com.motorola.iden.provider
Class DES
java.lang.Object
|
+--com.motorola.iden.crypto.CipherSpi
|
+--com.motorola.iden.provider.DES
- public final class DES
- extends CipherSpi
DES was written by IBM and first released in 1976. The algorithm is
freely usable for both single and triple encryption.
DES
is a block cipher with an 8 byte block size. The key length
is 8 bytes for single encryption. The parity of all DES keys is ignored.
For single encryption, please use algorithm name "DES". Interface
com.motorola.iden.security.Key must be implemented by end user.
DES support mode "ECB","CBC","CFB" and "OFB". OFB mode is not supported on Gemini.
Mode "CBC","CFB" and "OFB" have IV. IV can be initialized by user or
generated by system.
PKCS5Padding is supported defaultly.
MOTOROLA and the Stylized M Logo are registered trademarks of
Motorola, Inc. Reg. U.S. Pat. & Tm. Off.
© Copyright 2002 - 2004 Motorola, Inc. All Rights Reserved.
- See Also:
[CipherSpi]
Field Summary |
static int |
blocksize
The blocksize of DES.
|
Constructor Summary |
DES()
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
blocksize
public static final int blocksize
- The blocksize of DES.
DES is a block cipher with an 8 byte block size.
DES
public DES()
engineSetMode
protected void engineSetMode(java.lang.String mode)
throws NoSuchAlgorithmException
- Sets the mode of the cipher(ECB,CBC,CFB or OFB).
- Overrides:
engineSetMode
in class CipherSpi
- Parameters:
String
- mode. Mode ECB is set defaultly when parameter mode is null.- Returns:
- void.
- Throws:
NoSuchAlgorithmException
- if the requested mode mechanism
does not exist
engineSetPadding
protected void engineSetPadding(java.lang.String padding)
throws NoSuchPaddingException
- Sets the Padding of the cipher.
- Overrides:
engineSetPadding
in class CipherSpi
- Parameters:
String
- padding. PKCS5Padding is set defaultly when parameter padding is null.- Throws:
NoSuchPaddingException
- if the requested padding mechanism
does not exist
engineGetBlockSize
protected int engineGetBlockSize()
- Gets the bloksize of the cipher.
- Overrides:
engineGetBlockSize
in class CipherSpi
- Parameters:
viod.
- - Returns:
- int blocksize (bytes)..
engineGetIV
protected byte[] engineGetIV()
- Gets iv.
- Overrides:
engineGetIV
in class CipherSpi
- Returns:
- byte[] iv. (null when at mode ECB)
engineInit
protected void engineInit(int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
- Inits security builder.
- Overrides:
engineInit
in class CipherSpi
- Parameters:
opmode
- the operation mode of this cipher (this is one of
the following:
ENCRYPT_MODE
, DECRYPT_MODE
,key
- the encryption keyparams
- the algorithm parametersrandom
- the source of randomness, ignored in this implementation.- Returns:
- void.
- Throws:
InvalidKeyException
- if the given key is inappropriate for
initializing this cipherInvalidAlgorithmParameterException
- if the given algorithm
parameters are inappropriate for this cipher,
or if this cipher is being initialized for decryption and requires
algorithm parameters and params
is null.
engineUpdate
protected byte[] engineUpdate(byte[] input,
int inputOffset,
int inputLen)
- Updates cipher.
- Overrides:
engineUpdate
in class CipherSpi
- Parameters:
input
- the input bufferinputOffset
- the offset in input
where the input
startsinputLen
- the input length- Returns:
- the new buffer with the result, or null if the underlying
cipher is a block cipher and the input data is too short to result in a
new block.
engineDoFinal
protected byte[] engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
throws IllegalBlockSizeException,
BadPaddingException
- Finalizes cipher.
- Overrides:
engineDoFinal
in class CipherSpi
- Parameters:
input
- the input bufferinputOffset
- the offset in input
where the input
startsinputLen
- the input length- Returns:
- the new buffer with the result
- Throws:
IllegalBlockSizeException
- if this cipher is a block cipher,
no padding has been requested (only in encryption mode), and the total
input length of the data processed by this cipher is not a multiple of
block sizeBadPaddingException
- if this cipher is in decryption mode,
and (un)padding has been requested, but the decrypted data is not
bounded by the appropriate padding bytes
finalize
protected void finalize()
- Overrides:
finalize
in class java.lang.Object