Skip to content

Commit 0f13c17

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

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

0 commit comments

Comments
 (0)