Enable post-quantum cryptography
Post-quantum cryptography (PQC) protects TLS connections against future quantum computers. A quantum computer powerful enough to break current public-key algorithms like RSA and Elliptic Curve Cryptography (ECC) could decrypt traffic captured today. Security teams call this threat harvest now, decrypt later. F5 NGINXaaS for AWS addresses this with two modes:
- Hybrid mode: Combines classical elliptic-curve key exchange with the Module-Lattice-Based Key-Encapsulation Mechanism (ML-KEM) for data encryption. This protects against quantum attacks while staying compatible with clients that don’t yet support PQC.
- Full PQC mode: Uses Module-Lattice-Based Digital Signature Algorithm (ML-DSA) certificates and keys that you provide. This gives you a fully post-quantum TLS stack when both client and server support it.
Before you begin, ensure you have:
- An existing NGINXaaS for AWS deployment: See Create a deployment if you need to create one.
- TLS 1.3 in your NGINX configuration: NGINX includes TLSv1.3 in its default
ssl_protocolsvalue alongside TLSv1.2. ML-KEM hybrid key exchange only applies to TLS 1.3 connections. To prevent clients from downgrading to TLS 1.2, restrictssl_protocolstoTLSv1.3only - this is recommended for maximum security but drops support for older clients.
Hybrid mode is active by default. NGINX includes TLSv1.3 in its default ssl_protocols value, and ML-KEM hybrid groups are part of the default key exchange group list. No configuration changes are required in the NGINXaaS console for hybrid mode to work.
Clients that support ML-KEM will negotiate it automatically on TLS 1.3 connections. Clients that don’t support ML-KEM fall back to classical key exchange.
Because hybrid ML-KEM key exchange applies only to TLS 1.3 connections, allowing TLS 1.2 means some clients can still negotiate a purely classical handshake. To prevent a downgrade, restrict ssl_protocols to TLSv1.3 only:
-
Select Configurations in the left menu.
-
Select the ellipsis (three dots) next to your configuration and select Edit.
-
Add
ssl_protocols TLSv1.3;to yourserverblock:nginx server { listen 443 ssl; ssl_protocols TLSv1.3; ssl_certificate /etc/nginx/certs/server.crt; ssl_certificate_key /etc/nginx/certs/server.key; # ... } -
Select Next and then Save to apply the change.
-
Deploy configuration to relevant deployments.
Restricting to TLSv1.3 drops support for clients that only support TLS 1.2. If you need to support older clients, keep the defaultssl_protocolsvalue and accept that those connections won’t use ML-KEM.
If you want to enforce a specific group order or exclude classical-only groups, set ssl_ecdh_curve in your server block. The following snippet enables ML-KEM hybrid (X25519MLKEM768) first, with X25519 as a classical fallback:
server {
listen 443 ssl;
ssl_protocols TLSv1.3;
ssl_ecdh_curve X25519MLKEM768:X25519;
ssl_certificate /etc/nginx/certs/server.crt;
ssl_certificate_key /etc/nginx/certs/server.key;
# ...
}IncludingX25519afterX25519MLKEM768lets clients that don’t support ML-KEM fall back to classical key exchange. RemoveX25519only if you want to restrict connections to ML-KEM-capable clients.
Full PQC mode requires you to upload an ML-DSA certificate and private key. NGINXaaS for AWS accepts ML-DSA keys in PEM format with the following constraints:
- NGINXaaS Console: Seed-only key format only.
- AWS Secrets Manager: Seed-only and seed-priv formats are both supported.
Choose the method that matches your key format.
Use this method if your ML-DSA private key is in seed-only format.
-
Follow the steps in Add certificates using the Console to upload your ML-DSA certificate and key.
-
In your NGINX configuration, reference the certificate and key with
ssl_certificateandssl_certificate_key, and setssl_protocols TLSv1.3;:nginx server { listen 443 ssl; ssl_protocols TLSv1.3; ssl_certificate /etc/nginx/certs/mldsa.crt; ssl_certificate_key /etc/nginx/certs/mldsa.key; # ... } -
Select Next and then Save to apply the change.
-
Deploy configuration to relevant deployments.
Use this method if your ML-DSA private key is in seed-priv format, or if you want to keep your keys within AWS.
- Add your ML-DSA certificate and key to AWS Secrets Manager. Follow the steps in Add an SSL/TLS certificate to AWS Secrets Manager.
- Reference the secret in your NGINX configuration as described in Use an AWS Secrets Manager certificate in an NGINX configuration.
- Add
ssl_protocols TLSv1.3;to yourserverblock.
To confirm that a client is negotiating a post-quantum key exchange group with your deployment, inspect the TLS handshake from the client side using OpenSSL:
openssl s_client -connect <YOUR_DEPLOYMENT_ENDPOINT>:443 -groups X25519MLKEM768In the output, look for the Negotiated TLS1.3 group line. A successful hybrid negotiation shows:
Negotiated TLS1.3 group: X25519MLKEM768If you see X25519 or another classical group instead, confirm that ssl_protocols TLSv1.3; is set, and that no ssl_ecdh_curve directive is overriding the defaults with classical-only groups.
OpenSSL spot-checks confirm your server is ready, but they don’t show which of your actual clients negotiate ML-KEM. Use the $ssl_curve NGINX variable to log the key exchange group negotiated for each connection, then analyze the logs to measure adoption over time.
Add a custom log_format and an access_log directive to your NGINX configuration:
http {
log_format pqc_tracking '$remote_addr - $ssl_protocol $ssl_curve';
access_log /var/log/nginx/ssl-details.log pqc_tracking;
# ...
}In the logs, connections that negotiated ML-KEM hybrid key exchange appear with X25519MLKEM768 in a value of the $ssl_curve variable. Classical TLS 1.3 connections appear with X25519 or another classical group name, and TLS 1.2 connections return an empty value.
To forward logs to AWS CloudWatch, see Enable NGINX logs.
- SSL/TLS certificate overview - supported certificate types, formats, and rotation options.
- Add certificates using the Console - manage certificates alongside your NGINX configuration.
- Add certificates from AWS Secrets Manager - fetch secrets directly from AWS Secrets Manager.