Interface TlsAeadCipherImpl
- Namespace
- Org.BouncyCastle.Tls.Crypto.Impl
- Assembly
- BouncyCastle.Cryptography.dll
Base interface for services supporting AEAD encryption/decryption.
public interface TlsAeadCipherImpl
Methods
DoFinal(byte[], byte[], int, int, byte[], int)
Perform the cipher encryption/decryption returning the output in output.
int DoFinal(byte[] additionalData, byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
Parameters
additionalDatabyte[]any additional data to be included in the MAC calculation.
inputbyte[]array holding input data to the cipher.
inputOffsetintoffset into input array data starts at.
inputLengthintlength of the input data in the array.
outputbyte[]array to hold the cipher output.
outputOffsetintoffset into output array to start saving output.
Returns
- int
the amount of data written to output.
Remarks
Note: we have to use DoFinal() here as it is the only way to guarantee output from the underlying cipher.
Exceptions
- IOException
in case of failure.
DoFinal(byte[], int, int, byte[], int)
Perform the cipher encryption/decryption returning the output in output.
int DoFinal(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset)
Parameters
inputbyte[]array holding input data to the cipher.
inputOffsetintoffset into input array data starts at.
inputLengthintlength of the input data in the array.
outputbyte[]array to hold the cipher output.
outputOffsetintoffset into output array to start saving output.
Returns
- int
the amount of data written to output.
Remarks
Note: we have to use DoFinal() here as it is the only way to guarantee output from the underlying cipher.
Exceptions
- IOException
in case of failure.
GetOutputSize(int)
Return the maximum size of the output for input of inputLength bytes.
int GetOutputSize(int inputLength)
Parameters
inputLengthintthe length (in bytes) of the proposed input.
Returns
- int
the maximum size of the output.
Init(byte[], int, byte[])
Initialise the parameters for the AEAD operator.
void Init(byte[] nonce, int macSize, byte[] additionalData)
Parameters
noncebyte[]the nonce.
macSizeintMAC size in bytes.
additionalDatabyte[]any additional data to be included in the MAC calculation.
Exceptions
- IOException
if the parameters are inappropriate.
Reset()
void Reset()
SetKey(byte[], int, int)
Set the key to be used by the AEAD cipher implementation supporting this service.
void SetKey(byte[] key, int keyOff, int keyLen)
Parameters
keybyte[]array holding the AEAD cipher key.
keyOffintoffset into the array the key starts at.
keyLenintlength of the key in the array.
Exceptions
SetKey(ReadOnlySpan<byte>)
void SetKey(ReadOnlySpan<byte> key)
Parameters
keyReadOnlySpan<byte>