Show / Hide Table of Contents

Class Aead

Represents the abstract class from which all implementations of Authenticated Encryption with Associated Data (AEAD) must derive.

Inheritance
Object
Aead
Chacha20Poly1305
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: AtlasRhythm.Cryptography.Aeads
Assembly: AtlasRhythm.Cryptography.dll
Syntax
public abstract class Aead

Properties

| Improve this Doc View Source

Key

Declaration
protected abstract byte[] Key { get; }
Property Value
Type Description
Byte[]
| Improve this Doc View Source

KeyByteSizes

Gets the key sizes, in bytes, supported by this instance.

Declaration
public abstract KeySizes KeyByteSizes { get; }
Property Value
Type Description
KeySizes
| Improve this Doc View Source

NonceByteSizes

Gets the nonce sizes, in bytes, supported by this instance.

Declaration
public abstract KeySizes NonceByteSizes { get; }
Property Value
Type Description
KeySizes
| Improve this Doc View Source

TagByteSizes

Gets the tag sizes, in bytes, supported by this instance.

Declaration
public abstract KeySizes TagByteSizes { get; }
Property Value
Type Description
KeySizes

Methods

| Improve this Doc View Source

Decrypt(Byte[], Byte[], Byte[])

Decrypts the ciphertext and returns the plaintext in a new buffer if the authentication tag can be validated.

Declaration
public byte[] Decrypt(byte[] nonce, byte[] ciphertextAndTag, byte[] associatedData = null)
Parameters
Type Name Description
Byte[] nonce

The nonce associated with this message, which must match the value provided during encryption.

Byte[] ciphertextAndTag

The byte array containing the concatenated ciphertext and authentication tag.

Byte[] associatedData

Extra data associated with this message, which must match the value provided during encryption.

Returns
Type Description
Byte[]

The byte array containing the plaintext.

Exceptions
Type Condition
ArgumentNullException

The nonce or ciphertextAndTag parameter is null.

ArgumentException

The nonce parameter length is not permitted by NonceByteSizes.

ArgumentException

The ciphertextAndTag parameter length is shorter than the tag length.

CryptographicException

The tag value could not be verified.

| Improve this Doc View Source

Decrypt(Byte[], Byte[], Byte[], Byte[], Byte[])

Decrypts the ciphertext into the provided destination buffer if the authentication tag can be validated.

Declaration
public void Decrypt(byte[] nonce, byte[] ciphertext, byte[] tag, byte[] plaintext, byte[] associatedData = null)
Parameters
Type Name Description
Byte[] nonce

The nonce associated with this message, which must match the value provided during encryption.

Byte[] ciphertext

The encrypted content to decrypt.

Byte[] tag

The authentication tag produced for this message during encryption.

Byte[] plaintext

The byte array to receive the decrypted contents.

Byte[] associatedData

Extra data associated with this message, which must match the value provided during encryption.

Exceptions
Type Condition
ArgumentNullException

The nonce, ciphertext, tag, or plaintext parameter is null.

ArgumentException

The nonce parameter length is not permitted by NonceByteSizes.

ArgumentException

The tag parameter length is not permitted by TagByteSizes.

ArgumentException

The ciphertext parameter and the plaintext do not have the same length.

CryptographicException

The tag value could not be verified.

| Improve this Doc View Source

