ECDiffieHellman.ImportFromPem(ReadOnlySpan<Char>) 方法

定义

导入 RFC 7468 PEM 编码的密钥,替换此对象的密钥。Imports an RFC 7468 PEM-encoded key, replacing the keys for this object.

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

参数

input
ReadOnlySpan<Char>

要导入的密钥的 PEM 文本。The PEM text of the key to import.

例外

input 不包含带有可识别标签的 PEM 编码的密钥。input does not contain a PEM-encoded key with a recognized label.

-or-

input 包含多个带有可识别标签的 PEM 编码的密钥。input contains multiple PEM-encoded keys with a recognized label.

-or-

input 包含已加密的 PEM 编码的密钥。input contains an encrypted PEM-encoded key.

注解

不支持或格式不正确的 PEM 编码对象将被忽略。Unsupported or malformed PEM-encoded objects will be ignored. 如果找到多个受支持的 PEM 标签,则会引发异常,以防止在键不明确时导入密钥。If multiple supported PEM labels are found, an exception is raised to prevent importing a key when the key is ambiguous.

此方法支持以下 PEM 标签:This method supports the following PEM labels:

  • 公钥PUBLIC KEY
  • 私钥PRIVATE KEY
  • EC 私钥EC PRIVATE KEY

适用于