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