1.\"
2.\"	$OpenBSD: SSL_CTX_set_cipher_list.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $
3.\"
4.Dd $Mdocdate: November 5 2016 $
5.Dt SSL_CTX_SET_CIPHER_LIST 3
6.Os
7.Sh NAME
8.Nm SSL_CTX_set_cipher_list ,
9.Nm SSL_set_cipher_list
10.Nd choose list of available SSL_CIPHERs
11.Sh SYNOPSIS
12.In openssl/ssl.h
13.Ft int
14.Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "const char *str"
15.Ft int
16.Fn SSL_set_cipher_list "SSL *ssl" "const char *str"
17.Sh DESCRIPTION
18.Fn SSL_CTX_set_cipher_list
19sets the list of available ciphers for
20.Fa ctx
21using the control string
22.Fa str .
23The format of the string is described
24in
25.Xr openssl 1 .
26The list of ciphers is inherited by all
27.Fa ssl
28objects created from
29.Fa ctx .
30.Pp
31.Fn SSL_set_cipher_list
32sets the list of ciphers only for
33.Fa ssl .
34.Sh NOTES
35The control string
36.Fa str
37should be universally usable and not depend on details of the library
38configuration (ciphers compiled in).
39Thus no syntax checking takes place.
40Items that are not recognized, because the corresponding ciphers are not
41compiled in or because they are mistyped, are simply ignored.
42Failure is only flagged if no ciphers could be collected at all.
43.Pp
44It should be noted that inclusion of a cipher to be used into the list is a
45necessary condition.
46On the client side, the inclusion into the list is also sufficient.
47On the server side, additional restrictions apply.
48All ciphers have additional requirements.
49ADH ciphers don't need a certificate, but DH-parameters must have been set.
50All other ciphers need a corresponding certificate and key.
51.Pp
52A RSA cipher can only be chosen when a RSA certificate is available.
53RSA export ciphers with a keylength of 512 bits for the RSA key require a
54temporary 512 bit RSA key, as typically the supplied key has a length of 1024
55bits (see
56.Xr SSL_CTX_set_tmp_rsa_callback 3 ) .
57RSA ciphers using EDH need a certificate and key and additional DH-parameters
58(see
59.Xr SSL_CTX_set_tmp_dh_callback 3 ) .
60.Pp
61A DSA cipher can only be chosen when a DSA certificate is available.
62DSA ciphers always use DH key exchange and therefore need DH-parameters (see
63.Xr SSL_CTX_set_tmp_dh_callback 3 ) .
64.Pp
65When these conditions are not met for any cipher in the list (for example, a
66client only supports export RSA ciphers with an asymmetric key length of 512
67bits and the server is not configured to use temporary RSA keys), the
68.Dq no shared cipher
69.Pq Dv SSL_R_NO_SHARED_CIPHER
70error is generated and the handshake will fail.
71.Sh RETURN VALUES
72.Fn SSL_CTX_set_cipher_list
73and
74.Fn SSL_set_cipher_list
75return 1 if any cipher could be selected and 0 on complete failure.
76.Sh SEE ALSO
77.Xr ciphers 1 ,
78.Xr ssl 3 ,
79.Xr SSL_CTX_set_tmp_dh_callback 3 ,
80.Xr SSL_CTX_set_tmp_rsa_callback 3 ,
81.Xr SSL_CTX_use_certificate 3 ,
82.Xr SSL_get_ciphers 3
83