1---
2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_PROXY_SSL_VERIFYPEER
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_PROXY_SSL_VERIFYHOST (3)
9  - CURLOPT_SSL_VERIFYHOST (3)
10  - CURLOPT_SSL_VERIFYPEER (3)
11Protocol:
12  - TLS
13TLS-backend:
14  - All
15---
16
17# NAME
18
19CURLOPT_PROXY_SSL_VERIFYPEER - verify the proxy's SSL certificate
20
21# SYNOPSIS
22
23~~~c
24#include <curl/curl.h>
25
26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_VERIFYPEER,
27                          long verify);
28~~~
29
30# DESCRIPTION
31
32Pass a long as parameter set to 1L to enable or 0L to disable.
33
34This option tells curl to verify the authenticity of the HTTPS proxy's
35certificate. A value of 1 means curl verifies; 0 (zero) means it does not.
36
37This is the proxy version of CURLOPT_SSL_VERIFYPEER(3) that is used for
38ordinary HTTPS servers.
39
40When negotiating a TLS or SSL connection, the server sends a certificate
41indicating its identity. Curl verifies whether the certificate is authentic,
42i.e. that you can trust that the server is who the certificate says it is.
43This trust is based on a chain of digital signatures, rooted in certification
44authority (CA) certificates you supply. curl uses a default bundle of CA
45certificates (the path for that is determined at build time) and you can
46specify alternate certificates with the CURLOPT_PROXY_CAINFO(3) option or
47the CURLOPT_PROXY_CAPATH(3) option.
48
49When CURLOPT_PROXY_SSL_VERIFYPEER(3) is enabled, and the verification
50fails to prove that the certificate is authentic, the connection fails. When
51the option is zero, the peer certificate verification succeeds regardless.
52
53Authenticating the certificate is not enough to be sure about the server. You
54typically also want to ensure that the server is the server you mean to be
55talking to. Use CURLOPT_PROXY_SSL_VERIFYHOST(3) for that. The check that the
56hostname in the certificate is valid for the hostname you are connecting to is
57done independently of the CURLOPT_PROXY_SSL_VERIFYPEER(3) option.
58
59WARNING: disabling verification of the certificate allows bad guys to
60man-in-the-middle the communication without you knowing it. Disabling
61verification makes the communication insecure. Just having encryption on a
62transfer is not enough as you cannot be sure that you are communicating with
63the correct end-point.
64
65# DEFAULT
66
671
68
69# EXAMPLE
70
71~~~c
72int main(void)
73{
74  CURL *curl = curl_easy_init();
75  if(curl) {
76    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
77
78    /* Set the default value: strict certificate check please */
79    curl_easy_setopt(curl, CURLOPT_PROXY_SSL_VERIFYPEER, 1L);
80
81    curl_easy_perform(curl);
82  }
83}
84~~~
85
86# AVAILABILITY
87
88Added in 7.52.0
89
90If built TLS enabled.
91
92# RETURN VALUE
93
94Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
95