Share via


Pkcs8PrivateKeyInfo.DecryptAndDecode 方法

定義

多載

DecryptAndDecode(ReadOnlySpan<Byte>, ReadOnlyMemory<Byte>, Int32)

使用提供的位元組型密碼解密提供的資料,並將輸出解碼成 PKCS#8 PrivateKeyInfo 的物件檢視。

DecryptAndDecode(ReadOnlySpan<Char>, ReadOnlyMemory<Byte>, Int32)

使用提供的字元型密碼解密提供的資料,並將輸出解碼成 PKCS#8 PrivateKeyInfo 的物件檢視。

DecryptAndDecode(ReadOnlySpan<Byte>, ReadOnlyMemory<Byte>, Int32)

來源:
Pkcs8PrivateKeyInfo.cs
來源:
Pkcs8PrivateKeyInfo.cs
來源:
Pkcs8PrivateKeyInfo.cs
來源:
Pkcs8PrivateKeyInfo.cs

使用提供的位元組型密碼解密提供的資料,並將輸出解碼成 PKCS#8 PrivateKeyInfo 的物件檢視。

public:
 static System::Security::Cryptography::Pkcs::Pkcs8PrivateKeyInfo ^ DecryptAndDecode(ReadOnlySpan<System::Byte> passwordBytes, ReadOnlyMemory<System::Byte> source, [Runtime::InteropServices::Out] int % bytesRead);
public static System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo DecryptAndDecode (ReadOnlySpan<byte> passwordBytes, ReadOnlyMemory<byte> source, out int bytesRead);
static member DecryptAndDecode : ReadOnlySpan<byte> * ReadOnlyMemory<byte> * int -> System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo
Public Shared Function DecryptAndDecode (passwordBytes As ReadOnlySpan(Of Byte), source As ReadOnlyMemory(Of Byte), ByRef bytesRead As Integer) As Pkcs8PrivateKeyInfo

參數

passwordBytes
ReadOnlySpan<Byte>

解密金鑰產製原料時要用作密碼的位元組。

source
ReadOnlyMemory<Byte>

要以 ASN.1-BER 編碼讀取為 PKCS#8 EncryptedPrivateKeyInfo 結構的資料。

bytesRead
Int32

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

傳回

解密解碼為 PKCS#8 PrivateKeyInfo 之內容的物件檢視。

例外狀況

密碼不正確。

-或-

source 的內容指出要套用的金鑰衍生函數 (Key Derivation Function) (KDF) 是舊版 PKCS#12 KDF,這需要 Char 型密碼。

-或-

source 的內容不表示 ASN.1-BER 編碼的 PKCS#8 EncryptedPrivateKeyInfo 結構。

備註

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

這個方法僅支援 EncryptedPrivateKeyInfo 的二進位 (BER/CER/DER) 編碼。 如果值為Base64編碼或 PEM 文字格式,則呼叫端必須在呼叫此方法之前先將內容譯碼為Base64。

適用於

DecryptAndDecode(ReadOnlySpan<Char>, ReadOnlyMemory<Byte>, Int32)

來源:
Pkcs8PrivateKeyInfo.cs
來源:
Pkcs8PrivateKeyInfo.cs
來源:
Pkcs8PrivateKeyInfo.cs
來源:
Pkcs8PrivateKeyInfo.cs

使用提供的字元型密碼解密提供的資料,並將輸出解碼成 PKCS#8 PrivateKeyInfo 的物件檢視。

public:
 static System::Security::Cryptography::Pkcs::Pkcs8PrivateKeyInfo ^ DecryptAndDecode(ReadOnlySpan<char> password, ReadOnlyMemory<System::Byte> source, [Runtime::InteropServices::Out] int % bytesRead);
public static System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo DecryptAndDecode (ReadOnlySpan<char> password, ReadOnlyMemory<byte> source, out int bytesRead);
static member DecryptAndDecode : ReadOnlySpan<char> * ReadOnlyMemory<byte> * int -> System.Security.Cryptography.Pkcs.Pkcs8PrivateKeyInfo
Public Shared Function DecryptAndDecode (password As ReadOnlySpan(Of Char), source As ReadOnlyMemory(Of Byte), ByRef bytesRead As Integer) As Pkcs8PrivateKeyInfo

參數

password
ReadOnlySpan<Char>

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

source
ReadOnlyMemory<Byte>

以 ASN.1-BER 編碼的 PKCS#8 EncryptedPrivateKeyInfo 結構位元組。

bytesRead
Int32

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

傳回

解密解碼為 PKCS#8 PrivateKeyInfo 之內容的物件檢視。

備註

當 的內容 source 指出使用 PBKDF1 的演算法 (密碼型密鑰衍生函式 1) 或 PBKDF2 (密碼型金鑰衍生函式 2) 時,密碼會透過 UTF-8 編碼轉換成字節。

這個方法僅支援 EncryptedPrivateKeyInfo 的二進位 (BER/CER/DER) 編碼。 如果值為Base64編碼或 PEM 文字格式,則呼叫端必須在呼叫此方法之前先將內容譯碼為Base64。

另請參閱

適用於