finding expiration dates on ssl certificates

Discussion in 'Ruby' started by dusty, Oct 8, 2007.

  1. dusty

    dusty Guest

    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
    dusty, Oct 8, 2007
    #1
    1. Advertising

  2. On 10/8/07, dusty <> 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.
    Richard Conroy, Oct 8, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rickey Tom
    Replies:
    4
    Views:
    497
    Rickey Tom
    Jul 29, 2003
  2. David Lozzi

    Dates dates dates dates... SQL and ASP.NET

    David Lozzi, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    843
    Rob Schieber
    Sep 30, 2005
  3. n33470

    Are SSL certificates and x.509 certificates the same?

    n33470, Dec 14, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    176
    n33470
    Dec 14, 2005
  4. PW

    Dates! Dates! Dates!

    PW, Aug 7, 2004, in forum: ASP General
    Replies:
    4
    Views:
    178
    Mark Schupp
    Aug 9, 2004
  5. Roy Johnson
    Replies:
    0
    Views:
    119
    Roy Johnson
    Oct 24, 2003
Loading...

Share This Page