com.ibm.security12.sun.security.pkcs
Class PKCS10Attribute

java.lang.Object
  |
  +--com.ibm.security12.sun.security.pkcs.PKCS10Attribute

public class PKCS10Attribute
extends Object
implements DerEncoder

Represent a PKCS#10 Attribute.

Attributes are additonal information which can be inserted in a PKCS#10 certificate request. For example a "Driving License Certificate" could have the driving license number as an attribute.

Attributes are represented as a sequence of the attribute identifier (Object Identifier) and a set of DER encoded attribute values. ASN.1 definition of Attribute:

 Attribute :: SEQUENCE {
    type    AttributeType,
    values  SET OF AttributeValue
 }
 AttributeType  ::= OBJECT IDENTIFIER
 AttributeValue ::= ANY defined by type
 

Version:
1.17
Author:
Amit Kapoor, Hemma Prafullchandra

Field Summary
protected  ObjectIdentifier attributeId
           
protected  Object attributeValue
           
 
Constructor Summary
PKCS10Attribute(DerValue derVal)
          Constructs an attribute from a DER encoding.
PKCS10Attribute(ObjectIdentifier attributeId, Object attributeValue)
          Constructs an attribute from individual components of ObjectIdentifier and the value (any java object).
PKCS10Attribute(PKCS9Attribute attr)
          Constructs an attribute from PKCS9 attribute.
 
Method Summary
 void derEncode(OutputStream out)
          DER encode this object onto an output stream.
 ObjectIdentifier getAttributeId()
          Returns the ObjectIdentifier of the attribute.
 Object getAttributeValue()
          Returns the attribute value.
 String toString()
          Returns the attribute in user readable form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

attributeId

protected ObjectIdentifier attributeId

attributeValue

protected Object attributeValue
Constructor Detail

PKCS10Attribute

public PKCS10Attribute(DerValue derVal)
                throws IOException
Constructs an attribute from a DER encoding. This constructor expects the value to be encoded as defined above, i.e. a SEQUENCE of OID and SET OF value(s), not a literal X.509 v3 extension. Only PKCS9 defined attributes are supported currently.
Parameters:
derVal - the der encoded attribute.
Throws:
IOException - on parsing errors.

PKCS10Attribute

public PKCS10Attribute(ObjectIdentifier attributeId,
                       Object attributeValue)
Constructs an attribute from individual components of ObjectIdentifier and the value (any java object).
Parameters:
attributeId - the ObjectIdentifier of the attribute.
attributeValue - an instance of a class that implements the attribute identified by the ObjectIdentifier.

PKCS10Attribute

public PKCS10Attribute(PKCS9Attribute attr)
Constructs an attribute from PKCS9 attribute.
Parameters:
attr - the PKCS9Attribute to create from.
Method Detail

derEncode

public void derEncode(OutputStream out)
               throws IOException
DER encode this object onto an output stream. Implements the DerEncoder interface.
Specified by:
derEncode in interface DerEncoder
Parameters:
out - the OutputStream on which to write the DER encoding.
Throws:
IOException - on encoding errors.

getAttributeId

public ObjectIdentifier getAttributeId()
Returns the ObjectIdentifier of the attribute.

getAttributeValue

public Object getAttributeValue()
Returns the attribute value.

toString

public String toString()
Returns the attribute in user readable form.
Overrides:
toString in class Object