|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--javax.crypto.CipherSpi
Service Provider Interface (SPI) for the Cipher class.
Attention: This is not a SUN implementation!
This class has been developed by IAIK according to the documentation publically available.
For SUNīs documentation of this class see
http://java.sun.com/security/JCE1.2/spec/apidoc/index.html
This class represents the super SPI abstract class for cipher handling and has to be implemented by a
data en/decryption supporting provider for registering with the Java Security framework.
Within the IAIK provider environment this class is extended by the
iaik.security.cipher.BufferedCipher class for providing an automatical
buffering mechanism.
This class contains a set of abstract engine methods which have to be implemented by
a provider and are called by their appertaining Cipher equivalents for accessing provider specific
implementations.
Any application dealing en/decryption, uses the getInstance method
of the Cipher class for creating a cipher object.
KeyGenerator,
SecretKey,
AlgorithmParameters,
AlgorithmParameterSpec,
BufferedCipher,
Cipher| Constructor Summary | |
CipherSpi()
Constructor used for dynamic instantiation. |
|
| Method Summary | |
protected abstract byte[] |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
Returns the result of the last step of a multi-step en/decryption operation or the result of a single-step en/decryption operation by processing the given input data and any remaining buffered data. |
protected abstract int |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
Performs the last step of a multi-step en/decryption operation or a single-step en/decryption operation by processing the given input data and any remaining buffered data. |
protected abstract int |
engineGetBlockSize()
Returns the block size corresponding to this cipher. |
protected abstract byte[] |
engineGetIV()
Returns a byte array containing the initialization vector (IV). |
protected abstract int |
engineGetOutputSize(int inputLen)
Returns the output buffer size necessary for capturing the data resulting from the next update or doFinal operation including
any data currently being buffered. |
protected abstract AlgorithmParameters |
engineGetParameters()
Returns the parameters used with this cipher. |
protected abstract void |
engineInit(int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random)
Initializes this cipher object with proper key and algorithm parameters, and some random seed. |
protected abstract void |
engineInit(int opmode,
Key key,
AlgorithmParameters params,
SecureRandom random)
Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness. |
protected abstract void |
engineInit(int opmode,
Key key,
SecureRandom random)
Initializes this cipher object with a proper key and some random seed. |
protected abstract void |
engineSetMode(java.lang.String mode)
Sets the mode of this cipher. |
protected abstract void |
engineSetPadding(java.lang.String padding)
Sets the padding scheme of this cipher. |
protected abstract byte[] |
engineUpdate(byte[] input,
int inputOffset,
int inputLen)
Returns the result of the next step of a multi-step en/decryption operation. |
protected abstract int |
engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
Performs the next step of a multi-step en/decryption operation. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Constructor Detail |
public CipherSpi()
| Method Detail |
protected abstract void engineSetMode(java.lang.String mode)
throws NoSuchAlgorithmException
Cipher.getInstance(...)
without specifying a particular cipher mode, engineSetMode is supplied with the
default "ECB" mode.mode - the cipher modeBufferedCipher.engineSetMode(java.lang.String)
protected abstract void engineSetPadding(java.lang.String padding)
throws NoSuchPaddingException
Cipher.getInstance(...)
without specifying a particular padding scheme, engineSetMode is supplied with the
default "NoPadding" scheme.padding - the padding schemeBufferedCipher.engineSetPadding(java.lang.String)protected abstract int engineGetBlockSize()
Cipher.getBlockSize(),
BufferedCipher.engineGetBlockSize()protected abstract int engineGetOutputSize(int inputLen)
update or doFinal operation including
any data currently being buffered.inputLen - the number of bytes to processCipher.getOutputSize(int),
BufferedCipher.engineGetOutputSize(int)protected abstract byte[] engineGetIV()
null is returned.null otherwise.Cipher.getIV(),
BufferedCipher.engineGetIV()protected abstract AlgorithmParameters engineGetParameters()
protected abstract void engineInit(int opmode,
Key key,
SecureRandom random)
throws InvalidKeyException
opmode parameter (either ENCRYPT_MODE or DECCRYPT_MODE).
e.g. cipher_obj.init(Cipher.ENCRYPT_MODE, key, random_seed);
The Cipher init will call the proper CipherSpi engineInit method.
If this cipher (including its underlying feedback or padding scheme) requires any random bytes, it will get them from random.
opmode - the operation mode for which this cipher is used (ENCRYPT_MODE or DECRYPT_MODE)key - the keyrandom - the random seedCipher.init(int, java.security.Key),
BufferedCipher.engineInit(int, java.security.Key, java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom)
protected abstract void engineInit(int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
opmode parameter (either ENCRYPT_MODE or DECCRYPT_MODE).
e.g. cipher_obj.init(Cipher.ENCRYPT_MODE, key, alg_params, random_seed);
The Cipher init will call the proper CipherSpi engineInit method.
opmode - the operation mode for which this cipher is used (ENCRYPT_MODE or DECRYPT_MODE)key - the keyparams - the algorithm parametersrandom - the random seedCipher.init(int, java.security.Key),
BufferedCipher.engineInit(int, java.security.Key, java.security.spec.AlgorithmParameterSpec, java.security.SecureRandom)
protected abstract void engineInit(int opmode,
Key key,
AlgorithmParameters params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
opmode - the operation mode of this cipher
(this is either ENCRYPT_MODE or DECRYPT_MODE)key - the encryption keyparams - the algorithm parametersrandom - the source of randomness
protected abstract byte[] engineUpdate(byte[] input,
int inputOffset,
int inputLen)
inputOffset,
only the first inputLen bytes are en/decrypted. The result is returned as a byte array.input - the byte array holding the data to be processedinputOffset - the offset indicating the start position within the input byte arrayinputLen - the number of bytes to be processedCipher.update(byte[]),
BufferedCipher.engineUpdate(byte[], int, int)
protected abstract int engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws ShortBufferException
inputOffset,
only the first inputLen bytes are en/decrypted. The result is stored in the given
output byte array, beginning at outputOffset. The number of bytes stored in this
output byte array are returned.input - the byte array holding the data to be processedinputOffset - the offset indicating the start position within the input byte arrayinputLen - the number of bytes to be processedoutput - the byte array for holding the resultoutputOffset - the offset indicating the start position within the output byte array
to which the en/decrypted data is writtenCipher.update(byte[]),
BufferedCipher.engineUpdate(byte[], int, int)
protected abstract byte[] engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
throws IllegalBlockSizeException,
BadPaddingException
inputOffset,
only the first inputLen bytes are en/decrypted, including any buffered bytes of a previous
update operation. If necessary, padding is performed. The result is returned as
a output byte array.input - the byte array holding the data to be processedinputOffset - the offset indicating the start position within the input byte arrayinputLen - the number of bytes to be processedCipher.doFinal()
protected abstract int engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws ShortBufferException,
IllegalBlockSizeException,
BadPaddingException
inputOffset,
only the first inputLen bytes are en/decrypted, including any buffered bytes of a previous
update operation. If necessary, padding is performed. The result is stored in the
given output byte array, beginning at outputOffset. The number of bytes stored in
this byte array are returned.input - the byte array holding the data to be processedinputOffset - the offset indicating the start position within the input byte arrayinputLen - the number of bytes to be processedoutput - the byte array for holding the resultoutputOffset - the offset indicating the start position within the output byte array
to which the en/decrypted data is writtenCipher.doFinal()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||