title: cURL SSL Certificate error "Bad Certificate"
body: <p>I'm trying to send an SSL certificate with a soap message to a server and have only just managed to make cURL accept the certificate (.pem file spit out by putting a .pfx file through OpenSSL) and not return "unable to set private key file" (evidently the private key must keep its 'bag attributes'), however it's now returning exciting new errors:</p>
  
  <blockquote>
    <p>SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed</p>
  </blockquote>
  
  <p>I've tried setting the CA certificate with: </p>
  
  <pre><code>curl_setopt($soap_do, CURLOPT_CAINFO, $caFile);
  </code></pre>
  
  <p>But this yields no results with the root nor the intermediate ca files I have.</p>
  
  <p>Disabling this check with:</p>
  
  <pre><code>curl_setopt($soap_do, CURLOPT_SSL_VERIFYHOST, 0);
  curl_setopt($soap_do, CURLOPT_SSL_VERIFYPEER, 0);
  </code></pre>
  
  <p>brings me to the new problem:</p>
  
  <blockquote>
    <p>error:14094412:SSL routines:SSL3_READ_BYTES:sslv3 alert bad certificate</p>
  </blockquote>
  
  <p>This has been a thorn in my side for weeks now and while new error messages mean changes I'm not sure it means progress. Any advice or suggestions as to what is missing/I am doing wrong would be greatly appreiciated.</p>