java.lang.Object
javax.crypto.CipherSpi
cryptix.jce.provider.cipher.BlockCipher
cryptix.jce.provider.cipher.TripleDES
- public final class TripleDES
- extends BlockCipher
This class implements Triple DES EDE encryption with three independent
keys. DES-EDE3 acts as a block cipher with an 8 byte block size.
The encoded form of the Triple DES key should be a 24-byte array,
consisting of three 8-byte single DES keys in order - K1, K2 and K3.
Encryption and decryption are done as follows:
- C = EK3(DK2(EK1(P)))
- P = DK1(EK2(DK3(C)))
The alternating encryption and decryption was designed by IBM to
enable compatibility with single DES, when all three keys are equal
(although it is now rare for Triple DES to be used in that way).
When DES-EDE3 is used with the CBC mode class (algorithm name
"DES-EDE3/CBC"), the result is Outer-CBC, and only one IV is used.
DES was written by IBM and first released in 1976. The algorithm is
freely usable for both single and triple encryption.
- Version:
- $Revision: 1.7 $
Fields inherited from class cryptix.jce.provider.cipher.BlockCipher |
|
Method Summary |
protected void |
coreCrypt(byte[] in,
int inOffset,
byte[] out,
int outOffset)
Perform a DES encryption or decryption operation (depends on subkey). |
protected void |
coreInit(java.security.Key key,
boolean decrypt)
|
Methods inherited from class cryptix.jce.provider.cipher.BlockCipher |
clone, coreGetBlockSize, engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetKeySize, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUpdate, engineUpdate |
BLOCK_SIZE
private static final int BLOCK_SIZE
- See Also:
- Constant Field Values
KEY_LENGTH
private static final int KEY_LENGTH
- See Also:
- Constant Field Values
ALT_KEY_LENGTH
private static final int ALT_KEY_LENGTH
- See Also:
- Constant Field Values
DES_KEY_LENGTH
private static final int DES_KEY_LENGTH
- See Also:
- Constant Field Values
des1
private DES des1
des2
private DES des2
des3
private DES des3
TripleDES
public TripleDES()
coreInit
protected void coreInit(java.security.Key key,
boolean decrypt)
throws java.security.InvalidKeyException
- Specified by:
coreInit
in class BlockCipher
coreCrypt
protected void coreCrypt(byte[] in,
int inOffset,
byte[] out,
int outOffset)
- Perform a DES encryption or decryption operation (depends on subkey).
- Specified by:
coreCrypt
in class BlockCipher