How to set up cipher suites and the key exchange

Cipher suite and group decide how an HTTPS connection agrees on its key and what it encrypts with. A good list is short and holds only methods nobody can break today.

How it works

In the TLS handshake the browser lists the cipher suites and groups it supports; the server picks from them. A name like TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 reads from left to right:

  • ECDHE is the key exchange: browser and server create a short-lived key of its own for every connection.
  • RSA is the signature the server identifies itself with through its certificate.
  • AES_256_GCM is the encryption of the data, here AES with a 256-bit key in GCM mode.
  • SHA384 is the hash function for deriving the keys.

In TLS 1.3 the suite names only encryption and hash (TLS_AES_256_GCM_SHA384). The key exchange is agreed on separately through the group: an elliptic curve such as X25519 or P-256, or a hybrid post-quantum group such as X25519MLKEM768.

Forward secrecy follows from the short-lived key: whoever steals the server's key later still cannot open recorded connections. With the old RSA key exchange (TLS_RSA_WITH_…) they can.

What counts is everything the server accepts, not only what a current browser gets. A single weak suite is enough if an old client picks it or an attacker pushes the connection there.

What matters

  • Authenticated encryption only. AES-GCM and ChaCha20-Poly1305 are the state of the art. Suites in CBC mode are not broken, but no current recommendation lists them any more.
  • No broken methods. RC4, DES, 3DES, EXPORT, NULL and anonymous suites belong off the list. 3DES can be attacked on long connections (Sweet32), the others can be broken or do not encrypt at all.
  • Key exchange with ECDHE only. That gives every client forward secrecy. No current browser needs suites with RSA key exchange.
  • Diffie-Hellman with at least 2048 bits. If the server accepts DHE suites, the size of the prime counts. The researchers behind Logjam (2015) broke 512 bits themselves, consider 768 bits feasible for an academic team and 1024 bits for a nation-state, and recommend 2048 bits. Leaving DHE out altogether is simpler.
  • Curves: P-384 ahead of the 256-bit curves. Curves below 224 bits have long counted as too weak. Since December 2026 browsers and certificate authorities have been moving away from the 256-bit curves as well, as a precaution: Firefox intends to prefer P-384 ahead of X25519 and P-256, and from 15 March 2027 Chrome no longer trusts certificate authorities with a P-256 key. No practical attack is publicly known, and Germany's BSI still lists secp256r1 until 2031 in its guideline of January 2026. Put P-384 ahead of X25519 and P-256 in the list all the same. No classic curve helps against quantum computers; that is what the hybrid group is for, see post-quantum cryptography.
  • 256 bits where rules require it. AES-128 is secure. Strict rules such as the NSA's CNSA 2.0 require AES-256; then you move the 256-bit suites to the front.
  • Behind a CDN you set suites and groups at the CDN, because the visitor's connection ends there.

How to set it up

The lines follow Mozilla's “intermediate” recommendation (SSL Configuration Generator), with the hybrid post-quantum group added in first place.

Web server
ssl_ecdh_curve X25519MLKEM768:SecP384r1MLKEM1024:secp384r1:X25519:prime256v1;
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256;
ssl_conf_command Ciphersuites TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256;
ssl_prefer_server_ciphers on;
SSLOpenSSLConfCmd Groups X25519MLKEM768:SecP384r1MLKEM1024:secp384r1:X25519:prime256v1
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256
SSLCipherSuite TLSv1.3 TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256
SSLHonorCipherOrder on

The list puts the 256-bit suites first and lets the server decide the order. The line for TLS 1.3 sets the same order there. Only OpenSSL 3.5 knows X25519MLKEM768; with an older version leave the group out until the system is updated. Which protocol versions go with it is covered in TLS settings.

More on Encryption and quantum safety

Check your website now

The security check shows within seconds which headers are missing, with ready lines to copy.

Check website