de.flexiprovider.common.mode
Class OFB

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

public class OFB
extends Mode

Output feedback mode for symmetric block ciphers as per ISO/IEC 10116 (full feedback)

We do not support the FIPS PUB 81 version of OFB, since the expected cycle length dramatically decreases if the feedback is smaller than the block size of the cipher.

TODO WARNING! OFB currently supports just 1-byte feedback

For further information, see "Handbook of Applied Cryptography", Note 7.24.

Author:
Ralf-P. Weinmann

Fields inherited from class de.flexiprovider.api.Mode
blockSize, iv
 
Constructor Summary
OFB()
           
 
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()
          Reset feedback block to encrypted 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

OFB

public OFB()
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 cipherParams)
                          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
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.
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.
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 feedback block to encrypted initialization vector.
Overrides:
reset in class Mode