語言

CngKey.Create 方法

定義

建立 CngKey 一個物件來代表一個新的鍵。

多載

名稱 Description
Create(CngAlgorithm)

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

Create(CngAlgorithm, String)

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

Create(CngAlgorithm, String, CngKeyCreationParameters)

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

Create(CngAlgorithm)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
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

金鑰將被使用的演算法。

傳回

一把短暫的鑰匙。

屬性

例外狀況

algorithm 是 null。

此系統不支援密碼學下一代(CNG)。

其他所有錯誤。

備註

此過載會產生一個沒有名稱的金鑰,表示該金鑰是短暫的(也就是說,不會被持久化)。 它也會建立一個預設 CngKeyCreationParameters 物件,指定該鍵的預設 CngProvider 參數及其他進階參數。

適用於

Create(CngAlgorithm, String)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
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.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

金鑰名稱。 若未提供名稱,該金鑰將不會被持久化。

傳回

一個持久化或短暫的金鑰,提供指定的演算法。

屬性

例外狀況

algorithm 是 null。

此系統不支援密碼學下一代(CNG)。

其他所有錯誤。

備註

若 keyName 提供 ,此超載會產生持久化的金鑰。 若 keyName 未提供,該鑰匙將是短暫的。 此過載同時會建立一個預設 CngKeyCreationParameters 物件,指定該鍵的預設 CngProvider 參數及其他進階參數。

適用於

Create(CngAlgorithm, String, CngKeyCreationParameters)

來源:
Cng.NotSupported.cs
來源:
Cng.NotSupported.cs
來源:
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);
[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。

傳回

一個持久化或短暫的金鑰,提供指定的演算法。

屬性

例外狀況

algorithm 是 null。

此系統不支援密碼學下一代(CNG)。

其他所有錯誤。

備註

若 keyName 提供 ,此超載會產生持久化的金鑰。 若 keyName 未提供,該鑰匙將是短暫的。

適用於