• API Reference
Show / Hide Table of Contents
  • Cryptography
    • AesGcmSiv

Class AesGcmSiv

AES-256-GCM-SIV nonce misuse-resistant authenticated encryption mode, defined in draft-irtf-cfrg-gcmsiv-08.

Inheritance
System.Object
AesGcmSiv
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Cryptography
Assembly: Cryptography.dll
Syntax
public sealed class AesGcmSiv : IDisposable

Constructors

| Improve this Doc View Source

AesGcmSiv(Byte[])

Initializes a new instance of the AesGcmSiv class.

Declaration
public AesGcmSiv(byte[] key)
Parameters
Type Name Description
System.Byte[] key

The secret key for AES-256-GCM-SIV encryption.

Exceptions
Type Condition
System.ArgumentNullException

Thrown if the key is null.

System.PlatformNotSupportedException

Thrown if the CPU doesn't implement AES and CLMUL instruction sets.

System.Security.Cryptography.CryptographicException

Thrown if the key is not 32 bytes in length.

| Improve this Doc View Source

AesGcmSiv(ReadOnlySpan<Byte>)

Initializes a new instance of the AesGcmSiv class.

Declaration
public AesGcmSiv(ReadOnlySpan<byte> key)
Parameters
Type Name Description
System.ReadOnlySpan<System.Byte> key

The secret key for AES-256-GCM-SIV encryption.

Exceptions
Type Condition
System.PlatformNotSupportedException

Thrown if the CPU doesn't support AES and CLMUL instruction sets.

System.Security.Cryptography.CryptographicException

Thrown if the key is not 32 bytes in length.

Properties

| Improve this Doc View Source

IsSupported

Returns true if the CPU supports AES and CLMUL instruction sets, false otherwise.

Declaration
public static bool IsSupported { get; }
Property Value
Type Description
System.Boolean

Methods

| Improve this Doc View Source

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

Decrypt decrypts the ciphertext, and authenticates the decrypted plaintext and the optional associated data.

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

The 12-byte nonce that was previously used for encryption.

System.Byte[] ciphertext

The ciphertext to decrypt.

System.Byte[] tag

The 16-byte authentication tag.

System.Byte[] plaintext

The buffer for the plaintext. It must be the same length as the ciphertext.

System.Byte[] associatedData

Associated data to authenticate. Can be null.

Exceptions
Type Condition
System.ObjectDisposedException

Thrown if the current instance has already been disposed.

System.ArgumentNullException

Thrown if either nonce, plaintext, ciphertext, or tag is null.

System.ArgumentException

Thrown if any of the following conditions is satisfied:

- plaintext and ciphertext are not the same length.

- nonce is not 12 bytes in length.

- tag is not 16 bytes in length.

| Improve this Doc View Source

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

Decrypt decrypts the ciphertext, and authenticates the decrypted plaintext and the optional associated data.

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
System.ReadOnlySpan<System.Byte> nonce

The 12-byte nonce that was previously used for encryption.

System.ReadOnlySpan<System.Byte> ciphertext

The ciphertext to decrypt.

System.ReadOnlySpan<System.Byte> tag

The 16-byte authentication tag.

System.Span<System.Byte> plaintext

The buffer for the plaintext. It must be the same length as the ciphertext.

System.ReadOnlySpan<System.Byte> associatedData

Associated data to authenticate.

Exceptions
Type Condition
System.ObjectDisposedException

Thrown if the current instance has already been disposed.

System.ArgumentException

Thrown if any of the following conditions is satisfied:

- plaintext and ciphertext are not the same length.

- nonce is not 12 bytes in length.

- tag is not 16 bytes in length.

| Improve this Doc View Source

Dispose()

Disposes this object.

Declaration
public void Dispose()
| Improve this Doc View Source

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

Encrypt encrypts and authenticates the plaintext, and authenticates the optional associated data.

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

The 12-byte nonce. It is recommended to use randomnly chosen nonces.

System.Byte[] plaintext

The plaintext to encrypt.

System.Byte[] ciphertext

The buffer for the ciphertext. It must be the same length as the plaintext.

System.Byte[] tag

The 16-byte buffer for the authentication tag.

System.Byte[] associatedData

Associated data to authenticate. Can be null.

Exceptions
Type Condition
System.ObjectDisposedException

Thrown if the current instance has already been disposed.

System.ArgumentNullException

Thrown if either nonce, plaintext, ciphertext, or tag is null.

System.ArgumentException

Thrown if any of the following conditions is satisfied:

- plaintext and ciphertext are not the same length.

- nonce is not 12 bytes in length.

- tag is not 16 bytes in length.

| Improve this Doc View Source

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

Encrypt encrypts and authenticates the plaintext, and authenticates the optional associated data.

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
System.ReadOnlySpan<System.Byte> nonce

The 12-byte nonce. It is recommended to use randomnly chosen nonces.

System.ReadOnlySpan<System.Byte> plaintext

The plaintext to encrypt.

System.Span<System.Byte> ciphertext

The buffer for the ciphertext. It must be the same length as the plaintext.

System.Span<System.Byte> tag

The 16-byte buffer for the authentication tag.

System.ReadOnlySpan<System.Byte> associatedData

Associated data to authenticate.

Exceptions
Type Condition
System.ObjectDisposedException

Thrown if the current instance has already been disposed.

System.ArgumentException

Thrown if any of the following conditions is satisfied:

- plaintext and ciphertext are not the same length.

- nonce is not 12 bytes in length.

- tag is not 16 bytes in length.

Implements

System.IDisposable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX