APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.x509

public Class KeyIdentifier

extends Object
Class Inheritance
Imports
java.io.IOException, java.security.PublicKey, .MessageDigest, .NoSuchAlgorithmException, java.util.Arrays, sun.security.util.HexDumpEncoder, sun.security.util.*

Represent the Key Identifier ASN.1 object.
Authors
Amit Kapoor, Hemma Prafullchandra

Field Summary

Modifier and TypeField and Description
private final byte[]

Constructor Summary

AccessConstructor and Description
public
KeyIdentifier(byte[]
the octet string identifying the key identifier.
octetString
)

Create a KeyIdentifier with the passed bit settings.

public
KeyIdentifier(DerValue
the DerValue
val
)

Create a KeyIdentifier from the DER encoded value.

public
KeyIdentifier(PublicKey
the public key from which to construct this KeyIdentifier
pubKey
)

Creates a KeyIdentifier from a public-key value.

Method Summary

Modifier and TypeMethod and Description
pack-priv void
encode(DerOutputStream
the DerOutputStream to write the object to.
out
)

Write the KeyIdentifier to the DerOutputStream.

public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public byte[]
getIdentifier()

Return the value of the KeyIdentifier as byte array.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public String
toString()

Overrides java.lang.Object.toString.

Returns a printable representation of the KeyUsage.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

octetStringback to summary
private final byte[] octetString

Constructor Detail

KeyIdentifierback to summary
public KeyIdentifier(byte[] octetString)

Create a KeyIdentifier with the passed bit settings.

Parameters
octetString:byte[]

the octet string identifying the key identifier.

KeyIdentifierback to summary
public KeyIdentifier(DerValue val) throws IOException

Create a KeyIdentifier from the DER encoded value.

Parameters
val:DerValue

the DerValue

KeyIdentifierback to summary
public KeyIdentifier(PublicKey pubKey) throws IOException

Creates a KeyIdentifier from a public-key value.

From RFC 5280: Two common methods for generating key identifiers from the public key are:

  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).
  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.

This method supports method 1.

Parameters
pubKey:PublicKey

the public key from which to construct this KeyIdentifier

Exceptions
IOException:
on parsing errors

Method Detail

encodeback to summary
pack-priv void encode(DerOutputStream out)

Write the KeyIdentifier to the DerOutputStream.

Parameters
out:DerOutputStream

the DerOutputStream to write the object to.

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

Annotations
@Override
getIdentifierback to summary
public byte[] getIdentifier()

Return the value of the KeyIdentifier as byte array.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object. Objects that are equal will also have the same hashcode.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns a printable representation of the KeyUsage.