gnu.crypto.jce.cipher
Class CipherAdapter
CipherSpi
gnu.crypto.jce.cipher.CipherAdapter
(package private) 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(String)
constructor with the name of the cipher.
CipherAdapter(String cipherName) - Creates a new cipher adapter with the default block size.
|
CipherAdapter(String cipherName, int blockLen) - Protected constructor to be called by subclasses.
|
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, AlgorithmParameterSpec params, SecureRandom random)
|
protected void | engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random)
|
protected void | engineInit(int opmode, Key key, 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)
|
attributes
protected Map attributes
Our attributes map.
blockLen
protected int blockLen
The length of blocks we are processing.
keyLen
protected int keyLen
The current key size.
mode
protected IMode mode
Our mode instance.
pad
protected IPad pad
Our padding instance.
partBlock
protected byte[] partBlock
An incomplete block.
partLen
protected int partLen
CipherAdapter
protected CipherAdapter(String cipherName)
Creates a new cipher adapter with the default block size.
cipherName
- The cipher to instantiate.
CipherAdapter
protected CipherAdapter(String cipherName,
int blockLen)
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.
cipherName
- The cipher to instantiate.blockLen
- The block length to use.
engineDoFinal
protected byte[] engineDoFinal(byte[] input,
int off,
int len)
throws IllegalBlockSizeException,
BadPaddingException
engineDoFinal
protected int engineDoFinal(byte[] in,
int inOff,
int inLen,
byte[] out,
int outOff)
throws BadPaddingException,
IllegalBlockSizeException,
ShortBufferException
engineGetBlockSize
protected int engineGetBlockSize()
engineGetIV
protected byte[] engineGetIV()
engineGetOutputSize
protected int engineGetOutputSize(int inputLen)
engineGetParameters
protected AlgorithmParameters engineGetParameters()
engineInit
protected void engineInit(int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
engineInit
protected void engineInit(int opmode,
Key key,
AlgorithmParameters params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
engineInit
protected void engineInit(int opmode,
Key key,
SecureRandom random)
throws InvalidKeyException
engineSetMode
protected void engineSetMode(String modeName)
throws NoSuchAlgorithmException
engineSetPadding
protected void engineSetPadding(String padName)
throws NoSuchPaddingException
engineUpdate
protected byte[] engineUpdate(byte[] input,
int off,
int len)
engineUpdate
protected int engineUpdate(byte[] in,
int inOff,
int inLen,
byte[] out,
int outOff)
throws ShortBufferException
Copyright © 2001, 2002, 2003
Free Software Foundation,
Inc. All Rights Reserved.