de.bb.security
Class DES3
java.lang.Object
|
+--de.bb.security.BlockCipher
|
+--de.bb.security.DES
|
+--de.bb.security.DES3
- public class DES3
- extends DES
The triple-DES encryption method.
This is a fairly standard way of increasing the security of DES.
You run each block through DES three times, first encrypting with
key A, then decrypting with key B, then encrypting with key C.
|
Constructor Summary |
DES3()
Creates a new TripleDes object |
|
Method Summary |
void |
decrypt(byte[] cipherText,
int cipherOff,
byte[] clearText,
int clearOff)
Decrypt one block of bytes.
|
void |
encrypt(byte[] clearText,
int clearOff,
byte[] cipherText,
int cipherOff)
Encrypt one block of bytes.
|
void |
setKey(byte[] key)
Set the key for encryption and decryption. |
void |
setKeyUnchecked(byte[] key)
Set the key for encryption and decryption. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DES3
public DES3()
- Creates a new TripleDes object
- See Also:
DesCipher,
BlockCipher
setKey
public void setKey(byte[] key)
- Set the key for encryption and decryption.
- Overrides:
setKey in class DES
- Parameters:
key - the given key, an array with 16 bytes
setKeyUnchecked
public void setKeyUnchecked(byte[] key)
- Set the key for encryption and decryption.
- Overrides:
setKeyUnchecked in class DES
- Parameters:
key - the given key, an array with 16 bytes
encrypt
public void encrypt(byte[] clearText,
int clearOff,
byte[] cipherText,
int cipherOff)
- Encrypt one block of bytes.
You may use one byte array as input data and output data, to encrypt in place.
- Overrides:
encrypt in class DES
- Parameters:
clearText - input data which is encryptedclearOff - offset into input datacipherText - output data which is encrypted.cipherOff - offset into output data
decrypt
public void decrypt(byte[] cipherText,
int cipherOff,
byte[] clearText,
int clearOff)
- Decrypt one block of bytes.
You may use one byte array as input data and output data, to decrypt in place.
- Overrides:
decrypt in class DES
- Parameters:
cipherText - output data which is encrypted.cipherOff - offset into output dataclearText - input data which is encryptedclearOff - offset into input data