<PackageReference Include="Microsoft.Bcl.Cryptography" Version="10.0.10" />

System.Security.Cryptography.MLDsa

public abstract class MLDsa : IDisposable
Represents an ML-DSA key.
namespace System.Security.Cryptography { public abstract class MLDsa : IDisposable { private delegate TResult ExportPkcs8PrivateKeyFunc<TResult> (ReadOnlySpan<byte> pkcs8); public MLDsaAlgorithm Algorithm { get; } public static bool IsSupported { get; } protected MLDsa(MLDsaAlgorithm algorithm); public void Dispose(); public void SignData(ReadOnlySpan<byte> data, Span<byte> destination, ReadOnlySpan<byte> context = default(ReadOnlySpan<byte>)); public byte[] SignData(byte[] data, byte[] context = null); public bool VerifyData(ReadOnlySpan<byte> data, ReadOnlySpan<byte> signature, ReadOnlySpan<byte> context = default(ReadOnlySpan<byte>)); public bool VerifyData(byte[] data, byte[] signature, byte[] context = null); public void SignPreHash(ReadOnlySpan<byte> hash, Span<byte> destination, string hashAlgorithmOid, ReadOnlySpan<byte> context = default(ReadOnlySpan<byte>)); public byte[] SignPreHash(byte[] hash, string hashAlgorithmOid, byte[] context = null); public bool VerifyPreHash(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> signature, string hashAlgorithmOid, ReadOnlySpan<byte> context = default(ReadOnlySpan<byte>)); public bool VerifyPreHash(byte[] hash, byte[] signature, string hashAlgorithmOid, byte[] context = null); public byte[] SignMu(byte[] externalMu); public byte[] SignMu(ReadOnlySpan<byte> externalMu); public void SignMu(ReadOnlySpan<byte> externalMu, Span<byte> destination); protected abstract void SignMuCore(ReadOnlySpan<byte> externalMu, Span<byte> destination); public bool VerifyMu(byte[] externalMu, byte[] signature); public bool VerifyMu(ReadOnlySpan<byte> externalMu, ReadOnlySpan<byte> signature); protected abstract bool VerifyMuCore(ReadOnlySpan<byte> externalMu, ReadOnlySpan<byte> signature); public byte[] ExportSubjectPublicKeyInfo(); public bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten); public string ExportSubjectPublicKeyInfoPem(); public byte[] ExportPkcs8PrivateKey(); public bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritten); protected abstract bool TryExportPkcs8PrivateKeyCore(Span<byte> destination, out int bytesWritten); public string ExportPkcs8PrivateKeyPem(); public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters); public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters); public byte[] ExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters); public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten); public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten); public bool TryExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten); public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, PbeParameters pbeParameters); public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters); public string ExportEncryptedPkcs8PrivateKeyPem(string password, PbeParameters pbeParameters); public byte[] ExportMLDsaPublicKey(); public void ExportMLDsaPublicKey(Span<byte> destination); public byte[] ExportMLDsaPrivateKey(); public void ExportMLDsaPrivateKey(Span<byte> destination); public byte[] ExportMLDsaPrivateSeed(); public void ExportMLDsaPrivateSeed(Span<byte> destination); public static MLDsa GenerateKey(MLDsaAlgorithm algorithm); public static MLDsa ImportSubjectPublicKeyInfo(ReadOnlySpan<byte> source); public static MLDsa ImportSubjectPublicKeyInfo(byte[] source); public static MLDsa ImportPkcs8PrivateKey(ReadOnlySpan<byte> source); public static MLDsa ImportPkcs8PrivateKey(byte[] source); public static MLDsa ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, ReadOnlySpan<byte> source); public static MLDsa ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, ReadOnlySpan<byte> source); public static MLDsa ImportEncryptedPkcs8PrivateKey(string password, byte[] source); public static MLDsa ImportFromPem(ReadOnlySpan<char> source); public static MLDsa ImportFromPem(string source); public static MLDsa ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password); public static MLDsa ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<byte> passwordBytes); public static MLDsa ImportFromEncryptedPem(string source, string password); public static MLDsa ImportFromEncryptedPem(string source, byte[] passwordBytes); public static MLDsa ImportMLDsaPublicKey(MLDsaAlgorithm algorithm, ReadOnlySpan<byte> source); public static MLDsa ImportMLDsaPublicKey(MLDsaAlgorithm algorithm, byte[] source); public static MLDsa ImportMLDsaPrivateKey(MLDsaAlgorithm algorithm, ReadOnlySpan<byte> source); public static MLDsa ImportMLDsaPrivateKey(MLDsaAlgorithm algorithm, byte[] source); public static MLDsa ImportMLDsaPrivateSeed(MLDsaAlgorithm algorithm, ReadOnlySpan<byte> source); public static MLDsa ImportMLDsaPrivateSeed(MLDsaAlgorithm algorithm, byte[] source); protected virtual void Dispose(bool disposing); protected abstract void SignDataCore(ReadOnlySpan<byte> data, ReadOnlySpan<byte> context, Span<byte> destination); protected abstract bool VerifyDataCore(ReadOnlySpan<byte> data, ReadOnlySpan<byte> context, ReadOnlySpan<byte> signature); protected abstract void SignPreHashCore(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> context, string hashAlgorithmOid, Span<byte> destination); protected abstract bool VerifyPreHashCore(ReadOnlySpan<byte> hash, ReadOnlySpan<byte> context, string hashAlgorithmOid, ReadOnlySpan<byte> signature); protected abstract void ExportMLDsaPublicKeyCore(Span<byte> destination); protected abstract void ExportMLDsaPrivateKeyCore(Span<byte> destination); protected abstract void ExportMLDsaPrivateSeedCore(Span<byte> destination); } }