public class Attributes
extends java.lang.Object
The ASN.1 definition looks like:
Attributes ::= SET OF Attribute -- from X.501
-- in pre-1994 ASN.1, Attribute looks like: -- Attribute ::= SEQUENCE { -- type OBJECT IDENTIFIER, -- values SET OF ANY DEFINED BY type }
FriendlyName ::= BMPString -- a friendlyName has a single attr. value LocalKeyID ::= OCTET STRING -- a localKeyID has a single attr.value
SafeBag,
CertificateBag,
KeyBag| Constructor and Description |
|---|
Attributes()
Creates empty attributes.
|
Attributes(java.lang.String friendlyName,
byte[] localKeyID)
Creates new Attributes from a friendly name and a local key ID.
|
| Modifier and Type | Method and Description |
|---|---|
Attribute[] |
getAttributes()
Returns the attributes of this
SafeBag object or
null if there are no attributes. |
java.lang.String |
getFriendlyName()
Returns the fiendly name attribute.
|
byte[] |
getLocalKeyID()
Returns the local key ID attribute.
|
protected void |
setAttributes(Attribute[] attributes)
Set the (optional) attributes for this SafeBag.
|
void |
setFriendlyName(java.lang.String friendlyName)
Sets the friendly name attribute.
|
void |
setLocalKeyID(byte[] localKeyID)
Sets the local key ID attribute.
|
java.lang.String |
toString()
Returns a String representation of these Attributes.
|
public Attributes()
public Attributes(java.lang.String friendlyName,
byte[] localKeyID)
public void setFriendlyName(java.lang.String friendlyName)
public void setLocalKeyID(byte[] localKeyID)
public java.lang.String getFriendlyName()
public byte[] getLocalKeyID()
protected void setAttributes(Attribute[] attributes)
For instance:
byte[] loc_key_id = {0x01, 0x00, 0x00, 0x00};
Attribute[] attributes = new Attribute[2];
ASN1Object[] localKeyId = {new OCTET_STRING(loc_key_id)};
ASN1Object[] friendlyName = {new BMPString("This is a friendly name")};
attributes[0] = new Attribute(ObjectID.friendlyName, friendlyName);
attributes[1] = new Attribute(ObjectID.localKeyID, localKeyId);
safe_bag.setAttributes(attributes);
attributes - the attributes, as array of
iaik.asn1.structures.AttributeAttributepublic Attribute[] getAttributes()
SafeBag object or
null if there are no attributes.SafeBag, or null
if there are no attributes includedsetAttributes(iaik.asn1.structures.Attribute[])public java.lang.String toString()
toString in class java.lang.Object