org.logi.crypto.keys
Class K

java.lang.Object
  extended byorg.logi.crypto.Crypto
      extended byorg.logi.crypto.keys.K
All Implemented Interfaces:
Key
Direct Known Subclasses:
DHKey, RSAKey, SymmetricKey

public abstract class K
extends Crypto
implements Key

This abstract class implements some of the methods from the Key interface. It is used as the superclass of all the key classes in logi.crypto.

You should (probably) never declare variables of this type, but rather of the more abstract Key interface, since there might be key objects which do not inherit from this class.


Field Summary
protected  Fingerprint fingerprint
           
protected  Fingerprint otherFingerprint
           
 
Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
 
Constructor Summary
K()
           
 
Method Summary
protected abstract  Fingerprint calcFingerprint(boolean other, java.lang.String algorithm)
          Calculate the fingerprint for this key or the other in the pair.
 Fingerprint getFingerprint()
          Return the key's fingerprint using the default hash function.
 Fingerprint getFingerprint(java.lang.String algorithm)
          Return the key's fingerprint using the named hash function.
 int hashCode()
          Return a hash-code based on the keys SHA1 fingerprint.
 Fingerprint matchFingerprint()
          Returns the default fingerprint of the matching key in the key-pair.
 Fingerprint matchFingerprint(java.lang.String algorithm)
          Returns the default fingerprint of the matching key in the key-pair.
 
Methods inherited from class org.logi.crypto.Crypto
binString, binString, equal, equalRelaxed, equalSub, fromHexNibble, fromHexString, fromString, fromString, hexString, hexString, hexString, hexString, hexString, initRandom, initRandom, makeClass, makeInt, makeLong, makeSessionKey, pastSpace, pickBits, pickBits, readBlock, readInt, writeBytes, writeBytes, writeInt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.logi.crypto.keys.Key
getAlgorithm, getSize, isPrivate, matches
 

Field Detail

fingerprint

protected Fingerprint fingerprint

otherFingerprint

protected Fingerprint otherFingerprint
Constructor Detail

K

public K()
Method Detail

calcFingerprint

protected abstract Fingerprint calcFingerprint(boolean other,
                                               java.lang.String algorithm)
                                        throws InvalidCDSException
Calculate the fingerprint for this key or the other in the pair.

Throws:
InvalidCDSException

getFingerprint

public final Fingerprint getFingerprint()
Return the key's fingerprint using the default hash function.

Specified by:
getFingerprint in interface Key

getFingerprint

public final Fingerprint getFingerprint(java.lang.String algorithm)
                                 throws InvalidCDSException
Return the key's fingerprint using the named hash function.

Specified by:
getFingerprint in interface Key
Throws:
InvalidCDSException - if the specified hash function is not available.

matchFingerprint

public Fingerprint matchFingerprint()
Returns the default fingerprint of the matching key in the key-pair.

Specified by:
matchFingerprint in interface Key

matchFingerprint

public Fingerprint matchFingerprint(java.lang.String algorithm)
                             throws InvalidCDSException
Returns the default fingerprint of the matching key in the key-pair.

Specified by:
matchFingerprint in interface Key
Throws:
InvalidCDSException - if the specified hash function is not available.

hashCode

public final int hashCode()
Return a hash-code based on the keys SHA1 fingerprint.

Specified by:
hashCode in interface Key