Import Method (Byte[], CngKeyBlobFormat)

CngKey.Import Method (Byte[], CngKeyBlobFormat)

.NET Framework (current version)
 

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

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

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

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.

Return Value

Type: System.Security.Cryptography.CngKey

A new key.

Exception Condition
ArgumentNullException

keyBlob or format is null.

PlatformNotSupportedException

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

CryptographicException

All other errors.

The default KSP is MicrosoftSoftwareKeyStorageProvider.

System_CAPS_importantImportant

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

Universal Windows Platform
Available since 10
.NET Framework
Available since 3.5
Return to top
Show:
© 2016 Microsoft