public final class GCMCipherLite extends CipherLite
CipherLiteNull| Modifier and Type | Method and Description |
|---|---|
byte[] |
doFinal()
Finishes a multiple-part encryption or decryption operation, depending on
how the underlying cipher was initialized.
|
byte[] |
doFinal(byte[] input)
Encrypts or decrypts data in a single-part operation, or finishes a
multiple-part operation.
|
byte[] |
doFinal(byte[] input,
int inputOffset,
int inputLen)
Encrypts or decrypts data in a single-part operation, or finishes a
multiple-part operation.
|
long |
getCurrentCount()
For testing purposes.
|
byte[] |
getFinalBytes()
For testing purposes only.
|
long |
getMarkedCount()
For testing purposes.
|
long |
getOutputByteCount()
For testing purposes.
|
byte[] |
getTag()
For testing purposes.
|
long |
mark()
Marks the current position in this cipher lite.
|
boolean |
markSupported()
Tests if this cipher lite supports the
mark
and reset methods. |
void |
reset()
Repositions this cipher lite to the position at the time the
mark method was last called. |
byte[] |
update(byte[] input,
int inputOffset,
int inputLen)
Continues a multiple-part encryption or decryption operation (depending
on how the underlying cipher was initialized), processing another data
part.
|
createAuxiliary, createInverse, createUsingIV, getBlockSize, getCipher, getCipherAlgorithm, getCipherProvider, getContentCryptoScheme, getIV, getSecretKeyAlgorithm, recreatepublic byte[] doFinal()
throws IllegalBlockSizeException,
BadPaddingException
CipherLite
Input data that may have been buffered during a previous
update operation is processed, with padding (if requested)
being applied. If an AEAD mode such as GCM/CCM is being used, the
authentication tag is appended in the case of encryption, or verified in
the case of decryption. The result is stored in a new buffer.
Note: if any exception is thrown, a new instance of this cipher lite object may need to be constructed before it can be used again. be reconstructed before it can be used again.
doFinal in class CipherLiteIllegalBlockSizeException - 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.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 bytesAEADBadTagException - if this cipher is decrypting in an AEAD mode (such as
GCM/CCM), and the received authentication tag does not
match the calculated valuepublic final byte[] doFinal(byte[] input)
throws IllegalBlockSizeException,
BadPaddingException
CipherLite
The bytes in the input buffer, and any input bytes that may
have been buffered during a previous update operation, are
processed, with padding (if requested) being applied. If an AEAD mode
such as GCM/CCM is being used, the authentication tag is appended in the
case of encryption, or verified in the case of decryption. The result is
stored in a new buffer.
Note: if any exception is thrown, a new instance of this cipher lite object may need to be constructed before it can be used again.
doFinal in class CipherLiteinput - the input bufferIllegalBlockSizeException - 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.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; or if this cipher is
decrypting in an AEAD mode (such as GCM/CCM), and the
received authentication tag does not match the calculated
valuepublic final byte[] doFinal(byte[] input,
int inputOffset,
int inputLen)
throws IllegalBlockSizeException,
BadPaddingException
CipherLite
The first inputLen bytes in the input buffer,
starting at inputOffset inclusive, and any input bytes that
may have been buffered during a previous update operation,
are processed, with padding (if requested) being applied. If an AEAD mode
such as GCM/CCM is being used, the authentication tag is appended in the
case of encryption, or verified in the case of decryption. The result is
stored in a new buffer.
Note: if any exception is thrown, a new instance of this cipher lite object may need to be constructed before it can be used again.
doFinal in class CipherLiteinput - the input bufferinputOffset - the offset in input where the input startsinputLen - the input lengthIllegalBlockSizeException - 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.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; or if this cipher is
decrypting in an AEAD mode (such as GCM/CCM), and the
received authentication tag does not match the calculated
valuepublic byte[] update(byte[] input,
int inputOffset,
int inputLen)
CipherLite
The first inputLen bytes in the input buffer,
starting at inputOffset inclusive, are processed, and the
result is stored in a new buffer.
If inputLen is zero, this method returns null.
update in class CipherLiteinputLen - for mark() and reset() to work correctly,
inputLen should always be in multiple of 16 bytes except for
the very last part of the plaintext.input - the input bufferinputOffset - the offset in input where the input startspublic long mark()
CipherLitereset method repositions this cipher lite at the last marked
position so that subsequent crypto operations will be logically performed
in an idempotent manner as if the cipher has been rewinded back to the
marked position.
The general contract of mark is that, if the method
markSupported returns true, the cipher lite
somehow remembers the internal state after the call to mark
and stands ready to restore to the internal state so that it would be
able to produce the same output given the same input again if and
whenever the method reset is called.
mark in class CipherLitepublic boolean markSupported()
CipherLitemark
and reset methods. Returns false by default, but subclass
may override.markSupported in class CipherLitepublic void reset()
CipherLitemark method was last called.
The general contract of reset is:
markSupported returns true,
then the cipher lite is reset to the internal state since the most recent
call to mark (or since the start of the input data, if
mark has not been called), so that subsequent callers of the
udpate or doFinal method would produce the same
output given the same input data identical to the input data after the
mark method was last called..markSupported returns false,
then the call to reset may throw an
IllegalStateException.reset in class CipherLitepublic byte[] getFinalBytes()
public byte[] getTag()
public long getOutputByteCount()
public long getCurrentCount()
public long getMarkedCount()