Lots and lots of solutions for this one out there in Google land, but it turned out to be much simpler...

This is using Perl 5.14.3 on Linux, with LWP 6.04 using IO::Socket::SSL 1.77

I'd set the client up like so:

my $ua = LWP::UserAgent->new;
$ua->ssl_opts(
    SSL_ca_file => "$ENV{'HOME'}/ca.pem",
    SSL_cert_file => "$ENV{'HOME'}/my.crt",
    verify_hostname => 1,
);

...my crt file is a combined certificate and key.

The solution turned out to be simply a case of including the key statement, pointing at the same file:

$ua->ssl_opts(
    SSL_use_cert => 1,
    SSL_ca_file => "$ENV{'HOME'}/ca.pem",
    SSL_cert_file => "$ENV{'HOME'}/my.crt",
    SSL_key_file => "$ENV{'HOME'}/my.crt",
    verify_hostname => 1,
);

Comments

comments powered by Disqus