Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools Crypto Java API Reference 10g Release 3 (10.1.3) B25378-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## oracle.security.crypto.core
Class Blowfish

`java.lang.Object
oracle.security.crypto.core.Coder
oracle.security.crypto.core.Cipher
oracle.security.crypto.core.BlockCipher
oracle.security.crypto.core.Blowfish`

public final class Blowfish
extends BlockCipher

A block cipher which implements Bruce Schneier's Blowfish algorithm.

For more information on the Blowfish algorithm, see Schneier's book Applied Cryptography or Counterpane Internet Security, Inc..

Field Summary

Fields inherited from class oracle.security.crypto.core.BlockCipher
`blockSize, iv, paddingID`

Fields inherited from class oracle.security.crypto.core.Cipher
`CBC, decryptionKey, ECB, encryptionKey, key, mode, NULL_PADDING, PKCS5_PADDING, rbs`

Constructor Summary
`Blowfish()` Creates an uninitialized Blowfish instance.
`Blowfish(int mode)` Deprecated. Use the no-argument constructor and an initialize method instead.

Method Summary
`java.lang.String` | `algName()` Returns the name of the algorithm which this coder implements.
`protected void` | `decryptBlock(byte[] input, int inOff, byte[] output, int outOff)` Performs the block cipher's basic decryption operation on one block of ciphertext placing the result in the output buffer.
`void` | `decryptOp(byte[] in, int inOff, byte[] out, int outOff)` Deprecated. Use a decrypt method instead.
`protected void` | `encryptBlock(byte[] input, int inOff, byte[] output, int outOff)` Performs the block cipher's basic encryption operation on one block of plaintext placing the result in the output buffer.
`void` | `encryptOp(byte[] in, int inOff, byte[] out, int outOff)` Deprecated. Use an encrypt method instead.
`void` | `erase()` Erases any sensitive information stored in this BlockCipher object.
`AlgorithmIdentifier` | `getAlgID()` Builds an AlgorithmIdentifier that is a "snapshot" of the Cipher's current configuration.
`void` | `initialize(AlgorithmIdentifier algID, Key key)` This method verifies the AlgorithmIdentifier's OID and configures the Blowfish instance with data from the AlgorithmIdentifier and with BlockPadding set to NONE.
`void` | `initialize(AlgorithmIdentifier algID, SymmetricKey key, Padding.ID paddingID)` This method verifies the AlgorithmIdentifier's Object ID and configures the Blowfish instance appropriately with the params of the AlgorithmIdentifier in addition to the SymmetricKey and padding identifier.
`void` | `setAlgID(AlgorithmIdentifier algID)` Deprecated. Use an initialize method.
`void` | `setDecryptionKey(Key key)` Deprecated. Use an initialize method instead.
`void` | `setEncryptionKey(Key key)` Deprecated. Use an initialize method instead.
`void` | `setKey(SymmetricKey key)` Deprecated. Use an initialize method instead.
`void` | `setMode(int mode)` Deprecated. Modes should only be set when a BlockCipher is initialized. Use one of the initialize(...) methods instead.

Methods inherited from class oracle.security.crypto.core.BlockCipher
`blockSize, decrypt, decrypt, encrypt, encrypt, getBlockSize, getIV, getPadding, getPaddingID, setIV, setPadding`

Methods inherited from class oracle.security.crypto.core.Cipher
`assertDecryption, assertEncryption, cloneKey, decodeOp, decrypt, decrypt, decrypt, decryptOp, encodeOp, encrypt, encrypt, encrypt, encryptOp, getDecryptionKey, getEncryptionKey, getInstance, getInstance, getInstance, getInstance, getInstance, getKey, getMode, pad, releaseOp, setRandomBitsSource, unpad`

Methods inherited from class oracle.security.crypto.core.Coder
`decode, decode, encode, encode, initialize`

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

Constructor Detail

### Blowfish

    public Blowfish()

  Creates an uninitialized Blowfish instance. To use the Cipher, it must be initialized with a Key and algorithm parameters, usually in the form of an AlgorithmIdentifier.

