1CURLOPT_CERTINFO(3)        curl_easy_setopt options        CURLOPT_CERTINFO(3)
2
3
4

NAME

6       CURLOPT_CERTINFO - request SSL certificate information
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode  curl_easy_setopt(CURL  *handle,  CURLOPT_CERTINFO, long cert‐
12       info);
13

DESCRIPTION

15       Pass a long set to 1 to enable libcurl's certificate chain  info  gath‐
16       erer.  With  this enabled, libcurl will extract lots of information and
17       data about the certificates in the certificate chain used  in  the  SSL
18       connection.  This  data  may  then  be retrieved after a transfer using
19       curl_easy_getinfo(3) and its option CURLINFO_CERTINFO(3).
20

DEFAULT

22       0
23

PROTOCOLS

25       All TLS-based
26

EXAMPLE

28       curl = curl_easy_init();
29       if(curl) {
30         curl_easy_setopt(curl, CURLOPT_URL, "https://www.example.com/");
31
32         /* connect to any HTTPS site, trusted or not */
33         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
34         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
35
36         curl_easy_setopt(curl, CURLOPT_CERTINFO, 1L);
37
38         res = curl_easy_perform(curl);
39
40         if (!res) {
41           struct curl_certinfo *ci;
42           res = curl_easy_getinfo(curl, CURLINFO_CERTINFO, &ci);
43
44           if (!res) {
45             printf("%d certs!\n", ci->num_of_certs);
46
47             for(i = 0; i < ci->num_of_certs; i++) {
48               struct curl_slist *slist;
49
50               for(slist = ci->certinfo[i]; slist; slist = slist->next)
51                 printf("%s\n", slist->data);
52             }
53           }
54         }
55         curl_easy_cleanup(curl);
56       }
57

AVAILABILITY

59       This option is supported by the OpenSSL, GnuTLS, NSS  and  GSKit  back‐
60       ends.
61

RETURN VALUE

63       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
64       if not.
65

SEE ALSO

67       CURLOPT_CAINFO(3), CURLOPT_SSL_VERIFYPEER(3),
68
69
70
71libcurl 7.61.1                   May 27, 2017              CURLOPT_CERTINFO(3)
Impressum