Save This Page
Home » openjdk-7 » com.sun.crypto » provider » [javadoc | source]
com.sun.crypto.provider
public final class: BlowfishCipher [javadoc | source]
java.lang.Object
   javax.crypto.CipherSpi
      com.sun.crypto.provider.BlowfishCipher
This class implements the Blowfish algorithm in its various modes (ECB, CFB, OFB, CBC, PCBC) and padding schemes (PKCS5Padding, NoPadding, ISO10126Padding).

Blowfish is a 64-bit block cipher with a variable-length key.

Constructor:
 public BlowfishCipher() 
Method from com.sun.crypto.provider.BlowfishCipher Summary:
engineDoFinal,   engineDoFinal,   engineGetBlockSize,   engineGetIV,   engineGetKeySize,   engineGetOutputSize,   engineGetParameters,   engineInit,   engineInit,   engineInit,   engineSetMode,   engineSetPadding,   engineUnwrap,   engineUpdate,   engineUpdate,   engineWrap
Methods from javax.crypto.CipherSpi:
a,   engineDoFinal,   engineDoFinal,   engineDoFinal,   engineGetBlockSize,   engineGetIV,   engineGetKeySize,   engineGetOutputSize,   engineGetParameters,   engineInit,   engineInit,   engineInit,   engineSetMode,   engineSetPadding,   engineUnwrap,   engineUpdate,   engineUpdate,   engineUpdate,   engineWrap
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.crypto.provider.BlowfishCipher Detail:
 protected byte[] engineDoFinal(byte[] input,
    int inputOffset,
    int inputLen) throws IllegalBlockSizeException, BadPaddingException 
    Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. The data is encrypted or decrypted, depending on how this cipher was initialized.

    The first inputLen bytes in the input buffer, starting at inputOffset, and any input bytes that may have been buffered during a previous update operation, are processed, with padding (if requested) being applied. The result is stored in a new buffer.

    The cipher is reset to its initial state (uninitialized) after this call.

 protected int engineDoFinal(byte[] input,
    int inputOffset,
    int inputLen,
    byte[] output,
    int outputOffset) throws IllegalBlockSizeException, ShortBufferException, BadPaddingException 
    Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. The data is encrypted or decrypted, depending on how this cipher was initialized.

    The first inputLen bytes in the input buffer, starting at inputOffset, and any input bytes that may have been buffered during a previous update operation, are processed, with padding (if requested) being applied. The result is stored in the output buffer, starting at outputOffset.

    The cipher is reset to its initial state (uninitialized) after this call.

 protected int engineGetBlockSize() 
    Returns the block size (in bytes).
 protected byte[] engineGetIV() 
    Returns the initialization vector (IV) in a new buffer.

    This is useful in the case where a random IV has been created (see init), or in the context of password-based encryption or decryption, where the IV is derived from a user-supplied password.

 protected int engineGetKeySize(Key key) throws InvalidKeyException 
    Returns the key size of the given key object.
 protected int engineGetOutputSize(int inputLen) 
    Returns the length in bytes that an output buffer would need to be in order to hold the result of the next update or doFinal operation, given the input length inputLen (in bytes).

    This call takes into account any unprocessed (buffered) data from a previous update call, and padding.

    The actual output length of the next update or doFinal call may be smaller than the length returned by this method.

 protected AlgorithmParameters engineGetParameters() 
    Returns the parameters used with this cipher.

    The returned parameters may be the same that were used to initialize this cipher, or may contain the default set of parameters or a set of randomly generated parameters used by the underlying cipher implementation (provided that the underlying cipher implementation uses a default set of parameters or creates new parameters if it needs parameters but was not initialized with any).

 protected  void engineInit(int opmode,
    Key key,
    SecureRandom random) throws InvalidKeyException 
    Initializes this cipher with a key and a source of randomness.

    The cipher is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

    If this cipher requires an initialization vector (IV), it will get it from random. This behaviour should only be used in encryption or key wrapping mode, however. When initializing a cipher that requires an IV for decryption or key unwrapping, the IV (same IV that was used for encryption or key wrapping) must be provided explicitly as a parameter, in order to get the correct result.

    This method also cleans existing buffer and other related state information.

 protected  void engineInit(int opmode,
    Key key,
    AlgorithmParameterSpec params,
    SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException 
    Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.

    The cipher is initialized for one of the following four operations: encryption, decryption, key wrapping or key unwrapping, depending on the value of opmode.

    If this cipher (including its underlying feedback or padding scheme) requires any random bytes, it will get them from random.

 protected  void engineInit(int opmode,
    Key key,
    AlgorithmParameters params,
    SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException 
 protected  void engineSetMode(String mode) throws NoSuchAlgorithmException 
    Sets the mode of this cipher.
 protected  void engineSetPadding(String paddingScheme) throws NoSuchPaddingException 
    Sets the padding mechanism of this cipher.
 protected Key engineUnwrap(byte[] wrappedKey,
    String wrappedKeyAlgorithm,
    int wrappedKeyType) throws InvalidKeyException, NoSuchAlgorithmException 
    Unwrap a previously wrapped key.
 protected byte[] engineUpdate(byte[] input,
    int inputOffset,
    int inputLen) 
    Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.

    The first inputLen bytes in the input buffer, starting at inputOffset, are processed, and the result is stored in a new buffer.

 protected int engineUpdate(byte[] input,
    int inputOffset,
    int inputLen,
    byte[] output,
    int outputOffset) throws ShortBufferException 
    Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.

    The first inputLen bytes in the input buffer, starting at inputOffset, are processed, and the result is stored in the output buffer, starting at outputOffset.

 protected byte[] engineWrap(Key key) throws IllegalBlockSizeException, InvalidKeyException 
    Wrap a key.