1SSL_GET_CIPHERS(3ossl)              OpenSSL             SSL_GET_CIPHERS(3ossl)
2
3
4

NAME

6       SSL_get1_supported_ciphers, SSL_get_client_ciphers, SSL_get_ciphers,
7       SSL_CTX_get_ciphers, SSL_bytes_to_cipher_list, SSL_get_cipher_list,
8       SSL_get_shared_ciphers - get list of available SSL_CIPHERs
9

SYNOPSIS

11        #include <openssl/ssl.h>
12
13        STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl);
14        STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx);
15        STACK_OF(SSL_CIPHER) *SSL_get1_supported_ciphers(SSL *s);
16        STACK_OF(SSL_CIPHER) *SSL_get_client_ciphers(const SSL *ssl);
17        int SSL_bytes_to_cipher_list(SSL *s, const unsigned char *bytes, size_t len,
18                                     int isv2format, STACK_OF(SSL_CIPHER) **sk,
19                                     STACK_OF(SSL_CIPHER) **scsvs);
20        const char *SSL_get_cipher_list(const SSL *ssl, int priority);
21        char *SSL_get_shared_ciphers(const SSL *s, char *buf, int size);
22

DESCRIPTION

24       SSL_get_ciphers() returns the stack of available SSL_CIPHERs for ssl,
25       sorted by preference. If ssl is NULL or no ciphers are available, NULL
26       is returned.
27
28       SSL_CTX_get_ciphers() returns the stack of available SSL_CIPHERs for
29       ctx.
30
31       SSL_get1_supported_ciphers() returns the stack of enabled SSL_CIPHERs
32       for ssl as would be sent in a ClientHello (that is, sorted by
33       preference).  The list depends on settings like the cipher list, the
34       supported protocol versions, the security level, and the enabled
35       signature algorithms.  SRP and PSK ciphers are only enabled if the
36       appropriate callbacks or settings have been applied.  The list of
37       ciphers that would be sent in a ClientHello can differ from the list of
38       ciphers that would be acceptable when acting as a server.  For example,
39       additional ciphers may be usable by a server if there is a gap in the
40       list of supported protocols, and some ciphers may not be usable by a
41       server if there is not a suitable certificate configured.  If ssl is
42       NULL or no ciphers are available, NULL is returned.
43
44       SSL_get_client_ciphers() returns the stack of available SSL_CIPHERs
45       matching the list received from the client on ssl. If ssl is NULL, no
46       ciphers are available, or ssl is not operating in server mode, NULL is
47       returned.
48
49       SSL_bytes_to_cipher_list() treats the supplied len octets in bytes as a
50       wire-protocol cipher suite specification (in the three-octet-per-cipher
51       SSLv2 wire format if isv2format is nonzero; otherwise the two-octet
52       SSLv3/TLS wire format), and parses the cipher suites supported by the
53       library into the returned stacks of SSL_CIPHER objects sk and
54       Signalling Cipher-Suite Values scsvs.  Unsupported cipher suites are
55       ignored.  Returns 1 on success and 0 on failure.
56
57       SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER
58       listed for ssl with priority. If ssl is NULL, no ciphers are available,
59       or there are less ciphers than priority available, NULL is returned.
60
61       SSL_get_shared_ciphers() creates a colon separated and NUL terminated
62       list of SSL_CIPHER names that are available in both the client and the
63       server. buf is the buffer that should be populated with the list of
64       names and size is the size of that buffer. A pointer to buf is returned
65       on success or NULL on error. If the supplied buffer is not large enough
66       to contain the complete list of names then a truncated list of names
67       will be returned. Note that just because a ciphersuite is available
68       (i.e. it is configured in the cipher list) and shared by both the
69       client and the server it does not mean that it is enabled (see the
70       description of SSL_get1_supported_ciphers() above). This function will
71       return available shared ciphersuites whether or not they are enabled.
72       This is a server side function only and must only be called after the
73       completion of the initial handshake.
74

NOTES

76       The details of the ciphers obtained by SSL_get_ciphers(),
77       SSL_CTX_get_ciphers() SSL_get1_supported_ciphers() and
78       SSL_get_client_ciphers() can be obtained using the
79       SSL_CIPHER_get_name(3) family of functions.
80
81       Call SSL_get_cipher_list() with priority starting from 0 to obtain the
82       sorted list of available ciphers, until NULL is returned.
83
84       Note: SSL_get_ciphers(), SSL_CTX_get_ciphers() and
85       SSL_get_client_ciphers() return a pointer to an internal cipher stack,
86       which will be freed later on when the SSL or SSL_SESSION object is
87       freed.  Therefore, the calling code MUST NOT free the return value
88       itself.
89
90       The stack returned by SSL_get1_supported_ciphers() should be freed
91       using sk_SSL_CIPHER_free().
92
93       The stacks returned by SSL_bytes_to_cipher_list() should be freed using
94       sk_SSL_CIPHER_free().
95

RETURN VALUES

97       See DESCRIPTION
98

SEE ALSO

100       ssl(7), SSL_CTX_set_cipher_list(3), SSL_CIPHER_get_name(3)
101
103       Copyright 2000-2018 The OpenSSL Project Authors. All Rights Reserved.
104
105       Licensed under the Apache License 2.0 (the "License").  You may not use
106       this file except in compliance with the License.  You can obtain a copy
107       in the file LICENSE in the source distribution or at
108       <https://www.openssl.org/source/license.html>.
109
110
111
1123.1.1                             2023-08-31            SSL_GET_CIPHERS(3ossl)
Impressum