com.ibm.security.pkcs7
Class SignerIdentifier

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

public final class SignerIdentifier
extends PKCSDerObject
implements Cloneable

Implements the ASN.1 SignerIdentifier attribute type.

SignerIdentifier ::= CHOICE { issuerAndSerialNumber IssuerAndSerialNumber, subjectKeyIdentifier [0] SubjectKeyIdentifier }

SignerIdentifier objects are immutable; they cannot be changed once created.

See Also:
IssuerAndSerialNumber, SubjectKeyIdentifier

Fields inherited from class com.ibm.security.pkcsutil.PKCSDerObject
provider
 
Constructor Summary
SignerIdentifier(byte[] der)
          Create a SignerIdentifier object with a DER byte array.
SignerIdentifier(byte[] der, String provider)
          Create a SignerIdentifier object with a DER byte array.
SignerIdentifier(Certificate cert)
          Create a SignerIdentifier object with a X.509 Certificate object.
SignerIdentifier(Certificate cert, String provider)
          Create a SignerIdentifier object with a X.509 Certificate object.
SignerIdentifier(IssuerAndSerialNumber issuer)
          Create a SignerIdentifier object with an IssuerAndSerialNumber object.
SignerIdentifier(IssuerAndSerialNumber issuer, String provider)
          Create a SignerIdentifier object with an IssuerAndSerialNumber object.
SignerIdentifier(String filename, boolean base64)
          Create a SignerIdentifier with the filename of the DER-encoded or BASE64-encoded object.
SignerIdentifier(String filename, boolean base64, String provider)
          Create a SignerIdentifier with the filename of the DER-encoded or BASE64-encoded object.
SignerIdentifier(SubjectKeyIdentifier ski)
          Create a SignerIdentifier object with a SubjectKeyIdentifier object.
SignerIdentifier(SubjectKeyIdentifier ski, String provider)
          Create a SignerIdentifier object with a SubjectKeyIdentifier object.
 
Method Summary
 Object clone()
          Creates a clone of this SignerIdentifier object.
protected  void decode(com.ibm.security.pkcs7.DerValue encoding)
          Initializes a SignerIdentifier object from a DerValue.
 void encode(OutputStream os)
          Encodes this object to an OutputStream.
 boolean equals(Object other)
          Determines if this SignerIdentifier object is equivalent to the input object.
 IssuerAndSerialNumber getIssuer()
          Get a copy of the IssuerAndSerialNumber, if this SignerIdentifier contains an IssuerAndSerialNumber object.
 SubjectKeyIdentifier getSubjectKeyIdentifier()
          Get a copy of the SubjectKeyIdentifier object, if this SignerIdentifier contains a SubjectKeyIdentifier object.
 boolean isIssuer()
          Check if value is stored as an IssuerAndSerialNumber object.
 String toString()
          Returns a string representation of this SignerIdentifier 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

SignerIdentifier

public SignerIdentifier(byte[] der)
                 throws IOException
Create a SignerIdentifier object with a DER byte array.
Parameters:
der - a DER byte array of a SignerIdentifier object.
Throws:
IOException - on decoding errors.

SignerIdentifier

public SignerIdentifier(byte[] der,
                        String provider)
                 throws IOException
Create a SignerIdentifier object with a DER byte array.
Parameters:
der - a DER byte array of a SignerIdentifier object.
provider - the name of the java security provider to use.
Throws:
IOException - on decoding errors.

SignerIdentifier

public SignerIdentifier(IssuerAndSerialNumber issuer)
Create a SignerIdentifier object with an IssuerAndSerialNumber object.
Parameters:
issuer - IssuerAndSerialNumber

SignerIdentifier

public SignerIdentifier(IssuerAndSerialNumber issuer,
                        String provider)
Create a SignerIdentifier object with an IssuerAndSerialNumber object.
Parameters:
issuer - IssuerAndSerialNumber
provider - the name of the java security provider to use

SignerIdentifier

public SignerIdentifier(SubjectKeyIdentifier ski)
Create a SignerIdentifier object with a SubjectKeyIdentifier object.
Parameters:
ski - SubjectKeyIdentifier

SignerIdentifier

public SignerIdentifier(SubjectKeyIdentifier ski,
                        String provider)
Create a SignerIdentifier object with a SubjectKeyIdentifier object.
Parameters:
ski - SubjectKeyIdentifier
provider - the name of the java security provider to use

SignerIdentifier

public SignerIdentifier(Certificate cert)
                 throws IOException
Create a SignerIdentifier object with a X.509 Certificate object.
Parameters:
issuer - IssuerAndSerialNumber

SignerIdentifier

public SignerIdentifier(Certificate cert,
                        String provider)
                 throws IOException
Create a SignerIdentifier object with a X.509 Certificate object.
Parameters:
issuer - IssuerAndSerialNumber
provider - the name of the java security provider to use

SignerIdentifier

public SignerIdentifier(String filename,
                        boolean base64)
                 throws IOException
Create a SignerIdentifier 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.

SignerIdentifier

public SignerIdentifier(String filename,
                        boolean base64,
                        String provider)
                 throws IOException
Create a SignerIdentifier 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 SignerIdentifier object.
Overrides:
clone in class Object
Returns:
clone of this SignerIdentifier object.

equals

public boolean equals(Object other)
Determines if this SignerIdentifier 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 SignerIdentifier object from a DerValue. The DER encoding must be in the format specified by the SignerIdentifier ASN.1 notation.
Parameters:
encoding - a DER-encoded SignerIdentifier object.
Throws:
IOException - on parsing error.

getIssuer

public IssuerAndSerialNumber getIssuer()
Get a copy of the IssuerAndSerialNumber, if this SignerIdentifier contains an IssuerAndSerialNumber object.
Returns:
IssuerAndSerialNumber object or null if value is SubjectKeyIdentifier.

getSubjectKeyIdentifier

public SubjectKeyIdentifier getSubjectKeyIdentifier()
Get a copy of the SubjectKeyIdentifier object, if this SignerIdentifier contains a SubjectKeyIdentifier object.
Returns:
SubjectKeyIdentifier object or null if value is IssuerAndSerialNumber.

isIssuer

public boolean isIssuer()
Check if value is stored as an IssuerAndSerialNumber object.
Returns:
true if IssuerAndSerialNumber or false if value is a SubjectKeyIdentifier.

toString

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