Επεξεργασία

Κοινή χρήση μέσω


CngKey.Create Method

Definition

Creates a CngKey object that represents a new key.

Overloads

Create(CngAlgorithm)

Creates a CngKey object that can be used with the specified algorithm.

Create(CngAlgorithm, String)

Creates a named CngKey object that provides the specified algorithm.

Create(CngAlgorithm, String, CngKeyCreationParameters)

Creates a named CngKey object that provides the specified algorithm, using the supplied key creation parameters.

Create(CngAlgorithm)

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

Creates a CngKey object that can be used with the specified algorithm.

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

Parameters

algorithm
CngAlgorithm

The algorithm that the key will be used with.

Returns

An ephemeral key.

Attributes

Exceptions

algorithm is null.

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

All other errors.

Remarks

This overload creates a key without a name, which means that the key is ephemeral (that is, it will not be persisted). It also creates a default CngKeyCreationParameters object that specifies a default CngProvider and other advanced parameters for the key.

Applies to

Create(CngAlgorithm, String)

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

Creates a named CngKey object that provides the specified algorithm.

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);
[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);
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

Parameters

algorithm
CngAlgorithm

The algorithm that the key will be used with.

keyName
String

The key name. If a name is not provided, the key will not be persisted.

Returns

A persisted or ephemeral key that provides the specified algorithm.

Attributes

Exceptions

algorithm is null.

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

All other errors.

Remarks

If keyName is provided, this overload creates a persisted key. If keyName is not provided, the key will be ephemeral. This overload also creates a default CngKeyCreationParameters object that specifies a default CngProvider and other advanced parameters for the key.

Applies to

Create(CngAlgorithm, String, CngKeyCreationParameters)

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

Creates a named CngKey object that provides the specified algorithm, using the supplied key creation parameters.

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);
[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);
[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

Parameters

algorithm
CngAlgorithm

The algorithm that the key will be used with.

keyName
String

The key name. If a name is not provided, the key will not be persisted.

creationParameters
CngKeyCreationParameters

An object that specifies advanced parameters for the method, including the CngProvider.

Returns

A persisted or ephemeral key that provides the specified algorithm.

Attributes

Exceptions

algorithm is null.

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

All other errors.

Remarks

If keyName is provided, this overload creates a persisted key. If keyName is not provided, the key will be ephemeral.

Applies to