Skip to content

Commit 39c2fbc

Browse files
committed
Add ability to TLS 1.3 cipher suites on SSL Context
1 parent 62a0f50 commit 39c2fbc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/OpenSSL/SSL.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,29 @@ def set_cipher_list(self, cipher_list: bytes) -> None:
15001500
],
15011501
)
15021502

1503+
1504+
@_require_not_used
1505+
def set_ciphersuites_list(self, ciphersuites_list: bytes) -> None:
1506+
"""
1507+
Set the list of TLS 1.3 ciphers to be used in this context.
1508+
OpenSSL maintains a separate list of TLS 1.3+ ciphers to
1509+
ciphers for TLS 1.2 and lowers.
1510+
1511+
See the OpenSSL manual for more information (e.g.
1512+
:manpage:`ciphers(1)`).
1513+
1514+
:param bytes cipher_list: An OpenSSL cipher string.
1515+
:return: None
1516+
"""
1517+
cipher_list = _text_to_bytes_and_warn("ciphersuites_list", cipher_list)
1518+
1519+
if not isinstance(cipher_list, bytes):
1520+
raise TypeError("cipher_list must be a byte string.")
1521+
1522+
_openssl_assert(
1523+
_lib.SSL_CTX_set_ciphersuites(self._context, cipher_list) == 1
1524+
)
1525+
15031526
@_require_not_used
15041527
def set_client_ca_list(
15051528
self, certificate_authorities: Sequence[X509Name]

0 commit comments

Comments
 (0)