CURLOPT_CERTINFO(3)
π CURLOPT_CERTINFO(3) β the libcurl girlies' guide β¨
Okay so bestie, you're reading a page from the libcurl manual β CURLOPT_CERTINFO(3), to be exact π β and honestly? It's a good one. Let's get into it.
πΈ NAME πΈ
CURLOPT_CERTINFO β the option where you're literally asking for SSL certificate information π¦
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CERTINFO, long certinfo);
π DESCRIPTION π
So here's the vibe: you pass a long set to 1 to turn on libcurl's certificate chain info gatherer π. Like, you're telling it "girl, go collect the lore."
With this enabled, libcurl extracts lots of information and data about the certificates in the certificate chain used in the SSL connection π₯. It's giving detective energy, no cap.
Then, after the transfer is done, you can pull all that data back out using curl_easy_getinfo(3) and its option CURLINFO_CERTINFO(3) π«Ά. The way that it's a two-step situation β first you set it, then you get it β iykyk.
π DEFAULT π
0
(Yeah. Off. Not doing the thing. As it should be π )
π PROTOCOLS π
This functionality affects all TLS based protocols, bestie β so we're talking HTTPS, FTPS, IMAPS, POP3S, SMTPS, etc. β The whole TLS friend group.
Heads up though: this option works only with the following TLS backends βGnuTLS,OpenSSL,RustlsandSchannelπ. Everyone else is not invited to this particular party.
π§ EXAMPLE π§
Okay this is the part where we actually do it. Look at her go:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
/* connect to any HTTPS site, trusted or not */
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
result = curl_easy_perform(curl);
if(!result) {
struct curl_certinfo *ci;
result = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
if(!result) {
int i;
printf("%d certs!\n", ci->num_of_certs);
for(i = 0; i < ci->num_of_certs; i++) {
struct curl_slist *slist;
for(slist = ci->certinfo[i]; slist; slist = slist->next)
printf("%s\n", slist->data);
}
}
}
curl_easy_cleanup(curl);
}
}
Note the comment in there β it connects to any HTTPS site, trusted or not π. That's the demo being a demo, bestie, don't ship that energy to prod.
π¦ HISTORY π¦
Schannelsupport added in7.50.0β¨mbedTLSsupport added in8.9.0π
π AVAILABILITY π
Added in curl 7.19.1 β she's been iconic for a minute π
π₯ RETURN VALUE π₯
curl_easy_setopt(3) returns a CURLcode indicating success or error, periodt.
CURLE_OK (0) means everything was OK π. Non-zero means an error occurred β see libcurl-errors(3) for the whole breakdown.
π SEE ALSO π
CURLINFO_CAINFO(3)CURLINFO_CAPATH(3)CURLINFO_CERTINFO(3)CURLOPT_CAINFO(3)CURLOPT_SSL_VERIFYPEER(3)
and that's the whole page, bestie π«Ά this cutie was brought to you by libcurl, dated 2026-10-12, and she's filed under CURLOPT_CERTINFO(3). go get those certs π
β¨
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms