MLKem Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents an ML-KEM key.
public ref class MLKem abstract : IDisposable
public abstract class MLKem : IDisposable
type MLKem = class
interface IDisposable
Public MustInherit Class MLKem
Implements IDisposable
- Inheritance
-
MLKem
- Derived
- Implements
Remarks
This algorithm is specified by FIPS-203.
Developers are encouraged to program against the MLKem base class, rather than any specific derived class.
The derived classes are intended for interop with the underlying system cryptographic libraries.
Constructors
| MLKem(MLKemAlgorithm) |
Initializes a new instance of the MLKem class. |
Properties
| Algorithm |
Gets the specific ML-KEM algorithm for this key. |
| IsSupported |
Gets a value that indicates whether the algorithm is supported on the current platform. |
Methods
| Decapsulate(Byte[]) |
Decapsulates a shared secret from a provided ciphertext. |
| Decapsulate(ReadOnlySpan<Byte>, Span<Byte>) |
Decapsulates a shared secret from a provided ciphertext. |
| DecapsulateCore(ReadOnlySpan<Byte>, Span<Byte>) |
When overridden in a derived class, decapsulates a shared secret from a provided ciphertext. |
| Dispose() |
Releases all resources used by the MLKem class. |
| Dispose(Boolean) |
Called by the |
| Encapsulate(Byte[], Byte[]) |
Creates an encapsulation ciphertext and shared secret. |
| Encapsulate(Span<Byte>, Span<Byte>) |
Creates an encapsulation ciphertext and shared secret, writing them into the provided buffers. |
| EncapsulateCore(Span<Byte>, Span<Byte>) |
When overridden in a derived class, creates an encapsulation ciphertext and shared secret, writing them into the provided buffers. |
| Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
| ExportDecapsulationKey() |
Exports the decapsulation key. |
| ExportDecapsulationKey(Span<Byte>) |
Exports the decapsulation key into the provided buffer. |
| ExportDecapsulationKeyCore(Span<Byte>) |
When overridden in a derived class, exports the decapsulation key into the provided buffer. |
| ExportEncapsulationKey() |
Exports the encapsulation key. |
| ExportEncapsulationKey(Span<Byte>) |
Exports the encapsulation key into the provided buffer. |
| ExportEncapsulationKeyCore(Span<Byte>) |
When overridden in a derived class, exports the encapsulation key into the provided buffer. |
| ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters) |
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password. |
| ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters) |
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password. |
| ExportEncryptedPkcs8PrivateKey(String, PbeParameters) |
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password. |
| ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters) |
Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a byte-based password. |
| ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters) |
Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a char-based password. |
| ExportEncryptedPkcs8PrivateKeyPem(String, PbeParameters) |
Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a string password. |
| ExportPkcs8PrivateKey() |
Export the current key in the PKCS#8 PrivateKeyInfo format. |
| ExportPkcs8PrivateKeyPem() |
Exports the current key in a PEM-encoded representation of the PKCS#8 PrivateKeyInfo format. |
| ExportPrivateSeed() |
Exports the private seed. |
| ExportPrivateSeed(Span<Byte>) |
Exports the private seed into the provided buffer. |
| ExportPrivateSeedCore(Span<Byte>) |
When overridden in a derived class, exports the private seed into the provided buffer. |
| ExportSubjectPublicKeyInfo() |
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format. |
| ExportSubjectPublicKeyInfoPem() |
Exports the public-key portion of the current key in a PEM-encoded representation of the X.509 SubjectPublicKeyInfo format. |
| GenerateKey(MLKemAlgorithm) |
Generates a new ML-KEM key. |
| GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
| GetType() |
Gets the Type of the current instance. (Inherited from Object) |
| ImportDecapsulationKey(MLKemAlgorithm, Byte[]) |
Imports an ML-KEM key from a decapsulation key. |
| ImportDecapsulationKey(MLKemAlgorithm, ReadOnlySpan<Byte>) |
Imports an ML-KEM key from a decapsulation key. |
| ImportEncapsulationKey(MLKemAlgorithm, Byte[]) |
Imports an ML-KEM key from a encapsulation key. |
| ImportEncapsulationKey(MLKemAlgorithm, ReadOnlySpan<Byte>) |
Imports an ML-KEM key from a encapsulation key. |
| ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>) |
Imports an ML-KEM private key from a PKCS#8 EncryptedPrivateKeyInfo structure. |
| ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>) |
Imports an ML-KEM private key from a PKCS#8 EncryptedPrivateKeyInfo structure. |
| ImportEncryptedPkcs8PrivateKey(String, Byte[]) |
Imports an ML-KEM private key from a PKCS#8 EncryptedPrivateKeyInfo structure. |
| ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>) |
Imports an ML-KEM key from an encrypted RFC 7468 PEM-encoded string. |
| ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>) |
Imports an ML-KEM key from an encrypted RFC 7468 PEM-encoded string. |
| ImportFromEncryptedPem(String, Byte[]) |
Imports an ML-KEM key from an encrypted RFC 7468 PEM-encoded string. |
| ImportFromEncryptedPem(String, String) |
Imports an ML-KEM key from an encrypted RFC 7468 PEM-encoded string. |
| ImportFromPem(ReadOnlySpan<Char>) |
Imports an ML-KEM key from an RFC 7468 PEM-encoded string. |
| ImportFromPem(String) |
Imports an ML-KEM key from an RFC 7468 PEM-encoded string. |
| 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. |
| ImportPrivateSeed(MLKemAlgorithm, Byte[]) |
Imports an ML-KEM key from its private seed value. |
| ImportPrivateSeed(MLKemAlgorithm, ReadOnlySpan<Byte>) |
Imports an ML-KEM key from its private seed value. |
| ImportSubjectPublicKeyInfo(Byte[]) |
Imports an ML-KEM encapsulation key from an X.509 SubjectPublicKeyInfo structure. |
| ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>) |
Imports an ML-KEM encapsulation key from an X.509 SubjectPublicKeyInfo structure. |
| MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
| ToString() |
Returns a string that represents the current object. (Inherited from Object) |
| TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32) |
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password. |
| TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32) |
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password. |
| TryExportEncryptedPkcs8PrivateKey(String, PbeParameters, Span<Byte>, Int32) |
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password. |
| TryExportPkcs8PrivateKey(Span<Byte>, Int32) |
Attempts to export the current key in the PKCS#8 PrivateKeyInfo format into the provided buffer. |
| TryExportPkcs8PrivateKeyCore(Span<Byte>, Int32) |
When overridden in a derived class, attempts to export the current key in the PKCS#8 PrivateKeyInfo format into the provided buffer. |
| TryExportSubjectPublicKeyInfo(Span<Byte>, Int32) |
Attempts to export the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format into the provided buffer. |