Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
instance method
OpenSSL::SSL::SSLContext#min_version=
(::OpenSSL::SSL::tls_version version) -> ::OpenSSL::SSL::tls_version
ctx.min_version = OpenSSL::SSL::TLS1_2_VERSION
ctx.min_version = :TLS1_2
ctx.min_version = 0
ctx.min_version = nil
ext/openssl/ossl_ssl.c
View on GitHub ↗
static VALUE
ossl_sslctx_set_min_version(VALUE self, VALUE v)
{
SSL_CTX *ctx;
int version;
rb_check_frozen(self);
GetSSLCTX(self, ctx);
version = parse_proto_version(v);
if (!SSL_CTX_set_min_proto_version(ctx, version))
ossl_raise(eSSLError, "SSL_CTX_set_min_proto_version");
return v;
}
Sets the lower bound of the supported SSL/TLS protocol version range. The version may be specified by an integer constant named OpenSSL::SSL::*_VERSION or a Symbol. A value of 0 or nil leaves the lower bound unspecified.
See also security_level=, which may further restrict the available protocol versions.
Example
Example
ctx = OpenSSL::SSL::SSLContext.new ctx.min_version = OpenSSL::SSL::TLS1_1_VERSION ctx.max_version = OpenSSL::SSL::TLS1_2_VERSION sock = OpenSSL::SSL::SSLSocket.new(tcp_sock, ctx) sock.connect # Initiates a connection using either TLS 1.1 or TLS 1.2