How to find the SSL certificate's expiration.

Discussion in 'Perl Misc' started by perlnovice, May 11, 2004.

  1. perlnovice

    perlnovice Guest

    Hello all,

    I would like to write a script running on a client to determine the
    expiration date of a web server's SSL certificate. But I do not know
    how to. Can anybody give me a hint.

    Thanks in advance for your information.

    Tuan
     
    perlnovice, May 11, 2004
    #1
    1. Advertising

  2. perlnovice

    J. Gleixner Guest

    perlnovice wrote:
    > Hello all,
    >
    > I would like to write a script running on a client to determine the
    > expiration date of a web server's SSL certificate. But I do not know
    > how to. Can anybody give me a hint.


    Hint: Start by searching the internet! Learn to use google.

    Just for fun, after spending only a few minutes, I found:
    http://www.mail-archive.com//msg01187.html
     
    J. Gleixner, May 12, 2004
    #2
    1. Advertising

  3. perlnovice

    lostriver Guest

    On 11 May 2004 12:16:46 -0700, perlnovice wrote:
    > I would like to write a script running on a client to determine the
    > expiration date of a web server's SSL certificate. But I do not know
    > how to. Can anybody give me a hint.


    One way to do it is to use Net::SSLeay module available from CPAN.


    #!/usr/local/bin/perl
    use Net::SSLeay;

    $site = shift || die "Usage: $0 URL\n";
    (undef, undef, undef, $server_cert) = &Net::SSLeay::get_https3($site, 443, '/');

    if ( defined ($server_cert) ) {
    $from = Net::SSLeay::X509_get_notBefore($server_cert);
    print Net::SSLeay::p_ASN1_UTCTIME_put2string($from), "\n";

    $to = Net::SSLeay::X509_get_notAfter($server_cert);
    print Net::SSLeay::p_ASN1_UTCTIME_put2string($to);
    }
    __END__



    --
    ..signature: No such file or directory
     
    lostriver, May 12, 2004
    #3
    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. John Nagle
    Replies:
    11
    Views:
    640
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Dec 14, 2006
  2. Helena Cai
    Replies:
    0
    Views:
    407
    Helena Cai
    Aug 29, 2004
  3. dusty
    Replies:
    1
    Views:
    123
    Richard Conroy
    Oct 8, 2007
  4. Roy Johnson
    Replies:
    0
    Views:
    127
    Roy Johnson
    Oct 24, 2003
  5. Replies:
    0
    Views:
    420
Loading...

Share This Page