Class SubjectPublicKeyInfo

  • All Implemented Interfaces:
    ASN1Encodable, Encodable

    public class SubjectPublicKeyInfo
    extends ASN1Object
    The object that contains the public key stored in a certificate.

    The getEncoded() method in the public keys in the JCE produces a DER encoded one of these.

    • Constructor Detail

      • SubjectPublicKeyInfo

        public SubjectPublicKeyInfo​(AlgorithmIdentifier algId,
                                    ASN1Encodable publicKey)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • SubjectPublicKeyInfo

        public SubjectPublicKeyInfo​(AlgorithmIdentifier algId,
                                    byte[] publicKey)
      • SubjectPublicKeyInfo

        public SubjectPublicKeyInfo​(ASN1Sequence seq)
        Deprecated.
        use SubjectPublicKeyInfo.getInstance()
    • Method Detail

      • getAlgorithmId

        public AlgorithmIdentifier getAlgorithmId()
        Deprecated.
        use getAlgorithm()
        Returns:
        alg ID.
      • parsePublicKey

        public ASN1Primitive parsePublicKey()
                                     throws java.io.IOException
        for when the public key is an encoded object - if the bitstring can't be decoded this routine throws an IOException.
        Returns:
        the public key as an ASN.1 primitive.
        Throws:
        java.io.IOException - - if the bit string doesn't represent a DER encoded object.
      • getPublicKey

        public ASN1Primitive getPublicKey()
                                   throws java.io.IOException
        Deprecated.
        use parsePublicKey
        for when the public key is an encoded object - if the bitstring can't be decoded this routine throws an IOException.
        Returns:
        the public key as an ASN.1 primitive.
        Throws:
        java.io.IOException - - if the bit string doesn't represent a DER encoded object.
      • getPublicKeyData

        public DERBitString getPublicKeyData()
        for when the public key is raw bits.
        Returns:
        the public key as the raw bit string...
      • toASN1Primitive

        public ASN1Primitive toASN1Primitive()
        Produce an object suitable for an ASN1OutputStream.
         SubjectPublicKeyInfo ::= SEQUENCE {
                                  algorithm AlgorithmIdentifier,
                                  publicKey BIT STRING }
         
        Specified by:
        toASN1Primitive in interface ASN1Encodable
        Specified by:
        toASN1Primitive in class ASN1Object
        Returns:
        a primitive representation of this object.