| SSL_CTX_SET_CIPHER_LIST(3) | Library Functions Manual | SSL_CTX_SET_CIPHER_LIST(3) |
SSL_CTX_set_cipher_list,
SSL_set_cipher_list — choose
list of available SSL_CIPHERs
#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);
SSL_CTX_set_cipher_list()
sets the list of available cipher suites for ctx using
the control string. The list of cipher suites is
inherited by all ssl objects created from
ctx.
SSL_set_cipher_list()
sets the list of cipher suites only for ssl.
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. Each control words selects a set of cipher suites and can take
one of the following optional prefix characters:
-’):+’):!’):The following special words can only be used without a prefix:
DEFAULTALL:!aNULL:!eNULL.
It can only be used as the first word. The DEFAULT
cipher list can be displayed with the
openssl(1)
ciphers command.@SECLEVEL=n@STRENGTHThe following words can be used to select groups of cipher suites,
with or without a prefix character. 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.
ADHDH+aNULL.AEADAECDHECDH+aNULL.aECDSAAESAES128AES256AESGCMaGOSTaGOST01.aGOST01ALLeNULL.aNULLDEFAULT. Beware of man-in-the-middle attacks.aRSACAMELLIACAMELLIA128CAMELLIA256CHACHA20COMPLEMENTOFALLALL.
Currently an alias for eNULL.COMPLEMENTOFDEFAULTALL, but not
included in DEFAULT. Currently similar to
aNULL:!eNULL except for
the order of the cipher suites which are not
selected.3DESDHDHEDH:!aNULL except for the
order of the cipher suites which are not selected.ECDHECDHEECDH:!aNULL except for the
order of the cipher suites which are not selected.ECDSAaECDSA.eNULLDEFAULT, and not even included in
ALL.GOST89MACGOST94HIGHkGOSTkRSALOWMD5MEDIUMNULLeNULL.RC4RSAkRSA+aRSA.SHASHA1.SHA1SHA256SHA384SSLv3TLSv1.STREEBOG256TLSv1TLSv1.2TLSv1.3TLSv1.3 nor specifically
includes nor excludes any TLSv1.3 cipher suites, all the
TLSv1.3 cipher suites are made available,
too.The full words returned by the
openssl(1)
ciphers command can be used to select individual
cipher suites.
The following are deprecated aliases:
| avoid: | use: |
EDH |
DHE |
EECDH |
ECDHE |
kEDH |
DH |
kEECDH |
ECDH |
Unknown words are silently ignored, selecting no cipher suites. Failure is only flagged if the control string contains invalid bytes or if no matching cipher suites are available at all.
On the client side, including a cipher suite into the list of available cipher suites is sufficient for using it. On the server side, all cipher suites have additional requirements. 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.
SSL_CTX_set_cipher_list() and
SSL_set_cipher_list() return 1 if any cipher suite
could be selected and 0 on complete failure.
ssl(3), SSL_CTX_set1_groups(3), SSL_CTX_set_tmp_dh_callback(3), SSL_CTX_use_certificate(3), SSL_get_ciphers(3)
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.
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().
| January 18, 2025 | openbsd |