com.ibm.security.pkcs7
Class RecipientKeyIdentifier

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

public final class RecipientKeyIdentifier
extends PKCSDerObject
implements RecipientIdentifier, Cloneable

Implements the ASN.1 RecipientKeyIdentifier type.

RecipientKeyIdentifier ::= SEQUENCE { subjectKeyIdentifier SubjectKeyIdentifier, date GeneralizedTime OPTIONAL, other OtherKeyAttribute OPTIONAL } OtherKeyAttribute ::= SEQUENCE { keyAttrId OBJECT IDENTIFIER, keyAttr ANY DEFINED BY keyAttrId OPTIONAL }

The subjectKeyIdentifier identifies the recipient's certificate by the X.509 subjectKeyIdentifier extension value.

The optional date value specifies which of the recipient's UKMs was used by the sender.

The optional other value contains additional information used by the recipient to locate the keying material used by the sender.

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

See Also:
SubjectKeyIdentifier, UserKeyingMaterial

Fields inherited from class com.ibm.security.pkcsutil.PKCSDerObject
provider
 
Constructor Summary
RecipientKeyIdentifier(byte[] der)
          Create a RecipientKeyIdentifier object with a DER byte array.
RecipientKeyIdentifier(byte[] key, Date date, com.ibm.security.pkcs7.AVA attr)
          Create a RecipientKeyIdentifier object with the specified values.
RecipientKeyIdentifier(byte[] key, Date date, com.ibm.security.pkcs7.AVA attr, String provider)
          Create a RecipientKeyIdentifier object with the specified values.
RecipientKeyIdentifier(byte[] der, String provider)
          Create a RecipientKeyIdentifier object with a DER byte array.
RecipientKeyIdentifier(String filename, boolean base64)
          Create a RecipientKeyIdentifier with the filename of the DER-encoded or BASE64-encoded object.
RecipientKeyIdentifier(String filename, boolean base64, String provider)
          Create a RecipientKeyIdentifier with the filename of the DER-encoded or BASE64-encoded object.
 
Method Summary
 Object clone()
          Creates a clone of this RecipientKeyIdentifier object.
protected  void decode(com.ibm.security.pkcs7.DerValue encoding)
          Initializes a RecipientKeyIdentifier object from a DerValue.
 void encode(OutputStream os)
          Encodes this object to an OutputStream.
 boolean equals(Object other)
          Determines if this RecipientKeyIdentifier object is equivalent to the input object.
 Date getDate()
          Returns a copy the date data member of this object.
 byte[] getKeyIdentifier()
          Returns a copy the keyIdentifier data member of this object.
 com.ibm.security.pkcs7.AVA getOtherKeyAttribute()
          Returns a copy the other key attribute data member of this object.
 String toString()
          Returns a string representation of this RecipientKeyIdentifier 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

RecipientKeyIdentifier

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

RecipientKeyIdentifier

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

RecipientKeyIdentifier

public RecipientKeyIdentifier(byte[] key,
                              Date date,
                              com.ibm.security.pkcs7.AVA attr)
Create a RecipientKeyIdentifier object with the specified values.
Parameters:
key - identifies the recipient's certificate by the X.509 subjectKeyIdentifier extension value.
date - specifies which of the recipient's UKMs was used by the sender. This may be null.
attr - contains additional information used by the recipient to locate the keying material used by the sender. This may be null.

RecipientKeyIdentifier

public RecipientKeyIdentifier(byte[] key,
                              Date date,
                              com.ibm.security.pkcs7.AVA attr,
                              String provider)
Create a RecipientKeyIdentifier object with the specified values.
Parameters:
key - identifies the recipient's certificate by the X.509 subjectKeyIdentifier extension value.
date - specifies which of the recipient's UKMs was used by the sender. This may be null.
attr - contains additional information used by the recipient to locate the keying material used by the sender. This may be null.
provider - the name of the java security provider to use.

RecipientKeyIdentifier

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

RecipientKeyIdentifier

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

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 error.

decode

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

equals

public boolean equals(Object other)
Determines if this RecipientKeyIdentifier 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.

getKeyIdentifier

public byte[] getKeyIdentifier()
Returns a copy the keyIdentifier data member of this object.
Returns:
the byte array of the keyIdentifier data member of this object.

getDate

public Date getDate()
Returns a copy the date data member of this object.
Returns:
the date data member of this object.

getOtherKeyAttribute

public com.ibm.security.pkcs7.AVA getOtherKeyAttribute()
                                                throws IOException
Returns a copy the other key attribute data member of this object.
Returns:
the attribute data member of this object.
Throws:
IOException - if an attribute copy cannot be made.

toString

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

clone

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