What ML-DSA is and why certificates need it
ML-DSA is the post-quantum digital signature standardised in 2024. It will sign certificates, software updates and documents once quantum computers can forge today's RSA and ECDSA signatures.
A forged certificate lets an attacker pose as your bank. Signatures only need to be safe on the day they are checked, but every certificate authority has to move first.
By the end of this lesson
Note
I can sign a file and issue a certificate with ML-DSA using OpenSSL.
Key words
| Word | What it means | Example |
|---|---|---|
| ML-DSA | the standard post-quantum signature, built on lattices | |
| Signature | bytes that prove who signed a message and that it is unchanged | |
| Certificate authority | a key trusted to sign other keys' certificates | |
| Root certificate | a CA certificate that signs itself | |
| Signing request | a file asking a CA to certify a key | shop.csr |
| Chain | certificates from a server back to a root |
The cells students fill in are left blank in this preview.
Post-quantum signatures are much bigger
ML-DSA comes in ML-DSA-44, ML-DSA-65 and ML-DSA-87, with rising strength and size. Its signatures are kilobytes where Ed25519's are 64 bytes. Every certificate in a chain carries one signature and one public key, so a chain grows fast.
A second standard, SLH-DSA, is built only on hashes. It is slower and bigger again, and kept for when caution matters most.
Worked example: signature and key sizes
| Algorithm | Public key | Signature | Broken by Shor? |
|---|---|---|---|
| Ed25519 | 32 bytes | 64 bytes | Yes |
| RSA-2048 | 256 bytes | 256 bytes | Yes |
| ML-DSA-44 | 1312 bytes | 2420 bytes | No |
| ML-DSA-65 | 1952 bytes | 3309 bytes | No |
| ML-DSA-87 | 2592 bytes | 4627 bytes | No |
The cells students fill in are left blank in this preview.
Sign and check a notice
The lab wrote notice.txt, a short payment notice. The Runs make an ML-DSA-65 key pair, sign the notice and check the signature with the public key.
Then they change 480 pounds to 980 in a copy and check again. A good signature must fail on the changed copy.
Make an ML-DSA-65 key pair
docker exec pq openssl genpkey -algorithm ML-DSA-65 -out signer.pemShown here, not run. Press Start lab to type it into your own lab’s terminal.
Copy out the public key
docker exec pq openssl pkey -in signer.pem -pubout -out signer.pubShown here, not run. Press Start lab to type it into your own lab’s terminal.
Sign the notice
docker exec pq openssl pkeyutl -sign -rawin -inkey signer.pem -in notice.txt -out notice.sigShown here, not run. Press Start lab to type it into your own lab’s terminal.
Check the signature
docker exec pq openssl pkeyutl -verify -rawin -pubin -inkey signer.pub -in notice.txt -sigfile notice.sigShown here, not run. Press Start lab to type it into your own lab’s terminal.
Measure the notice and its signature
docker exec pq wc -c notice.txt notice.sigShown here, not run. Press Start lab to type it into your own lab’s terminal.
Change the amount in a copy
docker exec pq sh -c "sed s/480/980/ notice.txt > changed.txt"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
Check the old signature on the copy
docker exec pq sh -c "openssl pkeyutl -verify -rawin -pubin -inkey signer.pub -in changed.txt -sigfile notice.sig 2>/dev/null"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
What the signing Runs print
| Run | What it prints |
|---|---|
| Check the signature | Signature Verified Successfully |
| wc -c | 69 notice.txt, 3309 notice.sig, 3378 total |
| Check on the changed copy | Signature Verification Failure |
The cells students fill in are left blank in this preview.
A small certificate authority
A certificate authority, or CA, signs certificates. The Runs make a root CA that signs itself with ML-DSA-65. A shop server makes its own ML-DSA-44 key and a signing request, and the CA signs it.
openssl verify then checks the shop's certificate against the root. The serial numbers are set by hand so the output is the same every time.
The CA makes its key
docker exec pq openssl genpkey -algorithm ML-DSA-65 -out root.keyShown here, not run. Press Start lab to type it into your own lab’s terminal.
The CA signs its own certificate
docker exec pq openssl req -x509 -new -key root.key -subj "/CN=Class Root CA" -days 365 -set_serial 1 -out root.crtShown here, not run. Press Start lab to type it into your own lab’s terminal.
The shop makes an ML-DSA-44 key
docker exec pq openssl genpkey -algorithm ML-DSA-44 -out shop.keyShown here, not run. Press Start lab to type it into your own lab’s terminal.
The shop writes a signing request
docker exec pq openssl req -new -key shop.key -subj /CN=shop.lab -out shop.csrShown here, not run. Press Start lab to type it into your own lab’s terminal.
The CA issues the shop's certificate
docker exec pq openssl x509 -req -in shop.csr -CA root.crt -CAkey root.key -days 90 -set_serial 1001 -out shop.crtShown here, not run. Press Start lab to type it into your own lab’s terminal.
Verify the shop's certificate
docker exec pq openssl verify -CAfile root.crt shop.crtShown here, not run. Press Start lab to type it into your own lab’s terminal.
Read who signed what
docker exec pq sh -c "openssl x509 -in shop.crt -noout -text | grep -E 'Issuer:|Subject:|Algorithm'"Shown here, not run. Press Start lab to type it into your own lab’s terminal.
What the CA Runs print
| Run | What it prints |
|---|---|
| Issue the certificate | Certificate request self-signature ok, then subject=CN=shop.lab |
| Verify | shop.crt: OK |
| Read who signed what | Signature Algorithm: ML-DSA-65, Issuer: CN=Class Root CA, Subject: CN=shop.lab, Public Key Algorithm: ML-DSA-44, then Signature Algorithm: ML-DSA-65 again |
The cells students fill in are left blank in this preview.
A common mistake
Warning
Many people think a certificate uses one algorithm. It holds two: the key it certifies and the signature its issuer made. The shop's key is ML-DSA-44, but the CA signed it with ML-DSA-65. Check both when you list what must change.