in reply to Re: Getting an SSL Certificate Expiration Date
in thread Getting an SSL Certificate Expiration Date
Good idea, some quick googling found this post by Graham Knop from which I adapted the code:
use warnings; use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new( ssl_opts => { SSL_verify_callback => sub { my ($ok, $ctx_store) = @_; my $cert = Net::SSLeay::X509_STORE_CTX_get_current_cert($c +tx_store); print Net::SSLeay::P_ASN1_TIME_get_isotime( Net::SSLeay::X509_get_notAfter($cert) ), "\n"; return $ok; }, }, ); $ua->get('https://www.perlmonks.org/'); __END__ 2038-01-18T23:59:59Z 2029-08-21T23:59:59Z 2022-09-02T23:59:59Z
Note the documentation also says "The callback will be called for each element in the certificate chain."
Another post in the above thread points to Net::SSL::ExpireDate.
|
|---|