Skip to content

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

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
See also #max_version= #options #groups= #options= also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0