Perl LWP handshake failure error
115 words, 1 minutes.
I had this error the other day:
Perl LWP 'error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure'
Lots and lots of solutions for this one out there in Google land, but it turned out to be quite simple.
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,
);