iaik.cms
Class KeyAttribute

java.lang.Object
  extended by iaik.cms.KeyAttribute
Direct Known Subclasses:
UnknownKeyAttribute

public abstract class KeyAttribute
extends java.lang.Object

This class is the basic implementation for key attributes components of the CMS type OtherKeyAttribute. Every class, which implements a key attribute must be derived from this class.

Although using OtherKeyAttribute generally should be avoided it may be used for providing additional information for identifying a key:

 OtherKeyAttribute ::= SEQUENCE {
   keyAttrId OBJECT IDENTIFIER,
   keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
 
Any class implementing a particular keyAttr component has to be extended by this class and therefore has to implement the abstract methods decode, toASN1Object, getKeyAttributeID and equals). The keyAttrId to be returned by method getKeyAttrId is the one identifying the particular key attribute and shall be used for registering the corresponding class as implemenation for this key attribute component, e.g.:
 public class MyKeyAttribute extends KeyAttribute {
 ...
 // the key attribute id:
   public static final ObjectID keyAttrID = ...;
 ...
 }
 ...
 // register the implementation:
 OtherKeyAttribute.register(MyKeyAttribute.keyAttrID, MyKeyAttribute.class);
 
When implementing a key attribute by extensing this class please be aware that methods toASN1Object and decode only have to convert the key attribute itsself (and NOT the keyAttrID) into respectively from an ASN1Object.

See Also:
OtherKeyAttribute

Constructor Summary
KeyAttribute()
           
 
Method Summary
abstract  void decode(ASN1Object obj)
          Decodes a key attribute from its ASN.1 representation.
abstract  boolean equals(java.lang.Object obj)
          Checks if the supplied object equals this KeyAttribute.
abstract  ObjectID getKeyAttributeID()
          Returns the key attribute ID identifying this key attribute.
 java.lang.String getName()
          Returns the name of the key attribute.
abstract  int hashCode()
          Returns the hash code of the key attribute.
abstract  ASN1Object toASN1Object()
          Returns an ASN.1 representation of a particular key attribute.
abstract  java.lang.String toString()
          Returns a String representation of the key attribute.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyAttribute

public KeyAttribute()
Method Detail

decode

public abstract void decode(ASN1Object obj)
                     throws CodingException
Decodes a key attribute from its ASN.1 representation. This method is used by the OtherKeyAttribute class when parsing the ASN.1 representation of a key attribute. This method only expects the ASN.1 representation of the key attribute, but not the corresponding key attribute ID. This method shall not be explicitly called by an application.

Parameters:
obj - the key attribute as ASN1Object
Throws:
CodingException - if the ASN1Object cannot be parsed

toASN1Object

public abstract ASN1Object toASN1Object()
Returns an ASN.1 representation of a particular key attribute.

The ASN1Object returned by this method only represents the key attribute but does not include the corresponding key attribute id.

Returns:
the key attribute as ASN1Object

getKeyAttributeID

public abstract ObjectID getKeyAttributeID()
Returns the key attribute ID identifying this key attribute.

Returns:
the key attribute ID identifying the key attribute this class implements

toString

public abstract java.lang.String toString()
Returns a String representation of the key attribute.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the key attribute.

getName

public java.lang.String getName()
Returns the name of the key attribute.

Returns:
the name of the key attribute

equals

public abstract boolean equals(java.lang.Object obj)
Checks if the supplied object equals this KeyAttribute.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to be compared with this KeyAttribute
Returns:
true if the two KeyAttributes are equal, false if not

hashCode

public abstract int hashCode()
Returns the hash code of the key attribute.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code the key attribute

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