Creates a new instance of SSLSocket
. remotehost_ and remoteport_ are used to open TCPSocket
. If localhost_ and localport_ are specified, then those parameters are used on the local end to establish the connection. If context is provided, the SSL
Sockets initial params will be taken from the context.
sock = OpenSSL::SSL::SSLSocket.open('localhost', 443) sock.connect # Initiates a connection to localhost:443
with SSLContext:
ctx = OpenSSL::SSL::SSLContext.new sock = OpenSSL::SSL::SSLSocket.open('localhost', 443, context: ctx) sock.connect # Initiates a connection to localhost:443 with SSLContext
Initiates an SSL/TLS handshake with a server.
Waits for a SSL/TLS client to initiate a handshake.
Sends “close notify” to the peer and tries to shut down the SSL
connection gracefully.
The X509
certificate for this socket endpoint.
Returns the cipher suite actually used in the current session, or nil if no session has been established.
Works similar to TCPServer#accept
.
See IO#close
for details.
Performs the certificate verification using the parameters set to stctx.
See also the man page X509_verify_cert(3).
Returns the error code of stctx. This is typically called after verify
is done, or from the verification callback set to OpenSSL::X509::Store#verify_callback=
.
See also the man page X509_STORE_CTX_get_error(3).
Sets the error code of stctx. This is used by the verification callback set to OpenSSL::X509::Store#verify_callback=
.
See also the man page X509_STORE_CTX_set_error(3).
Sets the purpose of the context. This overrides the default value set by Store#purpose=
.
See also the man page X509_VERIFY_PARAM_set_purpose(3).
Sets the time used in the verification. If not set, the current time is used.
See also the man page X509_VERIFY_PARAM_set_time(3).
Verifies the signature of the certificate, with the public key key. key must be an instance of OpenSSL::PKey
.
Checks that cert signature is made with PRIVversion of this PUBLIC ‘key’
This adds a new ObjectId
to the internal tables. Where object_id is the numerical form, short_name is the short name, and long_name is the long name.
Returns true
if successful. Raises an OpenSSL::ASN1::ASN1Error
if it fails.