How can I use a PEM certificate with password? How can I use a PEM certificate with password? curl curl

How can I use a PEM certificate with password?


The way you uses curl with option -E, you are specifying a private key with a certificate.

(from the cURL man page)

-E/--cert

(SSL) Tells curl to use the specified client certificate file when getting a file with HTTPS, FTPS or another SSL-based protocol. The certificate must be in PEM format. If the optional password isn't specified, it will be queried for on the terminal. Note that this option assumes a "certificate" file that is the private key and the private certificate concatenated! See --cert and --key to specify them independently.

So in order to do the samething with RestClient, you can try using the ssl_client_key option. Like:

:ssl_client_key   =>  OpenSSL::PKey::RSA.new(File.read("key.pem"), "passphrase, if any"),