Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > getting security certificate expiration dates

Reply
Thread Tools

getting security certificate expiration dates

 
 
Roy Johnson
Guest
Posts: n/a
 
      10-24-2003
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";
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting cookie expiration dates and paths yawnmoth Javascript 1 07-19-2007 02:09 AM
Dates dates dates dates... SQL and ASP.NET David Lozzi ASP .Net 1 09-30-2005 02:18 PM
Various HP printer ink expiration dates analyzed Agent Orange Digital Photography 31 10-04-2004 05:34 AM
Dates! Dates! Dates! PW ASP General 4 08-09-2004 04:42 PM
Help with setting expiration dates on COOKIES Rickey Tom ASP .Net 4 07-29-2003 12:46 PM



Advertisments