CURLOPT_CRLFILE(3)
β¨ CURLOPT_CRLFILE(3) β¨
okay so welcome to the CURLOPT_CRLFILE(3) page, straight out of the Library Functions Manual π this is the libcurl manual and we're about to talk about Certificate Revocation List files. no cap, it's giving secure TLS energy π
π NAME π
CURLOPT_CRLFILE β Certificate Revocation List file. literally the option for telling curl where your CRL file lives, bestie π¦
πΈ SYNOPSIS πΈ
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_CRLFILE, char *file);
π¦ DESCRIPTION π¦
okay so you pass a char pointer to a null-terminated string naming a file with the concatenation of CRL (in PEM format) to use in the certificate validation that occurs during the SSL exchange. that's the whole vibe: CRL file, PEM format, SSL exchange, certificate validation β¨
backend tea, because it matters:
- GnuTLS: when curl is built to use GnuTLS, there is no way to influence the use of CRL passed to help in the verification process. so yeah, that's a thing π
- OpenSSL: when libcurl is built with OpenSSL support,
X509_V_FLAG_CRL_CHECKandX509_V_FLAG_CRL_CHECK_ALLare both set, requiring CRL check against all the elements of the certificate chain if a CRL file is passed. also note thatCURLOPT_CRLFILE(3)impliesCURLSSLOPT_NO_PARTIALCHAIN(seeCURLOPT_SSL_OPTIONS(3)) since curl7.71.0due to an OpenSSL bug.
this option makes sense only when used in combination with the CURLOPT_SSL_VERIFYPEER(3) option. like, that's its whole main character pairing π₯
a specific error code (CURLE_SSL_CRL_BADFILE) is defined with the option. it is returned when the SSL exchange fails because the CRL file cannot be loaded. a failure in certificate verification due to revocation information found in the CRL does not trigger this specific error. so don't blame this error for every CRL-related heartbreak, okay? π
the application does not have to keep the string around after setting this option. set it and forget it, bestie π«Ά
using this option multiple times makes the last set string override the previous ones. set it to NULL to disable its use again. periodt.
π DEFAULT π
NULL β the default is literally NULL, no cap.
π PROTOCOLS π
this functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. so many S's, iykyk π
this option works only with the following TLS backends: GnuTLS, OpenSSL, Rustls and mbedTLS. those are the backend besties that get it π
π EXAMPLE π
here's the example, bestie:
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
curl_easy_setopt(curl, CURLOPT_CRLFILE, "/etc/certs/crl.pem");
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
π¦ AVAILABILITY π¦
added in curl 7.19.0. iconic since way back, ngl β
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (0) means everything was OK, non-zero means an error occurred, see libcurl-errors(3). so vibe check that return code, fr fr π§
π SEE ALSO π
π that's the whole page! brought to you by libcurl, dated 2026-10-12, and titled CURLOPT_CRLFILE(3) β bye bestie, stay secure and slay π«Άβ¨
π¦ 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