SSL_GET_VERSION(3ossl)
π SSL_GET_VERSION (3ossl) β the protocol detective squad π΅οΈββοΈβ¨
okay so bestie, you've got an SSL connection and you're sitting there likeβ¦ "what even is this thing? which version? is it DTLS? is it QUIC?" β and this whole little family of functions exists to answer exactly that. welcome to the vibe check for protocol info π (this is page SSL_GET_VERSION(3ossl), from the OpenSSL manual, iykyk)
πΈ NAME πΈ
SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_is_tls, SSL_is_quic, SSL_version β get the protocol information of a connection π
β¨ SYNOPSIS β¨
like, the receipts:
#include <openssl/ssl.h>
int SSL_client_version(const SSL *s);
const char *SSL_get_version(const SSL *ssl);
int SSL_is_dtls(const SSL *ssl);
int SSL_is_tls(const SSL *ssl);
int SSL_is_quic(const SSL *ssl);
int SSL_version(const SSL *s);
π¦ DESCRIPTION π¦
okay so for SSL, TLS and DTLS protocols, SSL_client_version() returns the numeric protocol version that the client advertised in the legacy_version field of the ClientHello when it kicked off the connection. π
β οΈ lowkey important: for TLS, this value will never indicate a version greater than TLSv1.2 β even if TLSv1.3 ends up being negotiated later. so don't be surprised, it's not being shady, that's just how the legacy_version field works π
for QUIC connections, though? it returns OSSL_QUIC1_VERSION. slay.
SSL_get_version() returns the name of the protocol used for the connection. SSL_version() returns the numeric protocol version used for the connection. π―
π the way that these two should only be called after the initial handshake has been completedβ¦ prior to that, the results you get back from these functions may be unreliable. no cap. don't trust them mid-handshake, it's giving chaos π
SSL_is_dtls() returns 1 if the connection is using DTLS or 0 if not.
SSL_is_tls() returns 1 if the connection is using SSL/TLS or 0 if not.
SSL_is_quic() returns 1 if the connection is using QUIC or 0 if not. π
π RETURN VALUES π
SSL_get_version() returns one of these strings, bestie β memorize the menu π:
SSLv3β the connection uses the SSLv3 protocol.TLSv1β the connection uses the TLSv1.0 protocol.TLSv1.1β the connection uses the TLSv1.1 protocol.TLSv1.2β the connection uses the TLSv1.2 protocol.TLSv1.3β the connection uses the TLSv1.3 protocol.DTLSv0.9β the connection uses an obsolete pre-standardisation DTLS protocolDTLSv1β the connection uses the DTLSv1 protocolDTLSv1.2β the connection uses the DTLSv1.2 protocolQUICv1β the connection uses the QUICv1 protocol.unknownβ this indicates an unknown protocol version. π (mystery era, but not the fun kind)
SSL_version() and SSL_client_version() return an integer which could include any of the following π:
SSL3_VERSIONβ the connection uses the SSLv3 protocol.TLS1_VERSIONβ the connection uses the TLSv1.0 protocol.TLS1_1_VERSIONβ the connection uses the TLSv1.1 protocol.TLS1_2_VERSIONβ the connection uses the TLSv1.2 protocol.TLS1_3_VERSIONβ the connection uses the TLSv1.3 protocol (never returned forSSL_client_version()).DTLS1_BAD_VERβ the connection uses an obsolete pre-standardisation DTLS protocolDTLS1_VERSIONβ the connection uses the DTLSv1 protocolDTLS1_2_VERSIONβ the connection uses the DTLSv1.2 protocolOSSL_QUIC1_VERSIONβ the connection uses the QUICv1 protocol.
π₯ SEE ALSO π₯
ssl(7)β go read it, it's the parent lore π§
β HISTORY β
SSL_is_dtls()was added in OpenSSL 1.1.0.SSL_is_tls()andSSL_is_quic()were added in OpenSSL 3.2.
(so yes, the QUIC and TLS detectors are the new kids on the block, main character energy π)
π COPYRIGHT π
Copyright 2001-2023 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
aaaand that's the whole page, bestie π«Ά β this was SSL_GET_VERSION(3ossl) from OpenSSL 3.5.0, dated 2026-09-25. go forth and check your protocol versions responsibly π
β¨πΈ
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms