public class JceAEADCipherImpl extends java.lang.Object implements TlsAEADCipherImpl
| Constructor and Description |
|---|
JceAEADCipherImpl(org.bouncycastle.jcajce.util.JcaJceHelper helper,
java.lang.String cipherName,
java.lang.String algorithm,
int keySize,
boolean isEncrypting) |
| Modifier and Type | Method and Description |
|---|---|
int |
doFinal(byte[] additionalData,
byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
Perform the cipher encryption/decryption returning the output in output.
|
int |
getOutputSize(int inputLength)
Return the maximum size of the output for input of inputLength bytes.
|
void |
init(byte[] nonce,
int macSize)
Initialise the parameters for the AEAD operator.
|
void |
setKey(byte[] key,
int keyOff,
int keyLen)
Set the key to be used by the AEAD cipher implementation supporting this service.
|
public JceAEADCipherImpl(org.bouncycastle.jcajce.util.JcaJceHelper helper,
java.lang.String cipherName,
java.lang.String algorithm,
int keySize,
boolean isEncrypting)
throws java.security.GeneralSecurityException
java.security.GeneralSecurityExceptionpublic void setKey(byte[] key,
int keyOff,
int keyLen)
TlsAEADCipherImplsetKey in interface TlsAEADCipherImplkey - array holding the AEAD cipher key.keyOff - offset into the array the key starts at.keyLen - length of the key in the array.public void init(byte[] nonce,
int macSize)
TlsAEADCipherImplinit in interface TlsAEADCipherImplnonce - the nonce.macSize - MAC size in bytes.public int getOutputSize(int inputLength)
TlsAEADCipherImplgetOutputSize in interface TlsAEADCipherImplinputLength - the length (in bytes) of the proposed input.public int doFinal(byte[] additionalData,
byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
throws java.io.IOException
TlsAEADCipherImplNote: we have to use doFinal() here as it is the only way to guarantee output from the underlying cipher.
doFinal in interface TlsAEADCipherImpladditionalData - any additional data to be included in the MAC calculation.input - array holding input data to the cipher.inputOffset - offset into input array data starts at.inputLength - length of the input data in the array.output - array to hold the cipher output.outputOffset - offset into output array to start saving output.java.io.IOException - in case of failure.