public class OtherKeyAttribute extends java.lang.Object implements ASN1Type
The CMS Cryptographic Message Syntax (RFC 2630) specifies the OtherKeyAttributr type for supplying additional information to be used for key identification. Generally the usage of the OtherKeyAttribute type should be avoided. The ASN.1 structure consists of an object identifier and an optional key attribute identified by the object identifer (key attribute ID):
OtherKeyAttribute ::= SEQUENCE {
keyAttrId OBJECT IDENTIFIER,
keyAttr ANY DEFINED BY keyAttrId OPTIONAL }
This class includes a static part to be used for registering implementations for
particular key attributes. A key attribute may be implemented by extending the
abstract KeyAttribute class and registering it by
calling the static register method, 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);
Key Attributes for which no implementation have been registered are treated as
unknown key attributes.
KeyAttribute,
UnknownKeyAttribute| Constructor and Description |
|---|
OtherKeyAttribute()
Default Constructor.
|
OtherKeyAttribute(ASN1Object obj)
Creates an OtherKeyAttribute from an ASN1Object.
|
OtherKeyAttribute(KeyAttribute keyAttribute)
Creates an OtherKeyAttribute from the supplied KeyAttribute.
|
OtherKeyAttribute(ObjectID keyAttrID)
Creates an OtherKeyAttribute for the supplied key attribute ID.
|
| Modifier and Type | Method and Description |
|---|---|
static KeyAttribute |
create(ObjectID keyAttrID)
Returns the implementation of the key attribute defined through an
ASN.1 ObjectID.
|
void |
decode(ASN1Object obj)
Decodes an OtherKeyAttribute from its ASN.1 representation.
|
boolean |
equals(java.lang.Object obj)
Compares this
OtherKeyAttribute to the specified object. |
KeyAttribute |
getKeyAttribute()
Gets the KeyAttribute component of this OtherKeyAttribute.
|
ObjectID |
getKeyAttributeID()
Gets the key attribute ID of this OtherKeyAttribute.
|
static void |
register(ObjectID keyAttrID,
java.lang.Class cl)
Registers a new implementation for a key attribute.
|
ASN1Object |
toASN1Object()
Returns this OtherKeyAttribute as ASN1Object.
|
java.lang.String |
toString()
Returns a String representation of this OtherKeyAttribute.
|
public OtherKeyAttribute()
public OtherKeyAttribute(ObjectID keyAttrID)
keyAttrID - the key attribute ID of this OtherKeyAttributepublic OtherKeyAttribute(KeyAttribute keyAttribute)
keyAttribute - the KeyAttribute component of this OtherKeyAttributepublic OtherKeyAttribute(ASN1Object obj) throws CodingException
obj - the OtherKeyAttribute as ASN1ObjectCodingException - if the ASN1Object cannot be parsedpublic static KeyAttribute create(ObjectID keyAttrID) throws java.lang.InstantiationException
This method belongs to the static part of this class.
oid - the ObjectID of the key attribute.java.lang.InstantiationException - if the internal factory
couldn't create an instance of requested typepublic static void register(ObjectID keyAttrID, java.lang.Class cl)
keyAttrID - the key attribute ID of the key attribute to be registeredclass - the class which implements this key attributepublic KeyAttribute getKeyAttribute()
public ObjectID getKeyAttributeID()
public void decode(ASN1Object obj) throws CodingException
UnknownKeyAttribute object is created for the unknown KeyAttribute
allowing to query for information about the KeyAttribute.decode in interface ASN1Typeobj - the OtherKeyAttribute as ASN1ObjectCodingException - if the ASN1Object cannot be parsedpublic ASN1Object toASN1Object()
toASN1Object in interface ASN1Typepublic boolean equals(java.lang.Object obj)
OtherKeyAttribute to the specified object.equals in class java.lang.Objectobj - the object to compare this OtherKeyAttribute
against.true, if the given object is equal to this
OtherKeyAttribute,
false otherwisepublic java.lang.String toString()
toString in class java.lang.Object