Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.pki
Class KeyID  view KeyID download KeyID.java

java.lang.Object
  extended bycryptix.pki.KeyID

public abstract class KeyID
extends java.lang.Object

A KeyID is an identification of a key, usually by a hash.

Version:
$Revision: 1.2 $

Field Summary
private  int cachedHashCode
          Cache the hashcode
private  boolean isHashCodeCached
           
private  java.lang.String type
           
 
Constructor Summary
protected KeyID(java.lang.String type)
          Create a new KeyID object with the given type.
 
Method Summary
abstract  java.lang.Object clone()
          Return a clone of this object
abstract  boolean equals(java.lang.Object other)
          Do an equality comparison.
abstract  byte[] getBytes()
          Returns the full keyID as a byte array.
abstract  byte[] getBytes(int len)
          Returns a byte array of len bytes containing a reduced keyID.
abstract  int getLength()
          Returns the length of the contained KeyID.
 java.lang.String getType()
          Returns the type of this keyID.
 int hashCode()
          Returns a hashCode for this object based on the byte[]s returned by getBytes(4).
abstract  boolean match(java.security.Key other)
          Matches this keyID to a key.
abstract  boolean match(KeyID other)
          Matches this keyID to another.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

private final java.lang.String type

cachedHashCode

private transient int cachedHashCode
Cache the hashcode


isHashCodeCached

private transient boolean isHashCodeCached
Constructor Detail

KeyID

protected KeyID(java.lang.String type)
Create a new KeyID object with the given type.

Method Detail

hashCode

public int hashCode()
Returns a hashCode for this object based on the byte[]s returned by getBytes(4).


getType

public final java.lang.String getType()
Returns the type of this keyID.


clone

public abstract java.lang.Object clone()
Return a clone of this object


getLength

public abstract int getLength()
Returns the length of the contained KeyID.

This is the maximum number of bytes the getBytes(int) method can return.


getBytes

public abstract byte[] getBytes()
Returns the full keyID as a byte array.


getBytes

public abstract byte[] getBytes(int len)
Returns a byte array of len bytes containing a reduced keyID.

This method reduces the output of getBytes() in a format specific way to len bytes.

E.g. for OpenPGP getBytes(4) and getBytes(8) would return the 32-bit and 64-bit key ID's, being the least significant bits of the full 160-bit fingerprint.


equals

public abstract boolean equals(java.lang.Object other)
Do an equality comparison.

Note that this is an exact equality match. See the match(...) methods for if you want to match partial keyID's.


match

public abstract boolean match(KeyID other)
Matches this keyID to another.

This method differs from equals in that it can do a reduced match: if for example only 32 bits are available in one keyID, while 160 bits are available in the other, then this method can still return true if the 32 bits match.


match

public abstract boolean match(java.security.Key other)
Matches this keyID to a key.

This method differs from equals in that it can do a reduced match: if for example only 32 bits are available in this keyID, while the full keyID of a key is 160 bits, then this method can still return true if the 32 bits match.