1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLINFO_SSL_VERIFYRESULT 5Section: 3 6Source: libcurl 7See-also: 8 - CURLINFO_PROXY_SSL_VERIFYRESULT (3) 9 - curl_easy_getinfo (3) 10 - curl_easy_setopt (3) 11Protocol: 12 - TLS 13TLS-backend: 14 - OpenSSL 15 - GnuTLS 16Added-in: 7.5 17--- 18 19# NAME 20 21CURLINFO_SSL_VERIFYRESULT - get the result of the certificate verification 22 23# SYNOPSIS 24 25~~~c 26#include <curl/curl.h> 27 28CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SSL_VERIFYRESULT, 29 long *result); 30~~~ 31 32# DESCRIPTION 33 34Pass a pointer to a long to receive the result of the server SSL certificate 35verification that was requested (using the CURLOPT_SSL_VERIFYPEER(3) 36option). 37 380 is a positive result. Non-zero is an error. 39 40# %PROTOCOLS% 41 42# EXAMPLE 43 44~~~c 45int main(void) 46{ 47 CURL *curl = curl_easy_init(); 48 if(curl) { 49 CURLcode res; 50 long verifyresult; 51 52 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com"); 53 54 res = curl_easy_perform(curl); 55 if(res) { 56 printf("error: %s\n", curl_easy_strerror(res)); 57 curl_easy_cleanup(curl); 58 return 1; 59 } 60 61 res = curl_easy_getinfo(curl, CURLINFO_SSL_VERIFYRESULT, 62 &verifyresult); 63 if(!res) { 64 printf("The peer verification said %s\n", 65 (verifyresult ? "bad" : "fine")); 66 } 67 curl_easy_cleanup(curl); 68 } 69} 70~~~ 71 72# %AVAILABILITY% 73 74# RETURN VALUE 75 76Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 77