CngKey.Import 方法

定义

通过将密钥材料导入到密钥存储提供程序 (KSP) 中创建一个新密钥。

重载

Import(Byte[], CngKeyBlobFormat, CngProvider)

通过导入指定的密钥材料到指定的密钥存储提供程序 (KSP) 中,使用指定的格式创建一个新的密钥。

Import(Byte[], CngKeyBlobFormat)

通过将指定的密钥材料导入到默认的密钥存储提供程序 (KSP) 中和使用指定的格式创建一个新密钥。

Import(Byte[], CngKeyBlobFormat, CngProvider)

通过导入指定的密钥材料到指定的密钥存储提供程序 (KSP) 中,使用指定的格式创建一个新的密钥。

public:
 static System::Security::Cryptography::CngKey ^ Import(cli::array <System::Byte> ^ keyBlob, System::Security::Cryptography::CngKeyBlobFormat ^ format, System::Security::Cryptography::CngProvider ^ provider);
public static System.Security.Cryptography.CngKey Import (byte[] keyBlob, System.Security.Cryptography.CngKeyBlobFormat format, System.Security.Cryptography.CngProvider provider);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
public static System.Security.Cryptography.CngKey Import (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
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Import : byte[] * System.Security.Cryptography.CngKeyBlobFormat * System.Security.Cryptography.CngProvider -> System.Security.Cryptography.CngKey
[<System.Security.SecurityCritical>]
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

参数

keyBlob
Byte[]

一个包含密钥信息的数组。

format
CngKeyBlobFormat

一个对象,该对象指定 keyBlob 数组的格式。

provider
CngProvider

KSP。

返回

CngKey

一个新的密钥。

属性

例外

keyBlobformatprovidernull

此系统上不支持下一代加密技术 (CNG)。

所有其他错误。

注解

重要

在 Windows 7 和 Windows Server 2008 R2 之前的Windows操作系统上,不支持某些 CNG 密钥二进制大型对象 (BLOB) 格式。

适用于

Import(Byte[], CngKeyBlobFormat)

通过将指定的密钥材料导入到默认的密钥存储提供程序 (KSP) 中和使用指定的格式创建一个新密钥。

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);
[System.Runtime.Versioning.SupportedOSPlatform("windows")]
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
[<System.Runtime.Versioning.SupportedOSPlatform("windows")>]
static member Import : byte[] * System.Security.Cryptography.CngKeyBlobFormat -> System.Security.Cryptography.CngKey
Public Shared Function Import (keyBlob As Byte(), format As CngKeyBlobFormat) As CngKey

参数

keyBlob
Byte[]

一个包含密钥信息的数组。

format
CngKeyBlobFormat

一个对象,该对象指定 keyBlob 数组的格式。

返回

CngKey

一个新的密钥。

属性

例外

keyBlobformatnull

此系统上不支持下一代加密技术 (CNG)。

所有其他错误。

注解

默认 KSP 为 MicrosoftSoftwareKeyStorageProvider.

重要

在 Windows 7 和 Windows Server 2008 R2 之前的Windows操作系统上,不支持某些 CNG 密钥二进制大型对象 (BLOB) 格式。

适用于