DSA.ImportFromEncryptedPem 方法

定义

重载

ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

导入已加密的 RFC 7468 PEM 编码的私钥,替换此对象的密钥。

ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

导入已加密的 RFC 7468 PEM 编码的私钥,替换此对象的密钥。

ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

Source:
DSA.cs
Source:
DSA.cs
Source:
DSA.cs

导入已加密的 RFC 7468 PEM 编码的私钥,替换此对象的密钥。

public:
 override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<System::Byte> passwordBytes);
public override void ImportFromEncryptedPem (ReadOnlySpan<char> input, ReadOnlySpan<byte> passwordBytes);
override this.ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<byte> -> unit
Public Overrides Sub ImportFromEncryptedPem (input As ReadOnlySpan(Of Char), passwordBytes As ReadOnlySpan(Of Byte))

参数

input
ReadOnlySpan<Char>

要导入的加密密钥的 PEM 文本。

passwordBytes
ReadOnlySpan<Byte>

解密密钥材料时用作密码的字节。

例外

input 不包含具有已识别标签的 PEM 编码密钥。

- 或 -

input 包含多个具有已识别标签的 PEM 编码键。

密码不正确。

        -or-

        The base-64 decoded contents of the PEM text from <code data-dev-comment-type="paramref">input</code> do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.

        -or-

        The base-64 decoded contents of the PEM text from <code data-dev-comment-type="paramref">input</code> indicate the key is for an algorithm other than the algorithm represented by this instance.

        -or-

        The base-64 decoded contents of the PEM text from <code data-dev-comment-type="paramref">input</code> represent the key in a format that is not supported.

        -or-

        The algorithm-specific key import failed.

注解

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

将忽略不支持或格式不正确的 PEM 编码对象。 如果找到多个受支持的 PEM 标签,则会引发异常,以防止在密钥不明确时导入密钥。

此方法支持 ENCRYPTED PRIVATE KEY PEM 标签。

适用于

ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

Source:
DSA.cs
Source:
DSA.cs
Source:
DSA.cs

导入已加密的 RFC 7468 PEM 编码的私钥,替换此对象的密钥。

public:
 override void ImportFromEncryptedPem(ReadOnlySpan<char> input, ReadOnlySpan<char> password);
public override void ImportFromEncryptedPem (ReadOnlySpan<char> input, ReadOnlySpan<char> password);
override this.ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<char> -> unit
Public Overrides Sub ImportFromEncryptedPem (input As ReadOnlySpan(Of Char), password As ReadOnlySpan(Of Char))

参数

input
ReadOnlySpan<Char>

要导入的加密密钥的 PEM 文本。

password
ReadOnlySpan<Char>

用于解密密钥材料的密码。

例外

input 不包含具有已识别标签的 PEM 编码密钥。

- 或 -

input 包含多个具有已识别标签的 PEM 编码键。

密码不正确。

        -or-

        The base-64 decoded contents of the PEM text from <code data-dev-comment-type="paramref">input</code> do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.

        -or-

        The base-64 decoded contents of the PEM text from <code data-dev-comment-type="paramref">input</code> indicate the key is for an algorithm other than the algorithm represented by this instance.

        -or-

        The base-64 decoded contents of the PEM text from <code data-dev-comment-type="paramref">input</code> represent the key in a format that is not supported.

        -or-

        The algorithm-specific key import failed.

注解

当 的 base-64 解码内容 input 指示使用 PBKDF1 (基于密码的密钥派生函数 1) 或 PBKDF2 (基于密码的密钥派生函数 2) 的算法时,密码将通过 UTF-8 编码转换为字节。

将忽略不支持或格式不正确的 PEM 编码对象。 如果找到多个受支持的 PEM 标签,则会引发异常,以防止在密钥不明确时导入密钥。

此方法支持 ENCRYPTED PRIVATE KEY PEM 标签。

适用于