SSL_CTX_SET_CIPHER_LIST(3)
π
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 forALL:!aNULL:!eNULL. it can only be used as the first word. theDEFAULTcipher list can be displayed with theopenssl(1)cipherscommand. 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. seeSSL_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 toDH+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 toECDH+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 foraGOST01.aGOST01β cipher suites using GOST R 34.10-2001 server authentication.ALLβ all cipher suites except those selected byeNULL. the "everyone's invited except them" list.aNULLβ cipher suites that don't do any server authentication. not enabled byDEFAULT. 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 inALL. currently an alias foreNULL. the anti-ALL. the villain arc πCOMPLEMENTOFDEFAULTβ cipher suites that are included inALL, but not included inDEFAULT. currently similar toaNULL:!eNULLexcept 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 toDH:!aNULLexcept 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 toECDH:!aNULLexcept for the order of the cipher suites which are not selected.ECDSAβ an alias foraECDSA.eNULLβ cipher suites that do not use any encryption. not enabled byDEFAULT, and not even included inALL. read that again. not even inALLπ©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 foreNULL.RC4β cipher suites using RC4 for symmetric encryption.RSAβ cipher suites using RSA for both key exchange and server authentication. equivalent tokRSA+aRSA.SHAβ an alias forSHA1.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 forTLSv1.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 wordTLSv1.3nor 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, useDHEEECDHβ avoid, useECDHEkEDHβ avoid, useDHkEECDHβ avoid, useECDH
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":
ADHciphers 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
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2018, 2020 Ingo Schwarze <schwarze@openbsd.org>
- Copyright (c) 2000, 2001, 2013 The OpenSSL Project. All rights reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms