curl / Mailing Lists / curl-users / Single Mail


how to set password for private key with pem for https connection?

From: Jun Sun <>
Date: Thu, 4 Apr 2019 20:50:27 -0700

I started with pfx file and converted to pem files with following commands

openssl pkcs12 -in client.pfx -out client.pem (PEM password is "test")
openssl pkcs12 -in client.pfx -out client-nopass.pem -nodes

The nopass version works fine

curl -v -v -k --cert ./client-nopass.pem

The password version does not work no matter which ways I tried:

curl -v -v -k --cert ./client.pem --pass test
curl -v -v -k --cert ./client.pem:test

They all give "error reading X.509 potentially-encrypted key file: Error in

Can someone give a pointer? This drives me nuts.

BTW, there is an intermediate certificate embedded in the certificate,
which I don't think is an issue.

Also, my ultimate goal is to simply use pfx file directly without
converting to pem file. Is this possible?



Received on 2019-04-05