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

Constructor Index

 o DESKey()
Create a new random DES key.
 o DESKey(byte[])
Create a new DES key with the key bits from key[0..7].
 o DESKey(long)
Create a new DES key with the key bits from key.

Method Index

 o cipherBlockSize()
The block-size for the DES cipher is 8 bytes.
 o decrypt(byte[], int, byte[], int)
Decrypt one block of data.
 o encrypt(byte[], int, byte[], int)
Encrypt one block of data.
 o equals(Object)
Return true iff the two keys are equivalent.
 o getAlgorithm()
The name of the algorithm is "DES".
 o getKey()
Return the key-bits for this key as an array of 8 bytes.
 o getSize()
The key-size for the DES cipher is 56 bits.
 o parseCDS(String)
If "DESKey( key )" is a valid CDS for a DESKey, then DESKey.parseCDS(key) will return the described DESKey object.
 o plainBlockSize()
The block-size for the DES cipher is 8 bytes.
 o toString()
Return a CDS for this key.

Constructors

 o DESKey
 public DESKey()
Create a new random DES key.

 o DESKey
 public DESKey(byte key[])
Create a new DES key with the key bits from key[0..7].

 o DESKey
 public DESKey(long key)
Create a new DES key with the key bits from key.

Methods

 o 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
 o plainBlockSize
 public int plainBlockSize()
The block-size for the DES cipher is 8 bytes.

 o cipherBlockSize
 public int cipherBlockSize()
The block-size for the DES cipher is 8 bytes.

 o getSize
 public int getSize()
The key-size for the DES cipher is 56 bits.

Overrides:
getSize in class K
 o getAlgorithm
 public String getAlgorithm()
The name of the algorithm is "DES".

Overrides:
getAlgorithm in class K
 o equals
 public boolean equals(Object o)
Return true iff the two keys are equivalent.

Overrides:
equals in class Object
 o getKey
 public byte[] getKey()
Return the key-bits for this key as an array of 8 bytes.

 o toString
 public String toString()
Return a CDS for this key.

Overrides:
toString in class Object
See Also:
fromString
 o 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]

 o 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