1SSL_GET_VERSION(3) OpenSSL SSL_GET_VERSION(3)
2
3
4
6 SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_version - get the
7 protocol information of a connection
8
10 #include <openssl/ssl.h>
11
12 int SSL_client_version(const SSL *s);
13
14 const char *SSL_get_version(const SSL *ssl);
15
16 int SSL_is_dtls(const SSL *ssl);
17
18 int SSL_version(const SSL *s);
19
21 SSL_client_version() returns the numeric protocol version advertised by
22 the client in the legacy_version field of the ClientHello when
23 initiating the connection. Note that, for TLS, this value will never
24 indicate a version greater than TLSv1.2 even if TLSv1.3 is subsequently
25 negotiated. SSL_get_version() returns the name of the protocol used for
26 the connection. SSL_version() returns the numeric protocol version used
27 for the connection. They should only be called after the initial
28 handshake has been completed. Prior to that the results returned from
29 these functions may be unreliable.
30
31 SSL_is_dtls() returns one if the connection is using DTLS, zero if not.
32
34 SSL_get_version() returns one of the following strings:
35
36 SSLv3
37 The connection uses the SSLv3 protocol.
38
39 TLSv1
40 The connection uses the TLSv1.0 protocol.
41
42 TLSv1.1
43 The connection uses the TLSv1.1 protocol.
44
45 TLSv1.2
46 The connection uses the TLSv1.2 protocol.
47
48 TLSv1.3
49 The connection uses the TLSv1.3 protocol.
50
51 unknown
52 This indicates an unknown protocol version.
53
54 SSL_version() and SSL_client_version() return an integer which could
55 include any of the following:
56
57 SSL3_VERSION
58 The connection uses the SSLv3 protocol.
59
60 TLS1_VERSION
61 The connection uses the TLSv1.0 protocol.
62
63 TLS1_1_VERSION
64 The connection uses the TLSv1.1 protocol.
65
66 TLS1_2_VERSION
67 The connection uses the TLSv1.2 protocol.
68
69 TLS1_3_VERSION
70 The connection uses the TLSv1.3 protocol (never returned for
71 SSL_client_version()).
72
74 ssl(7)
75
77 The SSL_is_dtls() function was added in OpenSSL 1.1.0.
78
80 Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
81
82 Licensed under the OpenSSL license (the "License"). You may not use
83 this file except in compliance with the License. You can obtain a copy
84 in the file LICENSE in the source distribution or at
85 <https://www.openssl.org/source/license.html>.
86
87
88
891.1.1q 2022-07-21 SSL_GET_VERSION(3)