1CURLOPT_SSLVERSION(3) curl_easy_setopt options CURLOPT_SSLVERSION(3)
2
3
4
6 CURLOPT_SSLVERSION - set preferred TLS/SSL version
7
9 #include <curl/curl.h>
10
11 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSLVERSION, long ver‐
12 sion);
13
15 Pass a long as parameter to control which version range of SSL/TLS ver‐
16 sions to use.
17
18 The SSL and TLS versions have typically developed from the most inse‐
19 cure version to be more and more secure in this order through history:
20 SSL v2, SSLv3, TLS v1.0, TSL v1.1, TSL v1.2 and the most recent TLS
21 v1.3.
22
23 Use one of the available defines for this purpose. The available
24 options are:
25
26 CURL_SSLVERSION_DEFAULT
27 The default acceptable version range. The mimimum accept‐
28 able version is by default TLS 1.0 since 7.39.0 (unless
29 the TLS library has a stricter rule).
30
31 CURL_SSLVERSION_TLSv1
32 TLS v1.0 or later
33
34 CURL_SSLVERSION_SSLv2
35 SSL v2 (but not SSLv3)
36
37 CURL_SSLVERSION_SSLv3
38 SSL v3 (but not SSLv2)
39
40 CURL_SSLVERSION_TLSv1_0
41 TLS v1.0 or later (Added in 7.34.0)
42
43 CURL_SSLVERSION_TLSv1_1
44 TLS v1.1 or later (Added in 7.34.0)
45
46 CURL_SSLVERSION_TLSv1_2
47 TLS v1.2 or later (Added in 7.34.0)
48
49 CURL_SSLVERSION_TLSv1_3
50 TLS v1.3 or later (Added in 7.52.0)
51
52 The maximum TLS version can be set by using one of the CURL_SSLVER‐
53 SION_MAX_ macros below. It is also possible to OR one of the
54 CURL_SSLVERSION_ macros with one of the CURL_SSLVERSION_MAX_ macros.
55 The MAX macros are not supported for SSL backends axTLS or wolfSSL.
56
57 CURL_SSLVERSION_MAX_DEFAULT
58 The flag defines the maximum supported TLS version by
59 libcurl, or the default value from the SSL library is
60 used. libcurl will use a sensible default maximum, which
61 was TLS 1.2 up to before 7.61.0 and is TLS 1.3 since then
62 - assuming the TLS library support it. (Added in 7.54.0)
63
64 CURL_SSLVERSION_MAX_TLSv1_0
65 The flag defines maximum supported TLS version as TLS
66 v1.0. (Added in 7.54.0)
67
68 CURL_SSLVERSION_MAX_TLSv1_1
69 The flag defines maximum supported TLS version as TLS
70 v1.1. (Added in 7.54.0)
71
72 CURL_SSLVERSION_MAX_TLSv1_2
73 The flag defines maximum supported TLS version as TLS
74 v1.2. (Added in 7.54.0)
75
76 CURL_SSLVERSION_MAX_TLSv1_3
77 The flag defines maximum supported TLS version as TLS
78 v1.3. (Added in 7.54.0)
79
81 CURL_SSLVERSION_DEFAULT
82
84 All TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc.
85
87 CURL *curl = curl_easy_init();
88 if(curl) {
89 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
90
91 /* ask libcurl to use TLS version 1.0 or later */
92 curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
93
94 /* Perform the request */
95 curl_easy_perform(curl);
96 }
97
99 SSLv2 is disabled by default since 7.18.1. Other SSL versions avail‐
100 ability may vary depending on which backend libcurl has been built to
101 use.
102
103 SSLv3 is disabled by default since 7.39.0.
104
106 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION
107 if not.
108
110 CURLOPT_USE_SSL(3), CURLOPT_HTTP_VERSION(3), CURLOPT_IPRESOLVE(3)
111
112
113
114libcurl 7.61.1 June 28, 2018 CURLOPT_SSLVERSION(3)