# Migrate: certificates and private PKI

**What is at stake.** A signing certificate authenticates a peer. A future forgery can compromise authentication. Legacy TLS RSA key transport also uses the certificate’s RSA key to protect the session secret, exposing recorded sessions to later decryption. Prioritize that transport separately. Start planning replacement of long-lived roots and intermediates early.

## Public website certificates (rule `CRT-CLASSIC`)

- Leaf certificates stay RSA or ECDSA until your certificate authority issues ML-DSA certificates that browsers accept. Whether any public CA does today was not verified here: ask your CA, and check the vendor docs.
- What you can do now: make reissue boring. Automate issuance and renewal (ACME), shorten lifetimes, and keep an inventory of every certificate and where it is installed (`pq/cbom.json` lists the ones the scan found).
- Weak today (fix in wave 0, unrelated to quantum): RSA keys under 2048 bits, SHA-1 signatures (`WEAK-RSA-SMALL`, `WEAK-SIG-SHA1`).
- The human reissues and installs certificates (rule 5). You write the exact steps and the rollback (keep the old certificate and key in place until the new one is confirmed by a probe).

## Private PKI (internal CA, mTLS, device certificates)

1. List roots and intermediates with `notAfter` past the horizon (`2030-01-01` by default). Those are `trust-anchor` findings.
2. For each, write a re-root plan for the human: which relying parties must trust a new root, how the new root is distributed, and how long both roots stay trusted side by side.
3. For a long-lived new root, SLH-DSA (FIPS 205) is the conservative choice; ML-DSA (FIPS 204) for intermediates and leaves where every relying party supports it. Check each relying party first: an internal client that cannot verify ML-DSA breaks the whole chain.

## Issuing ML-DSA certificates for internal tests

OpenSSL 3.5.0+ supports ML-DSA and SLH-DSA. The command below generated a temporary ML-DSA-65 test CA on OpenSSL 3.6.1. Run it in a new private directory outside the repository.

```sh
openssl version                                        # must be 3.5.0 or newer
openssl req -x509 -newkey ML-DSA-65 -nodes -keyout test-ca.key -out test-ca.crt -days 30 -subj "/CN=PQ Shift test CA"
openssl x509 -in test-ca.crt -noout -text | grep -i "signature algorithm"
```

Keep test keys out of the repository (the scanner flags key files) and delete them after the test. Never generate production CA keys this way: production roots belong in an HSM or KMS, created by the human.

Library support for parsing ML-DSA certificates (from vendor docs, checked 2026-12-03): Go 1.27 `crypto/x509`; Python `cryptography` 49.0.0+ (loading certificates with ML-DSA public keys); Node 24.6.0+ can sign and verify with ML-DSA keys.

## How to prove

P1 (re-scan): weak certificates closed. For a new private root: a test client that verifies a chain under the new root, and an old client that still verifies under the old root (P3).
