<PackageReference Include="Microsoft.Bcl.Cryptography" Version="11.0.0-rc.3.26522.148" />

System.Security.Cryptography.CompositeMLKem

public abstract class CompositeMLKem : IDisposable
Represents a Composite ML-KEM key.

Gets the specific Composite ML-KEM algorithm for this key.

Initializes a new instance of the CompositeMLKem class.

Generates a new Composite ML-KEM key.

public static CompositeMLKem ImportDecapsulationKey(CompositeMLKemAlgorithm algorithm, byte[] source)

Imports a Composite ML-KEM key from a decapsulation key.

Imports a Composite ML-KEM key from a decapsulation key.

public static CompositeMLKem ImportEncapsulationKey(CompositeMLKemAlgorithm algorithm, byte[] source)

Imports a Composite ML-KEM key from an encapsulation key.

Imports a Composite ML-KEM key from an encapsulation key.

public static CompositeMLKem ImportEncryptedPkcs8PrivateKey(string password, byte[] source)

Imports a Composite ML-KEM decapsulation key from a PKCS#8 EncryptedPrivateKeyInfo structure.

public static CompositeMLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, ReadOnlySpan<byte> source)

Imports a Composite ML-KEM decapsulation key from a PKCS#8 EncryptedPrivateKeyInfo structure.

public static CompositeMLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, ReadOnlySpan<byte> source)

Imports a Composite ML-KEM decapsulation key from a PKCS#8 EncryptedPrivateKeyInfo structure.

public static CompositeMLKem ImportFromEncryptedPem(string source, string password)

Imports a Composite ML-KEM key from an encrypted RFC 7468 PEM-encoded string.

public static CompositeMLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password)

Imports a Composite ML-KEM key from an encrypted RFC 7468 PEM-encoded string.

public static CompositeMLKem ImportFromEncryptedPem(string source, byte[] passwordBytes)

Imports a Composite ML-KEM key from an encrypted RFC 7468 PEM-encoded string.

public static CompositeMLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<byte> passwordBytes)

Imports a Composite ML-KEM key from an encrypted RFC 7468 PEM-encoded string.

public static CompositeMLKem ImportFromPem(string source)

Imports a Composite ML-KEM key from an RFC 7468 PEM-encoded string.

public static CompositeMLKem ImportFromPem(ReadOnlySpan<char> source)

Imports a Composite ML-KEM key from an RFC 7468 PEM-encoded string.

public static CompositeMLKem ImportPkcs8PrivateKey(byte[] source)

Imports a Composite ML-KEM decapsulation key from a PKCS#8 PrivateKeyInfo structure.

Imports a Composite ML-KEM decapsulation key from a PKCS#8 PrivateKeyInfo structure.

public static CompositeMLKem ImportSubjectPublicKeyInfo(byte[] source)

Imports a Composite ML-KEM encapsulation key from an X.509 SubjectPublicKeyInfo structure.

Imports a Composite ML-KEM encapsulation key from an X.509 SubjectPublicKeyInfo structure.

public static bool IsAlgorithmSupported(CompositeMLKemAlgorithm algorithm)

Determines whether the specified algorithm is supported by the current platform.

public byte[] Decapsulate(byte[] ciphertext)

Decapsulates a shared secret from a provided ciphertext.

public void Decapsulate(ReadOnlySpan<byte> ciphertext, Span<byte> sharedSecret)

Decapsulates a shared secret from a provided ciphertext, writing it into the provided buffer.

protected abstract void DecapsulateCore(ReadOnlySpan<byte> ciphertext, Span<byte> sharedSecret)

When overridden in a derived class, decapsulates a shared secret from a provided ciphertext.

public void Dispose()

Releases all resources used by the CompositeMLKem class.

protected virtual void Dispose(bool disposing)

Called by the Dispose method to release the managed and unmanaged resources used by the current instance of the CompositeMLKem class.

public void Encapsulate(out byte ciphertext, out byte sharedSecret)

Creates an encapsulation ciphertext and shared secret.

public void Encapsulate(Span<byte> ciphertext, Span<byte> sharedSecret)

Creates an encapsulation ciphertext and shared secret, writing them into the provided buffers.

protected abstract void EncapsulateCore(Span<byte> ciphertext, Span<byte> sharedSecret)

When overridden in a derived class, creates an encapsulation ciphertext and shared secret, writing them into the provided buffers.

public byte[] ExportDecapsulationKey()

Exports the decapsulation key.

public int ExportDecapsulationKey(Span<byte> destination)

Exports the decapsulation key into the provided buffer.

protected abstract int ExportDecapsulationKeyCore(Span<byte> destination)

When overridden in a derived class, exports the decapsulation key into the provided buffer.

public byte[] ExportEncapsulationKey()

Exports the encapsulation key.

public int ExportEncapsulationKey(Span<byte> destination)

Exports the encapsulation key into the provided buffer.

protected abstract int ExportEncapsulationKeyCore(Span<byte> destination)

When overridden in a derived class, exports the encapsulation key into the provided buffer.

public byte[] ExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.

public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.

public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters)

Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password.

public string ExportEncryptedPkcs8PrivateKeyPem(string password, PbeParameters pbeParameters)

Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a string password.

public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, PbeParameters pbeParameters)

Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a char-based password.

public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters)

Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo representation of this key, using a byte-based password.

public byte[] ExportPkcs8PrivateKey()

Exports the current key in the PKCS#8 PrivateKeyInfo format.

public string ExportPkcs8PrivateKeyPem()

Exports the current key in a PEM-encoded representation of the PKCS#8 PrivateKeyInfo format.

Exports the encapsulation key portion of the current key in the X.509 SubjectPublicKeyInfo format.

Exports the encapsulation key portion of the current key in a PEM-encoded representation of the X.509 SubjectPublicKeyInfo format.

public bool TryExportDecapsulationKey(Span<byte> destination, out int bytesWritten)

Attempts to export the decapsulation key into the provided buffer.

public bool TryExportEncapsulationKey(Span<byte> destination, out int bytesWritten)

Attempts to export the encapsulation key into the provided buffer.

public bool TryExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten)

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.

public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten)

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password.

public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten)

Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password.

public bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritten)

Attempts to export the current key in the PKCS#8 PrivateKeyInfo format into the provided buffer.

protected abstract bool TryExportPkcs8PrivateKeyCore(Span<byte> destination, out int bytesWritten)

When overridden in a derived class, attempts to export the current key in the PKCS#8 PrivateKeyInfo format into the provided buffer.

public bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten)

Attempts to export the encapsulation key portion of the current key in the X.509 SubjectPublicKeyInfo format into the provided buffer.