TLS cipher suites: what they are and how to read them

12 min readUpdated

A cipher suite is a named set of algorithms that a client and a server agree to use for one TLS connection. In TLS 1.2 the name lists all of them: key exchange, authentication, encryption and the hash for key derivation [2]. TLS 1.3 cipher suites name only the encryption and the hash, because key exchange and signatures are negotiated on their own [1]. Both sides settle on one suite during the TLS handshake, and it is part of the TLS protocol section.

Chosen
in the handshake: the client lists its suites by preference, the server picks one [1]
TLS 1.2 example
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, value 0xC0,0x2F [3]
TLS 1.3 suites
five, defined in RFC 9846, which replaced RFC 8446; OpenSSL enables three by default [1]
TLS 1.2 key exchange
ECDHE; static RSA and finite-field Diffie-Hellman suites are MUST NOT under RFC 10015 [5]
When none match
the handshake fails; see cipher mismatch [1]

What a cipher suite does

A TLS connection needs four jobs done: agree on a shared secret without revealing it, prove the server holds its certificate's private key, encrypt the data, and protect every record against changes in transit. In RFC 5246, which defined TLS 1.2 and its cipher suites, each suite defines a key exchange algorithm, a bulk encryption algorithm with its key length, a MAC algorithm and a PRF [2].

The server selects a single suite from the client's list, and it holds for the connection [2]. Another client may get a different one: in our test, a default OpenSSL client got TLS_AES_256_GCM_SHA384, and a client that put ChaCha20 first got TLS_CHACHA20_POLY1305_SHA256 [14].

How to read a TLS 1.2 suite name

Take TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 apart. RFC 5289 defines it with the value 0xC0,0x2F [3]:

How to read a TLS 1.2 suite name
PartJobMeaning
ECDHEkey exchangeephemeral elliptic-curve Diffie-Hellman, a new key per connection, which gives forward secrecy
RSAauthenticationthe server signs the key exchange with its certificate's RSA key
AES_128_GCMencryptionAES, 128-bit key, GCM mode: authenticated encryption, which also detects changes
SHA256hashfor the TLS 1.2 PRF that derives keys; GCM gives integrity, shown by OpenSSL as Mac=AEAD [14]

The authentication part decides which certificate the suite can work with. RFC 8422 requires an RSA public key in the certificate for ECDHE_RSA and an ECDSA- or EdDSA-capable key for ECDHE_ECDSA [3]. A server whose list allows only ECDSA suites while its certificate has an RSA key cannot complete a TLS 1.2 handshake.

What that mismatch looks like

A test server with an RSA certificate and one ECDSA suite, a client over TLS 1.2; commands shortened, output trimmed, process ID shown as <pid> [14]:

$ openssl s_server -accept 8443 -cert rsa.pem -key rsa.key -cipher 'ECDHE-ECDSA-AES128-GCM-SHA256' -no_tls1_3
$ openssl s_client -connect localhost:8443 -servername www.example.com -tls1_2
<pid>:error:0A000410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:../ssl/record/rec_layer_s3.c:1599:SSL alert number 40
New, (NONE), Cipher is (NONE)

Alert 40 is handshake_failure [2]. The ECDSA suite was in both lists, but it needs an ECDSA key and the certificate had none, so the server found nothing usable and logged no shared cipher [3] [14].

What changed in TLS 1.3

TLS 1.3 took key exchange and authentication out of the suite. A TLS 1.3 suite names the AEAD algorithm that protects records and the hash used with HKDF. Key exchange groups travel in the supported_groups and key_share extensions and signature algorithms in signature_algorithms; without a pre-shared key, asymmetric key exchange and certificate authentication always happen. RFC 9846 defines the same five suites as RFC 8446 did [1]. The table adds the IANA Recommended flag [7] and the OpenSSL 3.0 default list [8]:

What changed in TLS 1.3
SuiteValueRFC 9846 §9.1IANA RecommendedOpenSSL 3.0 default
TLS_AES_128_GCM_SHA2560x13,0x01MUST implementYyes
TLS_AES_256_GCM_SHA3840x13,0x02SHOULD implementYyes
TLS_CHACHA20_POLY1305_SHA2560x13,0x03SHOULD implementYyes
TLS_AES_128_CCM_SHA2560x13,0x04not listedYno
TLS_AES_128_CCM_8_SHA2560x13,0x05not listedNno

Every remaining cipher is AEAD, static RSA and static Diffie-Hellman suites are gone, and every public-key key exchange provides forward secrecy. Suites do not cross versions: a TLS 1.3 suite cannot be used for TLS 1.2, and the reverse [1].

Why some suites are there

ChaCha20-Poly1305 covers hardware without AES acceleration: RFC 8439 describes ChaCha20 as considerably faster than AES in software-only implementations [6]. CCM_8 carries a truncated authentication tag, which is why IANA does not mark it Recommended. The registry also holds two AEGIS suites, 0x13,0x06 and 0x13,0x07, from an Internet-Draft and marked N: no IETF consensus or limited use, not necessarily a flaw [7].

