AesCng 构造函数

定义

初始化 AesCng 类的新实例。Initializes a new instance of the AesCng class.

重载

AesCng()

使用临时密钥初始化 AesCng 类的新实例。Initializes a new instance of the AesCng class with an ephemeral key.

AesCng(String)

使用指定密钥名称初始化 AesCng 类的新实例,该密钥名称表示现有的保留的 AES 密钥。Initializes a new instance of the AesCng class with the specified key name, which represents an existing persisted AES key.

AesCng(String, CngProvider)

使用指定的密钥名称和密钥存储提供者 (KSP) 初始化 AesCng 类的新实例,其中指定的密钥名称表示现有的保留的 AES 密钥。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)

使用指定的密钥名称、密钥存储提供者 (KSP) 和密钥打开选项初始化 AesCng 类的新实例,其中指定的密钥名称表示现有的保留的 AES 密钥。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()

使用临时密钥初始化 AesCng 类的新实例。Initializes a new instance of the AesCng class with an ephemeral key.

public:
 AesCng();
public AesCng ();
Public Sub New ()

适用于

AesCng(String)

使用指定密钥名称初始化 AesCng 类的新实例,该密钥名称表示现有的保留的 AES 密钥。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);
new System.Security.Cryptography.AesCng : string -> System.Security.Cryptography.AesCng
Public Sub New (keyName As String)

参数

keyName
String

键的名称。The name of the key.

例外

keyNamenullkeyName is null.

此系统上不支持下一代加密技术 (CNG)。Cryptography Next Generation (CNG) is not supported on this system.

所有其他错误。All other errors.

注解

此构造函数使用默认 CngKeyOpenOptionsNoneMicrosoftSoftwareKeyStorageProvider 作为默认的密钥存储提供程序 (KSP) 打开密钥。This constructor uses a default CngKeyOpenOptions value of None and MicrosoftSoftwareKeyStorageProvider as the default key storage provider (KSP) to open the key.

另请参阅

适用于

AesCng(String, CngProvider)

使用指定的密钥名称和密钥存储提供者 (KSP) 初始化 AesCng 类的新实例,其中指定的密钥名称表示现有的保留的 AES 密钥。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);
new System.Security.Cryptography.AesCng : string * System.Security.Cryptography.CngProvider -> System.Security.Cryptography.AesCng
Public Sub New (keyName As String, provider As CngProvider)

参数

keyName
String

键的名称。The name of the key.

provider
CngProvider

包含密钥的 KSP。The KSP that contains the key.

例外

keyNamenullkeyName is null.

-or- providernullprovider is null.

此系统上不支持下一代加密技术 (CNG)。Cryptography Next Generation (CNG) is not supported on this system.

所有其他错误。All other errors.

注解

的默认 CngKeyOpenOptionsNone 用于打开该密钥。A default CngKeyOpenOptions value of None is used to open the key.

另请参阅

适用于

AesCng(String, CngProvider, CngKeyOpenOptions)

使用指定的密钥名称、密钥存储提供者 (KSP) 和密钥打开选项初始化 AesCng 类的新实例,其中指定的密钥名称表示现有的保留的 AES 密钥。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);
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)

参数

keyName
String

键的名称。The name of the key.

provider
CngProvider

包含密钥的 KSP。The KSP that contains the key.

openOptions
CngKeyOpenOptions

枚举值的一个按位组合,这些值指定打开密钥的选项,例如打开密钥的位置(计算机或用户存储)以及是否取消 UI 提示。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.

例外

keyNamenullkeyName is null.

-or- providernullprovider is null.

此系统上不支持下一代加密技术 (CNG)。Cryptography Next Generation (CNG) is not supported on this system.

所有其他错误。All other errors.

另请参阅

适用于