Edit

Share via


MLDsa.ImportEncryptedPkcs8PrivateKey Method

Definition

Overloads

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Imports an ML-DSA private key from a PKCS#8 EncryptedPrivateKeyInfo structure.

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

Imports an ML-DSA private key from a PKCS#8 EncryptedPrivateKeyInfo structure.

ImportEncryptedPkcs8PrivateKey(String, Byte[])

Imports an ML-DSA private key from a PKCS#8 EncryptedPrivateKeyInfo structure.

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>)

Source:
MLDsa.cs
Source:
MLDsa.cs

Imports an ML-DSA private key from a PKCS#8 EncryptedPrivateKeyInfo structure.

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

Parameters

passwordBytes
ReadOnlySpan<Byte>

The bytes to use as a password when decrypting the key material.

source
ReadOnlySpan<Byte>

The bytes of a PKCS#8 EncryptedPrivateKeyInfo structure in the ASN.1-BER encoding.

Returns

The imported key.

Attributes

Exceptions

The contents of source do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.

-or-

The specified password is incorrect.

-or-

The EncryptedPrivateKeyInfo indicates the Key Derivation Function (KDF) to apply is the legacy PKCS#12 KDF, which requires Char-based passwords.

-or-

The value does not represent an ML-DSA key.

-or-

source contains trailing data after the ASN.1 structure.

-or-

The algorithm-specific import failed.

The platform does not support ML-DSA. Callers can use the IsSupported property to determine if the platform supports ML-DSA.

Applies to

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

Source:
MLDsa.cs
Source:
MLDsa.cs

Imports an ML-DSA private key from a PKCS#8 EncryptedPrivateKeyInfo structure.

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

Parameters

password
ReadOnlySpan<Char>

The password to use when decrypting the key material.

source
ReadOnlySpan<Byte>

The bytes of a PKCS#8 EncryptedPrivateKeyInfo structure in the ASN.1-BER encoding.

Returns

The imported key.

Attributes

Exceptions

The contents of source do not represent an ASN.1-BER-encoded PKCS#8 EncryptedPrivateKeyInfo structure.

-or-

The specified password is incorrect.

-or-

The value does not represent an ML-DSA key.

-or-

source contains trailing data after the ASN.1 structure.

-or-

The algorithm-specific import failed.

The platform does not support ML-DSA. Callers can use the IsSupported property to determine if the platform supports ML-DSA.

Applies to

ImportEncryptedPkcs8PrivateKey(String, Byte[])

Source:
MLDsa.cs

Imports an ML-DSA private key from a PKCS#8 EncryptedPrivateKeyInfo structure.

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

Parameters

password
String

The password to use when decrypting the key material.

source
Byte[]

The bytes of a PKCS#8 EncryptedPrivateKeyInfo structure in the ASN.1-BER encoding.

Returns

The imported key.

Attributes

Exceptions

password or source is null.

Applies to