Edit

Share via


MLKem.ImportPkcs8PrivateKey Method

Definition

Overloads

ImportPkcs8PrivateKey(Byte[])

Imports an ML-KEM private key from a PKCS#8 PrivateKeyInfo structure.

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>)

Imports an ML-KEM private key from a PKCS#8 PrivateKeyInfo structure.

ImportPkcs8PrivateKey(Byte[])

Source:
MLKem.cs
Source:
MLKem.cs

Imports an ML-KEM private key from a PKCS#8 PrivateKeyInfo structure.

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

Parameters

source
Byte[]

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

Returns

The imported key.

Attributes

Exceptions

source is null

Applies to

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>)

Source:
MLKem.cs
Source:
MLKem.cs

Imports an ML-KEM private key from a PKCS#8 PrivateKeyInfo structure.

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

Parameters

source
ReadOnlySpan<Byte>

The bytes of a PKCS#8 PrivateKeyInfo 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 PrivateKeyInfo structure.

-or-

The PrivateKeyInfo value does not represent an ML-KEM key.

-or-

source contains trailing data after the ASN.1 structure.

-or-

The algorithm-specific import failed.

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

Applies to