<PackageReference Include="BouncyCastle.Cryptography" Version="2.7.0" />

Org.BouncyCastle.Crypto.Modes.GcmBlockCipher

Implements the Galois/Counter mode (GCM) detailed in NIST Special Publication 800-38D.
public string AlgorithmName { get; }

The name of the algorithm this cipher implements (e.g., "AES/GCM").

Return the underlying block cipher being wrapped.

Base constructor.

public int DoFinal(byte[] output, int outOff)

Finish the operation, generating or verifying the Message Authentication Code (MAC).

public int GetBlockSize()

Return the block size for GCM (fixed at 16 bytes).

public byte[] GetMac()

Return the Message Authentication Code (MAC) generated or verified by the cipher.

public int GetOutputSize(int len)

Return the size of the output buffer required for an input of len bytes.

public int GetUpdateOutputSize(int len)

Return the size of the output buffer required for a ProcessBytes call with len bytes.

public void Init(bool forEncryption, ICipherParameters parameters)

Initialise the GCM cipher.

public void ProcessAadByte(byte input)

Process a single byte of Additional Authenticated Data (AAD).

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

Process a sequence of bytes of Additional Authenticated Data (AAD).

public int ProcessByte(byte input, byte[] output, int outOff)

Process a single byte of data.

public int ProcessBytes(byte[] input, int inOff, int len, byte[] output, int outOff)

Process a sequence of bytes from the input buffer.

public void Reset()

Reset the cipher to its initial state (ready for a new message with the same key but DIFFERENT nonce).