public class BaseStreamCipher extends BaseWrapCipher implements PBE
engineParams, pbeHash, pbeIvSize, pbeKeySize, pbeType, wrapEngineMD5, OPENSSL, PKCS12, PKCS5S1, PKCS5S1_UTF8, PKCS5S2, PKCS5S2_UTF8, SHA1, SHA256| Modifier | Constructor and Description |
|---|---|
protected |
BaseStreamCipher(StreamCipher engine,
int ivLength) |
| Modifier and Type | Method and Description |
|---|---|
protected byte[] |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
Finishes a multi-part transformation (encryption or decryption).
|
protected int |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
Finishes a multi-part transformation (encryption or decryption).
|
protected int |
engineGetBlockSize()
Returns the block size of this cipher (in bytes)
|
protected byte[] |
engineGetIV()
Returns the Initialization Vector (IV) that was used to initialize this
cipher or
null if none was used. |
protected int |
engineGetKeySize(Key key)
Returns the size of a specified key object in bits.
|
protected int |
engineGetOutputSize(int inputLen)
Returns the size for a buffer (in bytes), that the next call to
update of doFinal would return, taking into account any buffered
data from previous update calls and padding. |
protected AlgorithmParameters |
engineGetParameters()
Returns the parameters that where used to create this cipher instance.
|
protected void |
engineInit(int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random)
Initializes this cipher instance with the specified key, algorithm
parameters and a source of randomness.
|
protected void |
engineInit(int opmode,
Key key,
AlgorithmParameters params,
SecureRandom random)
Initializes this cipher instance with the specified key, algorithm
parameters and a source of randomness.
|
protected void |
engineInit(int opmode,
Key key,
SecureRandom random)
Initializes this cipher instance with the specified key and a source of
randomness.
|
protected void |
engineSetMode(String mode)
should never be called.
|
protected void |
engineSetPadding(String padding)
should never be called.
|
protected byte[] |
engineUpdate(byte[] input,
int inputOffset,
int inputLen)
Continues a multi-part transformation (encryption or decryption).
|
protected int |
engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
Continues a multi-part transformation (encryption or decryption).
|
createParametersInstance, engineUnwrap, engineWrapengineDoFinal, engineUpdate, engineUpdateAAD, engineUpdateAADprotected BaseStreamCipher(StreamCipher engine, int ivLength)
protected int engineGetBlockSize()
CipherSpiengineGetBlockSize in class BaseWrapCipherprotected byte[] engineGetIV()
CipherSpinull if none was used.engineGetIV in class BaseWrapCiphernull if none was used.protected int engineGetKeySize(Key key)
CipherSpiUnsupportedOperationException.engineGetKeySize in class BaseWrapCipherkey - the key to get the size for.protected int engineGetOutputSize(int inputLen)
CipherSpiupdate of doFinal would return, taking into account any buffered
data from previous update calls and padding.
The actual output length of the next call to update or doFinal may be smaller than the length returned by this method.
engineGetOutputSize in class BaseWrapCipherinputLen - the length of the input (in bytes).protected AlgorithmParameters engineGetParameters()
CipherSpiThese may be a the same parameters that were used to create this cipher instance, or may be a combination of default and random parameters, depending on the underlying cipher implementation.
engineGetParameters in class BaseWrapCiphernull if this cipher instance does not have any parameters
at all.protected void engineSetMode(String mode)
engineSetMode in class BaseWrapCiphermode - the name of the cipher mode.protected void engineSetPadding(String padding) throws NoSuchPaddingException
engineSetPadding in class BaseWrapCipherpadding - the name of the padding method.NoSuchPaddingException - if the specified padding method is not supported by this
cipher.protected void engineInit(int opmode,
Key key,
AlgorithmParameterSpec params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
CipherSpi
The cipher will be initialized for the specified operation (one of:
encryption, decryption, key wrapping or key unwrapping) depending on
opmode.
If this cipher instance needs any algorithm parameters and params
is null, the underlying implementation of this cipher is supposed
to generate the required parameters (using its provider or random
values). Random values are generated using random.
When a cipher instance is initialized by a call to any of the init methods, the state of the instance is overridden, means it is
equivalent to creating a new instance and calling it init method.
engineInit in class BaseWrapCipheropmode - the operation this cipher instance should be initialized for
(one of: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE or UNWRAP_MODE).key - the input key for the operation.params - the algorithm parameters.random - the source of randomness to use.InvalidKeyException - if the specified key cannot be used to initialize this cipher
instance.InvalidAlgorithmParameterException - it the specified parameters are inappropriate for this
cipher.protected void engineInit(int opmode,
Key key,
AlgorithmParameters params,
SecureRandom random)
throws InvalidKeyException,
InvalidAlgorithmParameterException
CipherSpi
The cipher will be initialized for the specified operation (one of:
encryption, decryption, key wrapping or key unwrapping) depending on
opmode.
If this cipher instance needs any algorithm parameters and params
is null, the underlying implementation of this cipher is supposed
to generate the required parameters (using its provider or random
values). Random values are generated using random.
When a cipher instance is initialized by a call to any of the init methods, the state of the instance is overridden, means it is
equivalent to creating a new instance and calling it init method.
engineInit in class BaseWrapCipheropmode - the operation this cipher instance should be initialized for
(one of: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE or UNWRAP_MODE).key - the input key for the operation.params - the algorithm parameters.random - the source of randomness to use.InvalidKeyException - if the specified key cannot be used to initialize this cipher
instance.InvalidAlgorithmParameterException - if the specified parameters are inappropriate for this
cipher.protected void engineInit(int opmode,
Key key,
SecureRandom random)
throws InvalidKeyException
CipherSpi
The cipher will be initialized for the specified operation (one of:
encryption, decryption, key wrapping or key unwrapping) depending on
opmode.
If this cipher instance needs any algorithm parameters or random values
that the specified key cannot provide, the underlying implementation of
this cipher is supposed to generate the required parameters (using its
provider or random values). Random values will be generated using random;
When a cipher instance is initialized by a call to any of the init methods, the state of the instance is overridden, means it is
equivalent to creating a new instance and calling it init method.
engineInit in class BaseWrapCipheropmode - the operation this cipher instance should be initialized for
(one of: ENCRYPT_MODE, DECRYPT_MODE, WRAP_MODE or UNWRAP_MODE).key - the input key for the operation.random - the source of randomness to use.InvalidKeyException - if the specified key cannot be used to initialize this cipher
instance.protected byte[] engineUpdate(byte[] input,
int inputOffset,
int inputLen)
CipherSpiengineUpdate in class BaseWrapCipherinput - the input bytes to transform.inputOffset - the offset in the input to start.inputLen - the length of the input to transform.null if the
input has zero length.protected int engineUpdate(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws ShortBufferException
CipherSpioutput buffer.
If the size of the output buffer is too small to hold the result,
a ShortBufferException is thrown. Use
getOutputSize to check for the size of the
output buffer.
engineUpdate in class BaseWrapCipherinput - the input bytes to transform.inputOffset - the offset in the input to start.inputLen - the length of the input to transform.output - the output buffer.outputOffset - the offset in the output buffer.ShortBufferException - if the size of the output buffer is too small.protected byte[] engineDoFinal(byte[] input,
int inputOffset,
int inputLen)
CipherSpi
Processes the inputLen bytes in input buffer at inputOffset, and any bytes that have been buffered in previous update calls.
engineDoFinal in class BaseWrapCipherinput - the input buffer.inputOffset - the offset in the input buffer.inputLen - the length of the input.protected int engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
CipherSpi
Processes the inputLen bytes in input buffer at
inputOffset, and any bytes that have been buffered in previous
update calls.
engineDoFinal in class BaseWrapCipherinput - the input buffer.inputOffset - the offset in the input buffer.inputLen - the length of the input.output - the output buffer for the transformed bytes.outputOffset - the offset in the output buffer.