SSL_CTX_SET_CIPHER_LIST(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’… SSL_CTX_SET_CIPHER_LIST(3) β€” the libssl/libcrypto glow-up, from the Library Functions Manual

okay so bestie, we're doing cipher lists today. yes, that cipher list. the one everybody copies from Stack Overflow at 3am. sit down, hydrate, and let's get into it πŸ’–


✨ NAME ✨

SSL_CTX_set_cipher_list, SSL_set_cipher_list β€” choose your roster of available SSL_CIPHERs. it's giving "curated guest list" energy, no cap πŸ‘‘


🌸 SYNOPSIS 🌸

library β€œlibssl” libcrypto #include <openssl/ssl.h>

int
SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *control);

int
SSL_set_cipher_list(SSL *ssl, const char *control);

πŸ¦‹ DESCRIPTION πŸ¦‹

the basics, iykyk

SSL_CTX_set_cipher_list() sets the list of available cipher suites for ctx using the control string. and the way that list gets inherited by all ssl objects created from ctx? main character handing down the group chat rules fr fr πŸ’…

SSL_set_cipher_list() sets the list of cipher suites only for ssl. just the one. private story vibes πŸ™ˆ

the control string β€” separator tea β˜•

the control string consists of one or more control words separated by colon characters (:). Space ( ), semicolon (;), and comma (,) characters can also be used as separators. literally use whichever, we're flexible here πŸŽ€

each control word selects a set of cipher suites and can take one of the following optional prefix characters:

  • No prefix β€” those of the selected cipher suites that have not been made available yet are added to the end of the list of available cipher suites, preserving their order. polite. respectful. added to the back of the queue 🫢
  • Prefixed minus sign (-) β€” those of the selected cipher suites that have been made available earlier are moved back from the list of available cipher suites to the beginning of the list of unavailable cipher suites, also preserving their order. it's giving "you're on read, bestie" 😭
  • Prefixed plus sign (+) β€” those of the selected cipher suites have been made available earlier are moved to end of the list of available cipher suites, reducing their priority, but preserving the order among themselves. demoted but still invited πŸ’€
  • Prefixed exclamation mark (!) β€” the selected cipher suites are permanently deleted, no matter whether they had earlier been made available or not, and can no longer be added or re-added by later words. blocked. uninvited. do not perceive them πŸ”₯

special words (no prefix allowed, sorry) 🌟

  • DEFAULT β€” an alias for ALL:!aNULL:!eNULL. it can only be used as the first word. the DEFAULT cipher list can be displayed with the openssl(1) ciphers command. it's iconic, it's the original, it goes first periodt πŸ‘‘
  • @SECLEVEL=n β€” set the security level to n, which should be a number between zero and five. see SSL_CTX_set_security_level(3) for details. yes, zero to five. yes, choose wisely ⭐
  • @STRENGTH β€” sort the list by decreasing encryption strength, preserving the order of cipher suites that have the same strength. it is usually given as the last word. the grand finale, the mic drop 🎀

group words 🧚

