Class: OpenSSL::SSL::SSLSocket
- Inherits:
-
Object
- Object
- OpenSSL::SSL::SSLSocket
- Includes:
- Buffering, Nonblock, SocketForwarder
- Defined in:
- lib/jopenssl22/openssl/ssl.rb,
lib/jopenssl23/openssl/ssl.rb,
lib/jopenssl19/openssl/ssl-internal.rb
Constant Summary
Constants included from Buffering
Instance Attribute Summary
Attributes included from Buffering
Instance Method Summary collapse
-
#post_connection_check(hostname) ⇒ Object
call-seq: ssl.post_connection_check(hostname) -> true.
-
#session ⇒ Object
call-seq: ssl.session -> aSession.
- #sysclose ⇒ Object
Methods included from Nonblock
Methods included from SocketForwarder
#addr, #closed?, #do_not_reverse_lookup=, #fcntl, #getsockopt, #peeraddr, #setsockopt
Methods included from Buffering
#<<, #close, #each, #each_byte, #eof?, #flush, #getc, #gets, #initialize, #print, #printf, #puts, #read, #read_nonblock, #readchar, #readline, #readlines, #readpartial, #ungetc, #write, #write_nonblock
Instance Method Details
#post_connection_check(hostname) ⇒ Object
call-seq:
ssl.post_connection_check(hostname) -> true
Perform hostname verification following RFC 6125.
This method MUST be called after calling #connect to ensure that the hostname of a remote peer has been verified.
242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/jopenssl22/openssl/ssl.rb', line 242 def post_connection_check(hostname) if peer_cert.nil? msg = "Peer verification enabled, but no certificate received." if using_anon_cipher? msg += " Anonymous cipher suite #{cipher[0]} was negotiated. Anonymous suites must be disabled to use peer verification." end raise SSLError, msg end unless OpenSSL::SSL.verify_certificate_identity(peer_cert, hostname) raise SSLError, "hostname \"#{hostname}\" does not match the server certificate" end return true end |
#session ⇒ Object
call-seq:
ssl.session -> aSession
Returns the SSLSession object currently used, or nil if the session is not established.
394 395 396 397 398 |
# File 'lib/jopenssl23/openssl/ssl.rb', line 394 def session SSL::Session.new(self) rescue SSL::Session::SessionError nil end |
#sysclose ⇒ Object
231 232 233 234 235 |
# File 'lib/jopenssl22/openssl/ssl.rb', line 231 def sysclose return if closed? stop io.close if sync_close end |