Class SubjectPublicKeyInfo

java.lang.Object
org.bouncycastle.asn1.ASN1Object
org.bouncycastle.asn1.x509.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 Details

  • Method Details

    • getInstance

      public static SubjectPublicKeyInfo getInstance(ASN1TaggedObject obj, boolean explicit)
    • getInstance

      public static SubjectPublicKeyInfo getInstance(Object obj)
    • getAlgorithm

      public AlgorithmIdentifier getAlgorithm()
    • getAlgorithmId

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

      public ASN1Primitive parsePublicKey() throws 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:
      IOException - - if the bit string doesn't represent a DER encoded object.
    • getPublicKey

      public ASN1Primitive getPublicKey() throws 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:
      IOException - - if the bit string doesn't represent a DER encoded object.
    • getPublicKeyData

      public ASN1BitString 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.