cryptix.provider.cipher
Class DESX

java.lang.Object
  |
  +--xjava.security.IJCE_Traceable
        |
        +--xjava.security.Cipher
              |
              +--cryptix.provider.cipher.DESX
All Implemented Interfaces:
Parameterized, SymmetricCipher

public class DESX
extends Cipher
implements SymmetricCipher

This class implements DESX encryption with two independent keys. DESX acts as a block cipher with an 8 byte block size.

The encoded form of the DESX key should be a 24-byte array, consisting of one 8-byte DES key K and two XOR keys K1 and K2 in order - K, K1 and K2. Encryption and decryption are done as follows:

When DESX is used with the CBC mode class (algorithm name "DESX/CBC"), the result is Outer-CBC, and only one IV is used.

References:

  1. Bruce Schneier, "Chapter 12 Data Encryption Standard," and "Section 15.2 Triple Encryption," Applied Cryptography, 2nd edition, John Wiley & Sons, 1996

  2. R.C. Merkle and M. Hellman, "On the Security of Multiple Encryption," Communications of the ACM, vol. 24 no. 7, 1981, pages 465-467.

  3. P Karn, P Metzger, W A Simpson "The ESP Triple DES Transform," Internet Draft, draft-simpson-esp-des3-x-01.txt

Copyright © 1998 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.3 $

Since:
Cryptix 3.0.4
Author:
Sascha Kettler

Fields inherited from class xjava.security.Cipher
DECRYPT, ENCRYPT, UNINITIALIZED
 
Fields inherited from class xjava.security.IJCE_Traceable
tracing
 
Constructor Summary
DESX()
          Constructs a DESX cipher object, in the UNINITIALIZED state.
 
Method Summary
 int engineBlockSize()
          SPI: Returns the length of an input block, in bytes.
protected  void engineInitDecrypt(java.security.Key key)
          SPI: Initializes this cipher for decryption, using the specified key.
 void engineInitEncrypt(java.security.Key key)
          SPI: Initializes this cipher for encryption, using the specified key.
protected  int engineUpdate(byte[] in, int inOffset, int inLen, byte[] out, int outOffset)
          SPI: This is the main engine method for updating data.
 
Methods inherited from class xjava.security.Cipher
blockSize, clone, crypt, crypt, crypt, doFinal, doFinal, doFinal, doFinal, engineCiphertextBlockSize, engineCrypt, engineGetParameter, engineInBufferSize, engineOutBufferSize, enginePlaintextBlockSize, engineSetPaddingScheme, engineSetParameter, getAlgorithm, getAlgorithms, getAlgorithms, getCiphertextBlockSize, getInputBlockSize, getInstance, getInstance, getInstance, getMode, getOutputBlockSize, getPadding, getPaddingScheme, getParameter, getPlaintextBlockSize, getProvider, getState, inBufferSize, inBufferSizeFinal, initDecrypt, initEncrypt, isPaddingBlockCipher, outBufferSize, outBufferSizeFinal, setParameter, toString, update, update, update, update
 
Methods inherited from class xjava.security.IJCE_Traceable
, disableTracing, enableTracing, traceMethod, traceResult, traceResult, traceVoidMethod
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DESX

public DESX()
Constructs a DESX cipher object, in the UNINITIALIZED state. This calls the Cipher constructor with implBuffering false, implPadding false and the provider set to "Cryptix".
Method Detail

engineBlockSize

public int engineBlockSize()
SPI: Returns the length of an input block, in bytes.
Overrides:
engineBlockSize in class Cipher
Returns:
the length in bytes of an input block for this cipher.

engineInitEncrypt

public void engineInitEncrypt(java.security.Key key)
                       throws java.security.KeyException
SPI: Initializes this cipher for encryption, using the specified key.
Overrides:
engineInitEncrypt in class Cipher
Parameters:
key - the key to use for encryption.
Throws:
java.security.KeyException - if one of the following occurs:
  • key.getEncoded() == null;
  • The length of the user key array is invalid.

engineInitDecrypt

protected void engineInitDecrypt(java.security.Key key)
                          throws java.security.KeyException
SPI: Initializes this cipher for decryption, using the specified key.
Overrides:
engineInitDecrypt in class Cipher
Parameters:
key - the key to use for decryption.
Throws:
java.security.KeyException - if one of the following occurs:
  • key.getEncoded() == null;
  • The length of the user key array is invalid.

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.

Overrides:
engineUpdate in class Cipher
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.