> It's not the most beautiful thing in the world, but you can get access
> to the certificate data in the SSL_verify_callback.  It gets called for
> each certificate in the chain, starting from the root cert.  Here's a
> basic example:
> 
> use strict;
> use warnings;
> use LWP::UserAgent;
> 
> my $last_expire;
> 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($ctx_store);
>       $last_expire =
> Net::SSLeay::P_ASN1_TIME_get_isotime(Net::SSLeay::X509_get_notAfter($cert));
>       return $ok;
>     },
>   },
> );
> 
> $ua->get('https://www.google.com/');
> warn "$last_expire\n";

This is exactly what I was looking for. Thanks! Unfortunately, the callback
function is not called on my system, probably a too-old library (I try
adding a die() in the callback, but nothing died).

-- 
Seb, autocuiseur

Reply via email to