CURLOPT_DOH_SSL_VERIFYPEER.3 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .\" generated by cd2nroff 0.1 from CURLOPT_DOH_SSL_VERIFYPEER.md
  2. .TH CURLOPT_DOH_SSL_VERIFYPEER 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_DOH_SSL_VERIFYPEER \- verify the DoH SSL certificate
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_DOH_SSL_VERIFYPEER,
  9. long verify);
  10. .fi
  11. .SH DESCRIPTION
  12. Pass a long as parameter set to 1L to enable or 0L to disable.
  13. This option tells curl to verify the authenticity of the DoH (DNS\-over\-HTTPS)
  14. server\(aqs certificate. A value of 1 means curl verifies; 0 (zero) means it
  15. does not.
  16. This option is the DoH equivalent of \fICURLOPT_SSL_VERIFYPEER(3)\fP and
  17. only affects requests to the DoH server.
  18. When negotiating a TLS or SSL connection, the server sends a certificate
  19. indicating its identity. Curl verifies whether the certificate is authentic,
  20. i.e. that you can trust that the server is who the certificate says it is.
  21. This trust is based on a chain of digital signatures, rooted in certification
  22. authority (CA) certificates you supply. curl uses a default bundle of CA
  23. certificates (the path for that is determined at build time) and you can
  24. specify alternate certificates with the \fICURLOPT_CAINFO(3)\fP option or the
  25. \fICURLOPT_CAPATH(3)\fP option.
  26. When \fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP is enabled, and the verification fails to
  27. prove that the certificate is authentic, the connection fails. When the option
  28. is zero, the peer certificate verification succeeds regardless.
  29. Authenticating the certificate is not enough to be sure about the server. You
  30. typically also want to ensure that the server is the server you mean to be
  31. talking to. Use \fICURLOPT_DOH_SSL_VERIFYHOST(3)\fP for that. The check that the
  32. hostname in the certificate is valid for the hostname you are connecting to
  33. is done independently of the \fICURLOPT_DOH_SSL_VERIFYPEER(3)\fP option.
  34. WARNING: disabling verification of the certificate allows bad guys to
  35. man\-in\-the\-middle the communication without you knowing it. Disabling
  36. verification makes the communication insecure. Just having encryption on a
  37. transfer is not enough as you cannot be sure that you are communicating with
  38. the correct end\-point.
  39. .SH DEFAULT
  40. 1
  41. .SH PROTOCOLS
  42. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  43. All TLS backends support this option.
  44. .SH EXAMPLE
  45. .nf
  46. int main(void)
  47. {
  48. CURL *curl = curl_easy_init();
  49. if(curl) {
  50. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  51. curl_easy_setopt(curl, CURLOPT_DOH_URL,
  52. "https://cloudflare-dns.com/dns-query");
  53. /* Disable certificate verification of the DoH server */
  54. curl_easy_setopt(curl, CURLOPT_DOH_SSL_VERIFYPEER, 0L);
  55. curl_easy_perform(curl);
  56. }
  57. }
  58. .fi
  59. .SH AVAILABILITY
  60. Added in curl 7.76.0
  61. .SH RETURN VALUE
  62. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  63. .SH SEE ALSO
  64. .BR CURLOPT_CAINFO (3),
  65. .BR CURLOPT_CAPATH (3),
  66. .BR CURLOPT_DOH_SSL_VERIFYHOST (3),
  67. .BR CURLOPT_PROXY_SSL_VERIFYHOST (3),
  68. .BR CURLOPT_PROXY_SSL_VERIFYPEER (3),
  69. .BR CURLOPT_SSL_VERIFYHOST (3),
  70. .BR CURLOPT_SSL_VERIFYPEER (3)