What a post-quantum upgrade of Python involves: runtimes and code

A post-quantum upgrade of Python depends on the OpenSSL build the ssl module is linked against, on Python 3.15 for group selection, and on the cryptography package's bundled OpenSSL, which is separate. Hybrid key exchange is available only where those pieces line up.

On this page

What does a post-quantum upgrade of Python need, and who must plan it?

For a Python service or fleet that must move toward post-quantum key exchange, the upgrade is mostly a question of two things: which OpenSSL build the interpreter is linked against, and which Python version the application runs on. The ssl module depends on the OpenSSL it is built with, so the groups available for key agreement come from that library. Python 3.15, released on 9 October 2026, is the first release with SSLContext.set_groups(), which sets the groups allowed for key agreement and supports post-quantum groups alongside ECDH curves. Before that release, the older set_ecdh_curve() control applies, and it does not cover post-quantum groups. Confirm which OpenSSL version each interpreter in the fleet uses, because a Python 3.15 build linked against an older OpenSSL will not give the same options. Note also that the cryptography package ships its own bundled OpenSSL in its wheels, so a pip-installed cryptography may not follow the system OpenSSL that ssl uses.

Three groups need to be involved in this work. Platform owners decide which Python versions and OpenSSL builds each service runs, and they own the build pipeline and container images that pin them. Security leads set the target for key exchange and signatures, decide which services are in scope first, and review the evidence that the chosen settings are in place. Vendor-risk reviewers check what each third-party package and runtime provider has stated about its OpenSSL version and its post-quantum support, and they record those statements with dates. Nothing in the facts supplied for this page establishes that any Python version, OpenSSL build or cryptography release is compliant or quantum safe, so the page should be read as a set of facts to verify, not as a certification.

The practical first step is an inventory, not a configuration change. For each service, record the Python version, the OpenSSL version reported by ssl.OPENSSL_VERSION, and whether cryptography is installed from its bundled wheel or built against a system library. Check that the planned Python release is one the team can actually deploy, since a 3.15 upgrade is a runtime change that touches every dependency. Then confirm with the vendor or the distribution which OpenSSL build their Python package uses, because that build sets the ceiling for what the application can negotiate. The results of that inventory decide whether a service needs a runtime upgrade, an OpenSSL change, or only configuration.

Which Python, OpenSSL and cryptography versions support which post-quantum pieces?

This table lists each post-quantum piece in Python and the cryptography package, the version that added it, the OpenSSL version it depends on, and the source and date for each row. Use it to confirm which release you run supports a feature before planning changes. The ssl module and a pip-installed cryptography package use different OpenSSL builds, so check each one separately.

ComponentVersion and requirementSource and date
Python 3.15 SSLContext.set_groups()Python 3.15 only. Sets allowed key agreement groups, including post-quantum groups, in OpenSSL group list format.Python 3.15 What's New; Python ssl docs (Python 3.15 released 9 October 2026)
Python 3.15 SSLContext.get_groups()Python 3.15 with OpenSSL 3.5 or later.Python 3.15 What's New (checked 2026-12-03)
Python 3.15 SSLSocket.group()Python 3.15 with OpenSSL 3.2 or later. Reports the key agreement group used on a connection.Python 3.15 What's New (checked 2026-12-03)
OpenSSL 3.5.0 default hybrid groupsOpenSSL 3.5.0 defaults to hybrid post-quantum KEM groups and offers X25519MLKEM768 and X25519 as default key shares.OpenSSL 3.5 NEWS (8 April 2025)
cryptography bundled OpenSSLcryptography 51.0.0 bundles OpenSSL 4.1.1. Applies to pip wheels, not to the ssl module.cryptography changelog (51.0.0, 2026-12-01)
cryptography ML-KEM and ML-DSA classesClasses MLKEM768, MLKEM1024 and MLDSA44/65/87 were added in cryptography 47.0.0 and raise UnsupportedAlgorithm if the backend lacks support.cryptography changelog (47.0.0, 2026-04-24); cryptography ML-KEM and ML-DSA docs
cryptography ML-KEM and ML-DSA with OpenSSLWheels provide ML-KEM encapsulation and ML-DSA signing when built against OpenSSL 3.5.0 or later, from cryptography 48.0.0.cryptography changelog (48.0.0, 2026-05-04)
Python ssl module OpenSSL buildPython 3.10 and later require OpenSSL 1.1.1 or newer. Post-quantum groups depend on the OpenSSL build the interpreter is linked against.Python ssl docs; PEP 644 (Final, target Python 3.10)

Which parts of a Python upgrade touch post-quantum key exchange and signatures?

A Python upgrade for post-quantum support touches several separate components: the ssl module and its linked OpenSSL, the cryptography package with its own bundled OpenSSL, hashlib, and the signing method used to verify the interpreter itself. Each one answers a different part of the question, so confirm each in your own environment rather than assuming one version covers them all.

The ssl module and linked OpenSSL

The ssl module requires OpenSSL 1.1.1 or newer since Python 3.10, so the TLS algorithms Python offers depend on the OpenSSL build it is linked against. Key agreement and certificate signatures in a Python TLS connection run through that OpenSSL. Confirm which OpenSSL version your Python build reports, because a post-quantum group such as X25519MLKEM768 can only be offered if that OpenSSL supports it. Python 3.15 adds set_groups() and get_groups(), which require OpenSSL 3.5 or later.

Python ssl docs

The cryptography package and its bundled OpenSSL

A pip-installed cryptography wheel ships its own statically linked OpenSSL, so it does not use the OpenSSL the ssl module uses. The two can be on different versions in the same environment. The changelog lists bundled OpenSSL 4.1.1 in cryptography 51.0.0, released 2026-12-01. ML-KEM and ML-DSA classes raise UnsupportedAlgorithm if the backend lacks support, so check the package version and the backend you actually run, not only the system OpenSSL.

cryptography install docs

hashlib's OpenSSL dependence and FIPS gaps

The hashlib module uses OpenSSL where it is available. Since Python 3.12 it falls back to a HACL* implementation for MD5, SHA1, SHA2 or SHA3 that the linked OpenSSL does not provide. In a FIPS-compliant build, or when OpenSSL FIPS mode excludes an algorithm, some algorithms may be missing or blocked. Confirm which algorithms your build exposes under the FIPS setting you run, since a FIPS restriction can change what your signing and hashing code can call.

Python hashlib docs

Sigstore signing and interpreter verification

PEP 761 deprecates PGP signatures for CPython releases starting with 3.14 and makes Sigstore the only signing method for new release series. The 3.15.1 release page lists a .sigstore file beside each download. This changes how you verify the interpreter itself, not how your application uses keys. Confirm that your verification process checks the Sigstore signature for the release you install, and update any internal procedure that still expects a PGP signature.

PEP 761 text

How the upgrade path differs by Python and OpenSSL version

Python 3.14 and earlier expose key agreement control through SSLContext.set_ecdh_curve(), which selects a single ECDH curve. The ssl documentation gives prime256v1 as the example and notes that it does not apply to client sockets, so it cannot list several groups or express post-quantum groups. Whether any post-quantum key exchange is possible depends on the OpenSSL build the ssl module is linked against, and the facts do not establish which Linux distributions or operating system packages ship a given OpenSSL build, so the reader must confirm this for each host.

  • Single curve only: set_ecdh_curve() sets one curve, and the facts do not show a way to express a hybrid group through it.
  • System OpenSSL dependency: the ssl module requires OpenSSL 1.1.1 or newer since Python 3.10, and the algorithms it offers follow the linked build.
  • Distribution builds unconfirmed: the sources do not say which distributions ship which OpenSSL version, so check the package metadata on each host.
  • Default cipher limits: the default cipher list since Python 3.10 uses security level 2, which rejects RSA and DH keys under 2048 bits.
  • Settings may change: the ssl docs warn that create_default_context() defaults may become more restrictive without deprecation.

Before planning changes, record the Python patch version and the OpenSSL version reported by the ssl module on each host, and confirm whether any post-quantum group is listed for that build.

Where the OpenSSL build and Python settings sit in a TLS handshake

The diagram starts at a Python client or server calling the ssl module, which hands key agreement to the OpenSSL build it is linked against. On Python 3.15, set_groups() chooses the groups offered, while set_ecdh_curve() is the pre-3.15 control, and SSLSocket.group() reports the group used on a connection. A separate path shows a pip-installed cryptography package calling its own bundled OpenSSL, so its algorithm support does not follow the ssl module's build. Check the OpenSSL version behind each path, since the two can differ.

Python's ssl module and the cryptography package each call a separate OpenSSL build.

What should a team do next, in order, to plan a Python post-quantum upgrade?

This sequence establishes the exact Python and OpenSSL builds in use, separates the ssl module's TLS stack from the bundled OpenSSL in the cryptography package, decides whether Python 3.15 is reachable, and records tested results before any production change. Each step ends with a check the team can repeat.

  1. Confirm the Python version in production

    Run python -VV on each production host, container image and build agent that runs Python code, and record the full output, including the release level and build date. Ask the owner of each system to confirm the interpreter path they actually launch, since a host can have several Python installations. The step is done when every system has a recorded Python version line, and any system without one is listed as an open item. Python 3.15 is the reference implementation documented at docs.python.org, and the 3.15 What's New page gives its release date, so compare each recorded version against that.

  2. Confirm the OpenSSL build the ssl module uses

    On the same hosts, run python -c "import ssl; print(ssl.OPENSSL_VERSION)" using the interpreter recorded in the previous step. The output names the OpenSSL build linked into the ssl module, which is the stack behind Python's TLS, certificate and key agreement behavior. Since Python 3.10 the ssl module requires OpenSSL 1.1.1 or newer, so a result below that is a blocker. Record the version string exactly, because the group and algorithm support discussed later depends on the OpenSSL version, not on the Python version alone. The step is done when every host has this string beside its Python version.

  3. Check whether the cryptography package is installed

    Inventory each environment for the cryptography package, using pip show cryptography or the equivalent lock file entry, and record the version. A pip-installed cryptography wheel carries its own statically linked OpenSSL rather than using the one the ssl module uses, so the two can differ on the same host. Next, run python -c "import cryptography; from cryptography.hazmat.backends.openssl.backend import backend; print(backend.openssl_version_text())" in environments that use it, or check the package documentation for the bundled version. The changelog lists bundled OpenSSL 4.1.1 for cryptography 51.0.0 released 2026-12-01, so record the bundled version separately from the ssl version. The step is done when each environment shows both the package version and its bundled OpenSSL.

  4. Decide whether Python 3.15 is an option

    Using the version data from the first two steps, decide whether each system can move to Python 3.15, which the 3.15 What's New page describes as the latest stable release. Note the 3.15 features the team would need, including set_groups(), the signature algorithm controls and the TLS 1.3 cipher restriction method. Confirm the upgrade path with the people who own each system, because a runtime change also changes the bundled dependencies and the sources of OpenSSL. The Python 3.15.1 release page lists a Sigstore file beside each download, which the team can use to verify the artifact before installation. The step is done when each system has a recorded yes, no or pending decision, with a named owner for the pending items.

  5. Test set_groups() and SSLSocket.group() on staging

    On a staging host that runs Python 3.15 with an OpenSSL build of 3.5 or later, test SSLContext.set_groups() and then read SSLSocket.group() on a live TLS connection. The What's New page says get_groups() requires OpenSSL 3.5 or later and group() requires OpenSSL 3.2 or later, so a host below those versions cannot run the test. Confirm that the group reported on the handshake matches the list the context was configured with, and note whether a hybrid group is selected. Keep the test to one client and one server you control, and do not change production settings from this step. The step is done when the staging result, including the OpenSSL version, Python version and negotiated group, is written down.

  6. Record the results and the open items

    Write the results from the earlier steps into one inventory record per system, listing the Python version, the ssl OpenSSL string, the cryptography version and bundled OpenSSL, the 3.15 decision and the staging group result. Mark each unanswered question as an open item with an owner, rather than assuming a default. The record is the evidence a security reviewer or vendor-risk lead will ask for, so date it and keep the raw command output with it. The step is done when every system in scope has a complete record or a named open item, and the team has agreed which items block the next change.

What has not been confirmed for Python post-quantum support, and what to ask

The sources listed on this page establish the OpenSSL, cryptography and CPython facts below, but leave several points open. Each card names one gap and the question to put to the project, the distribution or the package maintainers before you plan an upgrade on that basis.

ML-DSA certificates through the ssl module

The ssl module documentation ties its certificate handling to the linked OpenSSL build, and the 3.15 What's New page covers signature algorithm settings, but the sources do not state that ML-DSA certificates can be loaded, verified or presented through ssl. Ask the CPython project or your Python distributor whether ssl accepts ML-DSA certificate and key files on a given OpenSSL version, and request a test result from a server and client handshake, not a documentation reference. Until that is confirmed, treat certificate migration as a separate test item.

Python ssl docs

SLH-DSA and X25519MLKEM768 in cryptography

The cryptography 51.0.0 changelog entry lists composite ML-DSA-44 with Ed25519 keys and mentions neither SLH-DSA nor X25519MLKEM768, and the ML-KEM and ML-DSA documentation covers only the MLKEM and MLDSA key classes. Ask the cryptography maintainers whether SLH-DSA key classes and an X25519MLKEM768 key exchange are planned, and in which release. Do not assume a hybrid group exposed by OpenSSL is reachable from the package's Python API.

cryptography changelog

OpenSSL 3.5 builds in distributions

OpenSSL 3.5.0 added ML-KEM, ML-DSA and SLH-DSA and changed the default TLS groups, but the sources do not say which Python builds link against OpenSSL 3.5 or later. The CPython tracker shows Windows and macOS installers moving to OpenSSL 3.5.8 and 3.5.9, and nothing here covers Linux distributions. Ask each distribution which OpenSSL version its python3 package is built with, and whether that build exposes the post-quantum groups to the ssl module.

OpenSSL 3.5 NEWS

Published migration timeline

The sources reviewed for this page describe what Python 3.15 added, including set_groups() and signature algorithm controls, but do not show a dated plan from the project for moving the defaults to post-quantum algorithms. Ask the CPython project, through its release team or its published roadmap, whether a migration timeline exists and when it will be published. If there is none, record that gap in your vendor-risk file instead of inferring a schedule from the release of individual APIs.

Python 3.15 What's New

What can go wrong when hybrid key exchange is added to Python?

Adding hybrid key exchange to Python changes what a connection negotiates, and several of the effects are easy to miss because the code does not change. The ssl module's documentation warns that the default protocol, options and cipher settings of ssl.create_default_context() may change to more restrictive values at any time without prior deprecation. A service that works today can therefore start rejecting a peer after an interpreter or OpenSSL update, with no warning in the release notes. The default cipher list has already been narrowed since Python 3.10 to AES and ChaCha20 suites with forward secrecy at security level 2, which prohibits RSA and DH keys under 2048 bits and ECC keys under 224 bits. A legacy client or appliance that offers only weaker suites will fail the handshake, and the error will look like a generic TLS failure rather than a policy decision.

A second source of confusion is which OpenSSL is in use. The ssl module is linked against the OpenSSL build of the Python interpreter, while a pip-installed cryptography package ships its own bundled OpenSSL, so the two can report different versions. The cryptography changelog lists bundled OpenSSL 4.1.1 in version 51.0.0, which the reader should compare with the version reported by ssl.OPENSSL_VERSION in the same process. Group support also depends on the OpenSSL version: SSLContext.get_groups() requires OpenSSL 3.5 or later, and SSLSocket.group() requires 3.2 or later. Check these versions before testing key agreement, because a group that exists in one library may be absent from the other.

The third risk is the group that appears configured but is never offered. Python's hashlib documentation states that algorithms may be missing or blocked in a FIPS compliant build or when OpenSSL FIPS mode excludes them, and the same logic applies to TLS groups. A call to set_groups() can succeed, and a configuration file can list a post-quantum group, while the handshake still negotiates a classical group because the FIPS provider does not offer the hybrid one. Test first with a loopback connection on the target build: call SSLSocket.group() and confirm the negotiated group, then repeat against the real peer. Record the Python version, the ssl.OPENSSL_VERSION string and whether FIPS mode is active, since those three facts determine what the connection can negotiate.

Questions engineers and vendor-risk reviewers ask about a Python post-quantum upgrade

Is Python quantum safe?

The facts do not support calling Python quantum safe, and no post-quantum algorithm is enabled by default in the standard library. Python's ssl module uses whatever OpenSSL build it is linked against, so the key exchange groups and certificate signature algorithms available depend on that build. Python 3.15 added set_groups() and get_groups(), which expose post-quantum and hybrid groups when OpenSSL 3.5 or later is present, but turning them on is a configuration step, not a default. Confirm the OpenSSL version and the groups actually negotiated in your own environment before recording any status.

Which Python version is needed for hybrid key exchange groups?

