Which PHP features and APIs depend on RSA and elliptic-curve keys

In PHP's OpenSSL extension, TLS streams, certificate and CSR functions, and signing rely on RSA, DSA, DH and EC keys, while the sodium extension adds Ed25519 and Curve25519 operations. As of 3 December 2026, PHP core documents no ML-KEM or ML-DSA support.

On this page

Which PHP features depend on RSA and elliptic-curve keys today

As of 3 December 2026, the PHP features that depend on RSA, DH, DSA or elliptic-curve keys are the OpenSSL extension's TLS streams, the and ftps:// wrappers that run over ssl://, the key and certificate functions openssl_pkey_new() and openssl_csr_new(), the signing function openssl_sign()`, and the public-key functions in the sodium extension for Ed25519 signatures and key exchange. The PHP manual documents no post-quantum algorithm in PHP core for any of them. We checked the 8.2, 8.3, 8.4, 8.5 and 8.6 branches listed as supported on php.net, and these dependencies apply to every supported branch. Inventory owners, security assessors and vendor-risk reviewers recording an answer for a PHP application should treat this as the baseline: a PHP deployment is dependent on classical public-key cryptography in these places unless the application adds its own, third-party implementation.

The dependencies are not all the same kind of risk, so record them separately. TLS key exchange and certificate signatures in the stream layer depend on the keys and curves that the linked OpenSSL library provides. openssl_get_curve_names() lists those curves, and the manual names prime256v1 (NIST P-256) and secp384r1 (NIST P-384) as the most widely supported. Because ssl:// options also apply to and ftps://, a single context such as local_cert, local_pk, cafile or capath changes behavior for every wrapper that uses it. The verify_peer and verify_peer_name options default to true and allow_self_signed defaults to false, so the defaults already verify peers. The ciphers option defaults to DEFAULT, and min_proto_version and max_proto_version` use the OpenSSL default when unset, so confirm the effective values in your own configuration rather than assuming them. On Windows, PHP 8.2.0 and later use OpenSSL 3.0.0 by default, which you should confirm for the builds you run.

Symmetric ciphers in openssl_encrypt() and hashing in password_hash() are not public-key dependencies and belong in a separate part of the inventory. For the sodium extension, the public-key items are the Ed25519 signatures and the sodium_crypto_box* and sodium_crypto_kx_* functions, while sodium_crypto_pwhash* is password hashing. The PHP manual pages checked for the OpenSSL extension, the SSL context options and sodium document no ML-KEM, ML-DSA or SLH-DSA functions, constants or options. php-src issue #22862 for post-quantum support was still open with no maintainer plan as of 3 December 2026, and issue #23421 was closed as its duplicate. Record PHP as having no post-quantum support in core, and confirm the current status with the php-src tracker before you finalize the answer.

Public-key dependencies in PHP, by feature and version

This table lists the PHP features and APIs that use RSA, DSA, DH, elliptic-curve or Ed25519 keys, with the version each applies to and the source and date checked. Read the Public-key column first: a check mark means the feature performs public-key operations, while a dash or cross marks symmetric or hashing features that are not public-key dependencies. The main takeaway is that TLS streams, key generation, CSR creation and signing depend on public-key algorithms, while openssl_encrypt and password_hash do not.

