
#use wml::openssl-macros area=docs page=SSL_CTX_set_cipher_list

<title>Documents, SSL_CTX_set_cipher_list(3)</title>

<h1>SSL_CTX_set_cipher_list(3)</h1>

#use wml::imp::generic

{:
## What's this? [[s|(<STRONG>[^<].+?)</A>(</STRONG><DD>)|$1$2|sg]]
[[s|<P>\s+<P>|<P>|sg]]
[[s|<P>\s+</|</|sg]]
[[s|<DD>\s*<DT>|<DD>&nbsp;<DT>|sg]]
[[s|<DD>\s*</DL>|<DD>&nbsp;</DL>|sg]]
[[s|\[|&#91;|sg]]
[[s|\]|&#93;|sg]]

<!-- INDEX BEGIN -->

<UL>

	<LI><A HREF="#NAME">NAME</A>
	<LI><A HREF="#SYNOPSIS">SYNOPSIS</A>
	<LI><A HREF="#DESCRIPTION">DESCRIPTION</A>
	<LI><A HREF="#NOTES">NOTES</A>
	<LI><A HREF="#RETURN_VALUES">RETURN VALUES</A>
	<LI><A HREF="#SEE_ALSO">SEE ALSO</A>
</UL>
<!-- INDEX END -->

<HR>
<P>
<HR>
<H1><A NAME="NAME">NAME</A></H1>
<P>
SSL_CTX_set_cipher_list, SSL_set_cipher_list - choose list of available
SSL_CIPHERs

</P>
<P>
<HR>
<H1><A NAME="SYNOPSIS">SYNOPSIS</A></H1>
<PRE> #include &lt;openssl/ssl.h&gt;
</PRE>
<PRE> int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str);
 int SSL_set_cipher_list(SSL *ssl, const char *str);
</PRE>
<P>
<HR>
<H1><A NAME="DESCRIPTION">DESCRIPTION</A></H1>
<P>
<CODE>SSL_CTX_set_cipher_list()</CODE> sets the list of available ciphers
for <STRONG>ctx</STRONG>
using the control string <STRONG>str</STRONG>. The format of the string is described in <A HREF="../apps/ciphers.html#">ciphers(1)</A>. The list of ciphers is inherited by all
<STRONG>ssl</STRONG> objects created from <STRONG>ctx</STRONG>.

</P>
<P>
<CODE>SSL_set_cipher_list()</CODE> sets the list of ciphers only for <STRONG>ssl</STRONG>.

</P>
<P>
<HR>
<H1><A NAME="NOTES">NOTES</A></H1>
<P>
The control string <STRONG>str</STRONG> should be universally usable and not depend on details of the library
configuration (ciphers compiled in). Thus no syntax checking takes place.
Items that are not recognized, because the corresponding ciphers are not
compiled in or because they are mistyped, are simply ignored. Failure is
only flagged if no ciphers could be collected at all.

</P>
<P>
It should be noted, that inclusion of a cipher to be used into the list is
a necessary condition. On the client side, the inclusion into the list is
also sufficient. On the server side, additional restrictions apply. All
ciphers have additional requirements. ADH ciphers don't need a certificate,
but DH-parameters must have been set. All other ciphers need a
corresponding certificate and key.

</P>
<P>
A RSA cipher can only be chosen, when a RSA certificate is available. RSA
export ciphers with a keylength of 512 bits for the RSA key require a
temporary 512 bit RSA key, as typically the supplied key has a length of
1024 bit (see
<A HREF="../ssl/SSL_CTX_set_tmp_rsa_callback.html#">SSL_CTX_set_tmp_rsa_callback(3)</A>). RSA ciphers using EDH need a certificate and key and additional
DH-parameters (see <A HREF="../ssl/SSL_CTX_set_tmp_dh_callback.html#">SSL_CTX_set_tmp_dh_callback(3)</A>).

</P>
<P>
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 <A HREF="../ssl/SSL_CTX_set_tmp_dh_callback.html#">SSL_CTX_set_tmp_dh_callback(3)</A>).

</P>
<P>
When these conditions are not met for any cipher in the list (e.g. a client
only supports export RSA ciphers with a 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.

</P>
<P>
<HR>
<H1><A NAME="RETURN_VALUES">RETURN VALUES</A></H1>
<P>
<CODE>SSL_CTX_set_cipher_list()</CODE> and
<CODE>SSL_set_cipher_list()</CODE> return 1 if any cipher could be selected
and 0 on complete failure.

</P>
<P>
<HR>
<H1><A NAME="SEE_ALSO">SEE ALSO</A></H1>
<P>
<A HREF="../ssl/ssl.html#">ssl(3)</A>, <A HREF="../ssl/SSL_get_ciphers.html#">SSL_get_ciphers(3)</A>,
<A HREF="../ssl/SSL_CTX_use_certificate.html#">SSL_CTX_use_certificate(3)</A>,
<A HREF="../ssl/SSL_CTX_set_tmp_rsa_callback.html#">SSL_CTX_set_tmp_rsa_callback(3)</A>,
<A HREF="../ssl/SSL_CTX_set_tmp_dh_callback.html#">SSL_CTX_set_tmp_dh_callback(3)</A>,
<A HREF="../apps/ciphers.html#">ciphers(1)</A>



</P>
:}

