1CURLOPT_DOH_SSL_VERIFYPEER(3c)url_easy_setopt optionCsURLOPT_DOH_SSL_VERIFYPEER(3)
2
3
4
6 CURLOPT_DOH_SSL_VERIFYPEER - verify the DOH SSL certificate
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYPEER,
12 long verify);
13
15 Pass a long as parameter set to 1L to enable or 0L to disable.
16
17 This option tells curl to verify the authenticity of the DOH (DNS-over-
18 HTTPS) server's certificate. A value of 1 means curl verifies; 0 (zero)
19 means it doesn't.
20
21 This option is the DOH equivalent of CURLOPT_SSL_VERIFYPEER(3) and only
22 affects requests to the DOH server.
23
24 When negotiating a TLS or SSL connection, the server sends a certifi‐
25 cate indicating its identity. Curl verifies whether the certificate is
26 authentic, i.e. that you can trust that the server is who the certifi‐
27 cate says it is. This trust is based on a chain of digital signatures,
28 rooted in certification authority (CA) certificates you supply. curl
29 uses a default bundle of CA certificates (the path for that is deter‐
30 mined at build time) and you can specify alternate certificates with
31 the CURLOPT_CAINFO(3) option or the CURLOPT_CAPATH(3) option.
32
33 When CURLOPT_DOH_SSL_VERIFYPEER(3) is enabled, and the verification
34 fails to prove that the certificate is authentic, the connection fails.
35 When the option is zero, the peer certificate verification succeeds re‐
36 gardless.
37
38 Authenticating the certificate is not enough to be sure about the
39 server. You typically also want to ensure that the server is the server
40 you mean to be talking to. Use CURLOPT_DOH_SSL_VERIFYHOST(3) for that.
41 The check that the host name in the certificate is valid for the host
42 name you're connecting to is done independently of the CUR‐
43 LOPT_DOH_SSL_VERIFYPEER(3) option.
44
45 WARNING: disabling verification of the certificate allows bad guys to
46 man-in-the-middle the communication without you knowing it. Disabling
47 verification makes the communication insecure. Just having encryption
48 on a transfer is not enough as you cannot be sure that you are communi‐
49 cating with the correct end-point.
50
52 1
53
55 DOH
56
58 CURL *curl = curl_easy_init();
59 if(curl) {
60 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
61
62 curl_easy_setopt(curl, CURLOPT_DOH_URL, "https://cloudflare-dns.com/dns-query");
63
64 /* Disable certificate verification of the DOH server */
65 curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYPEER, 0L);
66
67 curl_easy_perform(curl);
68 }
69
71 Added in 7.76.0
72
73 If built TLS enabled.
74
76 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
77 if not.
78
80 CURLOPT_DOH_SSL_VERIFYHOST(3), CURLOPT_SSL_VERIFYHOST(3), CUR‐
81 LOPT_SSL_VERIFYPEER(3), CURLOPT_PROXY_SSL_VERIFYPEER(3), CUR‐
82 LOPT_PROXY_SSL_VERIFYHOST(3), CURLOPT_CAINFO(3), CURLOPT_CAPATH(3),
83
84
85
86libcurl 7.76.1 February 11, 2021 CURLOPT_DOH_SSL_VERIFYPEER(3)