iaik.cms
Class KEKIdentifier

java.lang.Object
  extended by iaik.cms.KEKIdentifier
All Implemented Interfaces:
ASN1Type, KeyIdentifier

public class KEKIdentifier
extends java.lang.Object
implements KeyIdentifier

The CMS type KEKIdentifier.

The KEKIdentifier type is used for identifying a symmetric key-encryption key previously distributed to the sender and one or more recipients. The symmetric key-encryption key is identified by an OCTET STRING key id and optional date (for identifiying a single key-encryption key from a set of previously distrbuted keys) and optional other key material; see RFC 5652:

 KEKIdentifier ::= SEQUENCE {   
   keyIdentifier OCTET STRING,
   date GeneralizedTime OPTIONAL,
   other OtherKeyAttribute OPTIONAL }
 
The use of OtherKeyAttribute should be avoided because of interoperability reasons.


Field Summary
 
Fields inherited from interface iaik.cms.KeyIdentifier
ISSUER_AND_SERIALNUMBER, KEK_IDENTIFIER, ORIGINATOR_PUBLIC_KEY, RECIPIENT_KEY_IDENTIFIER, SUBJECT_KEY_IDENTIFIER
 
Constructor Summary
KEKIdentifier()
          Empty default constructor.
KEKIdentifier(ASN1Object obj)
          Creates a KEKIdentifier from an ASN1Object.
KEKIdentifier(byte[] keyIdentifier)
          Creates a KEKIdentifier from the given keyIdentifier.
 
Method Summary
 void decode(ASN1Object obj)
          Decodes the KEKIdentifier from the given ASN1Object.
 boolean equals(java.lang.Object obj)
          Compares this KEKIdentifier to the specified object.
 java.util.Date getDate()
          Gets the optional Date value.
 byte[] getKeyIdentifier()
          Gets the key identifier.
 int getKeyIdType()
          Returns the key identifier type this class represents.
 java.lang.String getKeyIdTypeName()
          Returns the key identifier type this class represents as string.
 OtherKeyAttribute getOtherKeyAttribute()
          Gets the optional OtherKeyAttribute component value.
 boolean hasDate(java.util.Date date)
          Checks if this KEKIdentifier holds the given Date.
 int hashCode()
          Returns a hashcode for this KEKIdentifier.
 boolean hasKeyIdentifier(byte[] keyIdentifier)
          Checks if this KEKIdentifier holds the given key identifier.
 boolean hasOtherKeyAttribute(OtherKeyAttribute otherKeyAttribute)
          Checks if this KEKIdentifier holds the given OtherKeyAttribute.
 void setDate(java.util.Date date)
          Sets the optional Date component.
 void setOtherKeyAttribute(OtherKeyAttribute other)
          Sets the optional OtherKeyAttribute component.
 ASN1Object toASN1Object()
          Returns this KEKIdentifier as ASN1Object.
 java.lang.String toString()
          Returns a String representation of this KEKIdentifier.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KEKIdentifier

public KEKIdentifier()
Empty default constructor.

Used for dynamic object creation only. Shall be not used by an application.


KEKIdentifier

public KEKIdentifier(byte[] keyIdentifier)
Creates a KEKIdentifier from the given keyIdentifier.

Parameters:
keyIdentifier - the key identifier as byte array

KEKIdentifier

public KEKIdentifier(ASN1Object obj)
              throws CodingException
Creates a KEKIdentifier from an ASN1Object.

Parameters:
obj - the KEKIdentifier as ASN1Object
Throws:
CodingException - if the ASN1Object cannot be decoded or is invalid structured
Method Detail

setDate

public void setDate(java.util.Date date)
Sets the optional Date component.

Parameters:
date - the Date optionally identifying a key-encryption key from a set of previously distributed keys

setOtherKeyAttribute

public void setOtherKeyAttribute(OtherKeyAttribute other)
Sets the optional OtherKeyAttribute component.

Parameters:
other - additional information for identifying the key

getDate

public java.util.Date getDate()
Gets the optional Date value.

Returns:
the Date optionally identifying a key-encryption key from a set of previously distributed keys

getOtherKeyAttribute

public OtherKeyAttribute getOtherKeyAttribute()
Gets the optional OtherKeyAttribute component value.

Returns:
other additional information for identifying the key

getKeyIdentifier

public byte[] getKeyIdentifier()
Gets the key identifier.

Returns:
the key identifier.

decode

public void decode(ASN1Object obj)
            throws CodingException
Decodes the KEKIdentifier from the given ASN1Object.

Specified by:
decode in interface ASN1Type
Parameters:
obj - the KEKIdentifier as ASN1Object
Throws:
CodingException - if the ASN1Object cannot be decoded or is invalid structured

toASN1Object

public ASN1Object toASN1Object()
Returns this KEKIdentifier as ASN1Object.

Specified by:
toASN1Object in interface ASN1Type
Returns:
this KEKIdentifier as ASN1Object

hasKeyIdentifier

public boolean hasKeyIdentifier(byte[] keyIdentifier)
Checks if this KEKIdentifier holds the given key identifier.

Returns:
true if the key identifier value of this KEKIdentifier is equal to the supplied keyIdentifer, false otherwise

hasDate

public boolean hasDate(java.util.Date date)
Checks if this KEKIdentifier holds the given Date.

Returns:
true if the Date component of this KEKIdentifier is equal to the supplied Date, false otherwise

hasOtherKeyAttribute

public boolean hasOtherKeyAttribute(OtherKeyAttribute otherKeyAttribute)
Checks if this KEKIdentifier holds the given OtherKeyAttribute.

Returns:
true if the OtherKeyAttribute component of this KEKIdentifier is equal to the supplied OtherKeyAttribute, false otherwise

equals

public boolean equals(java.lang.Object obj)
Compares this KEKIdentifier to the specified object.

Specified by:
equals in interface KeyIdentifier
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this KEKIdentifier against.
Returns:
true, if the given object is equal to this KEKIdentifier, false otherwise

hashCode

public int hashCode()
Returns a hashcode for this KEKIdentifier.

Specified by:
hashCode in interface KeyIdentifier
Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode for this KEKIdentifier

getKeyIdType

public int getKeyIdType()
Returns the key identifier type this class represents.

Specified by:
getKeyIdType in interface KeyIdentifier
Returns:
the key id type KEK_IDENTIFIER (3)

getKeyIdTypeName

public java.lang.String getKeyIdTypeName()
Returns the key identifier type this class represents as string.

Specified by:
getKeyIdTypeName in interface KeyIdentifier
Returns:
"KEKIdentifier"

toString

public java.lang.String toString()
Returns a String representation of this KEKIdentifier.

Specified by:
toString in interface KeyIdentifier
Overrides:
toString in class java.lang.Object
Returns:
a String representation of this KEKIdentifer

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK-CMS 6.0, (c) 2002 IAIK, (c) 2003, 2023 SIC