1

I'm using libcurl libraries to call a rest endpoint and it fails on pulling the self signed cert with the error: schannel: Failed to import cert file sit.cer, last error is 0x80092002.

I'm not really that well versed on c++

curl_easy_setopt(curl, CURLOPT_CAINFO, "cacert.pem");
curl_easy_setopt(curl, CURLOPT_SSLCERT, "sit.crt");
curl_easy_setopt(curl, CURLOPT_SSLKEY, "sit.key");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);

I am really stuck on this, please help.

Ntokozo
  • 11
  • 1
  • 1
  • 3

3 Answers3

1

The error means that the option CURLOPT_SSLCERT can not handle the given certificate (type): For schannel you should provide certificates as described here: https://curl.se/libcurl/c/CURLOPT_SSLCERT.html

Dharman
  • 30,962
  • 25
  • 85
  • 135
peter
  • 11
  • 1
1

I received this error due to the windows 10 update in January 2022. Due to a security vulnerabilty they upgraded the version of curl from 7.55.1 to 7.79.1.

My previous curl commands that worked on 7.55.1 stopped working on 7.79.1 and gave me the same error as you. So in the interest of time I had to install a previous version of curl and amend my environment variable path to this previous version which resolved the error.

RamWill
  • 288
  • 1
  • 3
  • 6
  • THANK YOU!!!! I just moved away from the native curl 7.79.0 to an older 7.59.0 and everything has sprung into life. – thonnor Jun 06 '22 at 15:39
0

I had exactly the same problem. My Requests would work everywhere except through libcurl in c++. At first I thought that libcurl could not parse my generated certificates. I generated them through openssl in windows. And they worked everywhere (even through curl in command line).

What solved it was building and importing the libcurl with the openssl option.

I use vcpkg to handle my packages, so this is how I installed what was needed.

  1. ./vcpkg.exe install curl
  2. ./vcpkg.exe install curl[openssl] --recurse
  3. ./vcpkg.exe integrate install

After this, everything worked.

Renis1235
  • 4,116
  • 3
  • 15
  • 27