org.bouncycastle.asn1.x509

## Class AuthorityKeyIdentifier

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.x509.AuthorityKeyIdentifier

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class AuthorityKeyIdentifier
      extends ASN1Object

  The AuthorityKeyIdentifier object.

       id-ce-authorityKeyIdentifier OBJECT IDENTIFIER ::=  { id-ce 35 }

         AuthorityKeyIdentifier ::= SEQUENCE {
            keyIdentifier             [0] IMPLICIT KeyIdentifier           OPTIONAL,
            authorityCertIssuer       [1] IMPLICIT GeneralNames            OPTIONAL,
            authorityCertSerialNumber [2] IMPLICIT CertificateSerialNumber OPTIONAL  }

         KeyIdentifier ::= OCTET STRING

  Per RFC 5280 sec. 4.2.1.1 the authorityCertIssuer and authorityCertSerialNumber fields MUST both be present or both be absent.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AuthorityKeyIdentifier(ASN1Sequence seq)`
    `` | `AuthorityKeyIdentifier(byte[] keyIdentifier)` create an AuthorityKeyIdentifier with a precomputed key identifier
    `` | `AuthorityKeyIdentifier(byte[] keyIdentifier, GeneralNames name, java.math.BigInteger serialNumber)` create an AuthorityKeyIdentifier with a precomputed key identifier and the GeneralNames tag and the serial number provided as well.
    `` | `AuthorityKeyIdentifier(GeneralNames name, java.math.BigInteger serialNumber)` create an AuthorityKeyIdentifier with the GeneralNames tag and the serial number provided.
    `` | `AuthorityKeyIdentifier(SubjectPublicKeyInfo spki)` Deprecated. create the extension using org.bouncycastle.cert.X509ExtensionUtils
    `` | `AuthorityKeyIdentifier(SubjectPublicKeyInfo spki, GeneralNames name, java.math.BigInteger serialNumber)` Deprecated. create the extension using org.bouncycastle.cert.X509ExtensionUtils

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static AuthorityKeyIdentifier` | `fromExtensions(Extensions extensions)`
    `GeneralNames` | `getAuthorityCertIssuer()`
    `java.math.BigInteger` | `getAuthorityCertSerialNumber()`
    `static AuthorityKeyIdentifier` | `getInstance(ASN1TaggedObject obj, boolean explicit)`
    `static AuthorityKeyIdentifier` | `getInstance(java.lang.Object obj)`
    `byte[]` | `getKeyIdentifier()` Deprecated. Use `getKeyIdentifierOctets()` instead.
    `ASN1OctetString` | `getKeyIdentifierObject()`
    `byte[]` | `getKeyIdentifierOctets()`
    `ASN1Primitive` | `toASN1Primitive()` Produce an object suitable for an ASN1OutputStream.
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `encodeTo, encodeTo, equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AuthorityKeyIdentifier

          protected AuthorityKeyIdentifier(ASN1Sequence seq)

    - #### AuthorityKeyIdentifier

          public AuthorityKeyIdentifier(SubjectPublicKeyInfo spki)

      Deprecated. create the extension using org.bouncycastle.cert.X509ExtensionUtils
      Calulates the keyidentifier using a SHA1 hash over the BIT STRING from SubjectPublicKeyInfo as defined in RFC2459. Example of making a AuthorityKeyIdentifier:

             SubjectPublicKeyInfo apki = new SubjectPublicKeyInfo((ASN1Sequence)new ASN1InputStream(
                 publicKey.getEncoded()).readObject());
             AuthorityKeyIdentifier aki = new AuthorityKeyIdentifier(apki);

    - #### AuthorityKeyIdentifier

          public AuthorityKeyIdentifier(SubjectPublicKeyInfo spki,
                                        GeneralNames name,
                                        java.math.BigInteger serialNumber)

      Deprecated. create the extension using org.bouncycastle.cert.X509ExtensionUtils
      create an AuthorityKeyIdentifier with the GeneralNames tag and the serial number provided as well.

    - #### AuthorityKeyIdentifier

          public AuthorityKeyIdentifier(GeneralNames name,
                                        java.math.BigInteger serialNumber)

      create an AuthorityKeyIdentifier with the GeneralNames tag and the serial number provided.

    - #### AuthorityKeyIdentifier

          public AuthorityKeyIdentifier(byte[] keyIdentifier)

      create an AuthorityKeyIdentifier with a precomputed key identifier

    - #### AuthorityKeyIdentifier

          public AuthorityKeyIdentifier(byte[] keyIdentifier,
                                        GeneralNames name,
                                        java.math.BigInteger serialNumber)

      create an AuthorityKeyIdentifier with a precomputed key identifier and the GeneralNames tag and the serial number provided as well.

  - ### Method Detail

    - #### getInstance

          public static AuthorityKeyIdentifier getInstance(ASN1TaggedObject obj,
                                                           boolean explicit)

    - #### getInstance

          public static AuthorityKeyIdentifier getInstance(java.lang.Object obj)

    - #### fromExtensions

          public static AuthorityKeyIdentifier fromExtensions(Extensions extensions)

    - #### getKeyIdentifier

          public byte[] getKeyIdentifier()

      Deprecated. Use `getKeyIdentifierOctets()` instead.

    - #### getKeyIdentifierOctets

          public byte[] getKeyIdentifierOctets()

    - #### getKeyIdentifierObject

          public ASN1OctetString getKeyIdentifierObject()

    - #### getAuthorityCertIssuer

          public GeneralNames getAuthorityCertIssuer()

    - #### getAuthorityCertSerialNumber

          public java.math.BigInteger getAuthorityCertSerialNumber()

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Produce an object suitable for an ASN1OutputStream.
      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a primitive representation of this object.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`