MLDsa.ImportFromEncryptedPem Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>) |
Imports an ML-DSA key from an encrypted RFC 7468 PEM-encoded string. |
| ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>) |
Imports an ML-DSA key from an encrypted RFC 7468 PEM-encoded string. |
| ImportFromEncryptedPem(String, Byte[]) |
Imports an ML-DSA key from an encrypted RFC 7468 PEM-encoded string. |
| ImportFromEncryptedPem(String, String) |
Imports an ML-DSA key from an encrypted RFC 7468 PEM-encoded string. |
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)
- Source:
- MLDsa.cs
- Source:
- MLDsa.cs
Imports an ML-DSA key from an encrypted RFC 7468 PEM-encoded string.
public:
static System::Security::Cryptography::MLDsa ^ ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<System::Byte> passwordBytes);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.MLDsa ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<byte> passwordBytes);
public static System.Security.Cryptography.MLDsa ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<byte> passwordBytes);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<byte> -> System.Security.Cryptography.MLDsa
static member ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<byte> -> System.Security.Cryptography.MLDsa
Public Shared Function ImportFromEncryptedPem (source As ReadOnlySpan(Of Char), passwordBytes As ReadOnlySpan(Of Byte)) As MLDsa
Parameters
- source
- ReadOnlySpan<Char>
The PEM text of the encrypted key to import.
- passwordBytes
- ReadOnlySpan<Byte>
The bytes to use as a password when decrypting the key material.
Returns
- Attributes
Exceptions
source does not contain a PEM-encoded key with a recognized label.
-or-
source contains multiple PEM-encoded keys with a recognized label.
The password is incorrect.
-or-
The base-64 decoded contents of the PEM text from source do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.
-or-
The base-64 decoded contents of the PEM text from source 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 source represent the key in a format that is not supported.
-or-
An error occurred while importing the key.
The platform does not support ML-DSA. Callers can use the IsSupported property to determine if the platform supports ML-DSA.
Remarks
Unsupported or malformed PEM-encoded objects will be ignored. If multiple supported PEM labels are found, an exception is thrown to prevent importing a key when the key is ambiguous.
This method supports the ENCRYPTED PRIVATE KEY PEM label.
Applies to
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)
- Source:
- MLDsa.cs
- Source:
- MLDsa.cs
Imports an ML-DSA key from an encrypted RFC 7468 PEM-encoded string.
public:
static System::Security::Cryptography::MLDsa ^ ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.MLDsa ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password);
public static System.Security.Cryptography.MLDsa ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<char> -> System.Security.Cryptography.MLDsa
static member ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<char> -> System.Security.Cryptography.MLDsa
Public Shared Function ImportFromEncryptedPem (source As ReadOnlySpan(Of Char), password As ReadOnlySpan(Of Char)) As MLDsa
Parameters
- source
- ReadOnlySpan<Char>
The PEM text of the encrypted key to import.
- password
- ReadOnlySpan<Char>
The password to use for decrypting the key material.
Returns
- Attributes
Exceptions
source does not contain a PEM-encoded key with a recognized label.
-or-
source contains multiple PEM-encoded keys with a recognized label.
The password is incorrect.
-or-
The base-64 decoded contents of the PEM text from source do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.
-or-
The base-64 decoded contents of the PEM text from source 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 source represent the key in a format that is not supported.
-or-
An error occurred while importing the key.
The platform does not support ML-DSA. Callers can use the IsSupported property to determine if the platform supports ML-DSA.
Remarks
When the base-64 decoded contents of source indicate an algorithm that uses PBKDF1 (Password-Based Key Derivation Function 1) or PBKDF2 (Password-Based Key Derivation Function 2), the password is converted to bytes via the UTF-8 encoding.
Unsupported or malformed PEM-encoded objects will be ignored. If multiple supported PEM labels are found, an exception is thrown to prevent importing a key when the key is ambiguous.
This method supports the ENCRYPTED PRIVATE KEY PEM label.
Applies to
ImportFromEncryptedPem(String, Byte[])
- Source:
- MLDsa.cs
Imports an ML-DSA key from an encrypted RFC 7468 PEM-encoded string.
public:
static System::Security::Cryptography::MLDsa ^ ImportFromEncryptedPem(System::String ^ source, cli::array <System::Byte> ^ passwordBytes);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.MLDsa ImportFromEncryptedPem(string source, byte[] passwordBytes);
public static System.Security.Cryptography.MLDsa ImportFromEncryptedPem(string source, byte[] passwordBytes);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ImportFromEncryptedPem : string * byte[] -> System.Security.Cryptography.MLDsa
static member ImportFromEncryptedPem : string * byte[] -> System.Security.Cryptography.MLDsa
Public Shared Function ImportFromEncryptedPem (source As String, passwordBytes As Byte()) As MLDsa
Parameters
- source
- String
The PEM text of the encrypted key to import.
- passwordBytes
- Byte[]
The bytes to use as a password when decrypting the key material.
Returns
- Attributes
Exceptions
source or passwordBytes is null.
Applies to
ImportFromEncryptedPem(String, String)
- Source:
- MLDsa.cs
Imports an ML-DSA key from an encrypted RFC 7468 PEM-encoded string.
public:
static System::Security::Cryptography::MLDsa ^ ImportFromEncryptedPem(System::String ^ source, System::String ^ password);
[System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public static System.Security.Cryptography.MLDsa ImportFromEncryptedPem(string source, string password);
public static System.Security.Cryptography.MLDsa ImportFromEncryptedPem(string source, string password);
[<System.Diagnostics.CodeAnalysis.Experimental("SYSLIB5006", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
static member ImportFromEncryptedPem : string * string -> System.Security.Cryptography.MLDsa
static member ImportFromEncryptedPem : string * string -> System.Security.Cryptography.MLDsa
Public Shared Function ImportFromEncryptedPem (source As String, password As String) As MLDsa
Parameters
- source
- String
The PEM text of the encrypted key to import.
- password
- String
The password to use for decrypting the key material.
Returns
- Attributes
Exceptions
source or password is null.