I am facing an SSL issue with the curl
command. I want to reach an URL using my SSL client certificate and private key.
This is my command:
$
I've gone through the same problem, and found a solution finally, maybe it can help you.
The failure was due to the private key in PKCS#8 format:
a PKCS#8 private key starts with
-----BEGIN ENCRYPTED PRIVATE KEY-----
header
or
-----BEGIN PRIVATE KEY-----
header
With this key curl
+ openssl
will works, but curl
+ nss
+ libnsspem.so
wouldn't.
with a RSA private key which starts with
-----BEGIN RSA PRIVATE KEY-----
header
both curl
+ openssl
and curl
+ nss
+ libnsspem.so
will work.
So use this command
openssl pkcs8 -in path/to/your/pkcs8/key -out path/to/rsa/key
to convert the PKCS#8 key to traditional RSA key.
If your certificate has a passphrase you should add it after the certificate name:
curl -k -v "https://myurl.com/" --cert ./certificate.pem:passphrase --key ./private.key