|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.crypto.CipherSpi de.cscc.crypto.provider.RSACipherEngine
RSACipherEngine Class.
Constructor Summary | |
RSACipherEngine()
|
Method Summary | |
protected byte[] |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. |
protected int |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation. |
protected int |
engineGetBlockSize()
Returns the block size (in bytes) that can be processed while a multipart cipher operation. |
protected byte[] |
engineGetIV()
Returns the initialization vector (IV) in a new buffer. |
protected int |
engineGetKeySize(Key key)
Returns the key size of the given key object in bit. |
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). |
protected AlgorithmParameters |
engineGetParameters()
Returns the parameters used with this cipher. |
protected void |
engineInit(int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random)
Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness. |
protected 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 void |
engineInit(int opmode,
Key key,
SecureRandom random)
Initializes this cipher with a key and a source of randomness. |
protected void |
engineSetMode(String mode)
Sets the mode of this cipher. |
protected void |
engineSetPadding(String padding)
Sets the padding mechanism of this cipher. |
protected Key |
engineUnwrap(byte[] wrappedKey,
String wrappedKeyAlgorithm,
int wrappedKeyType)
Unwrap a previously wrapped key. |
protected byte[] |
engineUpdate(byte[] input,
int inputOffset,
int inputLen)
Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part. |
protected int |
engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part. |
protected byte[] |
engineWrap(Key key)
Wrap a key. |
String |
toString()
Returns a string representation of the object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public RSACipherEngine()
Method Detail |
public String toString()
protected void engineSetMode(String mode) throws NoSuchAlgorithmException
mode
- the cipher mode.
NoSuchAlgorithmException
- if the requested cipher mode does not exist.protected void engineSetPadding(String padding) throws NoSuchPaddingException
padding
- the padding mechanism.
NoSuchPaddingException
- if the requested padding mechanism does not exist.protected void engineInit(int opmode, Key key, SecureRandom random) throws InvalidKeyException
opmode
- the operation mode of this cipher.
This is one of the following:
javax.crypto.Cipher.ENCRYPT_MODE
javax.crypto.Cipher.DECRYPT_MODE
javax.crypto.Cipher.WRAP_MODE
javax.crypto.Cipher.UNWRAP_MODEkey
- the key to encrypt or to decrypt.random
- the source of randomness.
InvalidKeyException
- if the given key is inappropriate for
initializing this cipher, this means if the key does not match to
the specific opmode.
NullPointerException
- if key is null.protected void engineInit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException
opmode
- the operation mode of this cipher.
This is one of the following:
javax.crypto.Cipher.ENCRYPT_MODE
javax.crypto.Cipher.DECRYPT_MODE
javax.crypto.Cipher.WRAP_MODE
javax.crypto.Cipher.UNWRAP_MODEkey
- the key to encrypt or to decrypt.params
- the algorithm paramter.random
- the source of randomness.
InvalidKeyException
- if the given key is inappropriate for
initializing this cipher.
InvalidAlgorithmParameterException
- if params isn't null, because
we don't support AlgorithmParameters.protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException
opmode
- the operation mode of this cipher.
This is one of the following:
javax.crypto.Cipher.ENCRYPT_MODE
javax.crypto.Cipher.DECRYPT_MODE
javax.crypto.Cipher.WRAP_MODE
javax.crypto.Cipher.UNWRAP_MODEkey
- the key to encrypt or to decrypt.params
- the algorithm paramter.random
- the source of randomness.
InvalidKeyException
- if the given key is inappropriate for
initializing this cipher.
InvalidAlgorithmParameterException
- if params isn't null, because
we don't support AlgorithmParameterSpecs.protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen)
input
- the input buffer.inputOffset
- the offset in input where the input starts.inputLen
- the input length.
IllegalStateException
- if the Cipher was not initialized, or you
invoke this method in WRAP_MODE or UNWRAP_MODE.protected int engineUpdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws ShortBufferException
input
- the input buffer.inputOffset
- the offset in input where the input starts.inputLen
- the input length.output
- the buffer for the result.outputOffset
- the offset in output where the result is stored.
ShortBufferException
- if the given output buffer is too small to
hold the result.
IllegalStateException
- if the Cipher was not initialized, or you
invoke this method in WRAP_MODE or UNWRAP_MODE.protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) throws IllegalBlockSizeException, BadPaddingException
input
- the input buffer.inputOffset
- the offset in input where the input starts.inputLen
- the input length.
IllegalBlockSizeException
- if this cipher is a block cipher, no padding
has been requested (only in encryption mode),
and the total input length of the data processed
by this cipher is not a multiple of block size.
BadPaddingException
- if this cipher is in decryption mode,
and (un)padding has been requested,
but the decrypted data is not bounded
by the appropriate padding bytes.
IllegalStateException
- if the Cipher was not initialized, or you
invoke this method in WRAP_MODE or UNWRAP_MODE.protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException
input
- the input buffer.inputOffset
- the offset in input where the input starts.inputLen
- the input length.output
- the buffer for the finally result.outputOffset
- the offset in output where the result is stored.
ShortBufferException
- if the given output buffer is too small to
hold the result.
IllegalBlockSizeException
- if this cipher is a block cipher, no padding
has been requested (only in encryption mode),
and the total input length of the data processed
by this cipher is not a multiple of block size.
BadPaddingException
- if this cipher is in decryption mode,
and (un)padding has been requested,
but the decrypted data is not bounded
by the appropriate padding bytes.
IllegalStateException
- if the Cipher was not initialized, or you
invoke this method in WRAP_MODE or UNWRAP_MODE.protected byte[] engineWrap(Key key) throws IllegalBlockSizeException, InvalidKeyException
key
- the key to be wrapped.
NullpointerException
- if key.getEncoded()
is null.
This means the key does not support encoding.
IllegalBlockSizeException
- if the unsigned number representation
of the encoded key is equal or greater than the modulus of the RSAKey.
InvalidKeyException
- if it is impossible or unsafe to wrap the
key with this cipher (e.g., a hardware
public key is being passed to a
software-only cipher).
IllegalStateException
- if the Cipher was not initialized, or you
invoke this method in ENCRYPT_MODE or DECRTYPT_MODE.protected Key engineUnwrap(byte[] wrappedKey, String wrappedKeyAlgorithm, int wrappedKeyType) throws InvalidKeyException, NoSuchAlgorithmException
wrappedKey
- the wrapped key to unwrap.wrappedKeyAlgorithm
- the algorithm associated with the key wrapped
key.wrappedKeyType
- the type of the wrapped key. This is one of
javax.crypto.Cipher.SECRET_KEY,
javax.crypto.Cipher.PRIVATE_KEY,
javax.crypto.Cipher.PUBLIC_KEY.
InvalidKeyException
- if wrappedKey does not represent a wrapped
key, or if the algorithm associated with the wrapped key is different
from wrappedKeyAlgorithm and/or its key type is different from
wrappedKeyType.
NoSuchAlgorithmException
- if no installed providers can create
keys for the wrappedKeyAlgorithm.
IllegalStateException
- if the Cipher was not initialized.protected int engineGetBlockSize()
IllegalStateException
- if the Cipher was not initialized or a
opmode does not match.protected int engineGetOutputSize(int inputLen)
inputLen
- the input length in bytes.
IllegalStateException
- if the Cipher was not initialized or a
opmode does not match.protected int engineGetKeySize(Key key) throws InvalidKeyException
key
- the key object.
InvalidKeyException
- if key is invalid.protected AlgorithmParameters engineGetParameters()
IllegalStateException
- if the Cipher was not initialized.protected byte[] engineGetIV()
IllegalStateException
- if the Cipher was not initialized.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |