| cryptix.jce.provider.cipher.BlockCipher
All known Subclasses: cryptix.jce.provider.cipher.Twofish, cryptix.jce.provider.cipher.MARS, cryptix.jce.provider.cipher.Blowfish, cryptix.jce.provider.cipher.Serpent, cryptix.jce.provider.cipher.Rijndael, cryptix.jce.provider.cipher.CAST5,
BlockCipher | abstract public class BlockCipher extends CipherSpi (Code) | |
A fully constructed Cipher instance looks like this:
+------------------------------------------+
| CipherSpi (API methods) |
| |
| +--------------------------------------+ |
| | Padding | |
| | | |
| | +----------------------------------+ | |
| | | Mode | | |
| | | | | |
| | | +------------------------------+ | | |
| | | | CipherSpi | | | |
| | | | (blockcipher implementation) | | | |
| | | | | | | |
| | | +------------------------------+ | | |
| | | | | |
| | +----------------------------------+ | |
| | | |
| +--------------------------------------+ |
| |
+------------------------------------------+
author: Jeroen C. van Gelderen (gelderen@cryptix.org) author: Paul Waserbrot (pw@cryptix.org) version: $Revision: 1.1 $ |
Constructor Summary | |
protected | BlockCipher(int blockSize) Construct a new BlockCipher (CipherSpi) with an zero-length name ""
and given block size. | protected | BlockCipher(String algorithm, int blockSize) Construct a new BlockCipher (CipherSpi) with the given name and
block size. |
Method Summary | |
final public Object | clone() Always throws a CloneNotSupportedException (cloning of ciphers is not
supported for security reasons). | abstract void | coreCrypt(byte[] in, int inOffset, byte[] out, int outOffset) Encrypt a given buffer. | int | coreGetBlockSize() | abstract void | coreInit(Key key, boolean decrypt) | final protected int | engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) | final protected byte[] | engineDoFinal(byte[] input, int inputOffset, int inputLen) | final protected int | engineGetBlockSize() | final protected byte[] | engineGetIV() Returns a copy of the initialization vector (IV) used in this cipher. | protected int | engineGetKeySize(Key key) | final 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(s), and padding.
The actual output length of the next update or doFinal call
may be smaller than the length returned by this method. | final protected AlgorithmParameters | engineGetParameters() | final protected void | engineInit(int opmode, Key key, SecureRandom random) Initialize this blockcipher for encryption or decryption. | final protected void | engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) | final protected void | engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) | final protected void | engineSetMode(String mode) | final protected void | engineSetPadding(String padding) | final protected int | engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) | final protected byte[] | engineUpdate(byte[] input, int inputOffset, int inputLen) |
BlockCipher | protected BlockCipher(int blockSize)(Code) | | Construct a new BlockCipher (CipherSpi) with an zero-length name ""
and given block size.
|
BlockCipher | protected BlockCipher(String algorithm, int blockSize)(Code) | | Construct a new BlockCipher (CipherSpi) with the given name and
block size.
|
coreCrypt | abstract void coreCrypt(byte[] in, int inOffset, byte[] out, int outOffset)(Code) | | Encrypt a given buffer. in and out can point to the same buffer if
(outOffset == inOffset) || (outOffset >= (inOffset+coreGetBlockSize))
That is: the buffers may not partially overlap...
|
coreGetBlockSize | int coreGetBlockSize()(Code) | | |
engineDoFinal | final protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException(Code) | | throws: BadPaddingException - (decryption only) if padding is expected but not found at theend of the data or the padding is found but corrupt throws: IllegalBlockSizeException - if no padding is specified and the input data is not a multipleof the blocksize. throws: ShortBufferException - if the given buffer is to short to holdthe result. |
engineDoFinal | final protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) throws IllegalBlockSizeException, BadPaddingException(Code) | | Implemented in terms of engineDoFinal(byte[], int, int, byte[], int)
throws: BadPaddingException - (decryption only) if padding is expected but not found at theend of the data. throws: IllegalBlockSizeException - if no padding is specified and the input data is not a multipleof the blocksize. |
engineGetBlockSize | final protected int engineGetBlockSize()(Code) | | |
engineGetIV | final protected byte[] engineGetIV()(Code) | | Returns a copy of the initialization vector (IV) used in this cipher.
A copy of the IV or null if this cipher does not have an IV ornull if the IV has not yet been set. |
engineGetOutputSize | final protected int engineGetOutputSize(int inputLen)(Code) | | 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(s), and padding.
The actual output length of the next update or doFinal call
may be smaller than the length returned by this method. For ciphers with
a padding, calling the update method will generally return less data
than predicted by this function.
Parameters: inputLen - the length in bytes. the maximum amount of data that the cipher will return. |
engineInit | final protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException(Code) | | Initialize this blockcipher for encryption or decryption.
If the cipher requires randomness, it is taken from random .
Randomness is required for modes that use IVs and might be required for
some padding schemes.
Parameters: opmode - Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODE. Parameters: key - secret key Parameters: random - source of randomness |
engineSetPadding | final protected void engineSetPadding(String padding) throws NoSuchPaddingException(Code) | | |
engineUpdate | final protected int engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws ShortBufferException(Code) | | |
engineUpdate | final protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen)(Code) | | Implemented in terms of engineUpdate(byte[], int, int, byte[], int)
|
|
|