| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "SSL_GET_VERSION 3SSL" |
| 58 |
.TH SSL_GET_VERSION 3SSL 2026-04-07 3.6.2 OpenSSL |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_is_tls, SSL_is_quic, |
| 65 |
SSL_version \- get the protocol information of a connection |
| 66 |
.SH SYNOPSIS |
| 67 |
.IX Header "SYNOPSIS" |
| 68 |
.Vb 1 |
| 69 |
\& #include <openssl/ssl.h> |
| 70 |
\& |
| 71 |
\& int SSL_client_version(const SSL *s); |
| 72 |
\& |
| 73 |
\& const char *SSL_get_version(const SSL *ssl); |
| 74 |
\& |
| 75 |
\& int SSL_is_dtls(const SSL *ssl); |
| 76 |
\& int SSL_is_tls(const SSL *ssl); |
| 77 |
\& int SSL_is_quic(const SSL *ssl); |
| 78 |
\& |
| 79 |
\& int SSL_version(const SSL *s); |
| 80 |
.Ve |
| 81 |
.SH DESCRIPTION |
| 82 |
.IX Header "DESCRIPTION" |
| 83 |
For SSL, TLS and DTLS protocols \fBSSL_client_version()\fR returns the numeric |
| 84 |
protocol version advertised by the client in the legacy_version field of the |
| 85 |
ClientHello when initiating the connection. Note that, for TLS, this value |
| 86 |
will never indicate a version greater than TLSv1.2 even if TLSv1.3 is |
| 87 |
subsequently negotiated. For QUIC connections it returns OSSL_QUIC1_VERSION. |
| 88 |
.PP |
| 89 |
\&\fBSSL_get_version()\fR returns the name of the protocol used for the connection. |
| 90 |
\&\fBSSL_version()\fR returns the numeric protocol version used for the connection. |
| 91 |
They should only be called after the initial handshake has been completed. |
| 92 |
Prior to that the results returned from these functions may be unreliable. |
| 93 |
.PP |
| 94 |
\&\fBSSL_is_dtls()\fR returns 1 if the connection is using DTLS or 0 if not. |
| 95 |
.PP |
| 96 |
\&\fBSSL_is_tls()\fR returns 1 if the connection is using SSL/TLS or 0 if not. |
| 97 |
.PP |
| 98 |
\&\fBSSL_is_quic()\fR returns 1 if the connection is using QUIC or 0 if not. |
| 99 |
.SH "RETURN VALUES" |
| 100 |
.IX Header "RETURN VALUES" |
| 101 |
\&\fBSSL_get_version()\fR returns one of the following strings: |
| 102 |
.IP SSLv3 4 |
| 103 |
.IX Item "SSLv3" |
| 104 |
The connection uses the SSLv3 protocol. |
| 105 |
.IP TLSv1 4 |
| 106 |
.IX Item "TLSv1" |
| 107 |
The connection uses the TLSv1.0 protocol. |
| 108 |
.IP TLSv1.1 4 |
| 109 |
.IX Item "TLSv1.1" |
| 110 |
The connection uses the TLSv1.1 protocol. |
| 111 |
.IP TLSv1.2 4 |
| 112 |
.IX Item "TLSv1.2" |
| 113 |
The connection uses the TLSv1.2 protocol. |
| 114 |
.IP TLSv1.3 4 |
| 115 |
.IX Item "TLSv1.3" |
| 116 |
The connection uses the TLSv1.3 protocol. |
| 117 |
.IP DTLSv0.9 4 |
| 118 |
.IX Item "DTLSv0.9" |
| 119 |
The connection uses an obsolete pre-standardisation DTLS protocol |
| 120 |
.IP DTLSv1 4 |
| 121 |
.IX Item "DTLSv1" |
| 122 |
The connection uses the DTLSv1 protocol |
| 123 |
.IP DTLSv1.2 4 |
| 124 |
.IX Item "DTLSv1.2" |
| 125 |
The connection uses the DTLSv1.2 protocol |
| 126 |
.IP QUICv1 4 |
| 127 |
.IX Item "QUICv1" |
| 128 |
The connection uses the QUICv1 protocol. |
| 129 |
.IP unknown 4 |
| 130 |
.IX Item "unknown" |
| 131 |
This indicates an unknown protocol version. |
| 132 |
.PP |
| 133 |
\&\fBSSL_version()\fR and \fBSSL_client_version()\fR return an integer which could include any |
| 134 |
of the following: |
| 135 |
.IP SSL3_VERSION 4 |
| 136 |
.IX Item "SSL3_VERSION" |
| 137 |
The connection uses the SSLv3 protocol. |
| 138 |
.IP TLS1_VERSION 4 |
| 139 |
.IX Item "TLS1_VERSION" |
| 140 |
The connection uses the TLSv1.0 protocol. |
| 141 |
.IP TLS1_1_VERSION 4 |
| 142 |
.IX Item "TLS1_1_VERSION" |
| 143 |
The connection uses the TLSv1.1 protocol. |
| 144 |
.IP TLS1_2_VERSION 4 |
| 145 |
.IX Item "TLS1_2_VERSION" |
| 146 |
The connection uses the TLSv1.2 protocol. |
| 147 |
.IP TLS1_3_VERSION 4 |
| 148 |
.IX Item "TLS1_3_VERSION" |
| 149 |
The connection uses the TLSv1.3 protocol (never returned for |
| 150 |
\&\fBSSL_client_version()\fR). |
| 151 |
.IP DTLS1_BAD_VER 4 |
| 152 |
.IX Item "DTLS1_BAD_VER" |
| 153 |
The connection uses an obsolete pre-standardisation DTLS protocol |
| 154 |
.IP DTLS1_VERSION 4 |
| 155 |
.IX Item "DTLS1_VERSION" |
| 156 |
The connection uses the DTLSv1 protocol |
| 157 |
.IP DTLS1_2_VERSION 4 |
| 158 |
.IX Item "DTLS1_2_VERSION" |
| 159 |
The connection uses the DTLSv1.2 protocol |
| 160 |
.IP OSSL_QUIC1_VERSION 4 |
| 161 |
.IX Item "OSSL_QUIC1_VERSION" |
| 162 |
The connection uses the QUICv1 protocol. |
| 163 |
.SH "SEE ALSO" |
| 164 |
.IX Header "SEE ALSO" |
| 165 |
\&\fBssl\fR\|(7) |
| 166 |
.SH HISTORY |
| 167 |
.IX Header "HISTORY" |
| 168 |
The \fBSSL_is_dtls()\fR function was added in OpenSSL 1.1.0. The \fBSSL_is_tls()\fR and |
| 169 |
\&\fBSSL_is_quic()\fR functions were added in OpenSSL 3.2. |
| 170 |
.SH COPYRIGHT |
| 171 |
.IX Header "COPYRIGHT" |
| 172 |
Copyright 2001\-2023 The OpenSSL Project Authors. All Rights Reserved. |
| 173 |
.PP |
| 174 |
Licensed under the Apache License 2.0 (the "License"). You may not use |
| 175 |
this file except in compliance with the License. You can obtain a copy |
| 176 |
in the file LICENSE in the source distribution or at |
| 177 |
<https://www.openssl.org/source/license.html>. |