Created
June 4, 2021 00:20
-
-
Save brandonweeks/6eb5d668b93d19f6e06022497d6fe232 to your computer and use it in GitHub Desktop.
An example of how to use libcurl with a client certificate on Windows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include "curl/curl.h" | |
int main() | |
{ | |
CURL* req = curl_easy_init(); | |
CURLcode res; | |
if (req) | |
{ | |
curl_easy_setopt(req, CURLOPT_URL, "certauth.idrix.fr"); | |
curl_easy_setopt(req, CURLOPT_FOLLOWLOCATION, 1L); | |
curl_easy_setopt(req, CURLOPT_SSLCERT, "LocalMachine\\MY\\ee91848df230cec6cd8ce5be2811379f2ae91005"); | |
curl_easy_setopt(req, CURLOPT_VERBOSE, 1L); | |
res = curl_easy_perform(req); | |
if (res != CURLE_OK) | |
{ | |
fprintf(stderr, "curl_easy_operation() failed : %s\n", curl_easy_strerror(res)); | |
} | |
} | |
curl_easy_cleanup(req); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment