public class

KeyIdentifier

extends Object
java.lang.Object
   ↳ sun.security.x509.KeyIdentifier

Class Overview

Represent the Key Identifier ASN.1 object.

Summary

Public Constructors
KeyIdentifier(byte[] octetString)
Create a KeyIdentifier with the passed bit settings.
KeyIdentifier(DerValue val)
Create a KeyIdentifier from the DER encoded value.
KeyIdentifier(PublicKey pubKey)
Creates a KeyIdentifier from a public-key value.
Public Methods
boolean equals(Object other)
Indicates whether some other object is "equal to" this one.
byte[] getIdentifier()
Return the value of the KeyIdentifier as byte array.
int hashCode()
Returns a hash code value for this object.
String toString()
Returns a printable representation of the KeyUsage.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public KeyIdentifier (byte[] octetString)

Create a KeyIdentifier with the passed bit settings.

Parameters
octetString the octet string identifying the key identifier.

public KeyIdentifier (DerValue val)

Create a KeyIdentifier from the DER encoded value.

Parameters
val the DerValue
Throws
IOException

public KeyIdentifier (PublicKey pubKey)

Creates a KeyIdentifier from a public-key value.

From RFC2459: 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 the public key from which to construct this KeyIdentifier
Throws
IOException on parsing errors

Public Methods

public boolean equals (Object other)

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

Parameters
other the reference object with which to compare.
Returns
  • true if this object is the same as the obj argument; false otherwise.

public byte[] getIdentifier ()

Return the value of the KeyIdentifier as byte array.

public int hashCode ()

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

Returns
  • a hash code value for this object.

public String toString ()

Returns a printable representation of the KeyUsage.

Returns
  • a string representation of the object.