CURLOPT_SSLVERSION.3 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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_SSLVERSION 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_SSLVERSION \- preferred TLS/SSL version
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLVERSION, long version);
  32. .fi
  33. .SH DESCRIPTION
  34. Pass a long as parameter to control which version range of SSL/TLS versions to
  35. use.
  36. The SSL and TLS versions have typically developed from the most insecure
  37. version to be more and more secure in this order through history: SSL v2,
  38. SSLv3, TLS v1.0, TLS v1.1, TLS v1.2 and the most recent TLS v1.3.
  39. Use one of the available defines for this purpose. The available options are:
  40. .RS
  41. .IP CURL_SSLVERSION_DEFAULT
  42. The default acceptable version range. The minimum acceptable version is by
  43. default TLS v1.0 since 7.39.0 (unless the TLS library has a stricter rule).
  44. .IP CURL_SSLVERSION_TLSv1
  45. TLS v1.0 or later
  46. .IP CURL_SSLVERSION_SSLv2
  47. SSL v2 - refused
  48. .IP CURL_SSLVERSION_SSLv3
  49. SSL v3 - refused
  50. .IP CURL_SSLVERSION_TLSv1_0
  51. TLS v1.0 or later (Added in 7.34.0)
  52. .IP CURL_SSLVERSION_TLSv1_1
  53. TLS v1.1 or later (Added in 7.34.0)
  54. .IP CURL_SSLVERSION_TLSv1_2
  55. TLS v1.2 or later (Added in 7.34.0)
  56. .IP CURL_SSLVERSION_TLSv1_3
  57. TLS v1.3 or later (Added in 7.52.0)
  58. .RE
  59. The maximum TLS version can be set by using \fIone\fP of the
  60. CURL_SSLVERSION_MAX_ macros below. It is also possible to OR \fIone\fP of the
  61. CURL_SSLVERSION_ macros with \fIone\fP of the CURL_SSLVERSION_MAX_ macros.
  62. The MAX macros are not supported for WolfSSL.
  63. .RS
  64. .IP CURL_SSLVERSION_MAX_DEFAULT
  65. The flag defines the maximum supported TLS version by libcurl, or the default
  66. value from the SSL library is used. libcurl will use a sensible default
  67. maximum, which was TLS v1.2 up to before 7.61.0 and is TLS v1.3 since then -
  68. assuming the TLS library support it. (Added in 7.54.0)
  69. .IP CURL_SSLVERSION_MAX_TLSv1_0
  70. The flag defines maximum supported TLS version as TLS v1.0.
  71. (Added in 7.54.0)
  72. .IP CURL_SSLVERSION_MAX_TLSv1_1
  73. The flag defines maximum supported TLS version as TLS v1.1.
  74. (Added in 7.54.0)
  75. .IP CURL_SSLVERSION_MAX_TLSv1_2
  76. The flag defines maximum supported TLS version as TLS v1.2.
  77. (Added in 7.54.0)
  78. .IP CURL_SSLVERSION_MAX_TLSv1_3
  79. The flag defines maximum supported TLS version as TLS v1.3.
  80. (Added in 7.54.0)
  81. .RE
  82. In versions of curl prior to 7.54 the CURL_SSLVERSION_TLS options were
  83. documented to allow \fIonly\fP the specified TLS version, but behavior was
  84. inconsistent depending on the TLS library.
  85. .SH DEFAULT
  86. CURL_SSLVERSION_DEFAULT
  87. .SH PROTOCOLS
  88. All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  89. .SH EXAMPLE
  90. .nf
  91. CURL *curl = curl_easy_init();
  92. if(curl) {
  93. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  94. /* ask libcurl to use TLS version 1.0 or later */
  95. curl_easy_setopt(curl, CURLOPT_SSLVERSION, (long)CURL_SSLVERSION_TLSv1);
  96. /* Perform the request */
  97. curl_easy_perform(curl);
  98. }
  99. .fi
  100. .SH AVAILABILITY
  101. SSLv2 and SSLv3 are refused completely since curl 7.77.0
  102. SSLv2 is disabled by default since 7.18.1. Other SSL versions availability may
  103. vary depending on which backend libcurl has been built to use.
  104. SSLv3 is disabled by default since 7.39.0.
  105. .SH RETURN VALUE
  106. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  107. .SH "SEE ALSO"
  108. .BR CURLOPT_USE_SSL "(3), " CURLOPT_HTTP_VERSION "(3), "
  109. .BR CURLOPT_PROXY_SSLVERSION "(3), " CURLOPT_IPRESOLVE "(3) "