All Packages Class Hierarchy This Package Previous Next Index
Class is.logi.crypto.keys.TriDESKey
java.lang.Object
|
+----is.logi.crypto.Crypto
|
+----is.logi.crypto.keys.K
|
+----is.logi.crypto.keys.SymmetricKey
|
+----is.logi.crypto.keys.TriDESKey
- public class TriDESKey
- extends SymmetricKey
- implements CipherKey
This is the class for triple-DES keys used in an EDE3 configuration. This
is a variant of the standard DES cipher which increases the size of the
key-space to make exhaustive key-search infeasible.
The CDS for a triple-DES key is TriDESKey(key)
with
key
a string of 48 hexadecimal digits to create a specific key
or TriDESKey(?)
for a random TriDESKey object.
- Author:
- Logi Ragnarsson
(logir@hi.is)
- See Also:
- DESKey
-
TriDESKey()
- Create a new random triple-DES key.
-
TriDESKey(byte[])
- Create a new triple-DES key with the key bits from
key[0..23]
.
-
cipherBlockSize()
- The block-size for the triple-DES cipher is 8 bytes.
-
decrypt(byte[], int, byte[], int)
- Decrypt one block of data.
-
encrypt(byte[], int, byte[], int)
- Encrypt one block of data.
-
equals(Object)
- Return true iff the two keys are equivalent.
-
getAlgorithm()
- The name of the algorithm is "DES".
-
getKey()
- Return the key-bits for this key as an array of 24 bytes.
-
getSize()
- The key-size for the DES cipher is 168 bits.
-
parseCDS(String)
- If "TriDESKey( key )" is a valid CDS for a TriDESKey, then
TriDESKey.parseCDS(key) will return the described TriDESKey object.
-
plainBlockSize()
- The block-size for the triple-DES cipher is 8 bytes.
-
toString()
- Return a CDS for this key.
TriDESKey
public TriDESKey()
- Create a new random triple-DES key.
TriDESKey
public TriDESKey(byte key[])
- Create a new triple-DES key with the key bits from
key[0..23]
.
parseCDS
public static TriDESKey parseCDS(String key) throws InvalidCDSException
- If "TriDESKey( key )" is a valid CDS for a TriDESKey, then
TriDESKey.parseCDS(key) will return the described TriDESKey object.
A valid CDS can be created by calling the TriDESKey.toString() method.
- Throws: InvalidCDSException
- if the CDS is malformed.
- See Also:
- fromString
plainBlockSize
public int plainBlockSize()
- The block-size for the triple-DES cipher is 8 bytes.
cipherBlockSize
public int cipherBlockSize()
- The block-size for the triple-DES cipher is 8 bytes.
getSize
public int getSize()
- The key-size for the DES cipher is 168 bits.
- Overrides:
- getSize in class K
getAlgorithm
public String getAlgorithm()
- The name of the algorithm is "DES".
- Overrides:
- getAlgorithm in class K
equals
public boolean equals(Object o)
- Return true iff the two keys are equivalent.
- Overrides:
- equals in class Object
getKey
public byte[] getKey()
- Return the key-bits for this key as an array of 24 bytes.
toString
public String toString()
- Return a CDS for this key.
- Overrides:
- toString in class Object
- See Also:
- fromString
encrypt
public void encrypt(byte source[],
int i,
byte dest[],
int j)
- Encrypt one block of data. The plain data is taken from
source[i..i+23]
and ciphertext is written to
dest[j..j+23]
.
decrypt
public void decrypt(byte source[],
int i,
byte dest[],
int j)
- Decrypt one block of data. The encrypted data is taken from
dest[i..i+23]
and plaintext is written to
source[j..j+23]
.
All Packages Class Hierarchy This Package Previous Next Index