CURLINFO_SSL_VERIFYRESULT(3)

πŸ’– CURLINFO_SSL_VERIFYRESULT(3) πŸ’–

okay so bestie, welcome to the CURLINFO_SSL_VERIFYRESULT page β€” it's from the Library Functions Manual and it's literally all about peeking at the result of your certificate verification πŸŽ€


✨ NAME ✨

CURLINFO_SSL_VERIFYRESULT β€” the result of the certificate verification πŸ‘‘

Like, the actual verdict on whether that server's SSL cert passed the vibe check or not.


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SSL_VERIFYRESULT,
                           long *result);

πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the tea β˜• β€” you pass in a pointer to a long, and it gets filled with the result of the server SSL certificate verification that you asked for in the first place (you did that with the CURLOPT_SSL_VERIFYPEER(3) option, iykyk).

0 is a positive result. Non-zero is an error. That's it, that's the whole mood πŸ’…

Translation: zero = your cert is slaying, non-zero = something's sus 😭


🌈 PROTOCOLS 🌈

This functionality affects, like, all the TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. ✨

Heads up bestie 🫢 β€” this option works only with the following TLS backends: GnuTLS and OpenSSL. If you're on a different backend, this is not the function for you, no cap πŸ’€

πŸ“ EXAMPLE πŸ“

okay, a full little demo, enjoy 🧚

int main(void)
{
  CURL *curl = curl_easy_init();
  if(curl) {
    CURLcode result;
    long verifyresult;

    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");

    result = curl_easy_perform(curl);
    if(result) {
      printf("error: %s\n", curl_easy_strerror(result));
      curl_easy_cleanup(curl);
      return 1;
    }

    result = curl_easy_getinfo(curl, CURLINFO_SSL_VERIFYRESULT,
                               &verifyresult);
    if(!result) {
      printf("The peer verification said %s\n",
             (verifyresult ? "bad" : "fine"));
    }
    curl_easy_cleanup(curl);
  }
}

See how it prints "bad" or "fine"? That's the whole entire point, and it ate πŸ”₯


⭐ AVAILABILITY ⭐

Added in curl 7.5. vintage but iconic, honestly πŸ’œ


πŸŽ€ RETURN VALUE πŸŽ€

curl_easy_getinfo(3) returns a CURLcode indicating success or error.

CURLE_OK (0) means everything was OK, non-zero means an error occurred β€” go check libcurl-errors(3) for the deets πŸ“–


πŸ’… SEE ALSO πŸ’…


mwah, that's the page 🫢 brought to you by libcurl, dated 2026-10-12 β€” stay verified and stay iconic, bestie πŸ’–βœ¨πŸ‘‘

πŸ“¦ where this page comes from