confluent-kafka-dotnet
Show / Hide Table of Contents

Class Aead

The Aead class provides authenticated encryption with associated data. This class provides a high-level interface to Miscreant's misuse-resistant encryption.

Inheritance
object
Aead
Implements
IDisposable
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Confluent.SchemaRegistry.Encryption.Vendored.Miscreant
Assembly: Confluent.SchemaRegistry.Encryption.dll
Syntax
public sealed class Aead : IDisposable

Methods

CreateAesCmacSiv(byte[])

Initializes a new AEAD instance using the AES-CMAC-SIV algorithm.

Declaration
public static Aead CreateAesCmacSiv(byte[] key)
Parameters
TypeNameDescription
byte[]key

The secret key for AES-CMAC-SIV encryption.

Returns
TypeDescription
Aead

An AEAD instance.

CreateAesPmacSiv(byte[])

Initializes a new AEAD instance using the AES-PMAC-SIV algorithm.

Declaration
public static Aead CreateAesPmacSiv(byte[] key)
Parameters
TypeNameDescription
byte[]key

The secret key for AES-PMAC-SIV encryption.

Returns
TypeDescription
Aead

An AEAD instance.

Dispose()

Disposes this object.

Declaration
public void Dispose()

GenerateKey256()

Generates a random 32-byte encryption key.

Declaration
public static byte[] GenerateKey256()
Returns
TypeDescription
byte[]

Generated key.

GenerateKey512()

Generates a random 64-byte encryption key.

Declaration
public static byte[] GenerateKey512()
Returns
TypeDescription
byte[]

Generated key.

GenerateNonce(int)

Generates a random nonce.

Declaration
public static byte[] GenerateNonce(int size)
Parameters
TypeNameDescription
intsize

Nonce size in bytes.

Returns
TypeDescription
byte[]

Generated nonce.

Open(byte[], byte[], byte[])

Open decrypts ciphertext, authenticates the decrypted plaintext and the associated data and, if successful, returns the result. In case of failed decryption, this method throws CryptographicException.

Declaration
public byte[] Open(byte[] ciphertext, byte[] nonce = null, byte[] data = null)
Parameters
TypeNameDescription
byte[]ciphertext

The ciphertext to decrypt.

byte[]nonce

The nonce for encryption.

byte[]data

Associated data to authenticate.

Returns
TypeDescription
byte[]

The decrypted plaintext.

Exceptions
TypeCondition
CryptographicException

Thrown when the ciphertext is invalid.

Seal(byte[], byte[], byte[])

Seal encrypts and authenticates plaintext, authenticates the associated data, and returns the result.

Declaration
public byte[] Seal(byte[] plaintext, byte[] nonce = null, byte[] data = null)
Parameters
TypeNameDescription
byte[]plaintext

The plaintext to encrypt.

byte[]nonce

The nonce for encryption.

byte[]data

Associated data to authenticate.

Returns
TypeDescription
byte[]

Concatenation of the authentication tag and the encrypted data.

Implements

IDisposable
In this article