CngKey.Export(CngKeyBlobFormat) 方法

定义

将密钥材料以指定的格式导出到 BLOB 中。Exports the key material into a BLOB, in the specified format.

public:
 cli::array <System::Byte> ^ Export(System::Security::Cryptography::CngKeyBlobFormat ^ format);
public byte[] Export (System.Security.Cryptography.CngKeyBlobFormat format);
[System.Security.SecurityCritical]
public byte[] Export (System.Security.Cryptography.CngKeyBlobFormat format);
member this.Export : System.Security.Cryptography.CngKeyBlobFormat -> byte[]
[<System.Security.SecurityCritical>]
member this.Export : System.Security.Cryptography.CngKeyBlobFormat -> byte[]
Public Function Export (format As CngKeyBlobFormat) As Byte()

参数

format
CngKeyBlobFormat

一个指定密钥 BLOB 格式的对象。An object that specifies the format of the key BLOB.

返回

Byte[]

一个包含指定格式的密钥材料的 BLOB。A BLOB that contains the key material in the specified format.

属性

例外

formatnullformat is null.

所有其他错误。All other errors. 通常情况下,ExportPolicy 不允许导出密钥。Typically, the ExportPolicy does not allow the key to be exported.

注解

下一代加密 (CNG) 允许以基础密钥存储提供程序 (KSP) 支持的任何格式导出。Cryptography Next Generation (CNG) allows export in any format that the underlying key storage provider (KSP) supports. 例如,在 Windows Vista 上,默认的 KSP (是 MicrosoftSoftwareKeyStorageProvider) 只允许导出 Pkcs8PrivateBlobEccPrivateBlob 和格式的私钥 OpaqueTransportBlobFor example, on Windows Vista,the default KSP (which is MicrosoftSoftwareKeyStorageProvider) only allows export of private keys in the Pkcs8PrivateBlob, EccPrivateBlob, and OpaqueTransportBlob formats. 此限制由基础 KSP 控制。This restriction is controlled by the underlying KSP. 如果使用其他 KSP,可能会应用其他格式。If you use a different KSP, other formats may apply.

适用于