1SSL_CTX_SET_CIPHER_LIST(3ossl) OpenSSL SSL_CTX_SET_CIPHER_LIST(3ossl)
2
3
4
6 SSL_CTX_set_cipher_list, SSL_set_cipher_list, SSL_CTX_set_ciphersuites,
7 SSL_set_ciphersuites, OSSL_default_cipher_list,
8 OSSL_default_ciphersuites - choose list of available SSL_CIPHERs
9
11 #include <openssl/ssl.h>
12
13 int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);
14 int SSL_set_cipher_list(SSL *ssl, const char *str);
15
16 int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str);
17 int SSL_set_ciphersuites(SSL *s, const char *str);
18
19 const char *OSSL_default_cipher_list(void);
20 const char *OSSL_default_ciphersuites(void);
21
23 SSL_CTX_set_cipher_list() sets the list of available ciphers (TLSv1.2
24 and below) for ctx using the control string str. The format of the
25 string is described in openssl-ciphers(1). The list of ciphers is
26 inherited by all ssl objects created from ctx. This function does not
27 impact TLSv1.3 ciphersuites. Use SSL_CTX_set_ciphersuites() to
28 configure those.
29
30 SSL_set_cipher_list() sets the list of ciphers (TLSv1.2 and below) only
31 for ssl.
32
33 SSL_CTX_set_ciphersuites() is used to configure the available TLSv1.3
34 ciphersuites for ctx. This is a simple colon (":") separated list of
35 TLSv1.3 ciphersuite names in order of preference. Valid TLSv1.3
36 ciphersuite names are:
37
38 TLS_AES_128_GCM_SHA256
39 TLS_AES_256_GCM_SHA384
40 TLS_CHACHA20_POLY1305_SHA256
41 TLS_AES_128_CCM_SHA256
42 TLS_AES_128_CCM_8_SHA256
43
44 An empty list is permissible. The default value for the this setting
45 is:
46
47 "TLS_AES_256_GCM_SHA384:TLS_CHACHA20_POLY1305_SHA256:TLS_AES_128_GCM_SHA256"
48
49 SSL_set_ciphersuites() is the same as SSL_CTX_set_ciphersuites() except
50 it configures the ciphersuites for ssl.
51
52 OSSL_default_cipher_list() returns the default cipher string for
53 TLSv1.2 (and earlier) ciphers. OSSL_default_ciphersuites() returns the
54 default cipher string for TLSv1.3 ciphersuites.
55
57 The control string str for SSL_CTX_set_cipher_list(),
58 SSL_set_cipher_list(), SSL_CTX_set_ciphersuites() and
59 SSL_set_ciphersuites() should be universally usable and not depend on
60 details of the library configuration (ciphers compiled in). Thus no
61 syntax checking takes place. Items that are not recognized, because the
62 corresponding ciphers are not compiled in or because they are mistyped,
63 are simply ignored. Failure is only flagged if no ciphers could be
64 collected at all.
65
66 It should be noted, that inclusion of a cipher to be used into the list
67 is a necessary condition. On the client side, the inclusion into the
68 list is also sufficient unless the security level excludes it. On the
69 server side, additional restrictions apply. All ciphers have additional
70 requirements. ADH ciphers don't need a certificate, but DH-parameters
71 must have been set. All other ciphers need a corresponding certificate
72 and key.
73
74 An RSA cipher can only be chosen, when an RSA certificate is available.
75 RSA ciphers using DHE need a certificate and key and additional DH-
76 parameters (see SSL_CTX_set_tmp_dh_callback(3)).
77
78 A DSA cipher can only be chosen, when a DSA certificate is available.
79 DSA ciphers always use DH key exchange and therefore need DH-parameters
80 (see SSL_CTX_set_tmp_dh_callback(3)).
81
82 When these conditions are not met for any cipher in the list (e.g. a
83 client only supports export RSA ciphers with an asymmetric key length
84 of 512 bits and the server is not configured to use temporary RSA
85 keys), the "no shared cipher" (SSL_R_NO_SHARED_CIPHER) error is
86 generated and the handshake will fail.
87
88 OSSL_default_cipher_list() and OSSL_default_ciphersuites() replace
89 SSL_DEFAULT_CIPHER_LIST and TLS_DEFAULT_CIPHERSUITES, respectively. The
90 cipher list defines are deprecated as of 3.0.
91
93 SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any
94 cipher could be selected and 0 on complete failure.
95
96 SSL_CTX_set_ciphersuites() and SSL_set_ciphersuites() return 1 if the
97 requested ciphersuite list was configured, and 0 otherwise.
98
100 ssl(7), SSL_get_ciphers(3), SSL_CTX_use_certificate(3),
101 SSL_CTX_set_tmp_dh_callback(3), openssl-ciphers(1)
102
104 OSSL_default_cipher_list() and OSSL_default_ciphersites() are new in
105 3.0.
106
108 Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
109
110 Licensed under the Apache License 2.0 (the "License"). You may not use
111 this file except in compliance with the License. You can obtain a copy
112 in the file LICENSE in the source distribution or at
113 <https://www.openssl.org/source/license.html>.
114
115
116
1173.1.1 2023-08-31 SSL_CTX_SET_CIPHER_LIST(3ossl)