public interface Cipher extends CipherInformation
Modifier and Type | Interface and Description |
---|---|
static class |
Cipher.Mode |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkSupported(String xform,
int keyLength) |
void |
init(Cipher.Mode mode,
byte[] key,
byte[] iv)
Initialize the cipher for encryption or decryption with the given key and initialization vector
|
default void |
update(byte[] input)
Performs in-place encryption or decryption on the given data.
|
void |
update(byte[] input,
int inputOffset,
int inputLen)
Performs in-place encryption or decryption on the given data.
|
default void |
updateAAD(byte[] data)
Adds the provided input data as additional authenticated data during encryption or decryption.
|
void |
updateAAD(byte[] data,
int offset,
int length)
Adds the provided input data as additional authenticated data during encryption or decryption.
|
default void |
updateWithAAD(byte[] input,
int offset,
int aadLen,
int inputLen)
Performs in-place authenticated encryption or decryption with additional data (AEAD).
|
getAuthenticationTagSize, getCipherBlockSize, getIVSize, getKdfSize, getTransformation
getAlgorithm
getKeySize
void init(Cipher.Mode mode, byte[] key, byte[] iv) throws Exception
mode
- Encrypt/Decrypt initializationkey
- Key bytesiv
- Initialization vector bytesException
- If failed to initializedefault void update(byte[] input) throws Exception
input
- The input/output bytesException
- If failed to executeupdate(byte[], int, int)
void update(byte[] input, int inputOffset, int inputLen) throws Exception
input
- The input/output bytesinputOffset
- The offset of the data in the data bufferinputLen
- The number of bytes to update - starting at the given offsetException
- If failed to executedefault void updateAAD(byte[] data) throws Exception
data
- The data to authenticateException
- If failed to executevoid updateAAD(byte[] data, int offset, int length) throws Exception
data
- The additional data to authenticateoffset
- The offset of the additional data in the bufferlength
- The number of bytes in the buffer to use for authenticationException
- If failed to executedefault void updateWithAAD(byte[] input, int offset, int aadLen, int inputLen) throws Exception
aadLen
parameter are authenticated but not encrypted/decrypted, while payload data
indicated by the inputLen
parameter are authenticated and encrypted/decrypted.input
- The input/output bytesoffset
- The offset of the data in the input bufferaadLen
- The number of bytes to use as additional authenticated data - starting at offsetinputLen
- The number of bytes to update - starting at offset + aadLenException
- If failed to executestatic boolean checkSupported(String xform, int keyLength)
xform
- The full cipher transformation - e.g., AES/CBC/NoPadding - never null
/emptykeyLength
- The required key length in bits - always positivetrue
if the cipher transformation and required key length are supportedCipher.getMaxAllowedKeyLength(String)
Copyright © 2008–2024 The Apache Software Foundation. All rights reserved.