SSL_GET_VERSION(3SSL)
β¨ SSL_GET_VERSION β¨ (that's a section 3SSL OpenSSL page, bestie π)
okay so real talk β this is the OpenSSL page about asking a connection what protocol are you even speaking rn π¦ and there are like, a LOT of little functions that all do a slightly different flavour of that. let's get into it, no cap.
πΈ NAME πΈ
SSL_client_version, SSL_get_version, SSL_is_dtls, SSL_is_tls, SSL_is_quic, SSL_CTX_is_quic, SSL_CTX_is_server, SSL_version β get the protocol information of a connection π literally their whole job.
β¨ SYNOPSIS β¨
like, the vibes, verbatim:
#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_CTX_is_quic(const SSL_CTX *ctx);
int SSL_CTX_is_server(const SSL_CTX *ctx);
int SSL_version(const SSL *s);
π DESCRIPTION π
so for SSL, TLS and DTLS protocols β SSL_client_version() hands you the numeric protocol version that the client advertised in the legacy_version field of the ClientHello when it was initiating the connection. π«Ά
β οΈ heads up bestie β for TLS, this value will never indicate a version greater thanTLSv1.2, even ifTLSv1.3gets negotiated later. it's just built different (and by "different" i mean capped).
for QUIC connections tho? 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. π
π¨ and listen β these two should only be called after the initial handshake has been completed. prior to that, the results returned from these functions may be unreliable. it's giving "don't ask yet, she's not ready" π
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.
SSL_CTX_is_quic() returns 1 if the ctx creates QUIC SSL objects, or 0 if not.
SSL_CTX_is_server() returns 1 if the ctx uses a method that allows it to be a server (i.e. server-only or generic method), or 0 if not. main character energy fr fr π
π RETURN VALUES π
SSL_get_version() returns one of these strings, and honestly each one is its own little era:
SSLv3β the connection uses theSSLv3protocol.TLSv1β the connection uses theTLSv1.0protocol.TLSv1.1β the connection uses theTLSv1.1protocol.TLSv1.2β the connection uses theTLSv1.2protocol.TLSv1.3β the connection uses theTLSv1.3protocol.DTLSv0.9β the connection uses an obsolete pre-standardisation DTLS protocol πDTLSv1β the connection uses theDTLSv1protocolDTLSv1.2β the connection uses theDTLSv1.2protocolQUICv1β the connection uses theQUICv1protocol.unknownβ this indicates an unknown protocol version. π
and SSL_version() and SSL_client_version() return an integer which could include any of the following:
SSL3_VERSIONβ the connection uses theSSLv3protocol.TLS1_VERSIONβ the connection uses theTLSv1.0protocol.TLS1_1_VERSIONβ the connection uses theTLSv1.1protocol.TLS1_2_VERSIONβ the connection uses theTLSv1.2protocol.TLS1_3_VERSIONβ the connection uses theTLSv1.3protocol (never returned forSSL_client_version()).DTLS1_BAD_VERβ the connection uses an obsolete pre-standardisation DTLS protocol πDTLS1_VERSIONβ the connection uses theDTLSv1protocolDTLS1_2_VERSIONβ the connection uses theDTLSv1.2protocolOSSL_QUIC1_VERSIONβ the connection uses theQUICv1protocol.
π¦ SEE ALSO π¦
π HISTORY π
okay, storytime, who showed up when:
- The
SSL_is_dtls()function was added in OpenSSL 1.1.0. - The
SSL_is_tls()andSSL_is_quic()functions were added in OpenSSL 3.2.
and then the glow-up continued:
- The
SSL_CTX_is_quic()andSSL_CTX_is_server()functions were added in OpenSSL 4.0
π COPYRIGHT π
Copyright 2001-2026 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>.
aaaaand that's the whole page, bestie π§β¨ mwah. this was OpenSSL 4.0.3, dated 2026-09-29, and it's SSL_GET_VERSION(3SSL) β periodt π
π
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms