de.flexiprovider.common.mode
Class ECB
java.lang.Object
|
+--de.flexiprovider.api.Mode
|
+--de.flexiprovider.common.mode.ECB
- public class ECB
- extends Mode
This class implements the Electronic Codebook Mode (ECB) for symmetric block
ciphers.
The ECB mode directly applies the forward cipher function onto each block of
plaintext. Under a given key, blocks of plaintext that are equal are mapped
onto the same block of ciphertext. Decryption is accomplished by applying the
inverse cipher function onto blocks of ciphertext.
- Author:
- Ralf-P. Weinmann
|
Constructor Summary |
ECB()
|
|
Method Summary |
protected void |
initDecrypt(SecretKey key,
ModeParameterSpec modeParams,
AlgorithmParameterSpec cipherParams)
Initialize the Mode object for decryption. |
protected void |
initEncrypt(SecretKey key,
ModeParameterSpec modeParams,
AlgorithmParameterSpec cipherParams)
Initialize the Mode object for encryption. |
protected void |
nextChunkDecrypt(byte[] input,
int inOff,
byte[] output,
int outOff)
Decrypt the next data block. |
protected void |
nextChunkEncrypt(byte[] input,
int inOff,
byte[] output,
int outOff)
Encrypt the next data block. |
protected void |
reset()
ECB does not perform any operations on reset. |
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ECB
public ECB()
initEncrypt
protected final void initEncrypt(SecretKey key,
ModeParameterSpec modeParams,
AlgorithmParameterSpec cipherParams)
throws InvalidKeyException,
InvalidAlgorithmParameterException
- Initialize the Mode object for encryption.
- Overrides:
initEncrypt in class Mode
- Parameters:
key - the key used for encryptionmodeParams - additional mode parameters (not used)cipherParams - additional algorithm parameters- Throws:
InvalidKeyException - if the key is inappropriate for initializing the
underlying block cipher.InvalidAlgorithmParameterException - if the parameters are inappropriate for initializing the
underlying block cipher.
initDecrypt
protected final void initDecrypt(SecretKey key,
ModeParameterSpec modeParams,
AlgorithmParameterSpec cipherParams)
throws InvalidKeyException,
InvalidAlgorithmParameterException
- Initialize the Mode object for decryption.
- Overrides:
initDecrypt in class Mode
- Parameters:
key - the key used for decryptionmodeParams - additional mode parameters (not used)cipherParams - additional algorithm parameters- Throws:
InvalidKeyException - if the key is inappropriate for initializing the
underlying block cipher.InvalidAlgorithmParameterException - if the parameters are inappropriate for initializing the
underlying block cipher.
nextChunkEncrypt
protected final void nextChunkEncrypt(byte[] input,
int inOff,
byte[] output,
int outOff)
- Encrypt the next data block. Any special features of the Mode should be
implemented here.
- Overrides:
nextChunkEncrypt in class Mode
- Parameters:
input - input data bufferinOff - input data offsetoutput - output data bufferoutOff - output data offset
nextChunkDecrypt
protected final void nextChunkDecrypt(byte[] input,
int inOff,
byte[] output,
int outOff)
- Decrypt the next data block. Any special features of the Mode should be
implemented here.
- Overrides:
nextChunkDecrypt in class Mode
- Parameters:
input - input data bufferinOff - input data offsetoutput - output data bufferoutOff - output data offset
reset
protected final void reset()
- ECB does not perform any operations on reset.
- Overrides:
reset in class Mode