Trouble with Cygwin, Curl and Full paths for certificates in windows

58 Views Asked by At

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 that receives some parameters and sends them all to a .sh file that checks everything and creates a Curl request out of all the parameters.

Im using Cygwin distribution with Curl package

it creates this curl: curl -k -X POST -H "Content-Type:$$$" -H "Cache-Control:$$$" --cert "C:\Users\Yair\servercopy\server-bin\bin\jrod.crt" --cert-type PEM --key "C:\Users\Yair\servercopy\server-bin\bin\jrod.key" --key-type PEM --trace-ascii curl_debug_dump.log --data "@usr_setup.xml" "some_https_url"

And I get the error above. (Ignore the $$$)

When running the command as curl -k -X POST -H "Content-Type:$$$" -H "Cache-Control:$$$" --cert "jrod.crt" --cert-type PEM --key "jrod.key" --key-type PEM --trace-ascii curl_debug_dump.log --data "@usr_setup.xml" "some_https_url"

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

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 curl\Cygwin 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?

0

There are 0 best solutions below