Hybrid groups are reachable from Python through two layers: the Python version and the OpenSSL version. The Python 3.15 What's New page adds SSLContext.set_groups() and get_groups(), and says get_groups() requires OpenSSL 3.5 or later and SSLSocket.group() requires OpenSSL 3.2 or later. OpenSSL 3.5.0 changed its default TLS groups to prefer hybrid post-quantum KEM groups such as X25519MLKEM768. Python 3.15.1 was released on 21 October 2026, and the CPython tracker shows the Windows and macOS builds moving to OpenSSL 3.5.8 and later 3.5.9. Check the OpenSSL version your specific Python binary is linked against, since distribution builds may differ.

Does a post-quantum upgrade of Python add cost?

The facts do not give any figures for cost, so treat this as a question to confirm with your team and vendors. The main cost drivers are the scope of Python deployments that must change, whether the OpenSSL build behind each Python install needs upgrading, whether the cryptography package or other third-party libraries must move to versions with ML-KEM or ML-DSA support, and the testing needed to confirm peers can negotiate the new groups. Upgrades to the Python runtime itself are a one-time effort per environment, while ongoing costs come from keeping OpenSSL, cryptography and the interpreter patched. Ask for a written scope covering each of these before estimating effort.

What breaks when Python moves to post-quantum groups?

The facts name several risks rather than confirmed breakage. Larger key shares in hybrid groups can affect peers, middleboxes and clients that have not been updated, so connections may fail or fall back. Python's default cipher and protocol settings can change to more restrictive values without prior deprecation, as the ssl documentation warns, so code that depends on current defaults may behave differently after an update. Code that pins a specific OpenSSL cipher string or set_ecdh_curve() call may not pick up the new groups at all. Test each service's TLS handshake against its real peers before rolling out a change.

What should we ask the Python project or our distribution?

Ask the Python project or your distribution for the exact OpenSSL version linked into each interpreter, the list of groups available through get_groups() on that build, and whether the release notes or release artifacts carry any statement about post-quantum support. Ask whether a Sigstore signature is provided for the release you install, since PEP 761 makes Sigstore the only signing method for new release series. Ask the distribution how it handles OpenSSL security updates for your Python packages and whether it applies the August 2026 OpenSSL update. Record each answer with the version it applies to and the date you checked.

Can our team do this alone, or do we need outside help?

Whether your team can do this alone depends on how many Python deployments you run, how many of them terminate TLS directly, and how much your staff already knows about OpenSSL configuration. A small internal estate with a single known OpenSSL build may be manageable in-house. Larger or mixed estates, especially those where cryptography or other third-party packages bundle their own OpenSSL, usually need a plan for inventory, testing and rollout across each environment. DeployOpen can plan, implement and test such an upgrade under a fixed-scope engagement with written deliverables, and can help prepare the evidence your compliance team asks for. Ask for a written scope before deciding.

How DeployOpen helps plan and test a Python post-quantum upgrade

DeployOpen works with your engineers to scope what a Python post-quantum upgrade needs, from the interpreter and OpenSSL build through the ssl, hashlib and cryptography calls in your code. The work is planned in writing, built and tested in your environment, and handed over with documentation your team can keep using.

How we scope

  • We agree in writing which Python versions, OpenSSL builds and third-party packages the upgrade covers.
  • We list which services in scope call ssl, hashlib or cryptography, so the scope matches your real code paths.
  • We confirm which Python release and OpenSSL version you plan to run, since the facts tie group support to those versions.
  • We record what your team must confirm with the Python project and your distributor before work starts.

How we build

  • We build or select the interpreter and OpenSSL combination the agreed scope requires, and document each build choice.
  • We pin cryptography and other dependencies to versions that match the agreed OpenSSL and algorithm support.
  • We test the TLS version, cipher and key exchange group settings in a staging environment before any production change.
  • We check that hashlib and certificate verification behave as expected on the agreed build, including FIPS-mode builds.

How we hand over

  • We deliver a written record of the Python, OpenSSL and package versions tested, with the settings that were applied.
  • We provide test results showing which handshakes, certificate checks and hashes passed on the agreed builds.
  • We document the remaining gaps, such as algorithms or features the chosen Python release does not yet expose.
  • We walk your engineers through the runbook so they can repeat the checks after future Python or OpenSSL updates.

How we support

  • Ongoing support and upgrades can be arranged as a retainer after the initial engagement ends.
  • A retainer can cover retesting when Python, OpenSSL or cryptography releases change the supported algorithms.
  • Retesting after a dependency update is scoped and quoted separately, based on the systems affected.
  • Request a quote from a written scope to see what each part of this work would cost your organization.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.