D
dusty
Here is a way to find information about an ssl certificate. I
primarily wanted to do this as an easy way to check the expiration
date. In case anyone else is looking to do something similar, I
thought I'd share.
require 'net/https'
uri = URI.parse("https://www.somesite.com")
http = Net::HTTP.new(uri.host,uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start do |h|
@cert = h.peer_cert
end
puts <<EOD
Subject: #{@cert.subject}
Issuer: #{@cert.issuer}
Serial: #{@cert.serial}
Issued: #{@cert.not_before}
Expires: #{@cert.not_after}
EOD
primarily wanted to do this as an easy way to check the expiration
date. In case anyone else is looking to do something similar, I
thought I'd share.
require 'net/https'
uri = URI.parse("https://www.somesite.com")
http = Net::HTTP.new(uri.host,uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.start do |h|
@cert = h.peer_cert
end
puts <<EOD
Subject: #{@cert.subject}
Issuer: #{@cert.issuer}
Serial: #{@cert.serial}
Issued: #{@cert.not_before}
Expires: #{@cert.not_after}
EOD