Feature or APIKey types usedPublic-key dependencyVersion and source checked
TLS streams (ssl:// and tls://)RSA, EC certificates and key exchange via the OpenSSL libraryYesApplies to all supported branches. PHP manual, OpenSSL book, checked 3 Dec 2026
SSL context options (local_cert, local_pk, cafile)RSA or EC certificate and private key materialYesApplies to all supported branches. PHP manual, SSL context options, checked 3 Dec 2026
openssl_pkey_new()RSA, DSA, DH, EC; x25519, x448, ed25519, ed448 from PHP 8.4.0Yesx25519 to ed448 require PHP 8.4.0 or later. PHP manual, openssl_pkey_new, checked 3 Dec 2026
openssl_csr_new()Key pair supplied by the caller, typically RSA or ECYesDigest and key size come from openssl.cnf when not set. PHP manual, openssl_csr_new, checked 3 Dec 2026
openssl_sign()RSA, DSA or EC private keysYesDefault algorithm is OPENSSL_ALGO_SHA1. Padding parameter added in PHP 8.5.0. PHP manual, openssl_sign, checked 3 Dec 2026
openssl_get_curve_names()Lists EC curves, including prime256v1 and secp384r1YesReturns curves from the linked OpenSSL build. PHP manual, openssl_get_curve_names, checked 3 Dec 2026
sodium_crypto_sign* (Ed25519)Ed25519 signing keysYesPart of the sodium extension. PHP manual, Sodium, checked 3 Dec 2026
sodium_crypto_box* and sodium_crypto_kx_*Curve25519 public-key encryption and key exchangeYesPart of the sodium extension. PHP manual, Sodium, checked 3 Dec 2026
openssl_encrypt() and openssl_decrypt()Symmetric ciphers, no public-key operationNoSymmetric feature. PHP manual, openssl_encrypt, checked 3 Dec 2026
password_hash() (bcrypt default)None; hashing onlyNoHashing feature. Bcrypt default cost raised from 10 to 12 in PHP 8.4.0. PHP manual, password_hash, checked 3 Dec 2026

Which PHP components touch public keys and certificates

PHP reaches public-key cryptography through a few separate layers: TLS streams, the OpenSSL extension, and the sodium extension. Each layer has its own defaults and its own settings, so an assessor needs to check them one at a time.

TLS key exchange and certificate verification

The ssl:// and tls:// stream transports handle TLS key exchange and certificate checks for PHP code, and https:// and ftps:// use them underneath. By default, verify_peer and verify_peer_name are true and allow_self_signed is false, so PHP checks the server certificate and its name. The ciphers option defaults to DEFAULT, and security_level, min_proto_version and max_proto_version use the OpenSSL library default unless you set them. Confirm these values in each deployment, since a shared php.ini or a per-call context can override them.

SSL context options

Client certificates and private keys in stream contexts

The context options local_cert, local_pk, passphrase, cafile and capath set the certificate and key material that a TLS stream presents or trusts. local_cert and local_pk supply the client identity, and cafile and capath define which certificate authorities PHP accepts. Each connection can set these separately, so an inventory has to cover every place a context is built, not only the global configuration.

Key and CSR functions in ext/openssl

The OpenSSL extension creates and reads keys and certificate signing requests through openssl_pkey_new() and openssl_csr_new(). openssl_pkey_new() supports RSA, DSA, DH and EC keys, and since PHP 8.4.0 it also supports x25519, x448, ed25519 and ed448 keys. The openssl_csr_new() manual gives no hard-coded default for the digest or key size and takes both from openssl.cnf, so the effective values depend on your OpenSSL configuration file.

openssl_csr_new manual

Signatures from openssl_sign and its SHA1 default

openssl_sign() defaults its algorithm parameter to OPENSSL_ALGO_SHA1, so code that omits the argument produces SHA-1 signatures. PHP 8.5.0 added an optional padding parameter that accepts OPENSSL_PKCS1_PADDING or OPENSSL_PKCS1_PSS_PADDING. Find every openssl_sign() call that relies on the default and set the algorithm explicitly, because a reviewer will otherwise read the SHA-1 default as the intended setting.

openssl_sign manual

Ed25519 and Curve25519 in the sodium extension

The sodium extension provides Ed25519 signatures through sodium_crypto_sign*, and public-key encryption and key exchange through sodium_crypto_box* and sodium_crypto_kx_*. These are public-key operations separate from the OpenSSL extension, so an inventory that only searches for openssl_ calls will miss them. Record which sodium functions your code calls and where their keys come from.

Sodium manual

openssl.cafile and openssl.capath in php.ini

The php.ini directives openssl.cafile and openssl.capath both default to an empty string, and both are INI_PERDIR, so ini_set() cannot change them at runtime. They set the default trust store that TLS streams use when a context does not provide its own cafile or capath. Check the values in each php.ini that a server or CLI process loads, because an empty value leaves PHP relying on whatever the linked OpenSSL uses by default.

OpenSSL configuration

How the answer changes by PHP version, platform and build

PHP 8.2.0 and later on Windows use OpenSSL 3.0.0 by default. OpenSSL 3.x moves older algorithms into a separate legacy provider, so cipher and digest names that worked on earlier Windows builds can fail unless that provider is loaded. The PHP manual names bf-cbc, rc4 and des-ecb as examples of algorithms that are unavailable without it. For public-key work, this means key types and curves depend on the OpenSSL build bundled with the PHP binary rather than on any system library.

  • Default provider: OpenSSL 3.0.0 is the bundled library in PHP 8.2.0 and later on Windows.
  • Legacy algorithms: bf-cbc, rc4 and des-ecb fail unless the legacy provider is loaded.
  • Curve list: run openssl_get_curve_names() on the target build to see which curves are linked, rather than assuming the list from another platform.
  • Bundled versus system: confirm which OpenSSL DLL the PHP process actually loads, since a system OpenSSL on the PATH can change behavior.

Confirm on each Windows host by running php -i and reading the OpenSSL version line, then test the specific key types and algorithms your application uses.

What to inventory and check in your PHP estate first

This sequence builds a dated list of every PHP service that opens TLS connections, verifies certificates or signs data, and records which OpenSSL and PHP versions and SSL context settings each one uses. The output is the evidence a security assessor needs to answer which RSA, Diffie-Hellman and elliptic-curve dependencies exist before any post-quantum planning starts.

  1. List every PHP service that makes TLS connections

    The service owner, with help from the platform team, searches the codebase and deployment manifests for stream, HTTP and database client calls that use ssl://, tls://, https:// or ftps:// URLs, as well as stream_socket_client() and stream_socket_server() calls. Each service is recorded with its owner, its runtime host and the remote endpoints it contacts. The step is done when the owner has reviewed the grep output and confirmed the list matches the services they run, since calls hidden in vendored libraries will not show up in a simple search.

  2. Record the PHP and OpenSSL versions per host

    For each host or container image in the list, the platform engineer runs php -v and php -i | grep -i openssl to capture the PHP version and the OpenSSL library version the PHP build is linked against. Note that PHP 8.2 security support ends on 31 December 2026, so any host on that branch should be flagged for the planning team. The step closes when every host has both values in the inventory and the output of php -i has been attached to the record for that host.

  3. Check SSL context options in application code

    A developer searches the code for the SSL context keys crypto_method, min_proto_version, max_proto_version, ciphers, cafile and capath, and for any use of verify_peer or verify_peer_name set to false. Where a key is absent, the developer records that the OpenSSL library default applies, and notes that verify_peer and verify_peer_name default to true. The step is done when each service has a row listing which options are set, their values and their file location, and the security lead has reviewed any place where verification has been turned off.

  4. Check how stream crypto methods are selected

    The developer checks every call to stream_socket_enable_crypto() to see whether a STREAM_CRYPTO_METHOD_* constant is passed, and whether the context carries a crypto_method option. On PHP 8.0.0 and later, a call with neither throws a ValueError, so a missing method is a runtime fault rather than a silent default. The step closes when each call site is listed with the constant it uses, or with a note that the context supplies it.

  5. Inventory key generation and signing call sites

    The developer lists every call to openssl_pkey_new(), openssl_csr_new() and openssl_sign() with the file and function where it sits. For each call, the record notes the key type passed (RSA, DSA, DH, EC, or on PHP 8.4.0 and later x25519, x448, ed25519 or ed448), the private_key_bits or curve name used, and the digest algorithm given to openssl_sign(), where the manual states openssl_sign() defaults to OPENSSL_ALGO_SHA1 when none is given. The step is done when the owner has signed off that every call is accounted for and that defaults inherited from openssl.cnf have been checked on the host.

  6. Check sodium usage and its public-key functions

    The developer searches for calls to the sodium_crypto_sign*, sodium_crypto_box* and sodium_crypto_kx_* families, which carry Ed25519 signatures, public-key encryption and key exchange on Curve25519. Each call is recorded with its file location and purpose, and the record separates these from password_hash() and openssl_encrypt(), which are symmetric or hashing features. The step closes when the owner has confirmed the sodium list is complete and has checked the host's sodium extension is enabled.

  7. Confirm the inventory with the service owners

    The security lead sends each service owner their rows from the earlier steps and asks them to confirm the TLS endpoints, key types and context options are accurate, and to add any dependencies that a search would miss, such as libraries that open their own connections. The record is then dated and stored with the host versions. The step is complete when every owner has returned a signed confirmation and the open questions are logged for the planning stage.

What PHP core has not published, and what to ask

As of 3 December 2026, the PHP manual and the php-src tracker show no post-quantum public-key support in core. Each card below names one gap, what the manual or tracker shows, and what to ask the PHP project, your distribution or your hosting vendor.

No ML-KEM functions in the manual

The OpenSSL, SSL context and sodium manual pages checked on 3 December 2026 document no ML-KEM functions, constants or options. ML-KEM is the key encapsulation mechanism for post-quantum key exchange, so a TLS or sodium key exchange in PHP cannot be configured to use it from documented code. Ask the PHP project for the release in which ML-KEM would appear in ext/openssl or sodium, and ask your distribution whether its PHP build links an OpenSSL version that exposes it. Watch the OpenSSL book and the sodium book on php.net for new entries.

OpenSSL manual

No ML-DSA or SLH-DSA functions in the manual

The same pages document no ML-DSA or SLH-DSA functions, constants or options. These are the post-quantum signature schemes, so openssl_sign(), openssl_verify() and certificate handling in PHP have no documented post-quantum path. Ask the PHP project whether signature support is planned separately from key exchange, and ask your hosting vendor whether any PHP image it ships includes such a path. Check the SSL context options and sodium pages again at each PHP minor release.

SSL context options

Issue 22862 has no maintainer plan

Issue #22862, Add Post-Quantum Cryptography Support, was opened on 22 July 2026. As of 3 December 2026 it is open, labeled Status: Requires RFC, assigned to bukka, and has no written comments or maintainer plan. Requires RFC means a proposal must be written before work is scheduled. Ask the PHP project whether an RFC is planned and when a decision is expected. Watch the issue for labels, linked RFCs and milestone changes.

Issue 22862

Issue 23421 closed as a duplicate

Issue #23421 asked ext/openssl to expose ML-KEM and ML-DSA. It was closed as a duplicate of #22862 on 25 Aug 2026, so the tracking for those algorithms sits in the single open issue. Ask the PHP project whether any work tied to #23421 continues under #22862. If you record the request in your own evidence, cite both issue numbers and the closure date. Watch #22862 for the point where any of this work is scheduled.

Issue 23421

Third-party extension is not core

The ext-pqcrypto extension by Paragon Initiative Enterprises implements ML-KEM, ML-DSA, SLH-DSA and an X-Wing hybrid, but it is not part of PHP core. Paragon announced it on 7 April 2026 and said it has not been audited and that there will be bugs. The ext-pqcrypto repository checked on 3 December 2026 shows no published releases. Ask your vendor or internal platform team whether any such extension is in use, and record it separately from core PHP in your inventory. Do not treat it as a core PHP feature in vendor answers.

ext-pqcrypto repository

Third-party ext-pqcrypto is not PHP core support

Post-quantum algorithms in PHP do not come from PHP core. The ext-pqcrypto extension, published by Paragon Initiative Enterprises, is a third-party PHP extension that implements ML-KEM (FIPS 203), ML-DSA (FIPS 204), SLH-DSA (FIPS 205) and the X-Wing hybrid of X25519 and ML-KEM-768. It requires PHP 8.1 or later and a Rust toolchain at rustc 1.85 or later on the nightly channel. Installing it adds a dependency on a Rust build chain and on a component outside the PHP project's release process, so it belongs in your third-party software inventory, not in your PHP version record. The ext-pqcrypto repository is the source to check for its current code and status.

Paragon announced ext-pqcrypto and the pure-PHP library pqcrypto_compat on 7 April 2026. In that post, Paragon said it does not state that either has been audited, warned that there will be bugs, and advised against rushing to deploy them into production. When we checked the repository on 3 December 2026, it showed no published releases. Confirm this yourself before relying on it, because a repository with no tagged releases gives you no fixed version to pin, test or cite in a change record. Ask Paragon directly whether an independent security review has been performed, and if so, request the report and the scope it covered.

Using ext-pqcrypto is a separate third-party decision for your own review, not something PHP core support or the PHP project's roadmap settles. Treat it like any other unaudited dependency: review the source, build it in a non-production environment, record the exact commit you tested, and decide whether its owner and its maintenance terms meet your requirements. Do not confuse it with the PHP project's own position. As of 3 December 2026, the PHP project had an open feature request for post-quantum support in php-src (issue #22862) with no maintainer plan written in it, so no core PHP release provides these algorithms.

Questions assessors ask about PHP's RSA and EC dependencies

Is PHP quantum safe?

No supported post-quantum algorithm is documented for PHP core as of 3 December 2026. The PHP manual pages checked for the OpenSSL extension, the SSL context options and the sodium extension list no ML-KEM, ML-DSA or SLH-DSA functions, constants or options. PHP's public-key operations, including TLS key exchange, certificate signatures and the RSA, DSA, DH, EC, X25519 and Ed25519 keys in ext/openssl, rely on classical algorithms. The php-src issue asking for post-quantum support, #22862, was opened on 22 July 2026 and is still open with no maintainer plan written down. Treat PHP core as classical-only for inventory purposes, and confirm the status with your distribution before recording it.

Which PHP version do we need for post-quantum support?

No PHP version documented on 3 December 2026 provides post-quantum algorithms in core, so no version number answers this question yet. The supported branches listed on php.net are 8.6 (released 19 November 2026), 8.5, 8.4, 8.3 and 8.2, and the RSA and elliptic-curve dependencies described in the manual appear across them. Security support for 8.2 ends on 31 December 2026, so an inventory should record the branch you run and its support end date. Ask whether a future branch will add post-quantum support, and check the release notes for each version you plan to deploy.

Does moving PHP to post-quantum algorithms cost extra?

The sources checked do not give a price or effort estimate for any PHP upgrade, so no figure can be stated here. Costs for a PHP estate usually come from people and time: the engineers who inventory calls to openssl_*, stream and sodium functions, the teams that test TLS and signing paths after any change, and the work to rebuild or update the runtime if a distribution ships a new one. Recurring costs depend on how your distribution packages PHP and how often you receive updates. Ask your distribution or any outside provider for a written quote that lists these components separately, and ask what is one-time and what recurs.

What breaks if we change the PHP cryptography settings?

Changes to TLS and key settings affect every connection that uses PHP streams, including https:// and ftps:// requests. The SSL context options verify_peer and verify_peer_name default to true and allow_self_signed defaults to false, and the ciphers option defaults to DEFAULT. Changing min_proto_version, max_proto_version or ciphers can stop connections to peers that do not support the chosen protocol or cipher. On Windows, PHP 8.2.0 and later use OpenSSL 3.0.0 by default, and legacy algorithms such as bf-cbc, rc4 and des-ecb are unavailable unless the legacy provider is loaded. The openssl.cafile and openssl.capath directives can only be set in php.ini, not with ini_set(), so changes require a restart of the PHP process.

What should we ask PHP or our distribution about post-quantum plans?

Ask PHP core and your distribution the same specific questions, and record the answers with dates. For PHP core, ask whether the php-src issue 22862 has a maintainer plan, a target branch and an RFC, since the issue is labelled Status: Requires RFC and has no written plan. For your distribution, ask which PHP build you run, whether it links to an OpenSSL version with post-quantum algorithms, and whether it will ship a PHP build that exposes them. Ask about the openssl.libctx setting and the --with-system-ciphers build option, since these decide how the linked library's algorithms are exposed. Request written answers, because a verbal answer cannot be checked later.

Can we do the PHP cryptography inventory ourselves or do we need outside help?

Your own engineers can start the inventory with the PHP manual pages for the OpenSSL extension, the SSL context options and the sodium extension, then search your code and configuration for the functions and options those pages describe. Use the sources to list each call to openssl_pkey_new, openssl_csr_new, openssl_sign, stream_socket_enable_crypto and the sodium_crypto_sign*, sodium_crypto_box* and sodium_crypto_kx_* functions. Outside help becomes useful when the code base is large, when many services depend on the results, or when you need the inventory to support an audit. DeployOpen can plan, implement and document this work inside your own infrastructure as a fixed-scope engagement, with the scope agreed in writing before work starts.

Is the third-party ext-pqcrypto extension a supported option for PHP?

ext-pqcrypto is a third-party extension from Paragon Initiative Enterprises, not part of PHP core, so it is not a PHP-supported option. It implements ML-KEM, ML-DSA, SLH-DSA and the X-Wing hybrid, and it requires PHP 8.1 or later and a nightly Rust toolchain at rustc 1.85 or later. Paragon announced it on 7 April 2026, said it has not been audited, warned that there will be bugs, and advised against production deployment for now. The repository showed no published releases on 3 December 2026. If you evaluate it, treat it as a test-only component and record it as third-party software in your inventory.

How DeployOpen helps assess and plan PHP key dependencies

DeployOpen works through PHP key dependencies in three stages: scoping the applications and servers that use the OpenSSL extension, sodium and stream TLS, building an inventory of where RSA, Diffie-Hellman and elliptic-curve keys appear, and documenting what the team must confirm with its PHP version and vendors. The output is a written record that security and vendor-risk reviewers can check.

How we scope

  • We agree in writing which PHP applications, runtime versions and servers fall inside the assessment.
  • We list the PHP versions in use and check them against the supported branches published on php.net.
  • Engagements are fixed-scope, with deliverables and timelines confirmed before work begins; ongoing support is available as a retainer.

How we build

  • We trace where code calls openssl_pkey_new, openssl_csr_new, openssl_sign and stream TLS context options.
  • We record the key types, curves and default settings each call path uses, separating key exchange from certificate signatures.
  • We check the php.ini openssl.cafile, openssl.capath and openssl.libctx settings on each host and note any build flags such as --with-system-ciphers.

How we hand over

  • You receive an inventory that names each PHP version, extension and component the findings apply to.
  • Each dependency is dated and sourced to the PHP manual or vendor page it came from, so reviewers can re-check it.
  • We state what the PHP manual does not document for ML-KEM, ML-DSA or SLH-DSA, so your evidence file records the gap accurately.

How we support

  • We review the php-src issue status and project statements at each handover so the record reflects the current position.
  • Retesting after PHP upgrades or configuration changes is included in the retainer where agreed.
  • We help you ask PHP maintainers and third-party extension authors specific questions before any production decision.

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.