org.logi.crypto.keys
Class SymmetricKey

java.lang.Object
  extended byorg.logi.crypto.Crypto
      extended byorg.logi.crypto.keys.K
          extended byorg.logi.crypto.keys.SymmetricKey
All Implemented Interfaces:
Key
Direct Known Subclasses:
BlowfishKey, CaesarKey, DESKey, TriDESKey

public abstract class SymmetricKey
extends K

This abstract class implements some (more) of the methods from the Key interface.

See Also:
KeyPair, KeyRing

Field Summary
 
Fields inherited from class org.logi.crypto.keys.K
fingerprint, otherFingerprint
 
Fields inherited from class org.logi.crypto.Crypto
BIT, cdsPath, EMPTY_ARRAY, FOUR, keySource, NIBBLE, ONE, primeCertainty, random, TWO, ZERO
 
Constructor Summary
SymmetricKey()
           
 
Method Summary
protected  Fingerprint calcFingerprint(boolean other, java.lang.String algorithm)
          Calculate the fingerprint for this key using the named hash function.
 boolean isPrivate()
          Returns true iff this is a private key.
 boolean matches(Key key)
          Returns true if this and key are the same symmetric key.
 
Methods inherited from class org.logi.crypto.keys.K
getFingerprint, getFingerprint, hashCode, matchFingerprint, matchFingerprint
 
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
 

Constructor Detail

SymmetricKey

public SymmetricKey()
Method Detail

calcFingerprint

protected Fingerprint calcFingerprint(boolean other,
                                      java.lang.String algorithm)
                               throws InvalidCDSException
Calculate the fingerprint for this key using the named hash function. The default behaviour is to return the fingerprint of the CDS for this key.

Specified by:
calcFingerprint in class K
Throws:
InvalidCDSException

isPrivate

public boolean isPrivate()
Returns true iff this is a private key.

Symmetric keys simply return true.


matches

public boolean matches(Key key)
Returns true if this and key are the same symmetric key.

Symmetric keys simply call equals(key).