1---
2c: Copyright (C) Daniel Stenberg, <daniel.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)
11---
12
13# NAME
14
15CURLOPT_PROXY_SSL_VERIFYPEER - verify the proxy's SSL certificate
16
17# SYNOPSIS
18
19~~~c
20#include <curl/curl.h>
21
22CURLcode curl_easy_setopt(CURL *handle, CURLOPT_PROXY_SSL_VERIFYPEER,
23                          long verify);
24~~~
25
26# DESCRIPTION
27
28Pass a long as parameter set to 1L to enable or 0L to disable.
29
30This option tells curl to verify the authenticity of the HTTPS proxy's
31certificate. A value of 1 means curl verifies; 0 (zero) means it does not.
32
33This is the proxy version of CURLOPT_SSL_VERIFYPEER(3) that is used for
34ordinary HTTPS servers.
35
36When negotiating a TLS or SSL connection, the server sends a certificate
37indicating its identity. Curl verifies whether the certificate is authentic,
38i.e. that you can trust that the server is who the certificate says it is.
39This trust is based on a chain of digital signatures, rooted in certification
40authority (CA) certificates you supply. curl uses a default bundle of CA
41certificates (the path for that is determined at build time) and you can
42specify alternate certificates with the CURLOPT_PROXY_CAINFO(3) option or
43the CURLOPT_PROXY_CAPATH(3) option.
44
45When CURLOPT_PROXY_SSL_VERIFYPEER(3) is enabled, and the verification
46fails to prove that the certificate is authentic, the connection fails. When
47the option is zero, the peer certificate verification succeeds regardless.
48
49Authenticating the certificate is not enough to be sure about the server. You
50typically also want to ensure that the server is the server you mean to be
51talking to. Use CURLOPT_PROXY_SSL_VERIFYHOST(3) for that. The check that the
52hostname in the certificate is valid for the hostname you are connecting to is
53done independently of the CURLOPT_PROXY_SSL_VERIFYPEER(3) option.
54
55WARNING: disabling verification of the certificate allows bad guys to
56man-in-the-middle the communication without you knowing it. Disabling
57verification makes the communication insecure. Just having encryption on a
58transfer is not enough as you cannot be sure that you are communicating with
59the correct end-point.
60
61# DEFAULT
62
631
64
65# PROTOCOLS
66
67All
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