Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cryptix.jce.provider.cipher
Class TripleDES  view TripleDES download TripleDES.java

java.lang.Object
  extended byjavax.crypto.CipherSpi
      extended bycryptix.jce.provider.cipher.BlockCipher
          extended bycryptix.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:

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 $

Field Summary
private static int ALT_KEY_LENGTH
           
private static int BLOCK_SIZE
           
private static int DES_KEY_LENGTH
           
private  DES des1
           
private  DES des2
           
private  DES des3
           
private static int KEY_LENGTH
           
 
Fields inherited from class cryptix.jce.provider.cipher.BlockCipher
 
Constructor Summary
TripleDES()
           
 
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
 
Methods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineUnwrap, engineUpdate, engineWrap
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

TripleDES

public TripleDES()
Method Detail

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