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)

Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
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 的内容表示要应用的密钥派生功能 (KDF) 是旧的 PKCS#12 KDF,需要基于 Char 的密码。

source 的内容不表示 ASN.1-BER 编码的 PKCS#8 EncryptedPrivateKeyInfo 结构。

注解

密码字节直接传递到由 指示 pbeParameters的算法使用的密钥派生函数 (KDF) 。 当使用 PBKDF2 (基于密码的密钥派生函数 2) 处理密码时,这样可以与使用 UTF-8 以外的文本编码的其他系统兼容。

此方法仅支持 EncryptedPrivateKeyInfo 的二进制 (BER/CER/DER) 编码。 如果值为 Base64 编码或 PEM 文本格式,则调用方必须在调用此方法之前对内容进行 Base64 解码。

适用于

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

Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
Pkcs8PrivateKeyInfo.cs
Source:
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 解码。

另请参阅

适用于