How client and server choose

In TLS 1.2 and TLS 1.3 alike, the client sends its cipher suites in the first message, in descending order of preference, as it does with application protocols in the ALPN extension [1] [2]. The server picks one cipher suite it also supports. Whose order counts is a server setting. OpenSSL follows the client unless the server sets ServerPreference [8]; nginx exposes this as ssl_prefer_server_ciphers and Apache as SSLHonorCipherOrder, both off by default [9] [10]. In our TLS 1.2 test (server lists AES-256-GCM first, client AES-128-GCM first), the client's choice won by default and the server's with -serverpref [14]. TLSRef's intermediate profile leaves the choice to the client: every suite on its list is strong, and the client knows whether it has hardware-accelerated AES [11].

When nothing matches

If the client's and the server's cipher suites share nothing, the server ends the handshake with a handshake failure alert, handshake_failure; TLS 1.3 also allows insufficient_security [1] [2]. In our TLS 1.3 test with no cipher suite in common (server TLS_AES_128_GCM_SHA256, client TLS_CHACHA20_POLY1305_SHA256), the client got SSL alert number 40 and the server logged no shared cipher [14]. Firefox reports this as SSL_ERROR_NO_CYPHER_OVERLAP and Chrome as ERR_SSL_VERSION_OR_CIPHER_MISMATCH [13]; fixes are on cipher mismatch.

Two naming systems

The same suite has two names. The standard name, registered in the IANA TLS Cipher Suites registry, is TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 [7]. OpenSSL has its own short names for TLS 1.2 and older suites, here ECDHE-RSA-AES128-GCM-SHA256, and nginx and Apache take cipher lists in OpenSSL's format. For TLS 1.3, OpenSSL uses the standard names [8] [9] [10]. openssl ciphers -stdname prints both:

$ openssl ciphers -stdname -v 'ECDHE-RSA-AES128-GCM-SHA256'
TLS_AES_256_GCM_SHA384                        - TLS_AES_256_GCM_SHA384         TLSv1.3 Kx=any      Au=any   Enc=AESGCM(256)            Mac=AEAD
TLS_CHACHA20_POLY1305_SHA256                  - TLS_CHACHA20_POLY1305_SHA256   TLSv1.3 Kx=any      Au=any   Enc=CHACHA20/POLY1305(256) Mac=AEAD
TLS_AES_128_GCM_SHA256                        - TLS_AES_128_GCM_SHA256         TLSv1.3 Kx=any      Au=any   Enc=AESGCM(128)            Mac=AEAD
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256         - ECDHE-RSA-AES128-GCM-SHA256    TLSv1.2 Kx=ECDH     Au=RSA   Enc=AESGCM(128)            Mac=AEAD

The string asked for one TLS 1.2 suite. OpenSSL 3.0.13 printed that suite after its three default TLS 1.3 suites [14], because in OpenSSL a cipher list sets TLS 1.2 and below and does not touch TLS 1.3 suites [8].

Setting TLS 1.2 and TLS 1.3 suites separately

In OpenSSL the TLS 1.2 setting is the cipher list, and TLS 1.3 cipher suites have a list of their own. Each piece of software names the two settings differently [8] [9] [10]:

Setting TLS 1.2 and TLS 1.3 suites separately
SoftwareTLS 1.2 and belowTLS 1.3
OpenSSL librarySSL_CTX_set_cipher_listSSL_CTX_set_ciphersuites
nginxssl_ciphersssl_conf_command Ciphersuites …
ApacheSSLCipherSuite SSL …SSLCipherSuite TLSv1.3 …

A test server given only -cipher 'ECDHE-RSA-AES128-GCM-SHA256' still negotiated TLS_AES_256_GCM_SHA384 with a TLS 1.3 client, and used the configured suite only with a client held to TLS 1.2 [14].

Which suites to allow

Two IETF documents set the floor for TLS 1.2. RFC 9325, the IETF's TLS recommendations (BCP 195), rules out cipher suites with NULL encryption, RC4 or less than 112 bits of security, and requires support for suites with forward secrecy and a preference for them [4]. RFC 10015 then tightened its key exchange rules for TLS 1.2 [5]:

Which suites to allow
TLS 1.2 key exchangeName prefixRFC 9325RFC 10015
Static RSATLS_RSA_WITH_*SHOULD NOTMUST NOT
Ephemeral finite-field DHTLS_DHE_*SHOULD NOTMUST NOT
Static finite-field DHTLS_DH_*SHOULD NOTMUST NOT
Static elliptic-curve DHTLS_ECDH_*SHOULD NOTno change

