Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Security.​Cryptography.​MLKemCng
Assembly: System.Security.Cryptography
Inheritance: object → MLKem → MLKemCng
<para>Provides a Cryptography Next Generation (CNG) implementation of the Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM).</para>
Properties
public
MLKemAlgorithm
Algorithm
Gets the specific ML-KEM algorithm for this key.
Methods
protected
void
Dispose​(bool disposing)
Gets a new <see cref="T:System.Security.Cryptography.CngKey" /> representing the key used by the current instance.
protected
bool
TryExportPkcs8PrivateKeyCore​(Span`1 destination,
Int32& bytesWritten)
public
byte[]
Decapsulate​(byte[] ciphertext)
Inherited from MLKem
ciphertext
The ciphertext.
Returns The shared secret.
Decapsulates a shared secret from a provided ciphertext.
public
void
Decapsulate​(ReadOnlySpan`1 ciphertext,
Span`1 sharedSecret)
Inherited from MLKem
Releases all resources used by the <see cref="T:System.Security.Cryptography.MLKem" /> class.
public
void
Encapsulate​(Byte[]& ciphertext,
Byte[]& sharedSecret)
Inherited from MLKem
public
void
Encapsulate​(Span`1 ciphertext,
Span`1 sharedSecret)
Inherited from MLKem
public
byte[]
ExportDecapsulationKey​()
Inherited from MLKem
Returns The decapsulation key.
Exports the decapsulation key.
public
byte[]
ExportEncapsulationKey​()
Inherited from MLKem
Returns The encapsulation key.
Exports the encapsulation key.
public
byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters)
Inherited from MLKem
public
byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password,
PbeParameters pbeParameters)
Inherited from MLKem
public
byte[]
ExportEncryptedPkcs8PrivateKey​(string password,
PbeParameters pbeParameters)
Inherited from MLKem
password
The password to use when encrypting the key material.
pbeParameters
The password-based encryption (PBE) parameters to use when encrypting the key material.
Returns A byte array containing the PKCS#8 EncryptedPrivateKeyInfo representation of this key.
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.
public
string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters)
Inherited from MLKem
public
string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 password,
PbeParameters pbeParameters)
Inherited from MLKem
public
string
ExportEncryptedPkcs8PrivateKeyPem​(string password,
PbeParameters pbeParameters)
Inherited from MLKem
password
The password to use when encrypting the key material.
pbeParameters
The password-based encryption (PBE) parameters to use when encrypting the key material.
Returns A string containing the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo.
<para>Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a string password.</para>
public
byte[]
ExportPkcs8PrivateKey​()
Inherited from MLKem
Returns A byte array containing the PKCS#8 PrivateKeyInfo representation of this key.
Export the current key in the PKCS#8 PrivateKeyInfo format.
public
string
ExportPkcs8PrivateKeyPem​()
Inherited from MLKem
Returns A string containing the PEM-encoded representation of the PKCS#8 PrivateKeyInfo.
Exports the current key in a PEM-encoded representation of the PKCS#8 PrivateKeyInfo format.
Exports the private seed.
public
byte[]
ExportSubjectPublicKeyInfo​()
Inherited from MLKem
Returns A byte array containing the X.509 SubjectPublicKeyInfo representation of the public-key portion of this key.
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format.
public
string
ExportSubjectPublicKeyInfoPem​()
Inherited from MLKem
Returns <para>A string containing the PEM-encoded representation of the X.509 SubjectPublicKeyInfo representation of the public-key portion of this key.</para>
<para>Exports the public-key portion of the current key in a PEM-encoded representation of the X.509 SubjectPublicKeyInfo format.</para>
public
bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters,
Span`1 destination,
Int32& bytesWritten)
Inherited from MLKem
public
bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password,
PbeParameters pbeParameters,
Span`1 destination,
Int32& bytesWritten)
Inherited from MLKem
public
bool
TryExportEncryptedPkcs8PrivateKey​(string password,
PbeParameters pbeParameters,
Span`1 destination,
Int32& bytesWritten)
Inherited from MLKem
public
bool
TryExportPkcs8PrivateKey​(Span`1 destination,
Int32& bytesWritten)
Inherited from MLKem
public
bool
TryExportSubjectPublicKeyInfo​(Span`1 destination,
Int32& bytesWritten)
Inherited from MLKem
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object