title: Getting (58) unable to use client certificate (no key found or wrong pass phrase?) from curl
body: <p>I'm attempting to make test calls to a third-party API that requires a client cert. I generated a new cert using this command with openssl:</p>
  
  <pre><code>req -new -newkey rsa:2048 -nodes -out mycsr.csr -keyout mykey.key
  </code></pre>
  
  <p>I then sent them the csr, and they sent me back mycert.crt. I concatenated the cert and the key together:</p>
  
  <pre><code>cat mycert.crt mykey.key &gt; mycertandkey.pem
  </code></pre>
  
  <p>Finally, I added mycert.crt to the ca-certificates folder and ca-certificates.conf and ran "update-ca-certificates --fresh".</p>
  
  <p>Now, I'm trying to make curl call from bash using the following command:</p>
  
  <pre><code>curl -X GET --cert mycertandkey.pem -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https://api.URL.com
  </code></pre>
  
  <p>I've also tried:</p>
  
  <pre><code>curl -X GET --cert mycertandkey.pem --cacert mycert.crt -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https://api.URL.com
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>curl -X GET --cert mycertandkey.pem --cacert mycert.crt --key mykey.key -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https://api.URL.com
  </code></pre>
  
  <p>And every other combination I can think of. I always get the error "<strong>curl: (58) unable to use client certificate (no key found or wrong pass phrase?)</strong>". The key doesn't have a passphrase. All of the cert/key files have 777 permissions.</p>
  
  <p>I haven't worked much with certs in the past and I feel like I've missed something, especially since I seem to have only one cert. Is the cert that the other company sent me a cacert or is it my client cert? Did I concatenate the private key to the wrong cert? </p>
  
  <p>I've found a lot of piecemeal information about this online, but if anyone knows of a good tutorial on this subject, I'd really appreciate that as well.</p>