Table of Contents

Interface IAeadCipher

Namespace
Org.BouncyCastle.Crypto.Modes
Assembly
BouncyCastle.Cryptography.dll

A cipher mode that includes authenticated encryption with a streaming mode and optional associated data.

public interface IAeadCipher

Remarks

Implementations of this interface may operate in a packet mode (where all input data is buffered and processed during the call to DoFinal, or in a streaming mode (where output data is incrementally produced with each call to ProcessByte or ProcessBytes. This is important to consider during decryption: in a streaming mode, unauthenticated plaintext data may be output prior to the call to DoFinal that results in an authentication failure. The higher level protocol utilising this cipher must ensure the plaintext data is handled appropriately until the end of data is reached and the entire ciphertext is authenticated.

Properties

AlgorithmName

The name of the algorithm this cipher implements.

string AlgorithmName { get; }

Property Value

string

Methods

DoFinal(byte[], int)

int DoFinal(byte[] outBytes, int outOff)

Parameters

outBytes byte[]
outOff int

Returns

int

DoFinal(Span<byte>)

int DoFinal(Span<byte> output)

Parameters

output Span<byte>

Returns

int

GetMac()

byte[] GetMac()

Returns

byte[]

GetOutputSize(int)

int GetOutputSize(int len)

Parameters

len int

Returns

int

GetUpdateOutputSize(int)

int GetUpdateOutputSize(int len)

Parameters

len int

Returns

int

Init(bool, ICipherParameters)

Initialise the cipher.

void Init(bool forEncryption, ICipherParameters parameters)

Parameters

forEncryption bool

Initialise for encryption if true, for decryption if false.

parameters ICipherParameters

The key or other data required by the cipher.

Remarks

Parameter can either be an AeadParameters or a ParametersWithIV object.

ProcessAadByte(byte)

Add a single byte to the associated data check.

void ProcessAadByte(byte input)

Parameters

input byte

The byte to be processed.

Remarks

If the implementation supports it, this will be an online operation and will not retain the associated data.

ProcessAadBytes(byte[], int, int)

Add a sequence of bytes to the associated data check.

void ProcessAadBytes(byte[] inBytes, int inOff, int len)

Parameters

inBytes byte[]

The input byte array.

inOff int

The offset into the input array where the data to be processed starts.

len int

The number of bytes to be processed.

Remarks

If the implementation supports it, this will be an online operation and will not retain the associated data.

ProcessAadBytes(ReadOnlySpan<byte>)

Add a span of bytes to the associated data check.

void ProcessAadBytes(ReadOnlySpan<byte> input)

Parameters

input ReadOnlySpan<byte>

the span containing the data.

Remarks

If the implementation supports it, this will be an online operation and will not retain the associated data.

ProcessByte(byte, byte[], int)

int ProcessByte(byte input, byte[] outBytes, int outOff)

Parameters

input byte
outBytes byte[]
outOff int

Returns

int

ProcessByte(byte, Span<byte>)

int ProcessByte(byte input, Span<byte> output)

Parameters

input byte
output Span<byte>

Returns

int

ProcessBytes(byte[], int, int, byte[], int)

int ProcessBytes(byte[] inBytes, int inOff, int len, byte[] outBytes, int outOff)

Parameters

inBytes byte[]
inOff int
len int
outBytes byte[]
outOff int

Returns

int

ProcessBytes(ReadOnlySpan<byte>, Span<byte>)

int ProcessBytes(ReadOnlySpan<byte> input, Span<byte> output)

Parameters

input ReadOnlySpan<byte>
output Span<byte>

Returns

int

Reset()

Reset the cipher to the same state as it was after the last init (if there was one).

void Reset()