### Blowfish

    public Blowfish(int mode)

  Deprecated. Use the no-argument constructor and an initialize method instead.
  Create a Blowfish object with a given mode. Supported modes are ECB (default) and CBC.
Parameters:
  `mode` - Cipher.ECB or Cipher.CBC

Method Detail

### initialize

    public void initialize(AlgorithmIdentifier algID,
                           Key key)
                    throws AlgorithmIdentifierException,
                           InvalidKeyException

  This method verifies the AlgorithmIdentifier's OID and configures the Blowfish instance with data from the AlgorithmIdentifier and with BlockPadding set to NONE.
  Specified by:
    `initialize` in class `Cipher`
  Parameters:
    `algID` - is the AlgorithmIdentifier whose params will be used to configure the cipher.
    `key` - is the SymmetricKey instance that will be cloned and used by the cipher internally. The internal instance will be erased when `Cipher.erase()` is called.
  Throws:
    `AlgorithmIdentifierException` - is thrown if the algID's OID isn't valid for the Cipher instance being initialized or if the params are not valid for the algID's OID.
    `InvalidKeyException` - is thrown if there is a problem with the Key instance the Cipher is being initialized with.

### initialize

    public void initialize(AlgorithmIdentifier algID,
                           SymmetricKey key,
                           Padding.ID paddingID)
                    throws AlgorithmIdentifierException,
                           InvalidKeyException,
                           CipherException

  This method verifies the AlgorithmIdentifier's Object ID and configures the Blowfish instance appropriately with the params of the AlgorithmIdentifier in addition to the SymmetricKey and padding identifier.
  Specified by:
    `initialize` in class `BlockCipher`
  Parameters:
    `algID` - is the AlgorithmIdentifier whose params will be used to configure the cipher.
    `key` - is the SymmetricKey instance that will be cloned and used by the cipher internally. The internal instance will be erased when `Cipher.erase()` is called.
    `paddingID` - is used to indicate the type of padding that the Cipher should use. Options are Padding.NONE or Padding.PKCS5. A Cipher must be re-initialized before being used with the other Padding type.
  Throws:
    `AlgorithmIdentifierException` - is thrown if the algID's OID isn't valid for the Cipher instance being initialized or if the params are not valid for the algID's OID.
    `InvalidKeyException` - is thrown if there is a problem with the Key instance the Cipher is being initialized with.
    `CipherException` - is thrown if there's a problem initializing the Cipher with the given parameters.

### decryptBlock

    protected void decryptBlock(byte[] input,
                                int inOff,
                                byte[] output,
                                int outOff)
                         throws CipherException

  Description copied from class: `BlockCipher`
  Performs the block cipher's basic decryption operation on one block of ciphertext placing the result in the output buffer. Mode and padding operations are not applied.
  Specified by:
    `decryptBlock` in class `BlockCipher`
  Parameters:
    `input` - buffer in which data to be decrypted is stored.
    `inOff` - offset within input buffer of the start of data.
    `output` - buffer to place the decrypted bytes in
    `outOff` - offset within output buffer where the encrypted bytes will be stored.
  Throws:
    `CipherException` - is thrown if the Cipher is not initialized, length of data is not equal to the block size, etc.

### encryptBlock

    protected void encryptBlock(byte[] input,
                                int inOff,
                                byte[] output,
                                int outOff)
                         throws CipherException

  Description copied from class: `BlockCipher`
  Performs the block cipher's basic encryption operation on one block of plaintext placing the result in the output buffer. Mode and padding operations are not applied.
  Specified by:
    `encryptBlock` in class `BlockCipher`
  Parameters:
    `input` - buffer in which data to be encrypted is stored
    `inOff` - offset within input buffer of the start of data
    `output` - buffer to place the encrypted bytes in
    `outOff` - offset within output buffer where the encrypted bytes will be stored
  Throws:
    `CipherException` - is thrown if the Cipher is not initialized, length of data is not equal to the block size, etc.

