共用方式為


AsymmetricAlgorithm.TryExportPkcs8PrivateKeyPem 方法

定義

嘗試將 PEM 編碼 PKCS#8 PrivateKeyInfo 格式中的目前密鑰導出為提供的緩衝區。

public:
 bool TryExportPkcs8PrivateKeyPem(Span<char> destination, [Runtime::InteropServices::Out] int % charsWritten);
public bool TryExportPkcs8PrivateKeyPem (Span<char> destination, out int charsWritten);
member this.TryExportPkcs8PrivateKeyPem : Span<char> * int -> bool
Public Function TryExportPkcs8PrivateKeyPem (destination As Span(Of Char), ByRef charsWritten As Integer) As Boolean

參數

destination
Span<Char>

要接收 PEM 編碼 PKCS#8 PrivateKeyInfo 數據的字元範圍。

charsWritten
Int32

當這個方法傳回時,包含值,指出寫入 的 destination字元數。 這個參數會被視為未初始化。

傳回

destination 夠大可接收輸出,則為 true;否則為 false

例外狀況

無法匯出金鑰。

備註

PEM 編碼的 PKCS#8 PrivateKeyInfo 會以 -----BEGIN PRIVATE KEY----- 開頭,結尾 -----END PRIVATE KEY-----為 ,且在 PEM 界限之間具有密鑰的 base64 編碼 DER 內容。

          The PEM is encoded according to the IETF RFC 7468 "strict"
          encoding rules.

適用於