Bewerken

Delen via


AesGcm Constructors

Definition

Overloads

AesGcm(Byte[])
Obsolete.

Initializes a new instance of the AesGcm class with a provided key.

AesGcm(ReadOnlySpan<Byte>)
Obsolete.

Initializes a new instance of the AesGcm class with a provided key.

AesGcm(Byte[], Int32)

Initializes a new instance of the AesGcm class with a provided key and required tag size.

AesGcm(ReadOnlySpan<Byte>, Int32)

Initializes a new instance of the AesGcm class with a provided key and required tag size.

AesGcm(Byte[])

Source:
AesGcm.cs
Source:
AesGcm.cs
Source:
AesGcm.cs

Caution

AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.

Initializes a new instance of the AesGcm class with a provided key.

public:
 AesGcm(cli::array <System::Byte> ^ key);
public AesGcm (byte[] key);
[System.Obsolete("AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.", DiagnosticId="SYSLIB0053", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public AesGcm (byte[] key);
new System.Security.Cryptography.AesGcm : byte[] -> System.Security.Cryptography.AesGcm
[<System.Obsolete("AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.", DiagnosticId="SYSLIB0053", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.Cryptography.AesGcm : byte[] -> System.Security.Cryptography.AesGcm
Public Sub New (key As Byte())

Parameters

key
Byte[]

The secret key to use for this instance.

Attributes

Exceptions

The key parameter is null.

The key parameter length is other than 16, 24, or 32 bytes (128, 192, or 256 bits).

Applies to

AesGcm(ReadOnlySpan<Byte>)

Source:
AesGcm.cs
Source:
AesGcm.cs
Source:
AesGcm.cs

Caution

AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.

Initializes a new instance of the AesGcm class with a provided key.

public:
 AesGcm(ReadOnlySpan<System::Byte> key);
public AesGcm (ReadOnlySpan<byte> key);
[System.Obsolete("AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.", DiagnosticId="SYSLIB0053", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public AesGcm (ReadOnlySpan<byte> key);
new System.Security.Cryptography.AesGcm : ReadOnlySpan<byte> -> System.Security.Cryptography.AesGcm
[<System.Obsolete("AesGcm should indicate the required tag size for encryption and decryption. Use a constructor that accepts the tag size.", DiagnosticId="SYSLIB0053", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
new System.Security.Cryptography.AesGcm : ReadOnlySpan<byte> -> System.Security.Cryptography.AesGcm
Public Sub New (key As ReadOnlySpan(Of Byte))

Parameters

key
ReadOnlySpan<Byte>

The secret key to use for this instance.

Attributes

Exceptions

The key parameter length is other than 16, 24, or 32 bytes (128, 192, or 256 bits).

Applies to

AesGcm(Byte[], Int32)

Source:
AesGcm.cs
Source:
AesGcm.cs

Initializes a new instance of the AesGcm class with a provided key and required tag size.

public:
 AesGcm(cli::array <System::Byte> ^ key, int tagSizeInBytes);
public AesGcm (byte[] key, int tagSizeInBytes);
new System.Security.Cryptography.AesGcm : byte[] * int -> System.Security.Cryptography.AesGcm
Public Sub New (key As Byte(), tagSizeInBytes As Integer)

Parameters

key
Byte[]

The secret key to use for this instance.

tagSizeInBytes
Int32

The size of the tag, in bytes, that encryption and decryption must use.

Exceptions

The key parameter is null.

The key parameter length is other than 16, 24, or 32 bytes (128, 192, or 256 bits).

The tagSizeInBytes parameter is an unsupported tag size indicated by TagByteSizes.

The current platform does not support AES-GCM.

Remarks

The tagSizeInBytes parameter is used to indicate that the tag parameter in Encrypt or Decrypt must be exactly this size. Indicating the required tag size prevents issues where callers of Decrypt may supply a tag as input and that input is truncated to an unexpected size.

Applies to

AesGcm(ReadOnlySpan<Byte>, Int32)

Source:
AesGcm.cs
Source:
AesGcm.cs

Initializes a new instance of the AesGcm class with a provided key and required tag size.

public:
 AesGcm(ReadOnlySpan<System::Byte> key, int tagSizeInBytes);
public AesGcm (ReadOnlySpan<byte> key, int tagSizeInBytes);
new System.Security.Cryptography.AesGcm : ReadOnlySpan<byte> * int -> System.Security.Cryptography.AesGcm
Public Sub New (key As ReadOnlySpan(Of Byte), tagSizeInBytes As Integer)

Parameters

key
ReadOnlySpan<Byte>

The secret key to use for this instance.

tagSizeInBytes
Int32

The size of the tag, in bytes, that encryption and decryption must use.

Exceptions

The key parameter length is other than 16, 24, or 32 bytes (128, 192, or 256 bits).

The tagSizeInBytes parameter is an unsupported tag size indicated by TagByteSizes.

The current platform does not support AES-GCM.

Remarks

The tagSizeInBytes parameter is used to indicate that the tag parameter in Encrypt or Decrypt must be exactly this size. Indicating the required tag size prevents issues where callers of Decrypt may supply a tag as input and that input is truncated to an unexpected size.

Applies to