SSL_CTX_SET_SSL_VERSION(3ossl)
π SSL_CTX_SET_SSL_VERSION(3ossl) β the OpenSSL glow-up page
okay bestie, welcome to the OpenSSL 3ossl manual, this one's all about choosing a new TLS/SSL method and honestly it's giving "small functions, big feelings." Let's get into it π
β¨ 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);
β¨ DESCRIPTION β¨
so SSL_CTX_set_ssl_version() sets a brand new default TLS/SSL method for all the SSL objects that get newly created from this ctx. π Most of the configuration attached to the SSL_CTX object is retained, BUT β and this is the plot twist β the configured TLS ciphers get reset to the default values. gone. not like us. π
SSL objects that were already created from this SSL_CTX with SSL_new(3) are not affected, except when SSL_clear(3) is being called, as described below. iykyk.
SSL_CTX_get_ssl_method() returns the SSL_METHOD which was used to construct the SSL_CTX. simple, iconic, no notes.
SSL_set_ssl_method() sets a new TLS/SSL method for a particular ssl object. it may be reset when SSL_clear() is called. π
SSL_get_ssl_method() returns a pointer to the TLS/SSL method set in ssl. slay.
πΈ NOTES πΈ
the available method choices are described in SSL_CTX_new(3). go look, bestie, that's where the menu is π
when SSL_clear(3) is called and no session is connected to an SSL object, the method of the SSL object gets reset to the method currently set in the corresponding SSL_CTX object. β¨
β οΈ okay soSSL_CTX_set_version()has unusual semantics and no clear use case β genuinely 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, don't. just make a new one.
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. that's a hard no, not me trying, it's just not happening π
ββοΈ
π«Ά 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. π¬ go read the receipts.1β the operation succeeded. we love a win π
SSL_CTX_get_ssl_method() and SSL_get_ssl_method() always return non-NULL pointers. fr fr, never NULL. π
π¦ SEE ALSO π¦
SSL_CTX_new(3), SSL_new(3), SSL_clear(3), ssl(7), SSL_set_connect_state(3)
π HISTORY π
SSL_CTX_set_ssl_version() was deprecated in OpenSSL 3.0. it's giving "we've moved on." β
π 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>.
and that's the whole page, bestie!! π written by the OpenSSL girlies, version 3.5.6, dated 2026-04-07 β mwah, go forth and pick your methods wisely πβ¨π«Ά
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms