5 SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_version - get the
6 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);
18 int SSL_version(const SSL *s);
22 SSL_client_version() returns the numeric protocol version advertised by the
23 client in the legacy_version field of the ClientHello when initiating the
24 connection. Note that, for TLS, this value will never indicate a version greater
25 than TLSv1.2 even if TLSv1.3 is subsequently negotiated. SSL_get_version()
26 returns the name of the protocol used for the connection. SSL_version() returns
27 the numeric protocol version used for the connection. They should only be called
28 after the initial handshake has been completed. Prior to that the results
29 returned from these functions may be unreliable.
31 SSL_is_dtls() returns one if the connection is using DTLS, zero if not.
36 SSL_get_version() returns one of the following strings:
42 The connection uses the SSLv3 protocol.
46 The connection uses the TLSv1.0 protocol.
50 The connection uses the TLSv1.1 protocol.
54 The connection uses the TLSv1.2 protocol.
58 The connection uses the TLSv1.3 protocol.
62 This indicates an unknown protocol version.
66 SSL_version() and SSL_client_version() return an integer which could include any
73 The connection uses the SSLv3 protocol.
77 The connection uses the TLSv1.0 protocol.
81 The connection uses the TLSv1.1 protocol.
85 The connection uses the TLSv1.2 protocol.
89 The connection uses the TLSv1.3 protocol (never returned for
90 SSL_client_version()).
100 The SSL_is_dtls() function was added in OpenSSL 1.1.0.
104 Copyright 2001-2018 The OpenSSL Project Authors. All Rights Reserved.
106 Licensed under the Apache License 2.0 (the "License"). You may not use
107 this file except in compliance with the License. You can obtain a copy
108 in the file LICENSE in the source distribution or at
109 L<https://www.openssl.org/source/license.html>.