-
-
Save m6w6/7acc0943b024eee3bdc60df70d1f8e3e to your computer and use it in GitHub Desktop.
b0rked certinfo
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 <curl/curl.h> | |
#include <string.h> | |
#include <stdio.h> | |
int main(int argc, char *argv[]) { | |
struct curl_certinfo *info = NULL; | |
CURL *ch = curl_easy_init(); | |
int i; | |
curl_easy_setopt(ch, CURLOPT_URL, "https://google.com"); | |
curl_easy_setopt(ch, CURLOPT_CERTINFO, 1); | |
curl_easy_setopt(ch, CURLOPT_FILE, fopen("/dev/null", "w")); | |
curl_easy_perform(ch); | |
curl_easy_getinfo(ch, CURLINFO_CERTINFO, &info); | |
for (i = 0; i < info->num_of_certs; ++i) { | |
struct curl_slist *slist; | |
for (slist = info->certinfo[i]; slist; slist = slist->next) { | |
if (strstr(slist->data, "Algorithm")) { | |
printf("==========\n"); | |
printf("%s\n", slist->data); | |
printf("==========\n"); | |
} | |
} | |
} | |
curl_easy_cleanup(ch); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Somehow I missed the first include line in rev1