I'm trying to use CURL to test simple HTTPS connections to servers that require a client certificate. I've specified the certificate type in my .curlrc file with cert = /path/to/Cert.p12 and told it that yes, it's a PKCS12 cert with cert-type = P12. It kept failing with "could not parse PKCS12 file, check password...... mac verify failure", so out of curiosity I tried hard-coding the password in the config file, and sure enough it pulled the page right up.

I read the man page about a dozen times and I can't see anything from the command line to say "please prompt me for a password", and it says right there "If the optional password isn't specified, it will be queried for on the terminal". Am I missing something obvious?

2 Answers 2


I can't find a source, but it appears that while CURL sort of speaks PKCS12, it would really rather have a PEM-format cert. Simply converting my PKCS12 cert to PEM, with password, caused CURL to start prompting for passwords as expected.


I am able to use a P12 and I use an environment variable for the password, which I obtain via a secure prompt ahead of time. Code:

read -sp "Certificate Password: " CERTPASS
curl --cert-type P12 --cert myp12file.p12:"$CERTPASS" https://example.com

Also, I was able to get it to prompt for a certificate password with this command format:

curl -uadmin -v -X POST https://example.com

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .