class Object
Public Instance Methods
get_cert_info(domain)
click to toggle source
Return a monkey-patched X509 certificate for the given domain
# File lib/seguridad.rb, line 22 def get_cert_info(domain) port = 443 tokens = domain.split(':') if tokens.length > 1 domain = tokens[0] port = tokens[-1].to_i end socket = TCPSocket.new(domain, port) ctx = OpenSSL::SSL::SSLContext.new tls = OpenSSL::SSL::SSLSocket.new(socket, ctx) tls.connect cert = OpenSSL::X509::Certificate.new tls.peer_cert cert.domain = domain cert end