All Packages Class Hierarchy This Package Previous Next Index
Class cryptix.provider.cipher.DES_EDE3
java.lang.Object
|
+----java.security.IJCE_Traceable
|
+----java.security.Cipher
|
+----cryptix.provider.cipher.DES_EDE3
- public class DES_EDE3
- extends Cipher
- implements SymmetricCipher
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.
References:
- Bruce Schneier,
"Chapter 12 Data Encryption Standard," and
"Section 15.2 Triple Encryption,"
Applied Cryptography, 2nd edition,
John Wiley & Sons, 1996
- R.C. Merkle and M. Hellman,
"On the Security of Multiple Encryption,"
Communications of the ACM,
vol. 24 no. 7, 1981, pages 465-467.
- P Karn, P Metzger, W A Simpson
"The ESP Triple DES Transform,"
Internet Draft,
draft-simpson-esp-des3-x-01.txt
Copyright © 1997
Systemics Ltd on behalf of the
Cryptix Development Team.
All rights reserved.
$Revision: 1.4 $
- Author:
- David Hopwood
-
DES_EDE3()
- Constructs a DES-EDE3 cipher object, in the UNINITIALIZED state.
-
engineBlockSize()
- SPI: Returns the length of an input block, in bytes.
-
engineInitDecrypt(Key)
- SPI: Initializes this cipher for decryption, using the
specified key.
-
engineInitEncrypt(Key)
- SPI: Initializes this cipher for encryption, using the
specified key.
-
engineUpdate(byte[], int, int, byte[], int)
- SPI: This is the main engine method for updating data.
DES_EDE3
public DES_EDE3()
- Constructs a DES-EDE3 cipher object, in the UNINITIALIZED state.
This calls the Cipher constructor with implBuffering false,
implPadding false and the provider set to "Cryptix".
engineBlockSize
public int engineBlockSize()
- SPI: Returns the length of an input block, in bytes.
- Returns:
- the length in bytes of an input block for this cipher.
- Overrides:
- engineBlockSize in class Cipher
engineInitEncrypt
public void engineInitEncrypt(Key key) throws KeyException
- SPI: Initializes this cipher for encryption, using the
specified key.
- Parameters:
- key - the key to use for encryption.
- Throws: KeyException
- if one of the following occurs:
- key.getEncoded() == null;
- The length of the user key array is invalid.
- Overrides:
- engineInitEncrypt in class Cipher
engineInitDecrypt
protected void engineInitDecrypt(Key key) throws KeyException
- SPI: Initializes this cipher for decryption, using the
specified key.
- Parameters:
- key - the key to use for decryption.
- Throws: KeyException
- if one of the following occurs:
- key.getEncoded() == null;
- The length of the user key array is invalid.
- Overrides:
- engineInitDecrypt in class Cipher
engineUpdate
protected int engineUpdate(byte in[],
int inOffset,
int inLen,
byte out[],
int outOffset)
- SPI: This is the main engine method for updating data.
in and out may be the same array, and the input and output
regions may overlap.
- Parameters:
- in - the input data.
- inOffset - the offset into in specifying where the data starts.
- inLen - the length of the subarray.
- out - the output array.
- outOffset - the offset indicating where to start writing into
the out array.
- Returns:
- the number of bytes written.
- Throws: CryptixException
- if the native library is being used, and it
reports an error.
- Overrides:
- engineUpdate in class Cipher
All Packages Class Hierarchy This Package Previous Next Index