| 1 | # Post Quantum (PQ) Support |
| 2 | |
| 3 | s2n-tls supports both post-quantum key exchange and post-quantum authentication for TLS1.3. |
| 4 | |
| 5 | ## Key Exchange: ML-KEM |
| 6 | |
| 7 | Currently, only [ML-KEM](https://csrc.nist.gov/pubs/fips/203/final) is supported for post-quantum key exchange. |
| 8 | |
| 9 | s2n-tls supports both hybrid and pure PQ key exchange. |
| 10 | |
| 11 | - Hybrid PQ key exchange involves performing both classic ECDH key exchange and post-quantum key exchange, then combining the two resultant secrets. This strategy combines the high assurance of the classical key exchange algorithms with the quantum-resistance of the new post-quantum key exchange algorithms. If one of the two algorithms is compromised, either because advances in quantum computing make the classic algorithms insecure or because cryptographers find a flaw in the relatively new post-quantum algorithms, the secret is still secure. Hybrid post-quantum key exchange is more secure than standard key exchange, but is slower and requires more processing and more network bandwidth. |
| 12 | |
| 13 | - Pure PQ key exchange involves only post-quantum key exchange, without classic ECC components. It is a simpler long-term architecture compared to hybrid PQ algorithms. However, Pure PQ key exchange might lead to potential incompatibility with older devices as it takes no dependence on traditional ECC algorithms. |
| 14 | |
| 15 | Careful: An s2n-tls server that enables post-quantum cryptography will mandate post-quantum key exchange with any client advertising post-quantum algorithms. This can result in a retry and an extra round trip if the client does not initially send a post-quantum key share. The rationale behind this behavior is that post-quantum users prioritize security over the potential cost of an extra round trip. |
| 16 | |
| 17 | ## Authentication: ML-DSA |
| 18 | |
| 19 | Currently, only [ML-DSA](https://csrc.nist.gov/pubs/fips/204/final) is supported for post-quantum authentication. |
| 20 | |
| 21 | In order to use ML-DSA, you must configure s2n-tls to use an ML-DSA certificate, just as you would configure an RSA or ECDSA certificate. See [certificates](./ch09-certificates.md). |
| 22 | |
| 23 | ## Requirements |
| 24 | |
| 25 | ### AWS-LC |
| 26 | |
| 27 | s2n-tls must be built with aws-lc to use post-quantum algorithms. See the [s2n-tls build documentation](https://github.com/aws/s2n-tls/blob/main/docs/BUILD.md#building-with-a-specific-libcrypto) for how to build with aws-lc. For ML-DSA, you will need to use a version of AWS-LC >= v1.50.0 (API version 33). |
| 28 | |
| 29 | If you're unsure what cryptography library s2n-tls is built against, trying running s2nd or s2nc: |
| 30 | ``` |
| 31 | > s2nd localhost 8000 |
| 32 | libcrypto: AWS-LC |
| 33 | Listening on localhost:8000 |
| 34 | ``` |
| 35 | |
| 36 | ### Security Policy |
| 37 | |
| 38 | Post-quantum algorithms are enabled by configuring a security policy (see [Security Policies](./ch06-security-policies.md)) that supports post-quantum algorithms. |
| 39 | |
| 40 | "default_pq" is the equivalent of "default_tls13", but with PQ support. Like the other default policies, "default_pq" may change as a result of library updates. The fixed, numbered equivalent of "default_pq" is currently "20250721". For previous defaults, see the "Default Policy History" section below. |
| 41 | |
| 42 | "cnsa_2" is derived from [Commercial National Security Algorithm (CNSA) Suite Profile for TLS 1.3](https://datatracker.ietf.org/doc/draft-becker-cnsa2-tls-profile/). This is a TLS 1.3 PQ only policy that requires pure ML-KEM-1024 for key exchange and ML-DSA-87 for signature and certificate verification. |
| 43 | |
| 44 | "cnsa_1_2_interop" is a transitional policy from CNSA 1.0 / RFC 9151 (non-PQ) to CNSA 2.0 (PQ only). It combines all the supported algorithms in the "cnsa_2" and "rfc9151" (see [Security Policies](./ch06-security-policies.md)) policies. Like other default policies, these CNSA policies are subject to the source RFC definition changes. |
| 45 | |
| 46 | Other available PQ policies are compared in the tables below. |
| 47 | |
| 48 | ### Chart: Security Policy Version To PQ Key Exchange Methods (ML-KEM) |
| 49 | |
| 50 | | Version | x25519+mlkem768 | secp256r1+mlkem768 | secp384r1+mlkem1024 | mlkem1024 | |
| 51 | |-----------------------|-----------------|--------------------|---------------------|-----------| |
| 52 | | default_pq / 20250721 | X | X | X | | |
| 53 | | 20250512 | X | X | | | |
| 54 | | cnsa_2 | | | | X | |
| 55 | | cnsa_1_2_interop | | | | X | |
| 56 | |
| 57 | ### Chart: Security Policy Version To Signature Schemes |
| 58 | |
| 59 | | Version | ML-DSA | ECDSA | RSA | RSA-PSS | Legacy SHA1 | |
| 60 | |-----------------------|--------|-------|-----|---------|-------------| |
| 61 | | default_pq / 20250721 | X | X | X | X | | |
| 62 | | 20250512 | X | X | X | X | | |
| 63 | | cnsa_2 | 87 | | | | | |
| 64 | | cnsa_1_2_interop | 87 | X | X | X | | |
| 65 | |
| 66 | ### Chart: Security Policy Version To Classic Key Exchange |
| 67 | |
| 68 | If the peer doesn't support a PQ hybrid key exchange method, s2n-tls will fall back to a classical option. |
| 69 | |
| 70 | Note: the "cnsa_2" policy only allows ML-KEM-1024, thus there is no fallback to classic key exchange. |
| 71 | |
| 72 | | Version | secp256r1 | x25519 | secp384r1 | secp521r1 | DHE | RSA | |
| 73 | |-----------------------|-----------|--------|-----------|-----------|-----|-----| |
| 74 | | default_pq / 20250721 | X | X | X | X | | | |
| 75 | | 20250512 | X | X | X | X | | | |
| 76 | | cnsa_1_2_interop | | | X | | | | |
| 77 | |
| 78 | ### Chart: Security Policy Version To Ciphers |
| 79 | |
| 80 | | Version | AES-CBC | AES-GCM | CHACHAPOLY | 3DES | |
| 81 | |-----------------------|---------|---------|------------|------| |
| 82 | | default_pq / 20250721 | X | X | X | | |
| 83 | | 20250512 | X | X | X | | |
| 84 | | cnsa_2 | | X | | | |
| 85 | | cnsa_1_2_interop | | X | | | |
| 86 | |
| 87 | ### Chart: Security Policy Version To TLS Protocol Version |
| 88 | |
| 89 | | Version | 1.2 | 1.3 | |
| 90 | |-----------------------|-----|-----| |
| 91 | | default_pq / 20250721 | X | X | |
| 92 | | 20250512 | X | X | |
| 93 | | cnsa_2 | | X | |
| 94 | | cnsa_1_2_interop | X | X | |
| 95 | |
| 96 | #### Default Policy History |
| 97 | | Version | "default_pq" | |
| 98 | |------------|--------------| |
| 99 | | v1.5.23 | 20250721 | |
| 100 | | v1.5.19 | 20250512 | |
| 101 | | v1.5.6 | 20241001 | |
| 102 | | v1.5.0 | 20240730 | |
| 103 | |
| 104 | ## Visibility |
| 105 | Call `s2n_connection_get_kem_group_name` to determine if a TLS handshake negotiated PQ key exchange. |