Top Description Methods
org.bouncycastle.tls.crypto.impl

public Interface TlsAEADCipherImpl

Known Direct Implementers
org.bouncycastle.tls.crypto.impl.jcajce.JceChaCha20Poly1305, org.bouncycastle.tls.crypto.impl.jcajce.JceAEADCipherImpl
Imports
java.io.IOException

Base interface for services supporting AEAD encryption/decryption.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the amount of data written to output.
doFinal
(byte[]
any additional data to be included in the MAC calculation.
additionalData
,
byte[]
array holding input data to the cipher.
input
,
int
offset into input array data starts at.
inputOffset
,
int
length of the input data in the array.
inputLength
,
byte[]
array to hold the cipher output.
output
,
int
offset into output array to start saving output.
outputOffset
)

Perform the cipher encryption/decryption returning the output in output.

public int

Returns:

the maximum size of the output.
getOutputSize
(int
the length (in bytes) of the proposed input.
inputLength
)

Return the maximum size of the output for input of inputLength bytes.

public void
init(byte[]
the nonce.
nonce
,
int
MAC size in bytes.
macSize
)

Initialise the parameters for the AEAD operator.

public void
setKey(byte[]
array holding the AEAD cipher key.
key
,
int
offset into the array the key starts at.
keyOff
,
int
length of the key in the array.
keyLen
)

Set the key to be used by the AEAD cipher implementation supporting this service.

Method Detail

doFinalback to summary
public int doFinal(byte[] additionalData, byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws IOException

Perform the cipher encryption/decryption returning the output in output.

Note

we have to use doFinal() here as it is the only way to guarantee output from the underlying cipher.

Parameters
additionalData:byte[]

any additional data to be included in the MAC calculation.

input:byte[]

array holding input data to the cipher.

inputOffset:int

offset into input array data starts at.

inputLength:int

length of the input data in the array.

output:byte[]

array to hold the cipher output.

outputOffset:int

offset into output array to start saving output.

Returns:int

the amount of data written to output.

Exceptions
IOException:
in case of failure.
getOutputSizeback to summary
public int getOutputSize(int inputLength)

Return the maximum size of the output for input of inputLength bytes.

Parameters
inputLength:int

the length (in bytes) of the proposed input.

Returns:int

the maximum size of the output.

initback to summary
public void init(byte[] nonce, int macSize) throws IOException

Initialise the parameters for the AEAD operator.

Parameters
nonce:byte[]

the nonce.

macSize:int

MAC size in bytes.

Exceptions
IOException:
if the parameters are inappropriate.
setKeyback to summary
public void setKey(byte[] key, int keyOff, int keyLen) throws IOException

Set the key to be used by the AEAD cipher implementation supporting this service.

Parameters
key:byte[]

array holding the AEAD cipher key.

keyOff:int

offset into the array the key starts at.

keyLen:int

length of the key in the array.