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:
DEFAULT
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.@STRENGTH
The 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.
ADH
DH
+aNULL
.AEAD
AECDH
ECDH
+aNULL
.aECDSA
AES
AES128
AES256
AESGCM
aGOST
aGOST01
.aGOST01
ALL
eNULL
.aNULL
DEFAULT
. Beware of man-in-the-middle attacks.aRSA
CAMELLIA
CAMELLIA128
CAMELLIA256
CHACHA20
COMPLEMENTOFALL
ALL
.
Currently an alias for eNULL
.COMPLEMENTOFDEFAULT
ALL
, but not
included in DEFAULT
. Currently similar to
aNULL
:!eNULL
except for
the order of the cipher suites which are not
selected.3DES
DH
DHE
DH
:!aNULL
except for the
order of the cipher suites which are not selected.ECDH
ECDHE
ECDH
:!aNULL
except for the
order of the cipher suites which are not selected.ECDSA
aECDSA
.eNULL
DEFAULT
, and not even included in
ALL
.GOST89MAC
GOST94
HIGH
kGOST
kRSA
LOW
MD5
MEDIUM
NULL
eNULL
.RC4
RSA
kRSA
+aRSA
.SHA
SHA1
.SHA1
SHA256
SHA384
SSLv3
TLSv1
.STREEBOG256
TLSv1
TLSv1.2
TLSv1.3
TLSv1.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 words do not match anything because LibreSSL no longer provides any such cipher suites:
DES
DSS
IDEA
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)).
A DSA cipher can only be chosen when a DSA certificate is available. DSA ciphers always use DH key exchange and therefore need 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
().
April 25, 2020 | OpenBSD-7.0 |