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