title: How can I use a PEM certificate with password?
body: <p>I'm having plenty of trouble trying to use a certificate that has a password on ruby. I'm using rest-client, but that's not a requirement.</p>
  
  <p>This is the cURL-equivalent of the call I need to make:</p>
  
  <pre><code>curl -E certificate.pem:PASSWORD -d ident=language -d data="test" "https://theurl" 
  </code></pre>
  
  <p>I tried many things, but I can't get the password part working. Here's what I have so far:</p>
  
  <pre><code>cert = OpenSSL::X509::Certificate.new(File.read("#{RAILS_ROOT}/certificate.pem"))
  
  reply = RestClient.post("https://theurl", {:ident =&gt; 'language', :data =&gt; 'test'}, {:ssl_client_cert =&gt; cert})
  </code></pre>
  
  <p>I've tried putting the password everywhere, as :password and :ssl_client_key, I've looked through all documentation I could find but there's nowhere that will accept this password.</p>
  
  <p>This is the error I always get:</p>
  
  <pre><code>SSL_connect returned=1 errno=0 state=SSLv3 read finished A: sslv3 alert handshake failure
  </code></pre>
  
  <p>What am I missing?</p>