All Packages Class Hierarchy This Package Previous Next Index
Class is.hi.logir.cryptonite.DESKey
java.lang.Object
|
+----is.hi.logir.cryptonite.Cryptonite
|
+----is.hi.logir.cryptonite.K
|
+----is.hi.logir.cryptonite.SymmetricKey
|
+----is.hi.logir.cryptonite.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.
-
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
.
-
DESKey(String)
- Called by
Cryptonite.fromString(String)
.
-
cipherBlockSize()
- Return 8.
-
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 this is equivalent to
k
.
-
getAlgorithm()
- Return "DES".
-
getKey()
- Return the key-bits for this key as an array of 8 bytes.
-
getSize()
- Return 56
-
plainBlockSize()
- Return 8.
-
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
.
DESKey
public DESKey(String key) throws InvalidCDSException
- Called by
Cryptonite.fromString(String)
.
- Throws: InvalidCDSException
- if the CDS is in some way malformed.
plainBlockSize
public int plainBlockSize()
- Return 8.
cipherBlockSize
public int cipherBlockSize()
- Return 8.
getSize
public int getSize()
- Return 56
- Overrides:
- getSize in class K
getAlgorithm
public String getAlgorithm()
- Return "DES".
- Overrides:
- getAlgorithm in class K
equals
public boolean equals(Object o)
- Return true iff this is equivalent to
k
.
- 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 plain data is taken from
source[i..i+7]
and ciphertext is written to
dest[j..j+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