1CURLOPT_SSL_VERIFYPEER(3)  curl_easy_setopt options  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       NOTE: even when this option is disabled,  depending  on  the  used  TLS
48       backend,  curl  may  still  load the certificate file specified in CUR‐
49       LOPT_CAINFO(3). curl default settings in some distributions  might  use
50       quite a large file as a default setting for CURLOPT_CAINFO(3), so load‐
51       ing the file can be quite expensive, especially when dealing with  many
52       connections.  Thus, in some situations, you might want to disable veri‐
53       fication fully to save resources by setting CURLOPT_CAINFO(3) to NULL -
54       but please also consider the warning above!
55

DEFAULT

57       By default, curl assumes a value of 1.
58

PROTOCOLS

60       All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
61

EXAMPLE

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

AVAILABILITY

74       If built TLS enabled.
75

RETURN VALUE

77       Returns  CURLE_OK  if the option is supported, and CURLE_UNKNOWN_OPTION
78       if not.
79

SEE ALSO

81       CURLOPT_SSL_VERIFYHOST(3),    CURLOPT_PROXY_SSL_VERIFYPEER(3),     CUR‐
82       LOPT_PROXY_SSL_VERIFYHOST(3), CURLOPT_CAINFO(3),
83
84
85
86libcurl 7.82.0                 November 26, 2021     CURLOPT_SSL_VERIFYPEER(3)
Impressum