[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

finding expiration dates on ssl certificates

dusty

10/8/2007 4:18:00 PM

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...)
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

1 Answer

Richard Conroy

10/8/2007 7:27:00 PM

0

On 10/8/07, dusty <dusty.doris@gmail.com> wrote:
> 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.

<snip>

Nice! This is going to come in handy for me soon. Thanks for
pre-empting my google search.