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
Methods
DoFinal(byte[], int)
int DoFinal(byte[] outBytes, int outOff)
Parameters
Returns
DoFinal(Span<byte>)
int DoFinal(Span<byte> output)
Parameters
Returns
GetMac()
byte[] GetMac()
Returns
- byte[]
GetOutputSize(int)
int GetOutputSize(int len)
Parameters
lenint
Returns
GetUpdateOutputSize(int)
int GetUpdateOutputSize(int len)
Parameters
lenint
Returns
Init(bool, ICipherParameters)
Initialise the cipher.
void Init(bool forEncryption, ICipherParameters parameters)
Parameters
forEncryptionboolInitialise for encryption if true, for decryption if false.
parametersICipherParametersThe 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
inputbyteThe 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
inBytesbyte[]The input byte array.
inOffintThe offset into the input array where the data to be processed starts.
lenintThe 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
inputReadOnlySpan<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
Returns
ProcessByte(byte, Span<byte>)
int ProcessByte(byte input, Span<byte> output)
Parameters
Returns
ProcessBytes(byte[], int, int, byte[], int)
int ProcessBytes(byte[] inBytes, int inOff, int len, byte[] outBytes, int outOff)
Parameters
Returns
ProcessBytes(ReadOnlySpan<byte>, Span<byte>)
int ProcessBytes(ReadOnlySpan<byte> input, Span<byte> output)
Parameters
inputReadOnlySpan<byte>outputSpan<byte>
Returns
Reset()
Reset the cipher to the same state as it was after the last init (if there was one).
void Reset()