Created
January 7, 2026 20:10
-
-
Save AnthonyGiretti/3466ad5494b7a44d37f16d3c00ce1761 to your computer and use it in GitHub Desktop.
.NET 10 Post Quantum cryptography; exemple with ML-DSA signature algo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Security.Cryptography; | |
| byte[] data = "hello PQC"u8.ToArray(); | |
| // 1) Generate a post-quantum signature key (ML-DSA) | |
| using var signingKey = MLDSA.GenerateKey(MLDSAAlgorithm.MLDSA65); | |
| // 2) Sign the data | |
| byte[] signature = signingKey.SignData(data); | |
| // 3) Export the public key (PEM) and re-import it for verification | |
| string publicPem = signingKey.ExportSubjectPublicKeyInfoPem(); | |
| using var verifyKey = MLDSA.ImportFromPem(publicPem); | |
| // 4) Verify the signature | |
| bool ok = verifyKey.VerifyData(data, signature); | |
| Console.WriteLine(ok); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment