SSL_GET_VERSION(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… 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 protocol
  • DTLSv1 β€” the connection uses the DTLSv1 protocol
  • DTLSv1.2 β€” the connection uses the DTLSv1.2 protocol
  • QUICv1 β€” 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 for SSL_client_version()).
  • DTLS1_BAD_VER β€” the connection uses an obsolete pre-standardisation DTLS protocol
  • DTLS1_VERSION β€” the connection uses the DTLSv1 protocol
  • DTLS1_2_VERSION β€” the connection uses the DTLSv1.2 protocol
  • OSSL_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() and SSL_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 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