iaik.me.security.cipher
Class DES
java.lang.Object
|
+--iaik.me.security.Cipher
|
+--iaik.me.security.cipher.DES
- public class DES
- extends Cipher
Constructor Summary |
DES()
Constructor for the DES cipher.
|
Method Summary |
protected void |
cryptBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
Encrypt one block. |
int[] |
getKeyLength()
Return the valid key lengths for this cipher. |
void |
init(int mode,
CryptoBag keyb,
Object params,
SecureRandom random)
Initializes this DES cipher with proper key and algorithm parameters, and
some random seed.
|
Methods inherited from class iaik.me.security.Cipher |
doFinal, doFinal, extractIV, getBlockSize, getInstance, getIV, init, register, setMode, setPadding, toString, update, updateInternal |
DES
public DES()
- Constructor for the DES cipher.
This constructor only internally is used for initializing a DES Cipher.
Applications should not call this constructor to get a DES Cipher;
they should call one of the
Cipher.getInstance
factory
methods instead.
- See Also:
DES
,
javax.crypto.Cipher#getInstance
getKeyLength
public int[] getKeyLength()
- Description copied from class:
Cipher
- Return the valid key lengths for this cipher. The array will always have four elements,
key lengths are specified in bytes. The values identify the length of the key in bytes,
not the entropy, i.e. DES returns 8 instead of 7.
[0] is the minimum allowable length (e.g. 1 byte (8 bit) for ARCFOUR).
[1] is the recommended default length (e.g. 16 byte (128 bit) for ARCFOUR).
[2] is the maximum allowable length (e.g. 128 byte (1024 bit) for ARCFOUR).
[3] is increment between key length (e.g. 1 byte (8 bit) for ARCFOUR), 4 byte (32 bit) for AES.
It is assumed that keys are always a integral number of bytes.
- Overrides:
getKeyLength
in class Cipher
init
public void init(int mode,
CryptoBag keyb,
Object params,
SecureRandom random)
throws CryptoException
- Initializes this DES cipher with proper key and algorithm parameters, and
some random seed.
Before a cipher object is ready for data processing, it has to be initialized
according to the desired cryptographic operation, which is specified by the
opmode
parameter (either ENCRYPT_MODE or DECCRYPT_MODE).
The format of the key must be "RAW" and the length must be 8 bytes.
The algorithm parameters usually will be a IvParameterSpec representing the
initialization vector when running DES in CBC, PCBC, OFB or CFB mode.
- Overrides:
init
in class Cipher
- Parameters:
opmode
- the operation mode for which this cipher is used
(ENCRYPT_MODE or DECRYPT_MODE)key
- the keyparams
- the algorithm parametersrandom
- the random seed- Throws:
InvalidKeyException
- if the given key is invalid- See Also:
javax.crypto.spec.IvParameterSpec
cryptBlock
protected void cryptBlock(byte[] in,
int inOff,
byte[] out,
int outOff)
- Description copied from class:
Cipher
- Encrypt one block. To be implemented by subclasses.
- Overrides:
cryptBlock
in class Cipher
IAIK-JCE ME 3.04, (c) 2002 IAIK, (c) 2003 to 2006 Stiftung SIC