|
For the latest news and information visit The GNU Crypto project |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--javax.crypto.CipherSpi
|
+--gnu.crypto.jce.cipher.CipherAdapter
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 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(java.lang.String) constructor with the name of
the cipher.
| Field Summary | |
protected java.util.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(java.lang.String cipherName)
Creates a new cipher adapter with the default block size. |
protected |
CipherAdapter(java.lang.String cipherName,
int blockLen)
Protected constructor to be called by subclasses. |
| 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 java.security.AlgorithmParameters |
engineGetParameters()
|
protected void |
engineInit(int opmode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
|
protected void |
engineInit(int opmode,
java.security.Key key,
java.security.AlgorithmParameters params,
java.security.SecureRandom random)
|
protected void |
engineInit(int opmode,
java.security.Key key,
java.security.SecureRandom random)
|
protected void |
engineSetMode(java.lang.String modeName)
|
protected void |
engineSetPadding(java.lang.String padName)
|
protected byte[] |
engineUpdate(byte[] input,
int off,
int len)
|
protected int |
engineUpdate(byte[] in,
int inOff,
int inLen,
byte[] out,
int outOff)
|
| Methods inherited from class javax.crypto.CipherSpi |
engineGetKeySize, engineUnwrap, engineWrap |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected IBlockCipher cipher
protected IMode mode
protected IPad pad
protected int keyLen
protected java.util.Map attributes
protected byte[] partBlock
protected int partLen
partBlock.
protected int blockLen
| Constructor Detail |
protected CipherAdapter(java.lang.String cipherName,
int blockLen)
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.protected CipherAdapter(java.lang.String cipherName)
cipherName - The cipher to instantiate.| Method Detail |
protected void engineSetMode(java.lang.String modeName)
throws java.security.NoSuchAlgorithmException
engineSetMode in class javax.crypto.CipherSpijava.security.NoSuchAlgorithmException
protected void engineSetPadding(java.lang.String padName)
throws javax.crypto.NoSuchPaddingException
engineSetPadding in class javax.crypto.CipherSpijavax.crypto.NoSuchPaddingExceptionprotected int engineGetBlockSize()
engineGetBlockSize in class javax.crypto.CipherSpiprotected int engineGetOutputSize(int inputLen)
engineGetOutputSize in class javax.crypto.CipherSpiprotected byte[] engineGetIV()
engineGetIV in class javax.crypto.CipherSpiprotected java.security.AlgorithmParameters engineGetParameters()
engineGetParameters in class javax.crypto.CipherSpi
protected void engineInit(int opmode,
java.security.Key key,
java.security.SecureRandom random)
throws java.security.InvalidKeyException
engineInit in class javax.crypto.CipherSpijava.security.InvalidKeyException
protected void engineInit(int opmode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec params,
java.security.SecureRandom random)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException
engineInit in class javax.crypto.CipherSpijava.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
protected void engineInit(int opmode,
java.security.Key key,
java.security.AlgorithmParameters params,
java.security.SecureRandom random)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException
engineInit in class javax.crypto.CipherSpijava.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
protected byte[] engineUpdate(byte[] input,
int off,
int len)
engineUpdate in class javax.crypto.CipherSpi
protected int engineUpdate(byte[] in,
int inOff,
int inLen,
byte[] out,
int outOff)
throws javax.crypto.ShortBufferException
engineUpdate in class javax.crypto.CipherSpijavax.crypto.ShortBufferException
protected byte[] engineDoFinal(byte[] input,
int off,
int len)
throws javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
engineDoFinal in class javax.crypto.CipherSpijavax.crypto.IllegalBlockSizeException
javax.crypto.BadPaddingException
protected int engineDoFinal(byte[] in,
int inOff,
int inLen,
byte[] out,
int outOff)
throws javax.crypto.BadPaddingException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.ShortBufferException
engineDoFinal in class javax.crypto.CipherSpijavax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
javax.crypto.ShortBufferException
|
For the latest news and information visit The GNU Crypto project |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||