### algName

    public java.lang.String algName()

  Description copied from class: `Coder`
  Returns the name of the algorithm which this coder implements.
  Specified by:
    `algName` in class `Coder`

### erase

    public void erase()

  Description copied from class: `BlockCipher`
  Erases any sensitive information stored in this BlockCipher object.
  Overrides:
    `erase` in class `BlockCipher`

### getAlgID

    public AlgorithmIdentifier getAlgID()

  Description copied from class: `Cipher`
  Builds an AlgorithmIdentifier that is a "snapshot" of the Cipher's current configuration.

  Altering this AlgorithmIdentifier will have no effect on the state of the Cipher.

  Specified by:
    `getAlgID` in class `Cipher`
  Returns:
    A newly constructed AlgorithmIdentifier that is a "snapshot" of the Cipher's current configuration.

### decryptOp

    public void decryptOp(byte[] in,
                          int inOff,
                          byte[] out,
                          int outOff)
                   throws CipherException

  Deprecated. Use a decrypt method instead.
  Decrypts a sequence of bytes of length exactly equal to the block size.
  Specified by:
    `decryptOp` in class `Cipher`
  Parameters:
    `in` - buffer in which data to be decrypted is stored.
    `inOff` - offset within input buffer of the start of data.
    `out` - buffer to place the decrypted bytes in
    `outOff` - offset within output buffer where the encrypted bytes will be stored.
  Throws:
    `CipherException` - is thrown if the Cipher is not initialized, length of data is not equal to the block size, etc.

### encryptOp

    public void encryptOp(byte[] in,
                          int inOff,
                          byte[] out,
                          int outOff)
                   throws CipherException

  Deprecated. Use an encrypt method instead.
  Encrypts a sequence of bytes of length exactly equal to the block size.
  Specified by:
    `encryptOp` in class `Cipher`
  Parameters:
    `in` - buffer in which data to be encrypted is stored
    `inOff` - offset within input buffer of the start of data
    `out` - buffer to place the encrypted bytes in
    `outOff` - offset within output buffer where the encrypted bytes will be stored
  Throws:
    `CipherException` - is thrown if the Cipher is not initialized, length of data is not equal to the block size, etc.

### setAlgID

    public void setAlgID(AlgorithmIdentifier algID)
                  throws AlgorithmIdentifierException

  Deprecated. Use an initialize method.
  Sets the algorithm identifier for the cipher.
  Specified by:
    `setAlgID` in class `Cipher`
  Throws:
    `AlgorithmIdentifierException`

### setKey

    public void setKey(SymmetricKey key)
                throws InvalidKeyException

  Deprecated. Use an initialize method instead.
  Sets the encryption/decryption key and initializes the cipher.
  Overrides:
    `setKey` in class `Cipher`
  Parameters:
    `key` - the encryption/decryption key
  Throws:
    `InvalidKeyException` - is thrown if the the key is not valid for the Cipher instance

### setEncryptionKey

    public void setEncryptionKey(Key key)
                          throws InvalidKeyException

  Deprecated. Use an initialize method instead.
  Sets the encryption key and initializes the cipher.
  Overrides:
    `setEncryptionKey` in class `Cipher`
  Parameters:
    `key` - the encryption key
  Throws:
    `InvalidKeyException` - is thrown if the the key is not valid for the Cipher instance

### setDecryptionKey

    public void setDecryptionKey(Key key)
                          throws InvalidKeyException

  Deprecated. Use an initialize method instead.
  Sets the decryption key and initializes the cipher.
  Overrides:
    `setDecryptionKey` in class `Cipher`
  Parameters:
    `key` - the decryption key
  Throws:
    `InvalidKeyException` - is thrown if the the key is not valid for the Cipher instance

### setMode

    public void setMode(int mode)

  Deprecated. Modes should only be set when a BlockCipher is initialized. Use one of the initialize(...) methods instead.
  Sets the mode.
  Overrides:
    `setMode` in class `Cipher`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Oracle Security Developer Tools Crypto Java API Reference 10g Release 3 (10.1.3) B25378-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005, 2006 , Oracle. All rights reserved.