CngKey.Create 方法

定义

创建一个 CngKey 表示新键的对象。

重载

名称 说明
Create(CngAlgorithm)

CngKey创建可与指定算法一起使用的对象。

Create(CngAlgorithm, String)

创建提供指定算法的命名 CngKey 对象。

Create(CngAlgorithm, String, CngKeyCreationParameters)

使用提供的密钥创建参数创建提供指定算法的命名 CngKey 对象。

Create(CngAlgorithm)

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

CngKey创建可与指定算法一起使用的对象。

public:
 static System::Security::Cryptography::CngKey ^ Create(System::Security::Cryptography::CngAlgorithm ^ algorithm);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Security.Cryptography.CngKey Create(System.Security.Cryptography.CngAlgorithm algorithm);
public static System.Security.Cryptography.CngKey Create(System.Security.Cryptography.CngAlgorithm algorithm);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Create : System.Security.Cryptography.CngAlgorithm -> System.Security.Cryptography.CngKey
static member Create : System.Security.Cryptography.CngAlgorithm -> System.Security.Cryptography.CngKey
Public Shared Function Create (algorithm As CngAlgorithm) As CngKey

参数

algorithm
CngAlgorithm

密钥将用于的算法。

返回

临时键。

属性

例外

algorithmnull

此系统上不支持下一代加密(CNG)。

所有其他错误。

注解

此重载创建一个没有名称的键,这意味着密钥是临时的(即,不会持久保存)。 它还创建一个默认 CngKeyCreationParameters 对象,该对象指定密钥的默认 CngProvider 参数和其他高级参数。

适用于

Create(CngAlgorithm, String)

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

创建提供指定算法的命名 CngKey 对象。

public:
 static System::Security::Cryptography::CngKey ^ Create(System::Security::Cryptography::CngAlgorithm ^ algorithm, System::String ^ keyName);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Security.Cryptography.CngKey Create(System.Security.Cryptography.CngAlgorithm algorithm, string? keyName);
public static System.Security.Cryptography.CngKey Create(System.Security.Cryptography.CngAlgorithm algorithm, string? keyName);
public static System.Security.Cryptography.CngKey Create(System.Security.Cryptography.CngAlgorithm algorithm, string keyName);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Create : System.Security.Cryptography.CngAlgorithm * string -> System.Security.Cryptography.CngKey
static member Create : System.Security.Cryptography.CngAlgorithm * string -> System.Security.Cryptography.CngKey
Public Shared Function Create (algorithm As CngAlgorithm, keyName As String) As CngKey

参数

algorithm
CngAlgorithm

密钥将用于的算法。

keyName
String

键名称。 如果未提供名称,则不会保留密钥。

返回

提供指定算法的持久或临时密钥。

属性

例外

algorithmnull

此系统上不支持下一代加密(CNG)。

所有其他错误。

注解

如果 keyName 已提供,则此重载将创建持久密钥。 如果未 keyName 提供,则密钥将为临时密钥。 此重载还会创建一个默认 CngKeyCreationParameters 对象,该对象指定键的默认 CngProvider 参数和其他高级参数。

适用于

Create(CngAlgorithm, String, CngKeyCreationParameters)

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

使用提供的密钥创建参数创建提供指定算法的命名 CngKey 对象。

public:
 static System::Security::Cryptography::CngKey ^ Create(System::Security::Cryptography::CngAlgorithm ^ algorithm, System::String ^ keyName, System::Security::Cryptography::CngKeyCreationParameters ^ creationParameters);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Security.Cryptography.CngKey Create(System.Security.Cryptography.CngAlgorithm algorithm, string? keyName, System.Security.Cryptography.CngKeyCreationParameters? creationParameters);
public static System.Security.Cryptography.CngKey Create(System.Security.Cryptography.CngAlgorithm algorithm, string? keyName, System.Security.Cryptography.CngKeyCreationParameters? creationParameters);
public static System.Security.Cryptography.CngKey Create(System.Security.Cryptography.CngAlgorithm algorithm, string keyName, System.Security.Cryptography.CngKeyCreationParameters creationParameters);
[System.Security.SecurityCritical]
public static System.Security.Cryptography.CngKey Create(System.Security.Cryptography.CngAlgorithm algorithm, string keyName, System.Security.Cryptography.CngKeyCreationParameters creationParameters);
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Create : System.Security.Cryptography.CngAlgorithm * string * System.Security.Cryptography.CngKeyCreationParameters -> System.Security.Cryptography.CngKey
static member Create : System.Security.Cryptography.CngAlgorithm * string * System.Security.Cryptography.CngKeyCreationParameters -> System.Security.Cryptography.CngKey
[<System.Security.SecurityCritical>]
static member Create : System.Security.Cryptography.CngAlgorithm * string * System.Security.Cryptography.CngKeyCreationParameters -> System.Security.Cryptography.CngKey
Public Shared Function Create (algorithm As CngAlgorithm, keyName As String, creationParameters As CngKeyCreationParameters) As CngKey

参数

algorithm
CngAlgorithm

密钥将用于的算法。

keyName
String

键名称。 如果未提供名称,则不会保留密钥。

creationParameters
CngKeyCreationParameters

一个对象,指定方法的高级参数,包括 CngProvider.

返回

提供指定算法的持久或临时密钥。

属性

例外

algorithmnull

此系统上不支持下一代加密(CNG)。

所有其他错误。

注解

如果 keyName 已提供,则此重载将创建持久密钥。 如果未 keyName 提供,则密钥将为临时密钥。

适用于