Add SSL_CTX_get_ciphers()
[openssl.git] / doc / ssl / SSL_get_ciphers.pod
1 =pod
2
3 =head1 NAME
4
5 SSL_get_ciphers, SSL_CTX_get_ciphers, SSL_get_cipher_list - get list of available SSL_CIPHERs
6
7 =head1 SYNOPSIS
8
9  #include <openssl/ssl.h>
10
11  STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl);
12  STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx);
13  STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s);
14  STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *ssl);
15  const char *SSL_get_cipher_list(const SSL *ssl, int priority);
16
17 =head1 DESCRIPTION
18
19 SSL_get_ciphers() returns the stack of available SSL_CIPHERs for B<ssl>,
20 sorted by preference. If B<ssl> is NULL or no ciphers are available, NULL
21 is returned.
22
23 SSL_CTX_get_ciphers() returns the stack of available SSL_CIPHERs for B<ctx>.
24
25 SSL_get1_supported_ciphers() returns the stack of enabled SSL_CIPHERs for
26 B<ssl>, sorted by preference.
27 The list depends on settings like the cipher list, the supported protocol
28 versions, the security level, and the enabled signature algorithms.
29 SRP and PSK ciphers are only enabled if the appropriate callbacks or settings
30 have been applied.
31 This is the list that will be sent by the client to the server.
32 The list supported by the server might include more ciphers in case there is a
33 hole in the list of supported protocols.
34 The server will also not use ciphers from this list depending on the
35 configured certificates and DH parameters.
36 If B<ssl> is NULL or no ciphers are available, NULL is returned.
37
38 SSL_get_client_ciphers() returns the stack of available SSL_CIPHERs matching the
39 list received from the client on B<ssl>. If B<ssl> is NULL, no ciphers are
40 available, or B<ssl> is not operating in server mode, NULL is returned.
41
42 SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER
43 listed for B<ssl> with B<priority>. If B<ssl> is NULL, no ciphers are
44 available, or there are less ciphers than B<priority> available, NULL
45 is returned.
46
47 =head1 NOTES
48
49 The details of the ciphers obtained by SSL_get_ciphers(), SSL_CTX_get_ciphers()
50 SSL_get1_supported_ciphers() and SSL_get_client_ciphers() can be obtained using
51 the L<SSL_CIPHER_get_name(3)> family of functions.
52
53 Call SSL_get_cipher_list() with B<priority> starting from 0 to obtain the
54 sorted list of available ciphers, until NULL is returned.
55
56 Note: SSL_get_ciphers(), SSL_CTX_get_ciphers() and SSL_get_client_ciphers()
57 return a pointer to an internal cipher stack, which will be freed later on when
58 the SSL or SSL_SESSION object is freed.  Therefore, the calling code B<MUST NOT>
59 free the return value itself.
60
61 The stack returned by SSL_get1_supported_ciphers() should be freed using
62 sk_SSL_CIPHER_free().
63
64 =head1 RETURN VALUES
65
66 See DESCRIPTION
67
68 =head1 SEE ALSO
69
70 L<ssl(3)>, L<SSL_CTX_set_cipher_list(3)>,
71 L<SSL_CIPHER_get_name(3)>
72
73 =cut