CURLINFO_CAINFO(3)
π CURLINFO_CAINFO β ok so this is your built-in CA cert path bestie
Hey bestie, welcome to the CURLINFO_CAINFO page, from the Library Functions Manual era of libcurl. This little cutie is the default built-in CA certificate path getter, and honestly? Underrated. Let's get into it π
β¨ SYNOPSIS β¨
#include <curl/curl.h>
CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_CAINFO, char **path);
π¦ DESCRIPTION π¦
Okay so picture this: you pass in a pointer to a char pointer, right? And libcurl fills it with a pointer to a null-terminated string β that string holds the default built-in path that gets used for the CURLOPT_CAINFO(3) option, unless the user goes and sets it themselves. Very "here's the default, do with it what you will" energy π
β οΈ Now pay attention because this is the plot twist: if libcurl was built to support multiple TLS libraries, this option might return a string even if the specific TLS library currently set to be used does not support CURLOPT_CAINFO(3). Like, the string shows up anyway. Awkward but true. π
Also important, bestie: this is a path identifying a single file containing CA certificates. One file. Not a directory vibe. ποΈ
And if there's just no default path at all? The path pointer gets set to NULL. Nothing. Nada. π«₯
πΈ PROTOCOLS πΈ
This functionality affects all TLS based protocols β and I mean all of them, slay:
HTTPSFTPSIMAPSPOP3SSMTPS- etc. (yes, the "etc." is doing a lot of heavy lifting here and we love her for it π)
And the best part? All TLS backends support this option. Every single one. No gatekeeping. Periodt. π
π§ EXAMPLE π§
Look at this little guy go β icon behavior, honestly:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
char *cainfo = NULL;
curl_easy_getinfo(curl, CURLINFO_CAINFO, &cainfo);
if(cainfo) {
printf("default ca info path: %s\n", cainfo);
}
curl_easy_cleanup(curl);
}
}
Note the if(cainfo) check β because like we said, it could be NULL, and we are not about to printf a null pointer in this house π
β AVAILABILITY β
Added in curl 7.84.0 π (so if you're on something ancient, this is your sign to update, ngl)
π RETURN VALUE π
curl_easy_getinfo(3) returns a CURLcode telling you success or error. Groundbreaking, I know.
CURLE_OK(0) β everything was OK, we ate, no crumbs left π- non-zero β an error occurred π see
libcurl-errors(3)for the full lore
π SEE ALSO π
Go read these too, they're all connected, iykyk:
β¨ and that's the whole page, bestie β¨ this was libcurl, dated 2026-10-12, sitting pretty under the CURLINFO_CAINFO(3) title. go forth and fetch your CA info responsibly π«Άπ
π¦ 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