iaik.security.cipher
Class DESParameterSpec

java.lang.Object
  |
  +--iaik.security.cipher.DESParameterSpec

public class DESParameterSpec
extends java.lang.Object
implements AlgorithmParameterSpec

DES parameter specification.

This class represents an initialization vector (IV), and the DES S-Boxes and P-Boxes.

If you want to use the default S-Boxes or P-Box or want the IV to be generated automatically pass null.

The S-Boxes have to be a byte array with 8*64 entries ranging from 0 to 15. S-Box 1 starts at index 0, S-Box 2 at 64, etc. Entries have to be present in the order originally specified; for the standard DES S-Box 1 that is 14, 4, 13, 1, 2, 15, ... , 14, 10, 0, 6, 13.

The P-Box has to be a byte array with 32 distinct entries ranging from 1 to 32. The original DES P-Box is 16, 7, 20, 21, 29, 12, ... , 30, 6, 22, 11, 4, 25.

You will typically not want to use a custom P-Box but it is implemented as the code supports it anyway. It may make sense to use custom S-Boxes, like the improved s3DES which is resistant to both differential and linear cryptanalysis (see Bruce Schneier's Applied Cryptography, page 299). However, never use random or not carefully evaluated S-Boxes as this greatly reduces DES's security (even if the attacker does not know them).

See Also:
AlgorithmParameterSpec

Constructor Summary
DESParameterSpec(byte[] SBoxes, byte[] PBox, byte[] initVector)
          Creates a DES Parameter specification by using the given SBoxes, PBox, and the first 8 bytes of the supplied byte array as initialization vector (IV).
DESParameterSpec(byte[] SBoxes, byte[] PBox, byte[] initVector, int offset)
          Creates a DES Parameter specification by using the given SBoxes, PBox, and 8 bytes of the supplied byte array as initialization vector (IV), beginning at the given offset.
 
Method Summary
 byte[] getIV()
          Returns a copy of the initialization vector (IV) as byte array representation.
 byte[] getPBox()
          Return the PBox.
 byte[] getSBoxes()
          Return the SBoxes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DESParameterSpec

public DESParameterSpec(byte[] SBoxes,
                        byte[] PBox,
                        byte[] initVector)
Creates a DES Parameter specification by using the given SBoxes, PBox, and the first 8 bytes of the supplied byte array as initialization vector (IV).

DESParameterSpec

public DESParameterSpec(byte[] SBoxes,
                        byte[] PBox,
                        byte[] initVector,
                        int offset)
Creates a DES Parameter specification by using the given SBoxes, PBox, and 8 bytes of the supplied byte array as initialization vector (IV), beginning at the given offset.
Method Detail

getIV

public byte[] getIV()
Returns a copy of the initialization vector (IV) as byte array representation.
Returns:
a copy of the initialization vector (IV) as byte array representation

getSBoxes

public byte[] getSBoxes()
Return the SBoxes. They will NOT be copied.

getPBox

public byte[] getPBox()
Return the PBox. It will NOT be copied.