com.ibm.security.pkcs7
Class SubjectKeyIdentifier

java.lang.Object
  |
  +--com.ibm.security.pkcsutil.PKCSDerObject
        |
        +--com.ibm.security.pkcs7.SubjectKeyIdentifier

public final class SubjectKeyIdentifier
extends PKCSDerObject
implements EntityIdentifier, Cloneable

Implements the ASN.1 SubjectKeyIdentifier type.

SubjectKeyIdentifier ::= OCTET STRING

SubjectKeyIdentifier objects are immutable; they cannot be changed once constructed and initialized. If the setIdentifier() method is called and the SubjectKeyIdentifier value has already been set, the setIdentifier() method will throw a PKCSException.


Fields inherited from class com.ibm.security.pkcsutil.PKCSDerObject
provider
 
Constructor Summary
SubjectKeyIdentifier()
          Create an uninitialized SubjectKeyIdentifier object.
SubjectKeyIdentifier(byte[] der)
          Create a SubjectKeyIdentifier object with a DER byte array.
SubjectKeyIdentifier(byte[] der, String provider)
          Create a SubjectKeyIdentifier object with a DER byte array.
SubjectKeyIdentifier(String provider)
          Create an uninitialized SubjectKeyIdentifier object.
SubjectKeyIdentifier(String filename, boolean base64)
          Create a SubjectKeyIdentifier with the filename of the DER-encoded or BASE64-encoded object.
SubjectKeyIdentifier(String filename, boolean base64, String provider)
          Create a SubjectKeyIdentifier with the filename of the DER-encoded or BASE64-encoded object.
 
Method Summary
 Object clone()
          Creates a clone of this SubjectKeyIdentifier object.
protected  void decode(com.ibm.security.pkcs7.DerValue encoding)
          Initializes a SubjectKeyIdentifier object from a DerValue.
 void encode(OutputStream os)
          Encodes this object to an OutputStream.
 boolean equals(Object other)
          Determines if this SubjectKeyIdentifier object is equivalent to the input object.
 byte[] getIdentifier()
          Returns a copy of the identifier contents of this SubjectKeyIdentifier object.
 void setIdentifier(byte[] identifier)
          Set the identifier contents for this SubjectKeyIdentifier object.
 String toString()
          Returns a string representation of this SubjectKeyIdentifier object.
 
Methods inherited from class com.ibm.security.pkcsutil.PKCSDerObject
decode, decode, encode, getObjectIdentifier, hashCode, read, readBASE64, write, write, writeBASE64
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubjectKeyIdentifier

public SubjectKeyIdentifier()
Create an uninitialized SubjectKeyIdentifier object. The identifier contents of this uninitialized object can be initialized with the setIdentifier method.

SubjectKeyIdentifier

public SubjectKeyIdentifier(String provider)
Create an uninitialized SubjectKeyIdentifier object. The identifier contents of this uninitialized object can be initialized with the setIdentifier method.
Parameters:
provider - the name of the java security provider to use.

SubjectKeyIdentifier

public SubjectKeyIdentifier(byte[] der)
                     throws IOException
Create a SubjectKeyIdentifier object with a DER byte array. To set the byte contents of the SubjectKeyIdentifier object without a DER-encoded byte array of the SubjectKeyIdentifier object, call the setIdentifier method.
Parameters:
der - a DER byte array of a SubjectKeyIdentifier object.
Throws:
IOException - on decoding errors.

SubjectKeyIdentifier

public SubjectKeyIdentifier(byte[] der,
                            String provider)
                     throws IOException
Create a SubjectKeyIdentifier object with a DER byte array. To set the byte contents of the SubjectKeyIdentifier object without a DER-encoded byte array of the SubjectKeyIdentifier object, call the setIdentifier method.
Parameters:
der - a DER byte array of a SubjectKeyIdentifier object.
provider - the name of the java security provider to use.
Throws:
IOException - on decoding errors.

SubjectKeyIdentifier

public SubjectKeyIdentifier(String filename,
                            boolean base64)
                     throws IOException
Create a SubjectKeyIdentifier with the filename of the DER-encoded or BASE64-encoded object.
Parameters:
filename - name of the DER-encoded or base64-encoded object
base64 - true if BASE64-encoded, false if DER-encoded
Throws:
IOException - on decoding errors.

SubjectKeyIdentifier

public SubjectKeyIdentifier(String filename,
                            boolean base64,
                            String provider)
                     throws IOException
Create a SubjectKeyIdentifier with the filename of the DER-encoded or BASE64-encoded object.
Parameters:
filename - name of the DER-encoded or base64-encoded object
base64 - true if BASE64-encoded, false if DER-encoded
provider - the name of the java security provider to use.
Throws:
IOException - on decoding errors.
Method Detail

clone

public Object clone()
Creates a clone of this SubjectKeyIdentifier object.
Overrides:
clone in class Object
Returns:
clone of this SubjectKeyIdentifier object.

equals

public boolean equals(Object other)
Determines if this SubjectKeyIdentifier object is equivalent to the input object.
Overrides:
equals in class PKCSDerObject
Parameters:
other - the object to compare this one to.
Returns:
true, if the two objects are equivalent, false otherwise.

encode

public void encode(OutputStream os)
            throws IOException
Encodes this object to an OutputStream.
Overrides:
encode in class PKCSDerObject
Parameters:
os - the OutputStream to write the encoded data to.
Throws:
IOException - on encoding errors.

decode

protected void decode(com.ibm.security.pkcs7.DerValue encoding)
               throws IOException
Initializes a SubjectKeyIdentifier object from a DerValue. The DER encoding must be in the format specified by the SubjectKeyIdentifier ASN.1 notation.
Parameters:
encoding - a DER-encoded SubjectKeyIdentifier object.
Throws:
IOException - on parsing error.

setIdentifier

public void setIdentifier(byte[] identifier)
                   throws PKCSException
Set the identifier contents for this SubjectKeyIdentifier object.
Parameters:
identifier - byte array of the identifier.
Throws:
PKCSException - if the identifier byte array was already set.

getIdentifier

public byte[] getIdentifier()
Returns a copy of the identifier contents of this SubjectKeyIdentifier object.
Returns:
a byte array of the identifier contents

toString

public String toString()
Returns a string representation of this SubjectKeyIdentifier object.
Overrides:
toString in class PKCSDerObject
Returns:
a string representation of this object.