I am trying to make test calls for a third-party API that requires a client certificate. I generated a new certificate using this command with openssl:
req -new -newkey rsa:2048 -nodes -out mycsr.csr -keyout mykey.key
Then I sent them csr and they sent me mycert.crt back. I combined the certificate and key together:
cat mycert.crt mykey.key > mycertandkey.pem
Finally, I added mycert.crt to the ca-cert and ca-certificates.conf folder and ran "update-ca-certificates -fresh".
Now I am trying to make a curl call from bash using the following command:
curl -X GET --cert mycertandkey.pem -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https:
I also tried:
curl -X GET --cert mycertandkey.pem --cacert mycert.crt -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https:
and
curl -X GET --cert mycertandkey.pem --cacert mycert.crt --key mykey.key -H 'Accept-Encoding: gzip,deflate' -H 'Content-Type: application/json' https:
And every other combination that I can think of. I always get the error message " curl: (58) cannot use the client certificate (the key was not found or the phrase is incorrect?) . The key does not have a passphrase. All cert / key files have 777 permissions.
I have not worked much with certificates in the past, and it seems to me that I missed something, especially since I seem to have only one certificate. Is there a certificate that another company sent me cacert or is it my client certificate? Did I connect the secret key with the wrong certificate?
I found a lot of step-by-step information about this on the Internet, but if anyone knows a good tutorial on this, I would appreciate it too.