CngKey.Import CngKey.Import CngKey.Import CngKey.Import Method

Definition

Creates a new key by importing key material into the key storage provider (KSP).

Overloads

Import(Byte[], CngKeyBlobFormat, CngProvider) Import(Byte[], CngKeyBlobFormat, CngProvider) Import(Byte[], CngKeyBlobFormat, CngProvider) Import(Byte[], CngKeyBlobFormat, CngProvider)

Creates a new key by importing the specified key material into the specified key storage provider (KSP), using the specified format.

Import(Byte[], CngKeyBlobFormat) Import(Byte[], CngKeyBlobFormat) Import(Byte[], CngKeyBlobFormat) Import(Byte[], CngKeyBlobFormat)

Creates a new key by importing the specified key material into the default key storage provider (KSP) and using the specified format.

Import(Byte[], CngKeyBlobFormat, CngProvider) Import(Byte[], CngKeyBlobFormat, CngProvider) Import(Byte[], CngKeyBlobFormat, CngProvider) Import(Byte[], CngKeyBlobFormat, CngProvider)

Creates a new key by importing the specified key material into the specified key storage provider (KSP), using the specified format.

public:
 static System::Security::Cryptography::CngKey ^ Import(cli::array <System::Byte> ^ keyBlob, System::Security::Cryptography::CngKeyBlobFormat ^ format, System::Security::Cryptography::CngProvider ^ provider);
[System.Security.SecurityCritical]
public static System.Security.Cryptography.CngKey Import (byte[] keyBlob, System.Security.Cryptography.CngKeyBlobFormat format, System.Security.Cryptography.CngProvider provider);
static member Import : byte[] * System.Security.Cryptography.CngKeyBlobFormat * System.Security.Cryptography.CngProvider -> System.Security.Cryptography.CngKey
Public Shared Function Import (keyBlob As Byte(), format As CngKeyBlobFormat, provider As CngProvider) As CngKey

Parameters

keyBlob
Byte[]

An array that contains the key information.

format
CngKeyBlobFormat CngKeyBlobFormat CngKeyBlobFormat CngKeyBlobFormat

An object that specifies the format of the keyBlob array.

Returns

A new key.

Exceptions

Remarks

Important

On Windows operating systems before Windows 7 and Windows Server 2008 R2, some CNG key binary large object (BLOB) formats are not supported.

Security

KeyContainerPermission
for permission to sign data. Demand value: Demand. Associated enumeration: Import

Import(Byte[], CngKeyBlobFormat) Import(Byte[], CngKeyBlobFormat) Import(Byte[], CngKeyBlobFormat) Import(Byte[], CngKeyBlobFormat)

Creates a new key by importing the specified key material into the default key storage provider (KSP) and using the specified format.

public:
 static System::Security::Cryptography::CngKey ^ Import(cli::array <System::Byte> ^ keyBlob, System::Security::Cryptography::CngKeyBlobFormat ^ format);
public static System.Security.Cryptography.CngKey Import (byte[] keyBlob, System.Security.Cryptography.CngKeyBlobFormat format);
static member Import : byte[] * System.Security.Cryptography.CngKeyBlobFormat -> System.Security.Cryptography.CngKey
Public Shared Function Import (keyBlob As Byte(), format As CngKeyBlobFormat) As CngKey

Parameters

keyBlob
Byte[]

An array that contains the key information.

format
CngKeyBlobFormat CngKeyBlobFormat CngKeyBlobFormat CngKeyBlobFormat

An object that specifies the format of the keyBlob array.

Returns

A new key.

Exceptions

Remarks

The default KSP is MicrosoftSoftwareKeyStorageProvider.

Important

On Windows operating systems before Windows 7 and Windows Server 2008 R2, some CNG key binary large object (BLOB) formats are not supported.

Applies to