gnu.crypto.jce.cipher
class CipherAdapter extends CipherSpi
The implementation of a generic Cipher Adapter class to wrap GNU Crypto cipher instances.
This class defines the Service Provider Interface (SPI) for the Cipher class, which provides the functionality of symmetric-key block ciphers, such as the AES.
This base class defines all of the abstract methods in CipherSpi, but does not define the (non-abstract) key wrapping functions that extended the base cipher SPI, and these methods thus immediately throw an UnsupportedOperationException. If a cipher implementation provides this functionality, or if it in fact accepts parameters other than the key and the initialization vector, the subclass should override those methods. Otherwise a subclass need only call the CipherAdapter constructor with the name of the cipher.
Version: $Revision: 1.5 $
Field Summary | |
---|---|
protected Map | attributes Our attributes map. |
protected int | blockLen The length of blocks we are processing. |
protected IBlockCipher | cipher Our cipher instance. |
protected int | keyLen The current key size. |
protected IMode | mode Our mode instance. |
protected IPad | pad Our padding instance. |
protected byte[] | partBlock An incomplete block. |
protected int | partLen The number of bytes in partBlock. |
Constructor Summary | |
---|---|
protected | CipherAdapter(String cipherName, int blockLen) Protected constructor to be called by subclasses. |
protected | CipherAdapter(String cipherName) Creates a new cipher adapter with the default block size. |
Method Summary | |
---|---|
protected byte[] | engineDoFinal(byte[] input, int off, int len) |
protected int | engineDoFinal(byte[] in, int inOff, int inLen, byte[] out, int outOff) |
protected int | engineGetBlockSize() |
protected byte[] | engineGetIV() |
protected int | engineGetOutputSize(int inputLen) |
protected AlgorithmParameters | engineGetParameters() |
protected void | engineInit(int opmode, Key key, SecureRandom random) |
protected void | engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) |
protected void | engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) |
protected void | engineSetMode(String modeName) |
protected void | engineSetPadding(String padName) |
protected byte[] | engineUpdate(byte[] input, int off, int len) |
protected int | engineUpdate(byte[] in, int inOff, int inLen, byte[] out, int outOff) |
Protected constructor to be called by subclasses. The cipher name argument should be the appropriate one listed in Registry. The basic cipher instance is created, along with an instance of the ECB mode and no padding.
Parameters: cipherName The cipher to instantiate. blockLen The block length to use.
Creates a new cipher adapter with the default block size.
Parameters: cipherName The cipher to instantiate.