Skip to content

Instantly share code, notes, and snippets.

@m6w6

m6w6/ossl-alg.c Secret

Last active March 26, 2019 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m6w6/7acc0943b024eee3bdc60df70d1f8e3e to your computer and use it in GitHub Desktop.
Save m6w6/7acc0943b024eee3bdc60df70d1f8e3e to your computer and use it in GitHub Desktop.
b0rked certinfo
#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;
}
@m6w6
Copy link
Author

m6w6 commented Mar 26, 2019

Somehow I missed the first include line in rev1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment