Edit

Share via


MLKem.ImportFromPem Method

Definition

Overloads

ImportFromPem(String)

Imports an ML-KEM key from an RFC 7468 PEM-encoded string.

ImportFromPem(ReadOnlySpan<Char>)

Imports an ML-KEM key from an RFC 7468 PEM-encoded string.

ImportFromPem(String)

Source:
MLKem.cs
Source:
MLKem.cs

Imports an ML-KEM key from an RFC 7468 PEM-encoded string.

public:
 static System::Security::Cryptography::MLKem ^ ImportFromPem(System::String ^ source);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.MLKem ImportFromPem(string source);
public static System.Security.Cryptography.MLKem ImportFromPem(string source);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ImportFromPem : string -> System.Security.Cryptography.MLKem
static member ImportFromPem : string -> System.Security.Cryptography.MLKem
Public Shared Function ImportFromPem (source As String) As MLKem

Parameters

source
String

The text of the PEM key to import.

Returns

The imported ML-KEM key.

Attributes

Exceptions

source is null

Applies to

ImportFromPem(ReadOnlySpan<Char>)

Source:
MLKem.cs
Source:
MLKem.cs

Imports an ML-KEM key from an RFC 7468 PEM-encoded string.

public:
 static System::Security::Cryptography::MLKem ^ ImportFromPem(ReadOnlySpan<char> source);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.MLKem ImportFromPem(ReadOnlySpan<char> source);
public static System.Security.Cryptography.MLKem ImportFromPem(ReadOnlySpan<char> source);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ImportFromPem : ReadOnlySpan<char> -> System.Security.Cryptography.MLKem
static member ImportFromPem : ReadOnlySpan<char> -> System.Security.Cryptography.MLKem
Public Shared Function ImportFromPem (source As ReadOnlySpan(Of Char)) As MLKem

Parameters

source
ReadOnlySpan<Char>

The text of the PEM key to import.

Returns

The imported ML-KEM key.

Attributes

Exceptions

source contains an encrypted PEM-encoded key.

-or-

source contains multiple PEM-encoded ML-KEM keys.

-or-

source contains no PEM-encoded ML-KEM keys.

An error occurred while importing the key.

Remarks

Unsupported or malformed PEM-encoded objects will be ignored. If multiple supported PEM labels are found, an exception is raised to prevent importing a key when the key is ambiguous.

This method supports the following PEM labels:

  • PUBLIC KEY
  • PRIVATE KEY

Applies to