CURLOPT_SSL_VERIFYPEER.3 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_SSL_VERIFYPEER 3 "January 02, 2023" "libcurl 7.88.1" "curl_easy_setopt options"
  26. .SH NAME
  27. CURLOPT_SSL_VERIFYPEER \- verify the peer's SSL certificate
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYPEER, long verify);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a long as parameter to enable or disable.
  35. This option determines whether curl verifies the authenticity of the peer's
  36. certificate. A value of 1 means curl verifies; 0 (zero) means it does not.
  37. When negotiating a TLS or SSL connection, the server sends a certificate
  38. indicating its identity. Curl verifies whether the certificate is authentic,
  39. i.e. that you can trust that the server is who the certificate says it is.
  40. This trust is based on a chain of digital signatures, rooted in certification
  41. authority (CA) certificates you supply. curl uses a default bundle of CA
  42. certificates (the path for that is determined at build time) and you can
  43. specify alternate certificates with the \fICURLOPT_CAINFO(3)\fP option or the
  44. \fICURLOPT_CAPATH(3)\fP option.
  45. When \fICURLOPT_SSL_VERIFYPEER(3)\fP is enabled, and the verification fails to
  46. prove that the certificate is authentic, the connection fails. When the
  47. option is zero, the peer certificate verification succeeds regardless.
  48. Authenticating the certificate is not enough to be sure about the server. You
  49. typically also want to ensure that the server is the server you mean to be
  50. talking to. Use \fICURLOPT_SSL_VERIFYHOST(3)\fP for that. The check that the
  51. host name in the certificate is valid for the host name you are connecting to
  52. is done independently of the \fICURLOPT_SSL_VERIFYPEER(3)\fP option.
  53. WARNING: disabling verification of the certificate allows bad guys to
  54. man-in-the-middle the communication without you knowing it. Disabling
  55. verification makes the communication insecure. Just having encryption on a
  56. transfer is not enough as you cannot be sure that you are communicating with
  57. the correct end-point.
  58. When libcurl uses secure protocols it trusts responses and allows for example
  59. HSTS and Alt-Svc information to be stored and used subsequently. Disabling
  60. certificate verification can make libcurl trust and use such information from
  61. malicious servers.
  62. .SH DEFAULT
  63. By default, curl assumes a value of 1.
  64. .SH PROTOCOLS
  65. All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  66. .SH EXAMPLE
  67. .nf
  68. CURL *curl = curl_easy_init();
  69. if(curl) {
  70. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  71. /* Set the default value: strict certificate check please */
  72. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
  73. curl_easy_perform(curl);
  74. }
  75. .fi
  76. .SH AVAILABILITY
  77. If built TLS enabled.
  78. .SH RETURN VALUE
  79. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  80. .SH "SEE ALSO"
  81. .BR CURLOPT_SSL_VERIFYHOST "(3), "
  82. .BR CURLOPT_PROXY_SSL_VERIFYPEER "(3), "
  83. .BR CURLOPT_PROXY_SSL_VERIFYHOST "(3), "
  84. .BR CURLOPT_CAINFO "(3), "