Created
January 19, 2026 01:40
-
-
Save AnthonyGiretti/8f6304003b8e6ef0013be459a1e5418d to your computer and use it in GitHub Desktop.
.NET 10 Post Quantum Cryptography, example with SLH-DSA
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 = "critical firmware update"u8.ToArray(); | |
| // Generate SLH-DSA key | |
| using var signingKey = SLHDSA.GenerateKey(SLHDSAAlgorithm.SLHDSA128S); | |
| // Sign the data | |
| byte[] signature = signingKey.SignData(data); | |
| // Export public key | |
| string publicPem = signingKey.ExportSubjectPublicKeyInfoPem(); | |
| // Import for verification | |
| using var verifyKey = SLHDSA.ImportFromPem(publicPem); | |
| // Verify 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