The main error: curl: (58) could not load PEM client certificate, OpenSSL error error:02001002:system library:fopen:No such file or directory, (no key found, wrong pass phrase, or wrong file format?)

Im running a shell command that runs a .bat file the receives some parameters and sends in all to a .sh file that checks everything and creates a Curl request out of all the parameters.

This is the original request:
start_task.bat -cString=some_https_url -task=usr_setup.xml -certFile=”C:UsersYairDownloadsservercopyserver-binbinjrod.crt” -keyFile=”C:UsersYairDownloadsservercopyserver-binbinjrod.key” -wait=true -debug=true

it creates this curl:
curl -k -X POST -H “Content-Type:$$$” -H “Cache-Control:$$$” –cert “C:UsersYairDownloadsservercopyserver-binbinjrod.crt” –cert-type PEM –key “C:UsersYairDownloadsservercopyserver-binbinjrod.key” –key-type PEM –trace-ascii curl_debug_dump.log –data “@usr_setup.xml” “some_https_url”

And I get the error above.

When running the command as
start_task.bat -cString=some_https_url -task=usr_setup.xml -certFile=”jrod.crt” -keyFile=”jrod.key” -wait=true -debug=true

Everything works just fine – when giving relative path it works.

notes:
Im using Cygwin distribution with Curl package

Things I already tried:

I downloaded a independent Curl.exe (one that is outside of Cygwin) and replaced the curl.exe of my cygwin dir with the curl.exe I just downloaded and it worked! – So I guessed it might be related to curlCygwin version, I downloaded the latest Cygwin distribution with the latest curl package and it didnt work. Seems like it doesnt work with Cygwin distribution + full paths.

I tried “playing” with the quotes, tried sending the request with ‘ instead of ” and without quotes at all, nothing worked.

I tried swapping the with / and vice versa, didnt work.

I checked the certs files has all the permissions needed – they have full permissions.

I tried using cat and other commands on the full path Im using to make sure other things can read it – works just fine.

I tried giving a full path to other parameters such as -task and it worked.

I tried giving a /mnt/c kind of path – didnt work.

Im out of ideas, why would it work with relative path, with independent curl, with other parameters having full path but not with cygwin curl, certs having full path and such..

Any idea what else can I try? what am I missing?

New contributor

Yair Dor is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.