I want to use cURL to access a remote server, and I need to identify myself using a private key or the remote server gives a 401 "Unauthorized".

I'm on Windows 7 (work machine, not my choice) and my private key is installed on my computer. I'm not permitted to access it directly, but I believe it's installed in the certificate store correctly. So I want to specify the public key in the cURL command, and let the operating system work out which private key to use.

I've given the public key to the remote server, and they've accepted it and installed it.

So I'm doing this:

curl --verbose --cert "my-public-cert.pem" https://secure.server.com/path

...but it's not working, I'm getting a 58 error:

*   Trying 12.34.56.78...
* Connected to secure.server.com (12.34.56.78) port 443 (#0)
* unable to use client certificate (no key found or wrong pass phrase?)
* Closing connection 0
curl: (58) unable to use client certificate (no key found or wrong pass phrase?)

Am I doing something wrong, or is this just impossible? Is there a way to send a cURL request over SSL, if I can't access the private key directly but the operating system has the private key installed?

Many thanks,

Brendan.

Maybe you need to specify pass phrase.

curl --verbose --cert "my-public-cert.pem:my_pass_phrase" https://secure.server.com/path

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.