5 SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_is_tls, SSL_is_quic,
6 SSL_version - get the protocol information of a connection
10 #include <openssl/ssl.h>
12 int SSL_client_version(const SSL *s);
14 const char *SSL_get_version(const SSL *ssl);
16 int SSL_is_dtls(const SSL *ssl);
17 int SSL_is_tls(const SSL *ssl);
18 int SSL_is_quic(const SSL *ssl);
20 int SSL_version(const SSL *s);
24 For SSL, TLS and DTLS protocols SSL_client_version() returns the numeric
25 protocol version advertised by the client in the legacy_version field of the
26 ClientHello when initiating the connection. Note that, for TLS, this value
27 will never indicate a version greater than TLSv1.2 even if TLSv1.3 is
28 subsequently negotiated. For QUIC connections it returns OSSL_QUIC1_VERSION.
30 SSL_get_version() returns the name of the protocol used for the connection.
31 SSL_version() returns the numeric protocol version used for the connection.
32 They should only be called after the initial handshake has been completed.
33 Prior to that the results returned from these functions may be unreliable.
35 SSL_is_dtls() returns 1 if the connection is using DTLS or 0 if not.
37 SSL_is_tls() returns 1 if the connection is using SSL/TLS or 0 if not.
39 SSL_is_quic() returns 1 if the connection is using QUIC or 0 if not.
44 SSL_get_version() returns one of the following strings:
50 The connection uses the SSLv3 protocol.
54 The connection uses the TLSv1.0 protocol.
58 The connection uses the TLSv1.1 protocol.
62 The connection uses the TLSv1.2 protocol.
66 The connection uses the TLSv1.3 protocol.
70 The connection uses an obsolete pre-standardisation DTLS protocol
74 The connection uses the DTLSv1 protocol
78 The connection uses the DTLSv1.2 protocol
82 The connection uses the QUICv1 protocol.
86 This indicates an unknown protocol version.
90 SSL_version() and SSL_client_version() return an integer which could include any
97 The connection uses the SSLv3 protocol.
101 The connection uses the TLSv1.0 protocol.
105 The connection uses the TLSv1.1 protocol.
109 The connection uses the TLSv1.2 protocol.
113 The connection uses the TLSv1.3 protocol (never returned for
114 SSL_client_version()).
118 The connection uses an obsolete pre-standardisation DTLS protocol
122 The connection uses the DTLSv1 protocol
124 =item DTLS1_2_VERSION
126 The connection uses the DTLSv1.2 protocol
128 =item OSSL_QUIC1_VERSION
130 The connection uses the QUICv1 protocol.
140 The SSL_is_dtls() function was added in OpenSSL 1.1.0. The SSL_is_tls() and
141 SSL_is_quic() functions were added in OpenSSL 3.2.
145 Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.
147 Licensed under the Apache License 2.0 (the "License"). You may not use
148 this file except in compliance with the License. You can obtain a copy
149 in the file LICENSE in the source distribution or at
150 L<https://www.openssl.org/source/license.html>.