Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix OpenPGP
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cryptix.pki
Class KeyID

    java.lang.Object
      cryptix.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 $
Author:
  Edwin Woudt

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`

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.

  Parameters:
    `len` - the number of bytes to return
  Throws:
    `java.lang.IllegalArgumentException` - for unsupported lengths

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

  Throws:
    `java.lang.IllegalArgumentException` - if other is of an incorrect type

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

  Throws:
    `java.lang.IllegalArgumentException` - if other is of an incorrect type

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix OpenPGP
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) 1999-2003 The Cryptix Foundation Ltd.