Export (0) Print
Expand All

CngKey.Import Method (Byte[], CngKeyBlobFormat, CngProvider)

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

Namespace:  System.Security.Cryptography
Assembly:  System.Core (in System.Core.dll)

public static CngKey Import(
	byte[] keyBlob,
	CngKeyBlobFormat format,
	CngProvider provider
)

Parameters

keyBlob
Type: System.Byte[]

An array that contains the key information.

format
Type: System.Security.Cryptography.CngKeyBlobFormat

An object that specifies the format of the keyBlob array.

provider
Type: System.Security.Cryptography.CngProvider

The KSP.

Return Value

Type: System.Security.Cryptography.CngKey
A new key.

ExceptionCondition
ArgumentNullException

keyBlob, format, or provider is null.

PlatformNotSupportedException

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

CryptographicException

All other errors.

Important noteImportant

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Show:
© 2015 Microsoft