SSL_CTX_SET_SSL_VERSION(3ossl)
π SSL_CTX_SET_SSL_VERSION(3ossl) β like, the whole choose-a-new-TLS/SSL-method situation
okay so bestie, welcome to the OpenSSL party π this page lives in the 3ossl manual section, and it's all about swapping out which TLS/SSL method an object is vibing with. four functions, one glow-up, let's go β¨
πΈ NAME πΈ
SSL_CTX_set_ssl_version, SSL_CTX_get_ssl_method, SSL_set_ssl_method, SSL_get_ssl_method β choose a new TLS/SSL method π¦
β¨ SYNOPSIS β¨
#include <openssl/ssl.h>
int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method);
const SSL_METHOD *SSL_CTX_get_ssl_method(const SSL_CTX *ctx);
int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method);
const SSL_METHOD *SSL_get_ssl_method(const SSL *ssl);
like, that's it. that's the whole squad π
π DESCRIPTION π
SSL_CTX_set_ssl_version() sets a brand-new default TLS/SSL method for the SSL objects that get newly created from this ctx. and the way that it works is so specific: most of the configuration attached to the SSL_CTX object is retained, with the exception of the configured TLS ciphers, which are reset to the default values. so yeah, your ciphers get a little reset, that's just how it is π«Ά
SSL objects you already created from this SSL_CTX with SSL_new(3)? not affected, bestie. they're doing their own thing. the one exception is when SSL_clear(3) is being called, as described below π
SSL_CTX_get_ssl_method() returns the SSL_METHOD which was used to construct the SSL_CTX. it's giving "who made me" energy π
SSL_set_ssl_method() sets a new TLS/SSL method for a particular ssl object. it may be reset, when SSL_clear() is called. lowkey fragile, but ok β
SSL_get_ssl_method() returns a pointer to the TLS/SSL method set in ssl. simple, iconic, no notes π
π¦ NOTES π¦
the available method choices are described in SSL_CTX_new(3). go look, i'll wait π§
when SSL_clear(3) is called and no session is connected to an SSL object, the method of the SSL object is reset to the method currently set in the corresponding SSL_CTX object. so it snaps back to the parent's vibe, fr fr π
β οΈSSL_CTX_set_version()has unusual semantics and no clear use case; it would usually be preferable to create a newSSL_CTXobject than to try to reuse an existing one in this fashion. its usage is considered deprecated. like, not me warning you π this one's a red flag, just make a fresh ctx.
also SSL_set_ssl_method() cannot be used to change a non-QUIC SSL object to a QUIC SSL object or vice versa, or change a QUIC SSL object from one QUIC method to another. QUIC stays QUIC, non-QUIC stays non-QUIC. no crossover episodes π
β RETURN VALUES β
the following return values can occur for SSL_CTX_set_ssl_version() and SSL_set_ssl_method():
0β the new choice failed, check the error stack to find out the reason π1β the operation succeeded π₯
SSL_CTX_get_ssl_method() and SSL_get_ssl_method() always return non-NULL pointers. always. no cap π
π SEE ALSO π
go read them, i'm literally begging you π
π HISTORY π
SSL_CTX_set_ssl_version() was deprecated in OpenSSL 3.0. she's retired, respect her legacy β¨
π COPYRIGHT π
Copyright 2000-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>.
okay that's the whole page, you ate that π
this was version 3.5.0, dated 2026-09-25, living in the SSL_CTX_SET_SSL_VERSION(3ossl) manual. mwah, go forth and pick your methods wisely, bestie π«ΆπΈ
π¦ 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