Skip to content

Commit 22ecc95

Browse files
committed
Support all ML-KEM key exchange algorithms
1 parent eb2c247 commit 22ecc95

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

splunklib/binding.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,21 @@ def connect(scheme, host, port):
17621762
kwargs["cert_file"] = cert_file
17631763

17641764
if not verify:
1765-
kwargs["context"] = ssl._create_unverified_context() # nosemgrep
1765+
ctx = ssl._create_unverified_context() # nosemgrep
1766+
# Support all ML-KEM key exchange algorithms, by default OpenSSL only
1767+
# includes the X25519MLKEM768 from all of the below listed MLKEM key
1768+
# exchanges.
1769+
#
1770+
# set_groups method is only available with Python 3.15, but Splunk comes
1771+
# with patched python that includes set_groups on 3.9 and 3.13, thus we
1772+
# check for the existence of set_groups, not the python version.
1773+
if hasattr(ctx, "set_groups"):
1774+
ctx.set_groups( # pyright: ignore[reportUnknownMemberType, reportAttributeAccessIssue]
1775+
"X25519MLKEM768:SecP256r1MLKEM768:SecP384r1MLKEM1024:"
1776+
+ "MLKEM512:MLKEM768:MLKEM1024:"
1777+
+ "X25519:secp256r1:X448:secp384r1:secp521r1:ffdhe2048:ffdhe3072"
1778+
)
1779+
kwargs["context"] = ctx
17661780
elif context:
17671781
# verify is True in elif branch and context is not None
17681782
kwargs["context"] = context

0 commit comments

Comments
 (0)