Class PKCS10Attribute

  • All Implemented Interfaces:
    java.io.Serializable, DerEncoder

    public class PKCS10Attribute
    extends java.lang.Object
    implements DerEncoder, java.io.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
     
    See Also:
    Serialized Form
    • Constructor Detail

      • PKCS10Attribute

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

        public PKCS10Attribute​(DerValue derVal)
                        throws java.io.IOException
        Constructs an attribute from a DER encoded array of bytes.
        Throws:
        java.io.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 Detail

      • encode

        public void encode​(java.io.OutputStream out)
                    throws java.security.cert.CertificateException,
                           java.io.IOException
        Write the output to the DerOutputStream.
        Parameters:
        out - the OutputStream to write the attribute to.
        Throws:
        java.security.cert.CertificateException - on certificate encoding errors.
        java.io.IOException - on encoding errors.
      • derEncode

        public void derEncode​(java.io.OutputStream out)
                       throws java.io.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:
        java.io.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 java.lang.String toString()
        Returns the attribute in user readable form.
        Overrides:
        toString in class java.lang.Object