CngKey.Create 方法

定義

建立 CngKey 物件,代表新的金鑰。

多載

Create(CngAlgorithm)

建立 CngKey 物件,可搭配指定的演算法使用。

Create(CngAlgorithm, String)

建立具名的 CngKey 物件,提供指定的演算法。

Create(CngAlgorithm, String, CngKeyCreationParameters)

建立具名的 CngKey 物件,使用提供的金鑰建立參數提供指定的演算法。

Create(CngAlgorithm)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs

建立 CngKey 物件,可搭配指定的演算法使用。

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")]
public static System.Security.Cryptography.CngKey Create (System.Security.Cryptography.CngAlgorithm algorithm);
static member Create : System.Security.Cryptography.CngAlgorithm -> System.Security.Cryptography.CngKey
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
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)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs

建立具名的 CngKey 物件,提供指定的演算法。

public:
 static System::Security::Cryptography::CngKey ^ Create(System::Security::Cryptography::CngAlgorithm ^ algorithm, System::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")]
public static System.Security.Cryptography.CngKey Create (System.Security.Cryptography.CngAlgorithm algorithm, string? keyName);
static member Create : System.Security.Cryptography.CngAlgorithm * string -> System.Security.Cryptography.CngKey
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
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)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs

建立具名的 CngKey 物件,使用提供的金鑰建立參數提供指定的演算法。

public:
 static System::Security::Cryptography::CngKey ^ Create(System::Security::Cryptography::CngAlgorithm ^ algorithm, System::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.Runtime.Versioning.SupportedOSPlatform("windows")]
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);
static member Create : System.Security.Cryptography.CngAlgorithm * string * System.Security.Cryptography.CngKeyCreationParameters -> System.Security.Cryptography.CngKey
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
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 提供 ,金鑰將會是暫時的。

適用於