All Packages Class Hierarchy This Package Previous Next Index
Class is.logi.crypto.keys.DESKey
java.lang.Object
|
+----is.logi.crypto.Crypto
|
+----is.logi.crypto.keys.K
|
+----is.logi.crypto.keys.SymmetricKey
|
+----is.logi.crypto.keys.DESKey
- public class DESKey
- extends SymmetricKey
- implements CipherKey
This is the class for Data Encryption Standard (DES) keys. DES is the
most widely used block cipher, although it is nowadays normally used
repeatedly for each piece of plain-text and is called triple-DES. This is
because the 56-bit key-size of the normal DES is too small to offer
complete security.
The CDS for a DES key is DESKey(key)
with key
a string of 16 hexadecimal digits to create a specific key
or DESKey(?)
for a random DESKey object.
- Author:
- Logi Ragnarsson
(logir@hi.is)
- See Also:
- TriDESKey
-
DESKey()
- Create a new random DES key.
-
DESKey(byte[])
- Create a new DES key with the key bits from
key[0..7]
.
-
DESKey(long)
- Create a new DES key with the key bits from
key
.
-
cipherBlockSize()
- The block-size for the 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 8 bytes.
-
getSize()
- The key-size for the DES cipher is 56 bits.
-
parseCDS(String)
- If "DESKey( key )" is a valid CDS for a DESKey, then
DESKey.parseCDS(key) will return the described DESKey object.
-
plainBlockSize()
- The block-size for the DES cipher is 8 bytes.
-
toString()
- Return a CDS for this key.
DESKey
public DESKey()
- Create a new random DES key.
DESKey
public DESKey(byte key[])
- Create a new DES key with the key bits from
key[0..7]
.
DESKey
public DESKey(long key)
- Create a new DES key with the key bits from
key
.
parseCDS
public static DESKey parseCDS(String key) throws InvalidCDSException
- If "DESKey( key )" is a valid CDS for a DESKey, then
DESKey.parseCDS(key) will return the described DESKey object.
A valid CDS can be created by calling the DESKey.toString() method.
- Throws: InvalidCDSException
- if the CDS is malformed.
- See Also:
- fromString
plainBlockSize
public int plainBlockSize()
- The block-size for the DES cipher is 8 bytes.
cipherBlockSize
public int cipherBlockSize()
- The block-size for the DES cipher is 8 bytes.
getSize
public int getSize()
- The key-size for the DES cipher is 56 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 8 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 plaintext is taken from
source[i..i+7]
and ciphertext is written to
dest[i..i+7]
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+7]
and plaintext is written to
source[j..j+7]
.
All Packages Class Hierarchy This Package Previous Next Index