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 certinfo);
12

DESCRIPTION

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

DEFAULT

21       0
22

PROTOCOLS

24       All TLS-based
25

EXAMPLE

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

AVAILABILITY

58       This  option  is supported by the OpenSSL, GnuTLS, Schannel, NSS, GSKit
59       and Secure Transport backends. Schannel support added in 7.50.0. Secure
60       Transport support added in 7.79.0.
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.82.0                 November 26, 2021           CURLOPT_CERTINFO(3)
Impressum