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