Class PKCS9Attributes


  • public class PKCS9Attributes
    extends java.lang.Object
    A set of attributes of class PKCS9Attribute.
    • Constructor Summary

      Constructors 
      Constructor Description
      PKCS9Attributes​(PKCS9Attribute[] attribs)
      Construct a set of PKCS9 Attributes from the given array of PCK9 attributes.
      PKCS9Attributes​(DerInputStream in)
      Construct a set of PKCS9 Attributes from its contents of its DER encoding on a DerInputStream.
      PKCS9Attributes​(ObjectIdentifier[] permittedAttributes, DerInputStream in)
      Construct a set of PKCS9 Attributes from its DER encoding on a DerInputStream, accepting only attributes with OIDs on the given list.
    • Constructor Detail

      • PKCS9Attributes

        public PKCS9Attributes​(ObjectIdentifier[] permittedAttributes,
                               DerInputStream in)
                        throws java.io.IOException
        Construct a set of PKCS9 Attributes from its DER encoding on a DerInputStream, accepting only attributes with OIDs on the given list. If the array is null, accept all attributes supported by class PKCS9Attribute.
        Parameters:
        permittedAttributes - Array of attribute OIDs that will be accepted.
        in - the contents of the DER encoding of the attribute set.
        Throws:
        java.io.IOException - on i/o error, encoding syntax error, unacceptable or unsupported attribute, or duplicate attribute.
        See Also:
        PKCS9Attribute
      • PKCS9Attributes

        public PKCS9Attributes​(DerInputStream in)
                        throws java.io.IOException
        Construct a set of PKCS9 Attributes from its contents of its DER encoding on a DerInputStream. Accept all attributes supported by class PKCS9Attribute.
        Throws:
        java.io.IOException - on i/o error, encoding syntax error, or unsupported or duplicate attribute.
        See Also:
        PKCS9Attribute
      • PKCS9Attributes

        public PKCS9Attributes​(PKCS9Attribute[] attribs)
                        throws java.lang.IllegalArgumentException,
                               java.io.IOException
        Construct a set of PKCS9 Attributes from the given array of PCK9 attributes. DER encoding on a DerInputStream. All attributes in attribs must be supported by class PKCS9Attribute.
        Throws:
        java.io.IOException - on i/o error, encoding syntax error, or unsupported or duplicate attribute.
        java.lang.IllegalArgumentException
        See Also:
        PKCS9Attribute
    • Method Detail

      • encode

        public void encode​(byte tag,
                           java.io.OutputStream out)
                    throws java.io.IOException
        Put the DER encoding of this PKCS9 attribute set on an DerOutputStream, tagged with the given implicit tag.
        Parameters:
        tag - the implicit tag to use in the DER encoding.
        out - the output stream on which to put the DER encoding.
        Throws:
        java.io.IOException - on output error.
      • getDerEncoding

        public byte[] getDerEncoding()
                              throws java.io.IOException
        Return the DER encoding of this attribute set, tagged with DerValue.tag_SetOf.
        Throws:
        java.io.IOException
      • getAttribute

        public PKCS9Attribute getAttribute​(java.lang.String name)
        Get an attribute from this set.
      • getAttributes

        public PKCS9Attribute[] getAttributes()
        Get an array of all attributes in this set, in order of OID.
      • getAttributeValue

        public java.lang.Object getAttributeValue​(ObjectIdentifier oid)
                                           throws java.io.IOException
        Get an attribute value by OID.
        Throws:
        java.io.IOException
      • getAttributeValue

        public java.lang.Object getAttributeValue​(java.lang.String name)
                                           throws java.io.IOException
        Get an attribute value by type name.
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Returns the PKCS9 block in a printable string form.
        Overrides:
        toString in class java.lang.Object