If you see an error saying curl: (58) unable to set private key file
there is a chance that the private key in your PEM file does not match the certificate.
You can check this by comparing the modulus of the certificate and the private key. Here’s how you can do it:
openssl x509 -noout -modulus -in certificate.pem | openssl md5
openssl rsa -noout -modulus -in private_key.pem | openssl md5