Decrypt(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Decrypts the ciphertext and returns the plaintext in a new buffer if the authentication tag can be validated.

Declaration
public byte[] Decrypt(ReadOnlySpan<byte> nonce, ReadOnlySpan<byte> ciphertextAndTag, ReadOnlySpan<byte> associatedData = default(ReadOnlySpan<byte>))
Parameters
Type Name Description
ReadOnlySpan<Byte> nonce

The nonce associated with this message, which must match the value provided during encryption.

ReadOnlySpan<Byte> ciphertextAndTag

The byte span containing the concatenated ciphertext and authentication tag.

ReadOnlySpan<Byte> associatedData

Extra data associated with this message, which must match the value provided during encryption.

Returns
Type Description
Byte[]

The byte array containing the plaintext.

Exceptions
Type Condition
ArgumentException

The nonce parameter length is not permitted by NonceByteSizes.

ArgumentException

The ciphertextAndTag parameter length is shorter than the tag length.

CryptographicException

The tag value could not be verified.

| Improve this Doc View Source

Decrypt(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, ReadOnlySpan<Byte>)

Decrypts the ciphertext into the provided destination buffer if the authentication tag can be validated.

Declaration
public void Decrypt(ReadOnlySpan<byte> nonce, ReadOnlySpan<byte> ciphertext, ReadOnlySpan<byte> tag, Span<byte> plaintext, ReadOnlySpan<byte> associatedData = default(ReadOnlySpan<byte>))
Parameters
Type Name Description
ReadOnlySpan<Byte> nonce

The nonce associated with this message, which must match the value provided during encryption.

ReadOnlySpan<Byte> ciphertext

The encrypted content to decrypt.

ReadOnlySpan<Byte> tag

The authentication tag produced for this message during encryption.

Span<Byte> plaintext

The byte span to receive the decrypted contents.

ReadOnlySpan<Byte> associatedData

Extra data associated with this message, which must match the value provided during encryption.

Exceptions
Type Condition
ArgumentException

The nonce parameter length is not permitted by NonceByteSizes.

ArgumentException

The tag parameter length is not permitted by TagByteSizes.

ArgumentException

The ciphertext parameter and the plaintext do not have the same length.

CryptographicException

The tag value could not be verified.

| Improve this Doc View Source

DecryptCore(Byte*, Byte*, Byte*, Int32, Byte*, Byte*, Int32, Byte*)

Declaration
protected abstract bool DecryptCore(byte *key, byte *nonce, byte *ciphertext, int size, byte *tag, byte *associatedData, int associatedDataSize, byte *plaintext)
Parameters
Type Name Description
Byte* key
Byte* nonce
Byte* ciphertext
Int32 size
Byte* tag
Byte* associatedData
Int32 associatedDataSize
Byte* plaintext
Returns
Type Description
Boolean
| Improve this Doc View Source

Encrypt(Byte[], Byte[], Byte[])

Encrypts the plaintext and returns the concatenated ciphertext and authentication tag in a new buffer.

Declaration
public byte[] Encrypt(byte[] nonce, byte[] plaintext, byte[] associatedData = null)
Parameters
Type Name Description
Byte[] nonce

The nonce associated with this message, which should be a unique value for every operation with the same key.

Byte[] plaintext

The content to encrypt.

Byte[] associatedData

Extra data associated with this message, which must also be provided during decryption.

Returns
Type Description
Byte[]

The byte array containing the concatenated ciphertext and authentication tag.

Exceptions
Type Condition
ArgumentNullException

The nonce or plaintext parameter is null.

ArgumentException

The nonce parameter length is not permitted by NonceByteSizes.

| Improve this Doc View Source

Encrypt(Byte[], Byte[], Byte[], Byte[], Byte[])

Encrypts the plaintext into the ciphertext destination buffer and generates the authentication tag into a separate buffer.

Declaration
public void Encrypt(byte[] nonce, byte[] plaintext, byte[] ciphertext, byte[] tag, byte[] associatedData = null)
Parameters
Type Name Description
Byte[] nonce

The nonce associated with this message, which should be a unique value for every operation with the same key.

Byte[] plaintext

The content to encrypt.

Byte[] ciphertext

The byte array to receive the encrypted contents.

Byte[] tag

The byte array to receive the generated authentication tag.

Byte[] associatedData

Extra data associated with this message, which must also be provided during decryption.

Exceptions
Type Condition
ArgumentNullException

The nonce, plaintext, ciphtertext, or tag parameter is null.

ArgumentException

The nonce parameter length is not permitted by NonceByteSizes.

ArgumentException

The tag parameter length is not permitted by TagByteSizes.

ArgumentException

The plaintext parameter and the ciphertext do not have the same length.

| Improve this Doc View Source

Encrypt(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Encrypts the plaintext and returns the concatenated ciphertext and authentication tag in a new buffer.

Declaration
public byte[] Encrypt(ReadOnlySpan<byte> nonce, ReadOnlySpan<byte> plaintext, ReadOnlySpan<byte> associatedData = default(ReadOnlySpan<byte>))
Parameters
Type Name Description
ReadOnlySpan<Byte> nonce

The nonce associated with this message, which should be a unique value for every operation with the same key.

ReadOnlySpan<Byte> plaintext

The content to encrypt.

ReadOnlySpan<Byte> associatedData

Extra data associated with this message, which must also be provided during decryption.

Returns
Type Description
Byte[]

The byte array containing the concatenated ciphertext and authentication tag.

Exceptions
Type Condition
ArgumentException

The nonce parameter length is not permitted by NonceByteSizes.

| Improve this Doc View Source

Encrypt(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Span<Byte>, Span<Byte>, ReadOnlySpan<Byte>)

Encrypts the plaintext into the ciphertext destination buffer and generates the authentication tag into a separate buffer.

Declaration
public void Encrypt(ReadOnlySpan<byte> nonce, ReadOnlySpan<byte> plaintext, Span<byte> ciphertext, Span<byte> tag, ReadOnlySpan<byte> associatedData = default(ReadOnlySpan<byte>))
Parameters
Type Name Description
ReadOnlySpan<Byte> nonce

The nonce associated with this message, which should be a unique value for every operation with the same key.

ReadOnlySpan<Byte> plaintext

The content to encrypt.

Span<Byte> ciphertext

The byte span to receive the encrypted contents.

Span<Byte> tag

The byte span to receive the generated authentication tag.

ReadOnlySpan<Byte> associatedData

Extra data associated with this message, which must also be provided during decryption.

Exceptions
Type Condition
ArgumentException

The nonce parameter length is not permitted by NonceByteSizes.

ArgumentException

The tag parameter length is not permitted by TagByteSizes.

ArgumentException

The plaintext parameter and the ciphertext do not have the same length.

| Improve this Doc View Source

EncryptCore(Byte*, Byte*, Byte*, Int32, Byte*, Int32, Byte*, Byte*)

Declaration
protected abstract void EncryptCore(byte *key, byte *nonce, byte *plaintext, int size, byte *associatedData, int associatedDataSize, byte *ciphertext, byte *tag)
Parameters
Type Name Description
Byte* key
Byte* nonce
Byte* plaintext
Int32 size
Byte* associatedData
Int32 associatedDataSize
Byte* ciphertext
Byte* tag
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX