|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface is implemented by cryptographic keys of any type. Any actual functionality of the keys is defined in the interfaces derived from Key.
Classes implementing Key should be "read-only" in the same sense as the String class and not implement any methods to change the state of the object.
Class | P-K | Key Size | Cipher | Block Size | Signature | Notes |
CaesarKey | no | 1 | yes | 1 | no | Very weak. Only included as an example. |
DESKey | no | 56 | yes | 8 | no | Old US Government standard. Can be broken with exchaustive search. |
TriDESKey | no | 168 | yes | 8 | no | Newer US Government standard. Applies DES three times. Slow. |
BlowfishKey | no | <=448 | yes | 8 | no | Fast. Free for all use. |
RSAKey | yes | >=256 | yes | K-1 / K | yes | Most widely used public-key algorithm. Patented in the USA and Canada. |
DHKey | yes | >=256 | yes | n/a | yes | Diffie-Hellman key-exchange and El-Gamal encryption and signatures. Patent expired. |
ElGamalKey | yes | >=256 | yes | K-1 / 2*K | yes | Merged into DHKey and deprecated. |
Class: The name of the class implementing an algorithm. It will be based on the name of the algorithm.
P-K: Is this a public-key algorithm?
Key Size: The size of the key in bits. In some cases variable.
Cipher: Can this algorithm be used for encryption?
Block Size: The size of the blocks of data which is encrypted at one time with this algorithm. If the resulting ciphertext block is not the same size, its size is also given, separated by a slash. The size may be based on the size of the key, which is denoted by K. All sizes are given in bytes. Thus "K-1 / 2*K" means that the input block size is one byte less than the size of the key, while the output size is twice the size of the key.
Signature: Can this algorithm be used to sign data?
CipherKey
,
SignatureKey
Method Summary | |
java.lang.String |
getAlgorithm()
Return the name of the algorithm used by this key. |
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 |
getSize()
Return the "size" of the key. |
int |
hashCode()
Return a hash-code based on the keys SHA1 fingerprint. |
boolean |
isPrivate()
Returns true iff this is a private key. |
boolean |
matches(Key key)
Check if a key mathces this. |
Fingerprint |
matchFingerprint()
Returns the fingerprint of the matching key in the key-pair. |
Fingerprint |
matchFingerprint(java.lang.String algorithm)
Returns the fingerprint of the matching key in the key-pair. |
Method Detail |
public int getSize()
public Fingerprint getFingerprint()
public Fingerprint getFingerprint(java.lang.String algorithm) throws InvalidCDSException
InvalidCDSException
- if the specified hash function is not
available.public Fingerprint matchFingerprint()
public Fingerprint matchFingerprint(java.lang.String algorithm) throws InvalidCDSException
InvalidCDSException
- if the specified hash function is not
available.public java.lang.String getAlgorithm()
public boolean isPrivate()
public int hashCode()
public boolean matches(Key key)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |