Edit

Share via


CompositeMLDsa.ImportFromEncryptedPem Method

Definition

Overloads

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

Imports a Composite ML-DSA key from an encrypted RFC 7468 PEM-encoded string.

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

Imports a Composite ML-DSA key from an encrypted RFC 7468 PEM-encoded string.

ImportFromEncryptedPem(String, Byte[])

Imports a Composite ML-DSA key from an encrypted RFC 7468 PEM-encoded string.

ImportFromEncryptedPem(String, String)

Imports a Composite ML-DSA key from an encrypted RFC 7468 PEM-encoded string.

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

Source:
CompositeMLDsa.cs

Imports a Composite ML-DSA key from an encrypted RFC 7468 PEM-encoded string.

public:
 static System::Security::Cryptography::CompositeMLDsa ^ ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<System::Byte> passwordBytes);
public static System.Security.Cryptography.CompositeMLDsa ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<byte> passwordBytes);
static member ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<byte> -> System.Security.Cryptography.CompositeMLDsa
Public Shared Function ImportFromEncryptedPem (source As ReadOnlySpan(Of Char), passwordBytes As ReadOnlySpan(Of Byte)) As CompositeMLDsa

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

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.

-or-

The specified Composite ML-DSA algorithm is not supported.

The platform does not support Composite ML-DSA. Callers can use the IsSupported property to determine if the platform supports Composite 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:
CompositeMLDsa.cs

Imports a Composite ML-DSA key from an encrypted RFC 7468 PEM-encoded string.

public:
 static System::Security::Cryptography::CompositeMLDsa ^ ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password);
public static System.Security.Cryptography.CompositeMLDsa ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password);
static member ImportFromEncryptedPem : ReadOnlySpan<char> * ReadOnlySpan<char> -> System.Security.Cryptography.CompositeMLDsa
Public Shared Function ImportFromEncryptedPem (source As ReadOnlySpan(Of Char), password As ReadOnlySpan(Of Char)) As CompositeMLDsa

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

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.

-or-

The specified Composite ML-DSA algorithm is not supported.

The platform does not support Composite ML-DSA. Callers can use the IsSupported property to determine if the platform supports Composite 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:
CompositeMLDsa.cs

Imports a Composite ML-DSA key from an encrypted RFC 7468 PEM-encoded string.

public:
 static System::Security::Cryptography::CompositeMLDsa ^ ImportFromEncryptedPem(System::String ^ source, cli::array <System::Byte> ^ passwordBytes);
public static System.Security.Cryptography.CompositeMLDsa ImportFromEncryptedPem(string source, byte[] passwordBytes);
static member ImportFromEncryptedPem : string * byte[] -> System.Security.Cryptography.CompositeMLDsa
Public Shared Function ImportFromEncryptedPem (source As String, passwordBytes As Byte()) As CompositeMLDsa

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

Exceptions

source or passwordBytes is null.

Applies to

ImportFromEncryptedPem(String, String)

Source:
CompositeMLDsa.cs

Imports a Composite ML-DSA key from an encrypted RFC 7468 PEM-encoded string.

public:
 static System::Security::Cryptography::CompositeMLDsa ^ ImportFromEncryptedPem(System::String ^ source, System::String ^ password);
public static System.Security.Cryptography.CompositeMLDsa ImportFromEncryptedPem(string source, string password);
static member ImportFromEncryptedPem : string * string -> System.Security.Cryptography.CompositeMLDsa
Public Shared Function ImportFromEncryptedPem (source As String, password As String) As CompositeMLDsa

Parameters

source
String

The PEM text of the encrypted key to import.

password
String

The password to use for decrypting the key material.

Returns

Exceptions

source or password is null.

Applies to