getting security certificate expiration dates

Discussion in 'Perl Misc' started by Roy Johnson, Oct 24, 2003.

  1. Roy Johnson

    Roy Johnson Guest

    Ok, one posting eaten. Trying again:

    My task is to check the expiration dates of security certificates, so
    we'll know when we need to renew them. I'm not terribly SSL savvy, but
    this should be really basic, right?

    Web searches pointed me to Net::SSLeay, which I'm wading through
    without getting a great understanding of what's important. I've built
    some code by example, and would appreciate some input from those with
    expertise, regarding:

    - am I using the right module?
    - am I using it appropriately (or, more likely, how far off-track am
    I)?

    Code:

    use strict;
    use warnings;

    use Net::SSLeay qw(die_now die_if_ssl_error);
    Net::SSLeay::load_error_strings();
    Net::SSLeay::SSLeay_add_ssl_algorithms(); # Important!
    Net::SSLeay::randomize();

    my $cert_path = '/path/to/cert.pem';
    my $key_path = '/path/to/notacakeynopass.pem';

    my $ctx = Net::SSLeay::new_x_ctx() or die("Failed to create CTX $!");
    Net::SSLeay::set_cert_and_key($ctx, $cert_path, $key_path);

    my $ssl = Net::SSLeay::new($ctx) or die("Failed to create SSL $!");
    my $cert = Net::SSLeay::dump_peer_certificate($ssl);

    ## Presumably, the expiration will be in here somewhere
    print "Cert is ", length($cert), "bytes\n";
    print $cert, "\n";
     
    Roy Johnson, Oct 24, 2003
    #1
    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:
    531
    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:
    904
    Rob Schieber
    Sep 30, 2005
  3. PW

    Dates! Dates! Dates!

    PW, Aug 7, 2004, in forum: ASP General
    Replies:
    4
    Views:
    231
    Mark Schupp
    Aug 9, 2004
  4. perlnovice
    Replies:
    2
    Views:
    535
    lostriver
    May 12, 2004
  5. yawnmoth
    Replies:
    1
    Views:
    91
    yawnmoth
    Jul 19, 2007
Loading...

Share This Page