1CURLOPT_SSL_VERIFYPEER(3)           libcurl          CURLOPT_SSL_VERIFYPEER(3)
2
3
4

NAME

6       CURLOPT_SSL_VERIFYPEER - verify the peer's SSL certificate
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYPEER, long verify);
12

DESCRIPTION

14       Pass a long as parameter to enable or disable.
15
16       This  option  determines  whether curl verifies the authenticity of the
17       peer's certificate. A value of 1 means curl verifies; 0 (zero) means it
18       does not.
19
20       When  negotiating  a TLS or SSL connection, the server sends a certifi‐
21       cate indicating its identity.  Curl verifies whether the certificate is
22       authentic,  i.e. that you can trust that the server is who the certifi‐
23       cate says it is.  This trust is based on a chain of digital signatures,
24       rooted  in  certification authority (CA) certificates you supply.  curl
25       uses a default bundle of CA certificates (the path for that  is  deter‐
26       mined  at  build  time) and you can specify alternate certificates with
27       the CURLOPT_CAINFO(3) option or the CURLOPT_CAPATH(3) option.
28
29       When CURLOPT_SSL_VERIFYPEER(3) is enabled, and the  verification  fails
30       to prove that the certificate is authentic, the connection fails.  When
31       the option is zero, the peer certificate verification succeeds  regard‐
32       less.
33
34       Authenticating  the  certificate  is  not  enough  to be sure about the
35       server. You typically also want to ensure that the server is the server
36       you mean to be talking to.  Use CURLOPT_SSL_VERIFYHOST(3) for that. The
37       check that the host name in the certificate is valid for the host  name
38       you  are  connecting  to is done independently of the CURLOPT_SSL_VERI‐
39       FYPEER(3) option.
40
41       WARNING: disabling verification of the certificate allows bad  guys  to
42       man-in-the-middle  the  communication without you knowing it. Disabling
43       verification makes the communication insecure. Just  having  encryption
44       on a transfer is not enough as you cannot be sure that you are communi‐
45       cating with the correct end-point.
46
47       When libcurl uses secure protocols it trusts responses and  allows  for
48       example  HSTS  and  Alt-Svc  information  to  be stored and used subse‐
49       quently. Disabling certificate verification can make libcurl trust  and
50       use such information from malicious servers.
51

DEFAULT

53       By default, curl assumes a value of 1.
54

PROTOCOLS

56       All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
57

EXAMPLE

59       CURL *curl = curl_easy_init();
60       if(curl) {
61         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
62
63         /* Set the default value: strict certificate check please */
64         curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
65
66         curl_easy_perform(curl);
67       }
68

AVAILABILITY

70       If built TLS enabled.
71

RETURN VALUE

73       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
74       if not.
75

SEE ALSO

77       CURLOPT_SSL_VERIFYHOST(3),    CURLOPT_PROXY_SSL_VERIFYPEER(3),     CUR‐
78       LOPT_PROXY_SSL_VERIFYHOST(3), CURLOPT_CAINFO(3),
79
80
81
82ibcurl 8.2.1                    April 26, 2023       CURLOPT_SSL_VERIFYPEER(3)
Impressum