Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

OpenSSL::SSL::SSLSocket.new

SSLSocket.new(io) => aSSLSocket
SSLSocket.new(io, ctx) => aSSLSocket

Creates a new SSL socket from io which must be a real IO object (not an IO-like object that responds to read/write).

If ctx is provided the SSL Sockets initial params will be taken from the context.

The OpenSSL::Buffering module provides additional IO methods.

This method will freeze the SSLContext if one is provided; however, session management is still allowed in the frozen SSLContext.

See also .open #accept also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0