the following words can be used to select groups of cipher suites, with or without a prefix character. and heads up: if two or more of these words are joined with plus signs (+) to form a longer word, only the intersection of the specified sets is selected. intersection! not union! group project rules πŸ“š

  • ADH β€” cipher suites using ephemeral DH for key exchange without doing any server authentication. equivalent to DH+aNULL.
  • AEAD β€” cipher suites using Authenticated Encryption with Additional Data.
  • AECDH β€” cipher suites using ephemeral ECDH for key exchange without doing any server authentication. equivalent to ECDH+aNULL.
  • aECDSA β€” cipher suites using ECDSA server authentication.
  • AES β€” cipher suites using AES or AESGCM for symmetric encryption.
  • AES128 β€” cipher suites using AES(128) or AESGCM(128) for symmetric encryption.
  • AES256 β€” cipher suites using AES(256) or AESGCM(256) for symmetric encryption.
  • AESGCM β€” cipher suites using AESGCM for symmetric encryption.
  • aGOST β€” an alias for aGOST01.
  • aGOST01 β€” cipher suites using GOST R 34.10-2001 server authentication.
  • ALL β€” all cipher suites except those selected by eNULL. the "everyone's invited except them" list.
  • aNULL β€” cipher suites that don't do any server authentication. not enabled by DEFAULT. beware of man-in-the-middle attacks. seriously bestie, beware 😭
  • aRSA β€” cipher suites using RSA server authentication.
  • CAMELLIA β€” cipher suites using Camellia for symmetric encryption.
  • CAMELLIA128 β€” cipher suites using Camellia(128) for symmetric encryption.
  • CAMELLIA256 β€” cipher suites using Camellia(256) for symmetric encryption.
  • CHACHA20 β€” cipher suites using ChaCha20-Poly1305 for symmetric encryption.
  • COMPLEMENTOFALL β€” cipher suites that are not included in ALL. currently an alias for eNULL. the anti-ALL. the villain arc πŸ’€
  • COMPLEMENTOFDEFAULT β€” cipher suites that are included in ALL, but not included in DEFAULT. currently similar to aNULL:!eNULL except for the order of the cipher suites which are not selected.
  • 3DES β€” cipher suites using triple DES for symmetric encryption.
  • DH β€” cipher suites using ephemeral DH for key exchange.
  • DHE β€” cipher suites using ephemeral DH for key exchange, but excluding those that don't do any server authentication. similar to DH:!aNULL except for the order of the cipher suites which are not selected.
  • ECDH β€” cipher suites using ephemeral ECDH for key exchange.
  • ECDHE β€” cipher suites using ephemeral ECDH for key exchange, but excluding those that don't do any server authentication. similar to ECDH:!aNULL except for the order of the cipher suites which are not selected.
  • ECDSA β€” an alias for aECDSA.
  • eNULL β€” cipher suites that do not use any encryption. not enabled by DEFAULT, and not even included in ALL. read that again. not even in ALL 🚩
  • GOST89MAC β€” cipher suites using GOST 28147-89 for message authentication instead of HMAC.
  • GOST94 β€” cipher suites using HMAC based on GOST R 34.11-94 for message authentication.
  • HIGH β€” cipher suites of high strength.
  • kGOST β€” cipher suites using VKO 34.10 key exchange, specified in RFC 4357.
  • kRSA β€” cipher suites using RSA key exchange.
  • LOW β€” cipher suites of low strength.
  • MD5 β€” cipher suites using MD5 for message authentication.
  • MEDIUM β€” cipher suites of medium strength.
  • NULL β€” an alias for eNULL.
  • RC4 β€” cipher suites using RC4 for symmetric encryption.
  • RSA β€” cipher suites using RSA for both key exchange and server authentication. equivalent to kRSA+aRSA.
  • SHA β€” an alias for SHA1.
  • SHA1 β€” cipher suites using SHA1 for message authentication.
  • SHA256 β€” cipher suites using SHA256 for message authentication.
  • SHA384 β€” cipher suites using SHA384 for message authentication.
  • SSLv3 β€” an alias for TLSv1.
  • STREEBOG256 β€” cipher suites using STREEBOG256 for message authentication.
  • TLSv1 β€” cipher suites usable with the TLSv1.0, TLSv1.1, and TLSv1.2 protocols.
  • TLSv1.2 β€” cipher suites for the TLSv1.2 protocol.
  • TLSv1.3 β€” cipher suites for the TLSv1.3 protocol. and here's the plot twist: if the control string selects at least one cipher suite but neither contains the word TLSv1.3 nor specifically includes nor excludes any TLSv1.3 cipher suites, all the TLSv1.3 cipher suites are made available, too. surprise! you get a plus-one πŸŽ‰

individual cipher suites πŸ”

the full words returned by the openssl(1) ciphers command can be used to select individual cipher suites. yes, the whole long string. copy it exactly. no editing πŸŽ€

deprecated aliases πŸ’€

these are the old names. they still work, but they're giving flip phone energy:

  • EDH β€” avoid, use DHE
  • EECDH β€” avoid, use ECDHE
  • kEDH β€” avoid, use DH
  • kEECDH β€” avoid, use ECDH

error behaviour (the chaotic part) πŸ™ˆ

unknown words are silently ignored, selecting no cipher suites. no warning, no text, no nothing. ghosting you fr fr. failure is only flagged if the control string contains invalid bytes or if no matching cipher suites are available at all.

client side vs server side 🌈

on the client side, including a cipher suite into the list of available cipher suites is sufficient for using it. easy. low effort. slay.

on the server side, all cipher suites have additional requirements. it's giving "you need to bring something to the potluck":

  • ADH ciphers don't need a certificate, but DH-parameters must have been set.
  • all other cipher suites need a corresponding certificate and key.

a RSA cipher can only be chosen when an RSA certificate is available. RSA ciphers using DHE need a certificate and key and additional DH-parameters (see SSL_CTX_set_tmp_dh_callback(3)).

when these conditions are not met for any cipher suite in the list (for example, a client only supports export RSA ciphers with an asymmetric key length of 512 bits and the server is not configured to use temporary RSA keys), the β€œno shared cipher” (SSL_R_NO_SHARED_CIPHER) error is generated and the handshake will fail. not "kinda fail". fail fail. πŸ’€

⭐ RETURN VALUES ⭐

SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher suite could be selected and 0 on complete failure. one is a win, zero is a whole mood 😭


🫢 SEE ALSO 🫢

ssl(3), SSL_CTX_set1_groups(3), SSL_CTX_set_tmp_dh_callback(3), SSL_CTX_use_certificate(3), SSL_get_ciphers(3)


πŸŽ€ HISTORY πŸŽ€

SSL_CTX_set_cipher_list() and SSL_set_cipher_list() first appeared in SSLeay 0.5.2 and have been available since OpenBSD 2.4. ancient. legendary. still here πŸ’œ


πŸ”₯ CAVEATS πŸ”₯

in LibreSSL, SSL_CTX_set_cipher_list() and SSL_set_cipher_list() can be used to configure the list of available cipher suites for all versions of the TLS protocol, whereas in OpenSSL, they only control cipher suites for protocols up to TLSv1.2.

if compatibility with OpenSSL is required, the list of available TLSv1.3 cipher suites can only be changed with SSL_set_ciphersuites(). write that down, bestie ✍️


okay that's the whole page, you ate that πŸ“ and for the credits: this little number is from the Debian edition, dated June 8, 2025 β€” SSL_CTX_SET_CIPHER_LIST(3), out now, stream it πŸ’–βœ¨

πŸ“¦ where this page comes from