public interface CryptoCipher extends Closeable
Note that implementations must provide a constructor that has 2 parameters:
a Properties instance and a String (transformation)
| ?????? | ????? |
|---|---|
int |
doFinal(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.
|
int |
doFinal(ByteBuffer inBuffer,
ByteBuffer outBuffer)
Encrypts or decrypts data in a single-part operation, or finishes a
multiple-part operation.
|
String |
getAlgorithm()
Returns the algorithm name of this
CryptoCipher object. |
int |
getBlockSize()
Returns the block size (in bytes).
|
void |
init(int mode,
Key key,
AlgorithmParameterSpec params)
Initializes the cipher with mode, key and iv.
|
int |
update(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
Continues a multiple-part encryption/decryption operation.
|
int |
update(ByteBuffer inBuffer,
ByteBuffer outBuffer)
Continues a multiple-part encryption/decryption operation.
|
int getBlockSize()
String getAlgorithm()
CryptoCipher object.
This is the same name that was specified in one of the
CryptoCipherFactory#getInstance calls that created this
CryptoCipher object..
CryptoCipher object.void init(int mode,
Key key,
AlgorithmParameterSpec params)
throws InvalidKeyException,
InvalidAlgorithmParameterException
mode - Cipher.ENCRYPT_MODE or
Cipher.DECRYPT_MODEkey - crypto key for the cipherparams - the algorithm parametersInvalidKeyException - if the given key is inappropriate for
initializing this cipher, or its keysize exceeds the maximum
allowable keysize (as determined from the configured jurisdiction
policy files).InvalidAlgorithmParameterException - if the given algorithm
parameters are inappropriate for this cipher, or this cipher
requires algorithm parameters and params is null, or
the given algorithm parameters imply a cryptographic strength
that would exceed the legal limits (as determined from the
configured jurisdiction policy files).int update(ByteBuffer inBuffer, ByteBuffer outBuffer) throws ShortBufferException
inBuffer - the input ByteBufferoutBuffer - the output ByteBufferoutputShortBufferException - if there is insufficient space in the output
bufferint update(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws ShortBufferException
input - the input byte arrayinputOffset - the offset in input where the input startsinputLen - the input lengthoutput - the byte array for the resultoutputOffset - the offset in output where the result is storedShortBufferException - if there is insufficient space in the output
byte arrayint doFinal(ByteBuffer inBuffer, ByteBuffer outBuffer) throws ShortBufferException, IllegalBlockSizeException, BadPaddingException
inBuffer - the input ByteBufferoutBuffer - the output ByteBufferoutputBadPaddingException - if this cipher is in decryption mode, and
(un)padding has been requested, but the decrypted data is not
bounded by the appropriate padding bytesIllegalBlockSizeException - 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; or if this encryption algorithm is unable
to process the input data provided.ShortBufferException - if the given output buffer is too small to
hold the resultint doFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
throws ShortBufferException,
IllegalBlockSizeException,
BadPaddingException
input - the input byte arrayinputOffset - the offset in input where the input startsinputLen - the input lengthoutput - the byte array for the resultoutputOffset - the offset in output where the result is storedShortBufferException - if the given output byte array is too small
to hold the resultBadPaddingException - if this cipher is in decryption mode, and
(un)padding has been requested, but the decrypted data is not
bounded by the appropriate padding bytesIllegalBlockSizeException - 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; or if this encryption algorithm is unable
to process the input data provided.Copyright © 2016 The Apache Software Foundation. All rights reserved.