RSA.TryExportEncryptedPkcs8PrivateKey 方法

定義

多載

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

使用 Char 型密碼,嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

使用位元組型密碼,嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

來源:
RSA.cs
來源:
RSA.cs
來源:
RSA.cs

使用 Char 型密碼,嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

public:
 override bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, System::Security::Cryptography::PbeParameters ^ pbeParameters, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public override bool TryExportEncryptedPkcs8PrivateKey (ReadOnlySpan<char> password, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
override this.TryExportEncryptedPkcs8PrivateKey : ReadOnlySpan<char> * System.Security.Cryptography.PbeParameters * Span<byte> * int -> bool
Public Overrides Function TryExportEncryptedPkcs8PrivateKey (password As ReadOnlySpan(Of Char), pbeParameters As PbeParameters, destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

參數

password
ReadOnlySpan<Char>

加密金鑰產製原料時要使用的密碼。

pbeParameters
PbeParameters

加密金鑰產製原料時要使用的密碼型加密 (PBE) 參數。

destination
Span<Byte>

要接收 PKCS#8 EncryptedPrivateKeyInfo 資料的位元組範圍。

bytesWritten
Int32

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

傳回

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

例外狀況

無法匯出金鑰。

備註

pbeParameters 指出使用 PBKDF2 (密碼型金鑰衍生函數 2) 的演算法時,密碼會透過 UTF-8 編碼轉換成位元組。

另請參閱

適用於

TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

來源:
RSA.cs
來源:
RSA.cs
來源:
RSA.cs

使用位元組型密碼,嘗試以 PKCS#8 EncryptedPrivateKeyInfo 格式將目前的金鑰匯出至提供的緩衝區。

public:
 override bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<System::Byte> passwordBytes, System::Security::Cryptography::PbeParameters ^ pbeParameters, Span<System::Byte> destination, [Runtime::InteropServices::Out] int % bytesWritten);
public override bool TryExportEncryptedPkcs8PrivateKey (ReadOnlySpan<byte> passwordBytes, System.Security.Cryptography.PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
override this.TryExportEncryptedPkcs8PrivateKey : ReadOnlySpan<byte> * System.Security.Cryptography.PbeParameters * Span<byte> * int -> bool
Public Overrides Function TryExportEncryptedPkcs8PrivateKey (passwordBytes As ReadOnlySpan(Of Byte), pbeParameters As PbeParameters, destination As Span(Of Byte), ByRef bytesWritten As Integer) As Boolean

參數

passwordBytes
ReadOnlySpan<Byte>

加密金鑰內容時要用作密碼的位元組。

pbeParameters
PbeParameters

加密金鑰產製原料時要使用的密碼型加密 (PBE) 參數。

destination
Span<Byte>

要接收 PKCS#8 EncryptedPrivateKeyInfo 資料的位元組範圍。

bytesWritten
Int32

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

傳回

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

例外狀況

無法匯出金鑰。

-或-

pbeParameters 指出應該使用 TripleDes3KeyPkcs12,這需要 Char 型密碼。

備註

密碼位元組會直接傳遞至金鑰衍生函式, (KDF) 由 所指示 pbeParameters 的演算法使用。 這可讓您與使用 UTF-8 以外的文字編碼的其他系統相容,以 PBKDF2 處理密碼時, (密碼型金鑰衍生函式 2) 。

另請參閱

適用於