CURLOPT_SSLVERSION.3 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. .\" generated by cd2nroff 0.1 from CURLOPT_SSLVERSION.md
  2. .TH CURLOPT_SSLVERSION 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_SSLVERSION \- preferred TLS/SSL version
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLVERSION, long version);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long as parameter to control which version range of SSL/TLS versions to
  12. use.
  13. The SSL and TLS versions have typically developed from the most insecure
  14. version to be more and more secure in this order through history: SSL v2,
  15. SSLv3, TLS v1.0, TLS v1.1, TLS v1.2 and the most recent TLS v1.3.
  16. Use one of the available defines for this purpose. The available options are:
  17. .IP CURL_SSLVERSION_DEFAULT
  18. The default acceptable version range. The minimum acceptable version is by
  19. default TLS v1.0 since 7.39.0 (unless the TLS library has a stricter rule).
  20. .IP CURL_SSLVERSION_TLSv1
  21. TLS v1.0 or later
  22. .IP CURL_SSLVERSION_SSLv2
  23. SSL v2 \- refused
  24. .IP CURL_SSLVERSION_SSLv3
  25. SSL v3 \- refused
  26. .IP CURL_SSLVERSION_TLSv1_0
  27. TLS v1.0 or later (Added in 7.34.0)
  28. .IP CURL_SSLVERSION_TLSv1_1
  29. TLS v1.1 or later (Added in 7.34.0)
  30. .IP CURL_SSLVERSION_TLSv1_2
  31. TLS v1.2 or later (Added in 7.34.0)
  32. .IP CURL_SSLVERSION_TLSv1_3
  33. TLS v1.3 or later (Added in 7.52.0)
  34. .PP
  35. The maximum TLS version can be set by using \fIone\fP of the
  36. CURL_SSLVERSION_MAX_ macros below. It is also possible to OR \fIone\fP of the
  37. CURL_SSLVERSION_ macros with \fIone\fP of the CURL_SSLVERSION_MAX_ macros.
  38. The MAX macros are not supported for wolfSSL.
  39. .IP CURL_SSLVERSION_MAX_DEFAULT
  40. The flag defines the maximum supported TLS version by libcurl, or the default
  41. value from the SSL library is used. libcurl uses a sensible default maximum,
  42. which was TLS v1.2 up to before 7.61.0 and is TLS v1.3 since then \- assuming
  43. the TLS library support it. (Added in 7.54.0)
  44. .IP CURL_SSLVERSION_MAX_TLSv1_0
  45. The flag defines maximum supported TLS version as TLS v1.0.
  46. (Added in 7.54.0)
  47. .IP CURL_SSLVERSION_MAX_TLSv1_1
  48. The flag defines maximum supported TLS version as TLS v1.1.
  49. (Added in 7.54.0)
  50. .IP CURL_SSLVERSION_MAX_TLSv1_2
  51. The flag defines maximum supported TLS version as TLS v1.2.
  52. (Added in 7.54.0)
  53. .IP CURL_SSLVERSION_MAX_TLSv1_3
  54. The flag defines maximum supported TLS version as TLS v1.3.
  55. (Added in 7.54.0)
  56. .PP
  57. In versions of curl prior to 7.54 the CURL_SSLVERSION_TLS options were
  58. documented to allow \fIonly\fP the specified TLS version, but behavior was
  59. inconsistent depending on the TLS library.
  60. .SH DEFAULT
  61. CURL_SSLVERSION_DEFAULT
  62. .SH PROTOCOLS
  63. This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
  64. All TLS backends support this option.
  65. .SH EXAMPLE
  66. .nf
  67. int main(void)
  68. {
  69. CURL *curl = curl_easy_init();
  70. if(curl) {
  71. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  72. /* ask libcurl to use TLS version 1.0 or later */
  73. curl_easy_setopt(curl, CURLOPT_SSLVERSION, (long)CURL_SSLVERSION_TLSv1);
  74. /* Perform the request */
  75. curl_easy_perform(curl);
  76. }
  77. }
  78. .fi
  79. .SH HISTORY
  80. SSLv2 and SSLv3 are refused completely since curl 7.77.0
  81. SSLv2 is disabled by default since 7.18.1. Other SSL versions availability may
  82. vary depending on which backend libcurl has been built to use.
  83. SSLv3 is disabled by default since 7.39.0.
  84. .SH AVAILABILITY
  85. Added in curl 7.1
  86. .SH RETURN VALUE
  87. Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
  88. .SH SEE ALSO
  89. .BR CURLOPT_HTTP_VERSION (3),
  90. .BR CURLOPT_IPRESOLVE (3),
  91. .BR CURLOPT_PROXY_SSLVERSION (3),
  92. .BR CURLOPT_USE_SSL (3)