Class PKCS10Attribute

java.lang.Object
org.mozilla.jss.netscape.security.pkcs.PKCS10Attribute
All Implemented Interfaces:
Serializable, DerEncoder

public class PKCS10Attribute extends Object implements DerEncoder, Serializable
Represent a PKCS Attribute.

Attributes are addiitonal attributes which can be inserted in a PKCS certificate request. For example a "Driving License Certificate" could have the driving license number as a attribute.

Attributes are represented as a sequence of the attribute identifier (Object Identifier) and a set of DER encoded attribute values. The current implementation only supports one value per attribute. ASN.1 definition of Attribute:

 Attribute :: SEQUENCE {
    type    AttributeValue,
    values  SET OF AttributeValue
 }
 AttributeValue ::= ANY
 
Version:
1.13
See Also:
  • Field Details

  • Constructor Details

    • PKCS10Attribute

      public PKCS10Attribute()
      Default constructor. Used only by sub-classes.
    • PKCS10Attribute

      public PKCS10Attribute(DerValue derVal) throws IOException
      Constructs an attribute from a DER encoded array of bytes.
      Throws:
      IOException
    • PKCS10Attribute

      public PKCS10Attribute(ObjectIdentifier attributeId, CertAttrSet attributeValue)
      Constructs an attribute from individual components of ObjectIdentifier and the DER encoded value.
      Parameters:
      attributeId - the ObjectIdentifier of the attribute.
      attributeValue - the CertAttrSet.
    • PKCS10Attribute

      public PKCS10Attribute(PKCS10Attribute attr)
      Constructs an attribute from another attribute. To be used for creating decoded subclasses.
      Parameters:
      attr - the attribute to create from.
  • Method Details

    • encode

      public void encode(OutputStream out) throws CertificateException, IOException
      Write the output to the DerOutputStream.
      Parameters:
      out - the OutputStream to write the attribute to.
      Throws:
      CertificateException - on certificate encoding errors.
      IOException - on encoding errors.
    • 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 CertAttrSet getAttributeValue()
      Returns the attribute value as an byte array for further processing.
    • toString

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