That leaves ECDHE. RFC 9325 adds that CBC-mode suites SHOULD NOT be used without the encrypt_then_mac extension, and recommends ECDHE with RSA or ECDSA and AES-128 or AES-256 in GCM mode [4]. TLS 1.3 needs no such filter: its five suites are all AEAD, and its public-key key exchange is always forward-secret [1].

Generating the exact list

For the configuration line itself, use the TLSRef Configurator, where the Mozilla SSL Configuration Generator has moved; it asks for your server software and version. Its intermediate profile, the one it recommends for almost all systems, enables TLS 1.2 and TLS 1.3 and allows, for TLS 1.2, only ECDHE suites with AES-GCM or ChaCha20-Poly1305 [11]. A generator follows the guidance as it changes; a hand-pasted list does not. Which protocol versions to enable is on TLS versions.

How to see what a server offers

To list every suite a server accepts, scan it with the Nmap script ssl-enum-ciphers, which tries one suite per connection and grades each accepted one [12]:

$ nmap -sV --script ssl-enum-ciphers -p 443 example.com

Nmap lists the script as intrusive, so scan only servers you are responsible for.

For one connection's suite, read the summary line of openssl s_client, such as New, TLSv1.3, Cipher is TLS_AES_256_GCM_SHA384. Over TLS 1.2 the line carries the OpenSSL name, as in New, TLSv1.2, Cipher is ECDHE-RSA-AES128-GCM-SHA256 [14].

Checking a cipher string before you use it

$ openssl ciphers -v 'ECDHE+AESGCM:ECDHE+CHACHA20'

On OpenSSL 3.0.13 it printed the three default TLS 1.3 suites, then six TLS 1.2 suites: ECDSA and RSA variants of AES-256-GCM, AES-128-GCM and ChaCha20-Poly1305. A string that selects nothing prints Error in cipher list and an error line naming no cipher match [14]. More commands are on OpenSSL commands.

FAQ

What is a cipher suite in TLS?

A named set of algorithms both sides use for one connection. In TLS 1.2 it names key exchange, authentication, encryption and the hash; in TLS 1.3 only encryption and the hash.

How many cipher suites does TLS 1.3 have?

Five, defined in RFC 9846 as in RFC 8446: TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256, TLS_AES_128_CCM_SHA256 and TLS_AES_128_CCM_8_SHA256. OpenSSL enables the first three by default.

Which cipher suites should I use?

TLS 1.3 with its defaults, and for TLS 1.2 only ECDHE suites with AES-GCM or ChaCha20-Poly1305. Generate the exact list for your server with the TLSRef Configurator.

What happens if the client and server have no cipher suite in common?

The server aborts the handshake with a fatal alert such as handshake_failure. Firefox reports SSL_ERROR_NO_CYPHER_OVERLAP and Chrome ERR_SSL_VERSION_OR_CIPHER_MISMATCH.

Why does OpenSSL use different cipher names?

OpenSSL has its own short names for TLS 1.2 and older suites, and nginx and Apache take lists in that format. openssl ciphers -stdname -v prints the standard name next to each one.

How do I check which cipher suite a website uses?

Run openssl s_client -connect example.com:443 and read the line that starts with New. To list every suite the server accepts, use the Nmap script ssl-enum-ciphers.

Sources

  1. RFC 9846, TLS 1.3 (obsoletes RFC 8446, RFC 5246 and RFC 8422): §1.2, §1.3, §4.2.1, §4.2.2, §9.1, B.4.

  2. RFC 5246, TLS 1.2: §7.2, §7.4.1.2, §7.4.1.3.

  3. RFC 5289: §3.2, §4; RFC 8422: §2, §5.3 (ECC cipher suites for TLS 1.2).

  4. RFC 9325 (BCP 195), Recommendations for Secure Use of TLS and DTLS: §4.1–§4.3.

  5. RFC 10015, Deprecating Obsolete Key Exchange Methods in (D)TLS 1.2: §2–§4, §6.

  6. RFC 8439, ChaCha20 and Poly1305 for IETF Protocols: §1.

  7. IANA, TLS Cipher Suites registry and its notes.

  8. OpenSSL 3.0 manual: openssl-ciphers, SSL_CTX_set_cipher_list, SSL_CONF_cmd, openssl-s_server.

  9. nginx, ngx_http_ssl_module: ssl_ciphers, ssl_prefer_server_ciphers, ssl_conf_command.

  10. Apache HTTP Server 2.4, mod_ssl: SSLCipherSuite, SSLHonorCipherOrder.

  11. TLSRef: Server-Side TLS, TLS Configurator; Mozilla SSL Configuration Generator (moved).

  12. Nmap NSE documentation: ssl-enum-ciphers.

  13. NSS lib/ssl/SSLerrs.h; Chromium net/base/net_error_list.h.

  14. Our runs: OpenSSL 3.0.13 on Linux, localhost, a www.example.com test certificate from our own lab root.