Can Python 3.15 be configured for post-quantum key exchange today?
If you run Python services that terminate or initiate TLS and you want post-quantum key exchange, the short answer is yes, with conditions. Python 3.15, released on 9 October 2026 according to the Python 3.15 What's New page, adds SSLContext.set_groups(), which selects the key agreement groups allowed on a connection and accepts finite-field and post-quantum groups alongside ECDH curves. The setting only works when the ssl module is linked to OpenSSL 3.5 or later. The cryptography package separately exposes ML-KEM and ML-DSA classes when its backend supports them. These are two different configurations. This page is for platform engineers and security leads who must record what a Python build can do, and the facts below are as of 2026-12-03, so confirm the current status before you rely on them.
First, check which OpenSSL your interpreter is linked against, because that decides whether set_groups() can use post-quantum groups at all. Run ssl.OPENSSL_VERSION and ssl.OPENSSL_VERSION_INFO in the target interpreter. The Python 3.15 documentation says SSLContext.get_groups() requires OpenSSL 3.5 or later and SSLSocket.group() requires OpenSSL 3.2 or later. OpenSSL 3.5.0 added ML-KEM, ML-DSA and SLH-DSA and changed its default TLS groups to prefer hybrid post-quantum KEM groups such as X25519MLKEM768. CPython tracked the move of its Windows builds and macOS installer to OpenSSL 3.5.8 on the 3.14 and 3.15 branches, and a pull request merged on 2026-09-30 moved the 3.15 macOS installer to OpenSSL 3.5.9. Confirm the version in your own build, since distribution packages may ship a different OpenSSL.
Second, keep the two stacks apart in your inventory and tests. A set_groups() setting changes the handshake of connections made through the ssl module, but it does not change the OpenSSL bundled in a pip-installed cryptography wheel. The cryptography documentation shows that ML-KEM and ML-DSA key classes raise UnsupportedAlgorithm when the backend lacks support, and its changelog says these became available in wheels from version 48.0.0 when OpenSSL 3.5.0 or later is used. Its 51.0.0 release, dated 2026-12-01, bundles OpenSSL 4.1.1. Test each path separately, record the library and OpenSSL version for each, and do not treat one passing as evidence for the other. Verify that a handshake actually negotiated a post-quantum group using SSLSocket.group() rather than assuming the configuration took effect.
Which settings apply to which Python and OpenSSL builds
This table lists which Python ssl settings and cryptography package releases apply to which Python and OpenSSL builds, with the source and date for each entry. Read each row against the Python version and OpenSSL version your interpreter is linked to, since the ssl module and the cryptography package use different OpenSSL builds. The main takeaway is that group selection depends on both the Python version and the linked OpenSSL version.
| Component | Requirement and setting | Source and date |
|---|---|---|
| Python 3.15 ssl: set_groups, get_groups, SSLSocket.group | set_groups() sets allowed key agreement groups. get_groups() requires OpenSSL 3.5 or later. SSLSocket.group() requires OpenSSL 3.2 or later. | Python 3.15 What's New, released 9 October 2026 |
| OpenSSL 3.5.0 default groups | Default TLS groups include and prefer hybrid post-quantum KEM groups, and default key shares offer X25519MLKEM768 and X25519. | OpenSSL 3.5 NEWS, 8 April 2025 |
| Python 3.10 to 3.14 ssl | Only set_ecdh_curve() is available for key agreement. It does not apply to client sockets, and the post-quantum group controls above are not present. | Python ssl docs (3.10 to 3.14 behavior) |
| cryptography 47.0.0 | Adds ML-KEM (MLKEM768, MLKEM1024) and ML-DSA (MLDSA44, MLDSA65, MLDSA87) key classes for AWS-LC or BoringSSL only. | cryptography changelog, 24 April 2026 |
| cryptography 48.0.0 | ML-KEM key encapsulation and ML-DSA signing work in wheels when the linked OpenSSL is 3.5.0 or later. | cryptography changelog, 4 May 2026 |
| cryptography 49.0.0 and 50.0.0 | 49.0.0 adds X.509 certificate, CSR and CRL signing with ML-DSA keys. 50.0.0 makes X.509 verification accept ML-DSA-44, ML-DSA-65 and ML-DSA-87 by default. | cryptography changelog, 12 June 2026 and 31 July 2026 |
| cryptography 51.0.0 | Adds composite ML-DSA-44 with Ed25519 key classes in OpenSSH format. The changelog read shows no SLH-DSA or X25519MLKEM768 key class. | cryptography changelog, 1 December 2026 |
Where set_groups() and the cryptography package sit in one connection
Key agreement for a Python TLS connection happens inside the OpenSSL that the ssl module is linked against, not inside the cryptography package. In Python 3.15, SSLContext.set_groups() sets the groups the handshake may offer, and it extends the older set_ecdh_curve(), which limits key agreement to ECDH curves in earlier releases. The Python 3.15 What's New page says set_groups() also accepts finite-field and post-quantum groups, but whether a post-quantum group can be negotiated depends on the OpenSSL version under the ssl module. The get_groups() method requires OpenSSL 3.5 or later, and SSLSocket.group(), which reports the group actually used on a connection, requires OpenSSL 3.2 or later. Before you rely on a group name in set_groups(), confirm the OpenSSL version with ssl.OPENSSL_VERSION and check the list returned by get_groups() on that build.
The cryptography package works differently. The statically linked wheels that pip installs for macOS, Windows and Linux carry their own bundled OpenSSL, so cryptography does not use the OpenSSL that ssl uses. The changelog lists bundled OpenSSL 4.1.1 in cryptography 51.0.0, released 2026-12-01. ML-KEM key encapsulation and ML-DSA signing appeared in wheels in cryptography 48.0.0 (2026-05-04) when the backend is OpenSSL 3.5.0 or later. Those calls in MLKEM768 or MLDSA65 therefore reach the bundled library, and a change to the Python ssl configuration does not alter them. The practical consequence is that a server can be set to offer a post-quantum group through set_groups() while the application's own signing code uses a different OpenSSL, so the two need separate checks.
Make the inventory match this split. For each service, record the OpenSSL version behind ssl (the Python build and any system OpenSSL it links to) and the cryptography version and its bundled OpenSSL, and test each one separately. Confirm the actual group on a live connection with SSLSocket.group() rather than assuming the configured value was used, because a peer that does not offer the group will fall back. Do not treat the presence of a group name in set_groups() as evidence that the application is post-quantum protected end to end.
How a Python TLS key agreement picks its group
The diagram starts with an application calling ssl.create_default_context(), then sets allowed key agreement groups: set_groups() on Python 3.15, or set_ecdh_curve() on 3.10 to 3.14. The linked OpenSSL then negotiates the group with the peer during the handshake. After the connection is open, SSLSocket.group() reports which group was used, a call that requires OpenSSL 3.2 or later. The branch where the linked OpenSSL is below 3.5 is marked as unable to list groups, because get_groups() requires 3.5 or later. Check the OpenSSL version your Python build reports before relying on group selection.
Group selection path in Python's ssl module, from context creation to the reported group.
Steps to enable and verify post-quantum groups in Python
This sequence confirms that the Python build, its linked OpenSSL and the ssl module can offer post-quantum key agreement groups, then proves on a test connection which group is negotiated. It ends with a dated record of the result for your inventory. The steps assume Python 3.15 or later, the version that added SSLContext.set_groups() and SSLSocket.group().
Confirm the Python build and linked OpenSSL
Run the interpreter you plan to use for the service and print ssl.OPENSSL_VERSION. Record the Python version and the OpenSSL version string. The Python 3.15 What's New page says get_groups() requires OpenSSL 3.5 or later and SSLSocket.group() requires OpenSSL 3.2 or later, so an OpenSSL build older than 3.5 will not list post-quantum groups. The CPython tracker shows the Windows and macOS installers moving to OpenSSL 3.5.8 on the 3.14 and 3.15 branches, and a later pull request updated the 3.15 macOS installer to 3.5.9, so confirm the exact string your build reports. This step is done when the version string is recorded and is 3.5 or later.
Confirm get_groups() lists post-quantum groups
Create an SSLContext with ssl.create_default_context() and call get_groups() on it. Each entry is marked as added in Python 3.15. Read the returned names and look for post-quantum entries, which OpenSSL 3.5 adds with its ML-KEM support. Do not copy a group name from documentation or a blog post into your configuration; take the names from this output on the machine you will deploy. This step is done when the output has been saved and you have confirmed whether any post-quantum group appears. If none appears, stop here and check the OpenSSL version recorded in the previous step.
Set the key agreement groups
Call set_groups() on the context with a string in the OpenSSL group list format, using the names you copied from get_groups() output. The Python 3.15 docs say set_groups() extends set_ecdh_curve() and accepts multiple groups, so you can list a post-quantum hybrid group together with classical ECDH groups. Keep the classical groups in the list so that peers which do not support post-quantum groups can still connect. Apply the same context to client or server sockets as your service needs. This step is done when set_groups() returns without error on the context that the service will use.
Verify the negotiated group on a test handshake
Start a test server with the configured context and connect a test client to it, both running the same Python build. After the handshake completes, call SSLSocket.group() on the connected socket and record the value returned. The docs describe this method as returning the group used for key agreement on that connection. Run the same test against a peer that cannot negotiate post-quantum groups and record what it returns. This step is done when you have a recorded group name from a completed handshake for each peer type you tested.
Check certificate and signature support in cryptography
If the service also needs ML-KEM or ML-DSA keys from the cryptography package, install cryptography 48.0.0 or later. The cryptography changelog says ML-KEM key encapsulation and ML-DSA signing became available in wheels in 48.0.0 when using OpenSSL 3.5.0 or later. Then try to construct the MLKEM768 key class in a short script, and confirm it does not raise UnsupportedAlgorithm. Note that the cryptography package ships its own bundled OpenSSL, separate from the one the ssl module uses, so a successful result here does not confirm that ssl negotiates the same algorithm. This step is done when the check result is recorded with the cryptography version.
Record the result with dates and versions
Write down the Python version, the ssl.OPENSSL_VERSION string, the cryptography version and its check result, the group names from get_groups(), and the group recorded from each test handshake. Add the date of the test and the name of the person who ran it. Keep this record with your cryptographic inventory, and repeat the sequence after any Python, OpenSSL or cryptography upgrade, since the ssl docs warn that default settings may change without prior deprecation. This step is done when the record exists and names the environment it describes.
Questions engineers ask about enabling post-quantum algorithms in Python
Is Python 3.15 quantum safe?
Python 3.15 is not a quantum-safe claim, and the documentation does not make one. What the sources support is narrower: Python 3.15 added SSLContext.set_groups(), SSLContext.get_groups() and SSLSocket.group(), which let code choose and inspect key agreement groups, including post-quantum groups, when the linked OpenSSL provides them. Whether a connection actually uses a post-quantum group depends on the OpenSSL build behind the ssl module, the groups configured, and what the peer offers. Python's own documentation does not state that the default configuration uses post-quantum key exchange, so confirm the negotiated group in your own environment rather than relying on the release label.
Which OpenSSL version does Python need for post-quantum groups?
Python's ssl module requires OpenSSL 1.1.1 or newer since Python 3.10, but post-quantum support depends on later versions. The Python 3.15 What's New page says SSLContext.get_groups() requires OpenSSL 3.5 or later and SSLSocket.group() requires OpenSSL 3.2 or later. OpenSSL 3.5.0, released 8 April 2025, added ML-KEM, ML-DSA and SLH-DSA, and changed the default TLS groups to prefer hybrid post-quantum KEM groups. The CPython tracker shows the Windows builds and macOS installer moving to OpenSSL 3.5.8 on the 3.14 and 3.15 branches, and a pull request merged on 2026-09-30 updated the 3.15 macOS installer to OpenSSL 3.5.9. Check the version your interpreter reports for its linked OpenSSL, since distribution and vendor builds may differ.
Does enabling post-quantum key exchange in Python cost extra?
The sources do not state a licensing or price difference for post-quantum groups in Python, and Python itself is open source. The cost you will see comes from the work around it: upgrading or rebuilding the OpenSSL your Python links against, testing the application and its dependencies on the new version, and updating deployment images. If you use the cryptography package, its post-quantum key classes arrived in later releases, starting with 47.0.0 for ML-KEM and ML-DSA, and wheels with OpenSSL 3.5.0 or later support them from 48.0.0. Ask your team or vendor to scope the upgrade path for your specific builds, because those effort costs depend on how many services and images you run.
What can break when older clients connect to a post-quantum Python server?
Older clients and peers may fail a handshake if the negotiated group or key share is unfamiliar to them, and middleboxes can interfere with larger key shares. The Python sources do not list the specific clients that will fail, so treat this as a test item rather than an assumption. Our sibling page on Python post-quantum compatibility with clients and peers covers how hybrid key exchange interacts with older clients, peers and middleboxes, and what to test first. Start there before changing production group settings.
How do I confirm which key exchange group a Python connection negotiated?
Use SSLSocket.group() on the connected socket after the handshake. The Python 3.15 documentation says it returns the group used for key agreement on that connection, and it requires OpenSSL 3.2 or later. To see which groups your context can offer, call SSLContext.get_groups(), which requires OpenSSL 3.5 or later. Set the groups with SSLContext.set_groups() using the OpenSSL group list format, then check the result against a test peer that you control. Confirm the output in your own environment, because the value you see depends on the OpenSSL build and the peer.
Can our engineers enable post-quantum algorithms in Python in-house, or do we need outside help?
Many teams can make the Python settings themselves once they know their OpenSSL version and have a test peer, since the required calls are documented in the ssl module. Outside help is usually worth scoping when the work spans many services, custom builds, pinned images or fleets of older clients, where the testing and rollout plan takes most of the effort. DeployOpen plans and implements self-hosted open-source platforms in your own infrastructure, and scopes a fixed-scope engagement with agreed deliverables and timelines in writing before work starts. We do not publish a price list, and a quote follows from the written scope.
What the sources do not show and what to ask the project or vendor
The sources checked for this page confirm that set_groups() and SSLSocket.group() exist in Python 3.15, but they leave several points open that decide whether a given build can use post-quantum key exchange or signatures. Put these questions to the Python project, your distributor or your own build team before you rely on a configuration.
SLH-DSA and X25519MLKEM768 key classes
The cryptography changelog entries checked for this page cover MLKEM768, MLKEM1024, MLDSA44, MLDSA65 and MLDSA87, but the 51.0.0 entry does not mention SLH-DSA or X25519MLKEM768 key classes. Those names come from OpenSSL's own algorithm list, not from the cryptography API this page covers. Ask the cryptography maintainers whether SLH-DSA or a hybrid X25519MLKEM768 key class is planned, and confirm in your installed version's documentation before writing code that imports either name.
cryptography changelogNo published default group list
The Python 3.15 ssl documentation describes set_groups() and get_groups() but does not state which groups are enabled by default when set_groups() is never called. Because the default depends on the OpenSSL build behind the ssl module, a post-quantum group may or may not be offered in a given deployment. Ask the Python project to publish the default group list for each release, and check what get_groups() returns on your own build before you depend on the default.
Python ssl docsOpenSSL version in the installers
get_groups() requires OpenSSL 3.5 or later, but the CPython tracker shows the Windows builds and macOS installer moving to OpenSSL 3.5.8 on the 3.14 and 3.15 branches, with a 3.15 macOS installer update to 3.5.9 merged on 2026-09-30. The sources checked do not say whether the python.org macOS and Windows installers of 3.15 link the ssl module to OpenSSL 3.5 or later in every release. Ask the Python release team to state the linked OpenSSL version for each 3.15 installer, and run ssl.OPENSSL_VERSION on the installed build to confirm it.
CPython OpenSSL update issueCertificate signature algorithms with ML-DSA
The cryptography changelog says that version 49.0.0 added signing and verifying of X.509 certificates with ML-DSA keys, and version 50.0.0 made verification accept ML-DSA-44, ML-DSA-65 and ML-DSA-87 by default. The sources do not say which certificate signature algorithms the Python ssl module accepts in a TLS handshake with ML-DSA, or whether the ssl module's signature algorithm settings cover ML-DSA. Ask the Python project to list the accepted algorithms, and test a handshake with an ML-DSA certificate on your target build before you issue one.
Python 3.15 What's NewInteraction of set_ciphersuites() and groups
Python 3.15 added set_ciphersuites() to restrict TLS 1.3 ciphers, and set_groups() to choose key agreement groups. The sources checked do not say whether a cipher restriction changes which groups are offered, or whether a group restriction affects the TLS 1.3 cipher suites the handshake negotiates. Ask the Python project whether the two settings are independent, and confirm the negotiated group and cipher with SSLSocket.group() and the cipher reported on a test connection.
Python ssl docsWhat each cited source covers
Start with the Python 3.15 What's New page at Python 3.15 What's New and the ssl module documentation at Python ssl docs. These two are the primary sources for the three Python 3.15 additions that control key agreement: SSLContext.set_groups(), SSLContext.get_groups() and SSLSocket.group(). The What's New page states that get_groups() requires OpenSSL 3.5 or later and SSLSocket.group() requires OpenSSL 3.2 or later, and the ssl docs give the group list format and mark each method as added in 3.15. Confirm the exact group names your build reports with get_groups(), since the names offered depend on the OpenSSL build linked to your interpreter, and record which Python patch release you tested.
Use the cryptography changelog at cryptography changelog and its ML-KEM and ML-DSA docs at cryptography ML-KEM docs and cryptography ML-DSA docs for the cryptography package, which uses its own bundled OpenSSL and therefore does not change what the ssl module negotiates. Check the release that added each class and the OpenSSL version the wheel bundles, and do not assume a feature in one package applies to the other. For the OpenSSL support behind the build versions, read the OpenSSL 3.5 NEWS at OpenSSL 3.5 NEWS and the CPython tracker entries at CPython OpenSSL update issue 156369 and CPython PR 158460, which show which OpenSSL version each Windows and macOS build of Python carries. Check each claim against its source before you record it in your inventory, and note the source and date beside it.
How DeployOpen helps plan and test post-quantum Python configuration
DeployOpen works through the Python settings that control post-quantum key exchange and signatures, starting from the Python build and the OpenSSL or cryptography versions it loads. Each engagement is scoped in writing, built and tested in your environment, and handed over with a record of the settings, versions and test results so your engineers and security reviewers can check them.
How we scope
- We confirm which Python release and which OpenSSL build the ssl module is linked against, since those set which groups are available.
- We list every service where Python sets key exchange groups, minimum TLS versions or cipher restrictions, so the written scope names each one.
- Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts; ongoing support is available as a retainer.
How we build
- We set key exchange groups with SSLContext.set_groups() on Python 3.15, and check the result with SSLSocket.group() on live connections.
- We test the TLS 1.3 cipher and group choices against each client and peer, because older clients may not offer hybrid groups.
- Where cryptography is used for ML-KEM or ML-DSA, we check the wheel's bundled OpenSSL version and confirm the key classes load in your environment.
How we hand over
- We deliver the final settings, the Python, OpenSSL and cryptography versions in use, and the test results for each connection path.
- We record which settings are fixed in code and which depend on the OpenSSL build, so later upgrades do not silently change them.
- We document how to repeat the checks after a Python or dependency update, so your team can run them without us.
How we support
- We retest after each Python patch release and OpenSSL update, since default settings in create_default_context() may change without notice.
- We track the Python 3.15 and cryptography release notes for new group, signature and key class support, and report changes that affect your settings.
- Continuous testing and upgrades are available as a retainer, with the same written scope and deliverables for each cycle.

