title: Using LWP with SSL and client certificates
body: <p>I'm porting an application from PHP/cURL to Perl and LWP::UserAgent. I need to do a POST request to a web server and provide a client certificate and key file. The PHP code I'm trying to replicate is this:</p>
  
  <pre><code>curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
  curl_setopt($ch, CURLOPT_SSLCERT, "/path/to/certificate.pem"); 
  curl_setopt($ch, CURLOPT_SSLKEY, "/path/to/private.key"); 
  curl_setopt($ch, CURLOPT_SSLKEYPASSWD, "secretpassword");
  </code></pre>
  
  <p>And here's my Perl code:</p>
  
  <pre><code>my $ua = LWP::UserAgent-&gt;new();
  $ua-&gt;ssl_opts(
     SSL_verify_mode =&gt; 0,
     SSL_cert_file   =&gt; '/path/to/certificate.pem',
     SSL_key_file    =&gt; "/path/to/private.key",
     SSL_passwd_cb   =&gt; sub { return "secretpassword"; }  
  );
  </code></pre>
  
  <p>The PHP code successfully connects to the server but the Perl code fails with:</p>
  
  <p>SSL read error error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure</p>
  
  <p>I can't figure out what I'm missing.</p>