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.

適用於