CURLOPT_SSL_VERIFYPEER.3 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2021, 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. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_SSL_VERIFYPEER 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_SSL_VERIFYPEER \- verify the peer's SSL certificate
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_VERIFYPEER, long verify);
  30. .fi
  31. .SH DESCRIPTION
  32. Pass a long as parameter to enable or disable.
  33. This option determines whether curl verifies the authenticity of the peer's
  34. certificate. A value of 1 means curl verifies; 0 (zero) means it does not.
  35. When negotiating a TLS or SSL connection, the server sends a certificate
  36. indicating its identity. Curl verifies whether the certificate is authentic,
  37. i.e. that you can trust that the server is who the certificate says it is.
  38. This trust is based on a chain of digital signatures, rooted in certification
  39. authority (CA) certificates you supply. curl uses a default bundle of CA
  40. certificates (the path for that is determined at build time) and you can
  41. specify alternate certificates with the \fICURLOPT_CAINFO(3)\fP option or the
  42. \fICURLOPT_CAPATH(3)\fP option.
  43. When \fICURLOPT_SSL_VERIFYPEER(3)\fP is enabled, and the verification fails to
  44. prove that the certificate is authentic, the connection fails. When the
  45. option is zero, the peer certificate verification succeeds regardless.
  46. Authenticating the certificate is not enough to be sure about the server. You
  47. typically also want to ensure that the server is the server you mean to be
  48. talking to. Use \fICURLOPT_SSL_VERIFYHOST(3)\fP for that. The check that the
  49. host name in the certificate is valid for the host name you are connecting to
  50. is done independently of the \fICURLOPT_SSL_VERIFYPEER(3)\fP option.
  51. WARNING: disabling verification of the certificate allows bad guys to
  52. man-in-the-middle the communication without you knowing it. Disabling
  53. verification makes the communication insecure. Just having encryption on a
  54. transfer is not enough as you cannot be sure that you are communicating with
  55. the correct end-point.
  56. NOTE: even when this option is disabled, depending on the used TLS backend,
  57. curl may still load the certificate file specified in
  58. \fICURLOPT_CAINFO(3)\fP. curl default settings in some distributions might use
  59. quite a large file as a default setting for \fICURLOPT_CAINFO(3)\fP, so
  60. loading the file can be quite expensive, especially when dealing with many
  61. connections. Thus, in some situations, you might want to disable verification
  62. fully to save resources by setting \fICURLOPT_CAINFO(3)\fP to NULL - but
  63. please also consider the warning above!
  64. .SH DEFAULT
  65. By default, curl assumes a value of 1.
  66. .SH PROTOCOLS
  67. All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  68. .SH EXAMPLE
  69. .nf
  70. CURL *curl = curl_easy_init();
  71. if(curl) {
  72. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  73. /* Set the default value: strict certificate check please */
  74. curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
  75. curl_easy_perform(curl);
  76. }
  77. .fi
  78. .SH AVAILABILITY
  79. If built TLS enabled.
  80. .SH RETURN VALUE
  81. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  82. .SH "SEE ALSO"
  83. .BR CURLOPT_SSL_VERIFYHOST "(3), "
  84. .BR CURLOPT_PROXY_SSL_VERIFYPEER "(3), "
  85. .BR CURLOPT_PROXY_SSL_VERIFYHOST "(3), "
  86. .BR CURLOPT_CAINFO "(3), "