sun.security.x509
Class KeyIdentifier

java.lang.Object
  extended by sun.security.x509.KeyIdentifier

public class KeyIdentifier
extends Object

Represent the Key Identifier ASN.1 object.


Constructor Summary
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.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyIdentifier

public KeyIdentifier(byte[] octetString)
Create a KeyIdentifier with the passed bit settings.

Parameters:
octetString - the octet string identifying the key identifier.

KeyIdentifier

public KeyIdentifier(DerValue val)
              throws IOException
Create a KeyIdentifier from the DER encoded value.

Parameters:
val - the DerValue
Throws:
IOException

KeyIdentifier

public KeyIdentifier(PublicKey pubKey)
              throws IOException
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
Method Detail

getIdentifier

public byte[] getIdentifier()
Return the value of the KeyIdentifier as byte array.


toString

public String toString()
Returns a printable representation of the KeyUsage.

Overrides:
toString in class Object
Returns:
a string representation of the object.

hashCode

public int hashCode()
Returns a hash code value for this object. Objects that are equal will also have the same hashcode.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable

equals

public boolean equals(Object other)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
other - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.
See Also:
Object.hashCode(), Hashtable