de.flexiprovider.common.mode
Class CFB

java.lang.Object
  |
  +--de.flexiprovider.api.Mode
        |
        +--de.flexiprovider.common.mode.CFB

public class CFB
extends Mode

Cipher feedback mode for symmetric block ciphers.

This class currently only supports 1-byte feedback which should be sufficient for most applications. For further information, see "Handbook of Applied Cryptography", Note 7.17. WARNING: CFB feedback should be in BYTES. The default value is 1 Byte(8 Bits)

Author:
Ralf-P. Weinmann

Fields inherited from class de.flexiprovider.api.Mode
blockSize, iv
 
Constructor Summary
CFB()
           
 
Method Summary
protected  void initDecrypt(SecretKey key, ModeParameterSpec modeParams, AlgorithmParameterSpec paramSpec)
          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()
          Reset shift block to initialization vector.
 
Methods inherited from class de.flexiprovider.api.Mode
getCipherBlockSize, initCipherDecrypt, initCipherEncrypt, setBlockCipher, singleBlockDecrypt, singleBlockEncrypt
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CFB

public CFB()
Method Detail

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 encryption
modeParams - additional mode parameters
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 paramSpec)
                          throws InvalidKeyException,
                                 InvalidAlgorithmParameterException
Initialize the Mode object for decryption.
Overrides:
initDecrypt in class Mode
Parameters:
key - the key used for decryption
modeParams - additional mode parameters
paramSpec - 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 buffer
inOff - input data offset
output - output data buffer
outOff - 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 buffer
inOff - input data offset
output - output data buffer
outOff - output data offset

reset

protected final void reset()
Reset shift block to initialization vector.
Overrides:
reset in class Mode