All Packages Class Hierarchy This Package Previous Next Index
Class is.hi.logir.cryptonite.TriDESKey
java.lang.Object
|
+----is.hi.logir.cryptonite.Cryptonite
|
+----is.hi.logir.cryptonite.K
|
+----is.hi.logir.cryptonite.SymmetricKey
|
+----is.hi.logir.cryptonite.TriDESKey
- public class TriDESKey
- extends SymmetricKey
- implements CipherKey
This is the class for Triple-DES keys.
The CDS for a triple-DES key is TriDESKey(key)
to create a specific key
or TriDESKey(?)
for a random TriDESKey object.
-
TriDESKey()
- Create a new random triple-DES key.
-
TriDESKey(byte[])
- Create a new triple-DES key with the key bits from
key[0..23]
.
-
TriDESKey(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 "TriDES".
-
getKey()
- Return the key-bits for this key as an array of 24 bytes.
-
getSize()
- Return 168
-
plainBlockSize()
- Return 8.
-
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]
.
TriDESKey
public TriDESKey(String key) throws InvalidCDSException
- Called by
Cryptonite.fromString(String)
.
- Throws: InvalidCDSException
- if the CDS is in some way malformed.
- See Also:
- fromString
plainBlockSize
public int plainBlockSize()
- Return 8.
cipherBlockSize
public int cipherBlockSize()
- Return 8.
getSize
public int getSize()
- Return 168
- Overrides:
- getSize in class K
getAlgorithm
public String getAlgorithm()
- Return "TriDES".
- 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 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+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