title: With self signed certificate, curl: (60) SSL certificate problem: unable to get local issuer certificate
body: <p>I have created a self signed certificate using <code>keytool</code>. Full command is</p>
  <pre><code>keytool -keystore server.p12 -alias server_key -keyalg rsa -ext ku=DigitalSignature,keyEncipherment,dataEncipherment
  </code></pre>
  <p>I added this keystore to my web server as well. There was no there. My question is about how to curl to the server without skipping verification. (I don't want to use <code>-k</code> option). I exported the server certificate using the following command</p>
  <pre><code>keytool -export -keystore server.p12 -alias server_key -file server.crt
  </code></pre>
  <p>With <code>curl -v --cacert server.crt https://host:port</code>, the following is the error even though server certificate is provided for curl.</p>
  <pre><code>* Rebuilt URL to: https://localhost:5443/
  *   Trying 127.0.0.1...
  * TCP_NODELAY set
  * Connected to localhost (127.0.0.1) port 5443 (#0)
  * ALPN, offering h2
  * ALPN, offering http/1.1
  * successfully set certificate verify locations:
  *   CAfile: /home/innsh/Downloads/cacert.pem
    CApath: /etc/ssl/certs
  * TLSv1.3 (OUT), TLS handshake, Client hello (1):
  * TLSv1.3 (IN), TLS handshake, Server hello (2):
  * TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
  * TLSv1.3 (IN), TLS handshake, Unknown (8):
  * TLSv1.3 (IN), TLS Unknown, Certificate Status (22):
  * TLSv1.3 (IN), TLS handshake, Certificate (11):
  * TLSv1.3 (OUT), TLS alert, Server hello (2):
  * SSL certificate problem: unable to get local issuer certificate
  * stopped the pause stream!
  * Closing connection 0
  curl: (60) SSL certificate problem: unable to get local issuer certificate
  More details here: https://curl.haxx.se/docs/sslcerts.html
  
  curl failed to verify the legitimacy of the server and therefore could not
  establish a secure connection to it. To learn more about this situation and
  how to fix it, please visit the web page mentioned above.
  </code></pre>