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
12       verify);
13

DESCRIPTION

15       Pass a long as parameter to enable or disable.
16
17       This option determines whether curl verifies the  authenticity  of  the
18       peer's certificate. A value of 1 means curl verifies; 0 (zero) means it
19       doesn't.
20
21       When negotiating a TLS or SSL connection, the server sends  a  certifi‐
22       cate indicating its identity.  Curl verifies whether the certificate is
23       authentic, i.e. that you can trust that the server is who the  certifi‐
24       cate says it is.  This trust is based on a chain of digital signatures,
25       rooted in certification authority (CA) certificates you  supply.   curl
26       uses  a  default bundle of CA certificates (the path for that is deter‐
27       mined at build time) and you can specify  alternate  certificates  with
28       the CURLOPT_CAINFO(3) option or the CURLOPT_CAPATH(3) option.
29
30       When  CURLOPT_SSL_VERIFYPEER(3)  is enabled, and the verification fails
31       to prove that the certificate is authentic, the connection fails.  When
32       the  option is zero, the peer certificate verification succeeds regard‐
33       less.
34
35       Authenticating the certificate is not  enough  to  be  sure  about  the
36       server. You typically also want to ensure that the server is the server
37       you mean to be talking to.  Use CURLOPT_SSL_VERIFYHOST(3) for that. The
38       check  that the host name in the certificate is valid for the host name
39       you're connecting to is done  independently  of  the  CURLOPT_SSL_VERI‐
40       FYPEER(3) option.
41
42       WARNING:  disabling  verification of the certificate allows bad guys to
43       man-in-the-middle the communication without you knowing  it.  Disabling
44       verification  makes  the communication insecure. Just having encryption
45       on a transfer is not enough as you cannot be sure that you are communi‐
46       cating with the correct end-point.
47
48       NOTE:  even  when  this  option  is disabled, depending on the used TLS
49       backend, curl may still load the certificate  file  specified  in  CUR‐
50       LOPT_CAINFO(3).  curl  default settings in some distributions might use
51       quite a large file as a default setting for CURLOPT_CAINFO(3), so load‐
52       ing  the file can be quite expensive, especially when dealing with many
53       connections. Thus, in some situations, you might want to disable  veri‐
54       fication fully to save resources by setting CURLOPT_CAINFO(3) to NULL -
55       but please also consider the warning above!
56

DEFAULT

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

PROTOCOLS

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

EXAMPLE

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

AVAILABILITY

75       If built TLS enabled.
76

RETURN VALUE

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

SEE ALSO

82       CURLOPT_SSL_VERIFYHOST(3),     CURLOPT_PROXY_SSL_VERIFYPEER(3),    CUR‐
83       LOPT_PROXY_SSL_VERIFYHOST(3), CURLOPT_CAINFO(3),
84
85
86
87libcurl 7.69.1                   June 24, 2018       CURLOPT_SSL_VERIFYPEER(3)
Impressum