@@ -1684,19 +1684,33 @@ to speed up repeated connections from the same clients.
16841684
16851685.. method :: SSLContext.set_ciphers(ciphers)
16861686
1687- Set the available ciphers for sockets created with this context.
1688- It should be a string in the `OpenSSL cipher list format
1687+ Set the allowed ciphers for sockets created with this context when
1688+ connecting using TLS 1.2 and earlier. The *ciphers * argument should
1689+ be a string in the `OpenSSL cipher list format
16891690 <https://docs.openssl.org/master/man1/ciphers/> `_.
1691+ To set allowed TLS 1.3 ciphers, use :meth: `SSLContext.set_ciphersuites `.
1692+
16901693 If no cipher can be selected (because compile-time options or other
16911694 configuration forbids use of all the specified ciphers), an
16921695 :class: `SSLError ` will be raised.
16931696
16941697 .. note ::
1695- when connected, the :meth: `SSLSocket.cipher ` method of SSL sockets will
1696- give the currently selected cipher.
1698+ When connected, the :meth: `SSLSocket.cipher ` method of SSL sockets will
1699+ return details about the negotiated cipher.
1700+
1701+ .. method :: SSLContext.set_ciphersuites(ciphersuites)
1702+
1703+ Set the allowed ciphers for sockets created with this context when
1704+ connecting using TLS 1.3. The *ciphersuites * argument should be a
1705+ colon-separate string of TLS 1.3 cipher names. If no cipher can be
1706+ selected (because compile-time options or other configuration forbids
1707+ use of all the specified ciphers), an :class: `SSLError ` will be raised.
1708+
1709+ .. note ::
1710+ When connected, the :meth: `SSLSocket.cipher ` method of SSL sockets will
1711+ return details about the negotiated cipher.
16971712
1698- TLS 1.3 cipher suites cannot be disabled with
1699- :meth: `~SSLContext.set_ciphers `.
1713+ .. versionadded :: next
17001714
17011715.. method :: SSLContext.set_groups(groups)
17021716
@@ -2845,10 +2859,15 @@ TLS 1.3
28452859The TLS 1.3 protocol behaves slightly differently than previous version
28462860of TLS/SSL. Some new TLS 1.3 features are not yet available.
28472861
2848- - TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and
2849- ChaCha20 cipher suites are enabled by default. The method
2850- :meth: `SSLContext.set_ciphers ` cannot enable or disable any TLS 1.3
2851- ciphers yet, but :meth: `SSLContext.get_ciphers ` returns them.
2862+ - TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20
2863+ cipher suites are enabled by default. To restrict which TLS 1.3 ciphers
2864+ are allowed, the :meth: `SSLContext.set_ciphersuites ` method should be
2865+ called instead of :meth: `SSLContext.set_ciphers `, which only affects
2866+ ciphers in older TLS versions. The :meth: `SSLContext.get_ciphers ` method
2867+ returns information about ciphers for both TLS 1.3 and earlier versions
2868+ and the method :meth: `SSLSocket.cipher ` returns information about the
2869+ negotiated cipher for both TLS 1.3 and earlier versions once a connection
2870+ is established.
28522871- Session tickets are no longer sent as part of the initial handshake and
28532872 are handled differently. :attr: `SSLSocket.session ` and :class: `SSLSession `
28542873 are not compatible with TLS 1.3.
0 commit comments