APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.crypto.provider

pack-priv final Class BlowfishCrypt

extends SymmetricCipher
implements BlowfishConstants
Class Inheritance
All Implemented Interfaces
com.sun.crypto.provider.BlowfishConstants
Imports
java.security.InvalidKeyException

This is the internal Blowfish class responsible for encryption and decryption of a byte array of size BLOWFISH_BLOCK_SIZE.
Authors
Jan Luehe, David Brownell
See Also
BlowfishCipher

Field Summary

Modifier and TypeField and Description
private boolean
private final int[]
p

private static final int[]
private final int[]
private final int[]
private final int[]
private final int[]
private final int[]

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
private void
cipherBlock(byte[] in, int inOffset, byte[] out, int outOffset)

Encrypts, or decrypts, the blocks of data passed in.

pack-priv void
decryptBlock(byte[]
the buffer with the input data to be decrypted
cipher
,
int
the offset in cipherOffset
cipherOffset
,
byte[]
the buffer for the result
plain
,
int
the offset in plain
plainOffset
)

Implements abstract com.sun.crypto.provider.SymmetricCipher.decryptBlock.

Performs decryption operation.

private void
decryptBlock(int[] value)

Decrypts a single block, in place.

pack-priv void
encryptBlock(byte[]
the buffer with the input data to be encrypted
plain
,
int
the offset in plain
plainOffset
,
byte[]
the buffer for the result
cipher
,
int
the offset in cipher
cipherOffset
)

Implements abstract com.sun.crypto.provider.SymmetricCipher.encryptBlock.

Performs encryption operation.

private void
encryptBlock(int[] value)

Encrypts a single block, in place.

private int
F(int v)

Calculates the S-Box function F().

pack-priv int

Returns:

this cipher's block size
getBlockSize
()

Implements abstract com.sun.crypto.provider.SymmetricCipher.getBlockSize.

Gets this cipher's block size.

pack-priv void
init(boolean decrypting, String algorithm, byte[] rawKey)

Implements abstract com.sun.crypto.provider.SymmetricCipher.init.

Initializes the cipher in the specified mode with the given key.

Field Detail

decryptingback to summary
private boolean decrypting
pback to summary
private final int[] p
piback to summary
private static final int[] pi
s0back to summary
private final int[] s0
s1back to summary
private final int[] s1
s2back to summary
private final int[] s2
s3back to summary
private final int[] s3
tempback to summary
private final int[] temp

Constructor Detail

BlowfishCryptback to summary
pack-priv BlowfishCrypt()

Method Detail

cipherBlockback to summary
private void cipherBlock(byte[] in, int inOffset, byte[] out, int outOffset)

Encrypts, or decrypts, the blocks of data passed in.

decryptBlockback to summary
pack-priv void decryptBlock(byte[] cipher, int cipherOffset, byte[] plain, int plainOffset)

Implements abstract com.sun.crypto.provider.SymmetricCipher.decryptBlock.

Performs decryption operation.

The input cipher text cipher, starting at cipherOffset and ending at (cipherOffset + len - 1), is decrypted. The result is stored in plain, starting at plainOffset.

The subclass that implements Cipher should ensure that init has been called before this method is called.

Parameters
cipher:byte[]

the buffer with the input data to be decrypted

cipherOffset:int

the offset in cipherOffset

plain:byte[]

the buffer for the result

plainOffset:int

the offset in plain

decryptBlockback to summary
private void decryptBlock(int[] value)

Decrypts a single block, in place.

encryptBlockback to summary
pack-priv void encryptBlock(byte[] plain, int plainOffset, byte[] cipher, int cipherOffset)

Implements abstract com.sun.crypto.provider.SymmetricCipher.encryptBlock.

Performs encryption operation.

The input plain text plain, starting at plainOffset and ending at (plainOffset + len - 1), is encrypted. The result is stored in cipher, starting at cipherOffset.

The subclass that implements Cipher should ensure that init has been called before this method is called.

Parameters
plain:byte[]

the buffer with the input data to be encrypted

plainOffset:int

the offset in plain

cipher:byte[]

the buffer for the result

cipherOffset:int

the offset in cipher

encryptBlockback to summary
private void encryptBlock(int[] value)

Encrypts a single block, in place.

Fback to summary
private int F(int v)

Calculates the S-Box function F(). This gets used "rounds" times on each encryption/decryption.

getBlockSizeback to summary
pack-priv int getBlockSize()

Implements abstract com.sun.crypto.provider.SymmetricCipher.getBlockSize.

Gets this cipher's block size.

Returns:int

this cipher's block size

initback to summary
pack-priv void init(boolean decrypting, String algorithm, byte[] rawKey) throws InvalidKeyException

Implements abstract com.sun.crypto.provider.SymmetricCipher.init.

Doc from com.sun.crypto.provider.SymmetricCipher.init.

Initializes the cipher in the specified mode with the given key.

Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this cipher