System.Security.Cryptography.MLKem
Represents an ML-KEM key.
namespace System.Security.Cryptography
{
public abstract class MLKem : IDisposable
{
private delegate TResult ExportPkcs8PrivateKeyFunc<TResult> (ReadOnlySpan<byte> pkcs8);
private delegate AsnWriter WriteEncryptedPkcs8Func<TChar> (ReadOnlySpan<TChar> password, AsnWriter writer, PbeParameters pbeParameters);
public static bool IsSupported { get; }
public MLKemAlgorithm Algorithm { get; }
protected MLKem(MLKemAlgorithm algorithm);
public static MLKem GenerateKey(MLKemAlgorithm algorithm);
public void Encapsulate(Span<byte> ciphertext, Span<byte> sharedSecret);
public void Encapsulate(out byte[] ciphertext, out byte[] sharedSecret);
protected abstract void EncapsulateCore(Span<byte> ciphertext, Span<byte> sharedSecret);
public void Decapsulate(ReadOnlySpan<byte> ciphertext, Span<byte> sharedSecret);
public byte[] Decapsulate(byte[] ciphertext);
protected abstract void DecapsulateCore(ReadOnlySpan<byte> ciphertext, Span<byte> sharedSecret);
public void ExportPrivateSeed(Span<byte> destination);
public byte[] ExportPrivateSeed();
protected abstract void ExportPrivateSeedCore(Span<byte> destination);
public static MLKem ImportPrivateSeed(MLKemAlgorithm algorithm, ReadOnlySpan<byte> source);
public static MLKem ImportPrivateSeed(MLKemAlgorithm algorithm, byte[] source);
public static MLKem ImportDecapsulationKey(MLKemAlgorithm algorithm, ReadOnlySpan<byte> source);
public static MLKem ImportDecapsulationKey(MLKemAlgorithm algorithm, byte[] source);
public static MLKem ImportEncapsulationKey(MLKemAlgorithm algorithm, ReadOnlySpan<byte> source);
public static MLKem ImportEncapsulationKey(MLKemAlgorithm algorithm, byte[] source);
public void ExportDecapsulationKey(Span<byte> destination);
public byte[] ExportDecapsulationKey();
protected abstract void ExportDecapsulationKeyCore(Span<byte> destination);
public void ExportEncapsulationKey(Span<byte> destination);
public byte[] ExportEncapsulationKey();
protected abstract void ExportEncapsulationKeyCore(Span<byte> destination);
public bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten);
public byte[] ExportSubjectPublicKeyInfo();
public string ExportSubjectPublicKeyInfoPem();
public bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritten);
public byte[] ExportPkcs8PrivateKey();
public string ExportPkcs8PrivateKeyPem();
protected abstract bool TryExportPkcs8PrivateKeyCore(Span<byte> destination, out int bytesWritten);
public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
public bool TryExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten);
public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters);
public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters);
public byte[] ExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters);
public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters);
public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, PbeParameters pbeParameters);
public string ExportEncryptedPkcs8PrivateKeyPem(string password, PbeParameters pbeParameters);
public static MLKem ImportSubjectPublicKeyInfo(ReadOnlySpan<byte> source);
public static MLKem ImportSubjectPublicKeyInfo(byte[] source);
public static MLKem ImportPkcs8PrivateKey(ReadOnlySpan<byte> source);
public static MLKem ImportPkcs8PrivateKey(byte[] source);
public static MLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, ReadOnlySpan<byte> source);
public static MLKem ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, ReadOnlySpan<byte> source);
public static MLKem ImportEncryptedPkcs8PrivateKey(string password, byte[] source);
public static MLKem ImportFromPem(ReadOnlySpan<char> source);
public static MLKem ImportFromPem(string source);
public static MLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password);
public static MLKem ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<byte> passwordBytes);
public static MLKem ImportFromEncryptedPem(string source, string password);
public static MLKem ImportFromEncryptedPem(string source, byte[] passwordBytes);
public void Dispose();
protected virtual void Dispose(bool disposing);
}
}