1---
2c: Copyright (C) Daniel Stenberg, <daniel.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)
11---
12
13# NAME
14
15CURLINFO_SSL_VERIFYRESULT - get the result of the certificate verification
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLcode curl_easy_getinfo(CURL *handle, CURLINFO_SSL_VERIFYRESULT,
23                           long *result);
24~~~
25
26# DESCRIPTION
27
28Pass a pointer to a long to receive the result of the server SSL certificate
29verification that was requested (using the CURLOPT_SSL_VERIFYPEER(3)
30option).
31
320 is a positive result. Non-zero is an error.
33
34# PROTOCOLS
35
36All using TLS
37
38# EXAMPLE
39
40~~~c
41int main(void)
42{
43  CURL *curl = curl_easy_init();
44  if(curl) {
45    CURLcode res;
46    long verifyresult;
47    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
48    res = curl_easy_perform(curl);
49    if(res)
50      printf("error: %s\n", curl_easy_strerror(res));
51    curl_easy_getinfo(curl, CURLINFO_SSL_VERIFYRESULT, &verifyresult);
52    printf("The peer verification said %s\n", verifyresult?
53           "BAAAD":"fine");
54    curl_easy_cleanup(curl);
55  }
56}
57~~~
58
59# AVAILABILITY
60
61Added in 7.5. Only set by the OpenSSL/libressl/boringssl and GnuTLS backends.
62
63# RETURN VALUE
64
65Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
66