Edit

Share via


SlhDsa.ImportFromEncryptedPem Method

Definition

Overloads

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

Imports an SLH-DSA key from an encrypted RFC 7468 PEM-encoded string.

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

Imports an SLH-DSA key from an encrypted RFC 7468 PEM-encoded string.

ImportFromEncryptedPem(String, Byte[])

Imports an SLH-DSA key from an encrypted RFC 7468 PEM-encoded string.

ImportFromEncryptedPem(String, String)

Imports an SLH-DSA key from an encrypted RFC 7468 PEM-encoded string.

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

Source:
SlhDsa.cs
Source:
SlhDsa.cs

Imports an SLH-DSA key from an encrypted RFC 7468 PEM-encoded string.

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

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.

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

Imports an SLH-DSA key from an encrypted RFC 7468 PEM-encoded string.

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

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.

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

Imports an SLH-DSA key from an encrypted RFC 7468 PEM-encoded string.

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

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:
SlhDsa.cs

Imports an SLH-DSA key from an encrypted RFC 7468 PEM-encoded string.

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

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