Skip to content

Commit 99633ae

Browse files
authored
Update auth.cpp
1 parent 6b540e4 commit 99633ae

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

auth.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,26 @@ std::string KeyAuth::api::req(std::string data, std::string url) {
12611261

12621262
debugInfo(data, url, to_return);
12631263

1264+
struct curl_certinfo* ci;
1265+
code = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
1266+
1267+
if (!code) {
1268+
bool issuer_found = false;
1269+
1270+
for (int i = 0; i < ci->num_of_certs; i++) {
1271+
struct curl_slist* slist;
1272+
1273+
for (slist = ci->certinfo[i]; slist; slist = slist->next) {
1274+
if (std::strstr(slist->data, XorStr("Google Trust Services").c_str()) != NULL || std::strstr(slist->data, XorStr("Let's Encrypt").c_str()) != NULL) {
1275+
issuer_found = true;
1276+
}
1277+
}
1278+
}
1279+
1280+
if (!issuer_found)
1281+
error(XorStr("SSL certificate couldn't be verified"));
1282+
}
1283+
12641284
return to_return;
12651285
}
12661286
void error(std::string message) {

0 commit comments

Comments
 (0)