RSA.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
  • RSA 私密金鑰RSA PRIVATE KEY
  • RSA 公開金鑰RSA PUBLIC KEY

適用於