Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix V3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## cryptix.provider.mode
Class OFB

    java.lang.Object
      |
      +--xjava.security.IJCE_Traceable
            |
            +--xjava.security.Cipher
                  |
                  +--xjava.security.Mode
                        |
                        +--cryptix.provider.mode.FeedbackMode
                              |
                              +--cryptix.provider.mode.OFB

public class OFB
extends cryptix.provider.mode.FeedbackMode

Implements a byte-oriented stream cipher using n-bit OFB with an n-bit-sized block cipher.

The full block size of the supplied cipher is used for the Output Feedback Mode. The bytes supplied are processed and returned immediately.

References:

1. Bruce Schneier, "Section 9.8 Output Feedback Mode," and "Section 9.11 Choosing a Cipher Mode," Applied Cryptography, 2nd edition, John Wiley & Sons, 1996

2. `sci.crypt` FAQ, "Part 5: Product Ciphers," ftp://ftp.rtfm.mit.edu/pub/usenet/news.answers/cryptography-faq/part05

3. National Bureau of Standards (now NIST), "DES Modes of Operation," NBS FIPS PUB 81, U.S. Department of Commerce, December 1980

Copyright © 1997 Systemics Ltd on behalf of the Cryptix Development Team.
All rights reserved.

$Revision: 1.6 $

Since:
  Cryptix 2.2.2
Author:
  David Hopwood, Raif S. Naffah

Fields inherited from class cryptix.provider.mode.FeedbackMode
`currentByte, ivBlock, ivStart, length`

Fields inherited from class xjava.security.Mode
`cipher`

Fields inherited from class xjava.security.Cipher
`DECRYPT, ENCRYPT, UNINITIALIZED`

Constructor Summary
`OFB()` Constructs an OFB cipher, assuming that the IV will be provided via `setInitializationVector`.
`OFB(Cipher cipher)` Constructs an OFB cipher, assuming that the IV will be provided via `setInitializationVector`.
`OFB(Cipher cipher, byte[] iv)` Constructs a OFB cipher, using an initialization vector provided in the constructor.

Method Summary
`protected int` | `engineBlockSize()` SPI: Returns the length of a block, in bytes.
`protected void` | `engineInitDecrypt(java.security.Key newkey)` SPI: Initializes this cipher for decryption, using the specified key.
`protected void` | `engineInitEncrypt(java.security.Key newkey)` SPI: Initializes this cipher for encryption, using the specified key.
`protected int` | `engineUpdate(byte[] in, int inOffset, int inLen, byte[] out, int outOffset)` SPI: This is the main engine method for updating data.

Methods inherited from class cryptix.provider.mode.FeedbackMode
`engineSetCipher, getInitializationVector, getInitializationVectorLength, setInitializationVector`

Methods inherited from class xjava.security.Mode
`engineGetParameter, engineSetParameter, getAlgorithms, getAlgorithms, getInstance, getInstance, toString`

Methods inherited from class xjava.security.Cipher
`blockSize, clone, crypt, crypt, crypt, doFinal, doFinal, doFinal, doFinal, engineCiphertextBlockSize, engineCrypt, engineInBufferSize, engineOutBufferSize, enginePlaintextBlockSize, engineSetPaddingScheme, getAlgorithm, getCiphertextBlockSize, getInputBlockSize, getInstance, getMode, getOutputBlockSize, getPadding, getPaddingScheme, getParameter, getPlaintextBlockSize, getProvider, getState, inBufferSize, inBufferSizeFinal, initDecrypt, initEncrypt, isPaddingBlockCipher, outBufferSize, outBufferSizeFinal, setParameter, update, update, update, update`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### OFB

    public OFB()

  Constructs an OFB cipher, assuming that the IV will be provided via `setInitializationVector`.

  The IV value must be unique during the lifetime of the key. If it is not unique, and an attacker has access to a different message encrypted under the same IV and key, all of the plaintext can normally be recovered.

### OFB

    public OFB(Cipher cipher)

  Constructs an OFB cipher, assuming that the IV will be provided via `setInitializationVector`. See the previous constructor for more details.
  Parameters:
    `cipher` - the cipher object to use in OFB mode.
  Throws:
    NullPointerException - if cipher == null
    IllegalBlockSizeException - if cipher.getPlaintextBlockSize() != cipher.getCiphertextBlockSize()

### OFB

    public OFB(Cipher cipher,
               byte[] iv)

  Constructs a OFB cipher, using an initialization vector provided in the constructor.

  The IV value must be unique during the lifetime of the key. If it is not unique, and an attacker has access to a different message encrypted under the same IV and key, all of the plaintext can normally be recovered.

  Parameters:
    `cipher` - the block cipher to use
    `iv` - the initial value for the shift register (IV)
  Throws:
    NullPointerException - if cipher == null

Method Detail

### engineBlockSize

    protected int engineBlockSize()

  Description copied from class: Cipher
  SPI: Returns the length of a block, in bytes. Ciphers for which plaintext and ciphertext blocks are the same size may override this method. Otherwise, both enginePlaintextBlockSize and engineCiphertextBlockSize should be overridden.

  The value may change when `initEncrypt` or `initDecrypt` is called, but it should not change at other times.

  Overrides:
    engineBlockSize in class Cipher
  Tags copied from class: Cipher
  Returns:
    the length in bytes of a block for this cipher.

### engineInitEncrypt

    protected void engineInitEncrypt(java.security.Key newkey)
                              throws java.security.KeyException

  Description copied from class: Cipher
  SPI: Initializes this cipher for encryption, using the specified key.

  After a call to this method, the cipher's state is set to ENCRYPT.

  Overrides:
    engineInitEncrypt in class Cipher
  Tags copied from class: Cipher
  Parameters:
    `key` - the key to use for encryption.
  Throws:
    java.security.KeyException - if the key is invalid.

### engineInitDecrypt

    protected void engineInitDecrypt(java.security.Key newkey)
                              throws java.security.KeyException

  Description copied from class: Cipher
  SPI: Initializes this cipher for decryption, using the specified key.

  After a call to this method, the cipher's state is set to DECRYPT.

  Overrides:
    engineInitDecrypt in class Cipher
  Tags copied from class: Cipher
  Parameters:
    `key` - the key to use for decryption.
  Throws:
    java.security.KeyException - if the key is invalid.

### engineUpdate

    protected int engineUpdate(byte[] in,
                               int inOffset,
                               int inLen,
                               byte[] out,
                               int outOffset)

  SPI: This is the main engine method for updating data. It may be called with any size of input.

  `in` and `out` may be the same array, and the input and output regions may overlap.

  Overrides:
    engineUpdate in class Cipher
  Parameters:
    `in` - the input data.
    `inOffset` - the offset into `in` specifying where the data starts.
    `inLen` - the length of the subarray.
    `out` - the output array.
    `outOffset` - the offset indicating where to start writing into the `out` array.
  Returns:
    the number of bytes written.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Cryptix V3.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) 1995-2000 The Cryptix Foundation Ltd. All rights reserved.