Bouncy Castle Cryptography Library 1.45

## org.bouncycastle.asn1.x509
Class SubjectKeyIdentifier

    java.lang.Object
      org.bouncycastle.asn1.ASN1Encodable
          org.bouncycastle.asn1.x509.SubjectKeyIdentifier

All Implemented Interfaces:
  DEREncodable

Direct Known Subclasses:
  SubjectKeyIdentifierStructure

    public class SubjectKeyIdentifier

extends ASN1Encodable

The SubjectKeyIdentifier object.

     SubjectKeyIdentifier::= OCTET STRING

Field Summary

Fields inherited from class org.bouncycastle.asn1.ASN1Encodable
`BER, DER`

Constructor Summary
`SubjectKeyIdentifier(ASN1OctetString keyid)`
`SubjectKeyIdentifier(byte[] keyid)`
`SubjectKeyIdentifier(SubjectPublicKeyInfo spki)` Calculates the keyidentifier using a SHA1 hash over the BIT STRING from SubjectPublicKeyInfo as defined in RFC3280.

Method Summary
`static SubjectKeyIdentifier` `createSHA1KeyIdentifier(SubjectPublicKeyInfo keyInfo)` Return a RFC 3280 type 1 key identifier.
`static SubjectKeyIdentifier` `createTruncatedSHA1KeyIdentifier(SubjectPublicKeyInfo keyInfo)` Return a RFC 3280 type 2 key identifier.
`static SubjectKeyIdentifier` `getInstance(ASN1TaggedObject obj, boolean explicit)`
`static SubjectKeyIdentifier` `getInstance(java.lang.Object obj)`
`byte[]` `getKeyIdentifier()`
`DERObject` `toASN1Object()`

Methods inherited from class org.bouncycastle.asn1.ASN1Encodable
`equals, getDEREncoded, getDERObject, getEncoded, getEncoded, hashCode`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SubjectKeyIdentifier

    public SubjectKeyIdentifier(byte[] keyid)

### SubjectKeyIdentifier

    public SubjectKeyIdentifier(ASN1OctetString keyid)

### SubjectKeyIdentifier

    public SubjectKeyIdentifier(SubjectPublicKeyInfo spki)

  Calculates the keyidentifier using a SHA1 hash over the BIT STRING from SubjectPublicKeyInfo as defined in RFC3280.

  Parameters:
    `spki` - the subject public key info.

Method Detail

### getInstance

    public static SubjectKeyIdentifier getInstance(ASN1TaggedObject obj,
                                                   boolean explicit)

### getInstance

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

### getKeyIdentifier

    public byte[] getKeyIdentifier()

### toASN1Object

    public DERObject toASN1Object()

  Specified by:
    `toASN1Object` in class `ASN1Encodable`

### createSHA1KeyIdentifier

    public static SubjectKeyIdentifier createSHA1KeyIdentifier(SubjectPublicKeyInfo keyInfo)

  Return a RFC 3280 type 1 key identifier. As in:

       (1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the
       value of the BIT STRING subjectPublicKey (excluding the tag,
       length, and number of unused bits).

  Parameters:
    `keyInfo` - the key info object containing the subjectPublicKey field.
  Returns:
    the key identifier.

### createTruncatedSHA1KeyIdentifier

    public static SubjectKeyIdentifier createTruncatedSHA1KeyIdentifier(SubjectPublicKeyInfo keyInfo)

  Return a RFC 3280 type 2 key identifier. As in:

       (2) The keyIdentifier is composed of a four bit type field with
       the value 0100 followed by the least significant 60 bits of the
       SHA-1 hash of the value of the BIT STRING subjectPublicKey.

  Parameters:
    `keyInfo` - the key info object containing the subjectPublicKey field.
  Returns:
    the key identifier.

Bouncy Castle Cryptography Library 1.45