iaik.pkcs.pkcs12
Class Attributes

java.lang.Object
  |
  +--iaik.pkcs.pkcs12.Attributes
Direct Known Subclasses:
SafeBag

public class Attributes
extends Object

This class implements attributes of SafeBags as defined in PKCS#12. At this time the following attributes are implemented:

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

Version:
File Revision 13
See Also:
SafeBag, CertificateBag, KeyBag

Constructor Summary
Attributes()
          Creates empty attributes.
Attributes(String friendlyName, byte[] localKeyID)
          Creates new Attributes from a friendly name and a local key ID.
 
Method Summary
 Attribute[] getAttributes()
          Returns the attributes of this SafeBag object or null if there are no attributes.
 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(String friendlyName)
          Sets the friendly name attribute.
 void setLocalKeyID(byte[] localKeyID)
          Sets the local key ID attribute.
 String toString()
          Returns a String representation of these Attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attributes

public Attributes()
Creates empty attributes.

Attributes

public Attributes(String friendlyName,
                  byte[] localKeyID)
Creates new Attributes from a friendly name and a local key ID.
Method Detail

setFriendlyName

public void setFriendlyName(String friendlyName)
Sets the friendly name attribute.

setLocalKeyID

public void setLocalKeyID(byte[] localKeyID)
Sets the local key ID attribute.

getFriendlyName

public String getFriendlyName()
Returns the fiendly name attribute.

getLocalKeyID

public byte[] getLocalKeyID()
Returns the local key ID attribute.

setAttributes

protected void setAttributes(Attribute[] attributes)
Set the (optional) attributes for this SafeBag.

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);
 

Parameters:
attributes - the attributes, as array of iaik.asn1.structures.Attribute
See Also:
Attribute

getAttributes

public Attribute[] getAttributes()
Returns the attributes of this SafeBag object or null if there are no attributes.
Returns:
the attributes of this SafeBag, or null if there are no attributes included
See Also:
setAttributes(iaik.asn1.structures.Attribute[])

toString

public String toString()
Returns a String representation of these Attributes.
Overrides:
toString in class Object

This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note).

IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK