AesCng Constructors

Definition

Initializes a new instance of the AesCng class.

Overloads

AesCng()

Initializes a new instance of the AesCng class with an ephemeral key.

AesCng(String)

Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key.

AesCng(String, CngProvider)

Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key, and the specified key storage provider (KSP).

AesCng(String, CngProvider, CngKeyOpenOptions)

Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key, the specified key storage provider (KSP) and key open options.

AesCng()

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

Initializes a new instance of the AesCng class with an ephemeral key.

public:
 AesCng();
public AesCng ();
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public AesCng ();
Public Sub New ()
Attributes

Applies to

AesCng(String)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key.

public:
 AesCng(System::String ^ keyName);
public AesCng (string keyName);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public AesCng (string keyName);
new System.Security.Cryptography.AesCng : string -> System.Security.Cryptography.AesCng
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
new System.Security.Cryptography.AesCng : string -> System.Security.Cryptography.AesCng
Public Sub New (keyName As String)

Parameters

keyName
String

The name of the key.

Attributes

Exceptions

keyName is null.

Cryptography Next Generation (CNG) is not supported on this system.

All other errors.

Remarks

This constructor uses a default CngKeyOpenOptions value of None and MicrosoftSoftwareKeyStorageProvider as the default key storage provider (KSP) to open the key.

See also

Applies to

AesCng(String, CngProvider)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key, and the specified key storage provider (KSP).

public:
 AesCng(System::String ^ keyName, System::Security::Cryptography::CngProvider ^ provider);
public AesCng (string keyName, System.Security.Cryptography.CngProvider provider);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public AesCng (string keyName, System.Security.Cryptography.CngProvider provider);
new System.Security.Cryptography.AesCng : string * System.Security.Cryptography.CngProvider -> System.Security.Cryptography.AesCng
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
new System.Security.Cryptography.AesCng : string * System.Security.Cryptography.CngProvider -> System.Security.Cryptography.AesCng
Public Sub New (keyName As String, provider As CngProvider)

Parameters

keyName
String

The name of the key.

provider
CngProvider

The KSP that contains the key.

Attributes

Exceptions

keyName is null.

-or-

provider is null.

Cryptography Next Generation (CNG) is not supported on this system.

All other errors.

Remarks

A default CngKeyOpenOptions value of None is used to open the key.

See also

Applies to

AesCng(String, CngProvider, CngKeyOpenOptions)

Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs
Source:
Cng.NotSupported.cs

Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key, the specified key storage provider (KSP) and key open options.

public:
 AesCng(System::String ^ keyName, System::Security::Cryptography::CngProvider ^ provider, System::Security::Cryptography::CngKeyOpenOptions openOptions);
public AesCng (string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions openOptions);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public AesCng (string keyName, System.Security.Cryptography.CngProvider provider, System.Security.Cryptography.CngKeyOpenOptions openOptions);
new System.Security.Cryptography.AesCng : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> System.Security.Cryptography.AesCng
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
new System.Security.Cryptography.AesCng : string * System.Security.Cryptography.CngProvider * System.Security.Cryptography.CngKeyOpenOptions -> System.Security.Cryptography.AesCng
Public Sub New (keyName As String, provider As CngProvider, openOptions As CngKeyOpenOptions)

Parameters

keyName
String

The name of the key.

provider
CngProvider

The KSP that contains the key.

openOptions
CngKeyOpenOptions

A bitwise combination of the enumeration values that specify options for opening the key, such as where the key is opened from (machine or user storage) and whether to suppress UI prompting.

Attributes

Exceptions

keyName is null.

-or-

provider is null.

Cryptography Next Generation (CNG) is not supported on this system.

All other errors.

See also

Applies to