Quantum-safe encryption in Laravel: what to fix
Laravel's own encryption, AES-256 with HMAC-SHA256, is already quantum-safe, and so are bcrypt and signed URLs. The exposure is public-key cryptography: on Ubuntu 22.04's OpenSSL 3.0.2, Laravel's HTTP client negotiated classical X25519 and Passport signed tokens with RSA-4096. OpenSSL 3.5 or later turns on the hybrid X25519MLKEM768 key exchange, and X-Wing sealing replaces RSA for data only a back office should read.

Every time Chrome opens your Laravel site, it offers a post-quantum key exchange before it asks for the first page. If your server runs an OpenSSL older than 3.5, it ignores the offer and settles on X25519, a key exchange that someone can record today and decrypt once a large quantum computer exists. That handshake, not your APP_KEY, is where quantum-safe encryption work in Laravel starts.
I checked what that means for a real app. On a fresh Laravel 13.42 install with Passport, running PHP 8.3.36 on Ubuntu 22.04 with its OpenSSL 3.0.2, Laravel's own encryption came out fine. Its outbound HTTPS calls did not: they negotiated plain X25519. Its Passport tokens were signed with a 4,096-bit RSA key. Below is what quantum-safe actually means, which parts of Laravel already qualify, and how to fix the rest, with a tested audit command and a sealer for data only your back office should read.
The versions this guide covers, checked on 16 November 2026:
Laravel 13.42.0 and Laravel Passport 13.11.0, which signs tokens through league/oauth2-server 9.4.1 and lcobucci/jwt 5.6.1.
PHP 8.5.12 is the current stable release, and PHP 8.6.0 is due on 19 November 2026 (its seventh release candidate was tagged on 11 November).
OpenSSL 3.5.9 is the long-term support line with post-quantum algorithms, supported until April 2030; the newest release is 4.1.0.
libsodium 1.0.22 and Paragon's pqcrypto_compat 0.3.4 are the PHP-side post-quantum libraries this guide uses or discusses.
What does quantum-safe encryption actually mean?
Quantum-safe encryption is cryptography that no known attack can break in practice, on today's computers or a large quantum one: NIST's new ML-KEM, ML-DSA and SLH-DSA standards, plus AES and SHA-2 at today's sizes.
The split comes from two quantum algorithms. Shor's algorithm solves the maths under RSA and elliptic curves, so a big enough quantum computer would break every key exchange and signature that rests on them. That covers X25519, P-256, ECDSA, Ed25519 and RSA of any size. Grover's algorithm only speeds up a brute-force search, and NIST's post-quantum FAQ says it "will provide little or no advantage in attacking AES". The same FAQ concludes that "current applications can continue to use AES with key sizes 128, 192, or 256 bits".
That is why NIST's new standards replace only public-key cryptography. FIPS 203 (ML-KEM) handles key exchange, while FIPS 204 (ML-DSA) and FIPS 205 (SLH-DSA) handle signatures, all three published in August 2024. The final transition plan, NIST IR 8547, published on 27 October 2026, says plainly that NIST "does not expect to need to transition away from" its symmetric standards. In NIST's five post-quantum security categories, AES-256 defines the top one.
Three terms mean the same thing here: post-quantum, quantum-resistant and quantum-safe. None of them means quantum cryptography. Quantum key distribution (QKD) uses physics and dedicated hardware, and India's own quantum-safe roadmap describes it as suited to "limited high-assurance/research-focused environments". For a Laravel app, quantum-safe encryption means ordinary software running new algorithms.
"Safe" also means only that no attack is known. In July 2022, two KU Leuven researchers broke SIKE, a candidate that had reached the fourth round of NIST's competition. Their published code recovers a SIKEp434 key "in about ten minutes on a single core". ML-KEM has stood up to years of analysis, but the industry hedges anyway with hybrids. A hybrid such as X25519MLKEM768 runs X25519 and ML-KEM-768 together, and NIST describes the goal as keys that "remain secure if at least one" of the parts is unbroken.
How close is a quantum computer that can break RSA?
No quantum computer can break RSA or elliptic curves today, but 2026's resource estimates cut the hardware needed so far that Google and Cloudflare now plan to finish their own migrations by 2029.
The estimates have fallen fast over eighteen months:
In May 2025, Google's Craig Gidney estimated that a 2048-bit RSA key could be factored in under a week with fewer than a million noisy qubits. His 2019 estimate with Martin Ekerå had needed 20 million.
On 30 March 2026, a Google Research paper put the cost of breaking 256-bit elliptic curves at fewer than 500,000 physical qubits, running "in a few minutes". Google published a zero-knowledge proof of its circuits instead of the circuits themselves.
The same day, nine researchers, the physicist John Preskill among them, estimated that as few as 10,000 neutral-atom qubits could run Shor's algorithm at a useful scale. With 26,000 such qubits, they put a P-256 break at "just a few days".
In October 2026, Alice & Bob's preprint put RSA-2048 at 22,593 cat qubits and 3.14 days, under hardware assumptions nobody has demonstrated. Our breakdown of that RSA-2048 estimate explains the gap.
None of these is a break, and none of the machines exists. They still changed plans. Google set a 2029 deadline for its own migration on 25 March 2026, and Cloudflare moved its target for full post-quantum security to 2029 two weeks later. Notice that elliptic curves now look easier to break than RSA. X25519 and P-256, the curves behind most HTTPS key exchanges, are in the first line of fire.
Two kinds of risk follow, on different clocks. Encrypted traffic is exposed now, because of what NIST calls "harvest now, decrypt later": an attacker records your TLS sessions today and decrypts them when the hardware arrives. Signatures are exposed only later. A forged Passport token is useful only while your server still trusts the key, so that risk starts when a quantum computer exists, not before.
Which parts of a Laravel app are already quantum-safe?
Everything Laravel builds on symmetric cryptography already counts as quantum-safe encryption; the exposure is the public-key cryptography around it, mainly TLS key exchange, Passport's RSA signatures and any openssl_seal() in your own code.
I read the Laravel 13.42 source to check each piece. The table lists what each one uses and what to do about it.
Laravel feature | Algorithm | Quantum risk | Action |
|---|---|---|---|
| AES-256-CBC with HMAC-SHA256 (default) | None known | Keep the default. |
Signed URLs | HMAC-SHA256 with | None known | Nothing to do. |
Password hashing | bcrypt, cost 12 (Argon2id optional) | None known | Nothing to do. |
Sanctum tokens | Random tokens stored as SHA-256 hashes | None known | Nothing to do. |
HTTPS to your site | TLS key exchange (X25519 on OpenSSL 3.0) | Recorded now, decrypted later | Upgrade to OpenSSL 3.5 or later. |
| Same, through curl | Recorded now, decrypted later | Upgrade the PHP host's OpenSSL. |
Passport access tokens | RS256 with an RSA-4096 key | Forgery once a quantum computer exists | Shorten token lifetimes; plan ML-DSA. |
| RSA | Stolen ciphertext decrypted later | Switch to X-Wing sealing. |
There is one caution about APP_KEY. The key is 32 random bytes and AES-256 is safe, but a symmetric key is only as safe as the channel that carried it. NIST makes the same point about keys set up over TLS. If your deploy pulls APP_KEY from a secrets manager over a classical TLS connection, a recording of that session would expose the key later, and with it every value it encrypted.
How do you turn on post-quantum TLS for a Laravel site?
Run your web server on OpenSSL 3.5 or later, which offers the hybrid X25519MLKEM768 group by default, and delete any old curve list that pins classical groups; sites behind Cloudflare already get it for visitors.
OpenSSL 3.5.9's built-in group list starts with ?*X25519MLKEM768 / ?*X25519:?secp256r1, so the hybrid comes first, with a key share sent up front. The group itself is standardised for TLS 1.3 in RFC 10024, published in August 2026. Browsers already send it: Firefox from version 132 and Chrome from version 131, both in late 2024, and Apple's iOS 26 and macOS Tahoe 26. Whether a connection gets it depends on your server's OpenSSL:
Ubuntu 22.04 ships OpenSSL 3.0.2 and Ubuntu 24.04 ships 3.0.13, so neither can offer ML-KEM.
Ubuntu 26.04 LTS ships OpenSSL 3.5.5 with nginx 1.28.3 and PHP 8.5.
Debian 13 ships OpenSSL 3.5.7, while Debian 12 stays on 3.0.
Laravel Forge has offered Ubuntu 26.04 for new servers since its 31 August 2026 update and no longer offers 22.04. A new server is therefore a clean way to get OpenSSL 3.5.
Why does an upgraded nginx still negotiate X25519?
Usually because the config pins its curves: an ssl_ecdh_curve line that lists only classical groups wins over OpenSSL's defaults, even after the upgrade.
Mozilla's SSL Configuration Generator, which now lives at TLSRef, is one source of such lines. Up to guideline 5.7 it produced this line for nginx, and the same list for Apache's SSLOpenSSLConfCmd Curves:
ssl_ecdh_curve X25519:prime256v1:secp384r1;Guideline 5.8, released on 6 April 2026, puts the hybrid first. Either delete the line, so nginx's default auto uses OpenSSL's list, or replace it:
# nginx, OpenSSL 3.5 or later
ssl_ecdh_curve X25519MLKEM768:X25519:prime256v1:secp384r1;
# Apache 2.4 with mod_ssl, OpenSSL 3.5 or later
SSLOpenSSLConfCmd Curves X25519MLKEM768:X25519:prime256v1:secp384r1Run nginx -t or apachectl configtest before reloading. On an OpenSSL older than 3.5, both servers reject the unknown group name, which is a useful early warning.
How do you check what your server negotiates?
Ask for the hybrid group from a machine with OpenSSL 3.5 or later and read the line OpenSSL prints about the negotiated group.
openssl s_client -connect example.com:443 -groups X25519MLKEM768 </dev/null 2>&1 \
| grep "Negotiated TLS1.3 group"A post-quantum server answers Negotiated TLS1.3 group: X25519MLKEM768, while an older one fails the handshake. In Chrome, DevTools shows the same under Security for the page's connection.
What about Cloudflare, FrankenPHP and old firewalls?
Cloudflare and Caddy-based servers such as FrankenPHP already use the hybrid by default, while some old firewalls drop the larger first message it needs.
Cloudflare has offered hybrid key exchange to visitors on every TLS 1.3 site since 2022, and it prefers the hybrid toward your origin whenever the origin supports it. Origin servers are further behind. In February 2026, Cloudflare counted roughly 10% of origins able to benefit from it, up from under 1% at the start of 2025. Laravel Octane on FrankenPHP 1.13.5, built on Caddy 2.11.9, offers X25519MLKEM768 by default, unless a curves line in your Caddyfile pins the old list.
The cost is size. The hybrid key share adds about 1.2 KB to the ClientHello, and OpenSSL's own manual warns that the message "may no longer fit in a single TCP segment", which some firewalls mishandle. If old middleboxes sit in front of your servers, test before rolling out.
Does Laravel's HTTP client use post-quantum TLS?
Only when PHP loads OpenSSL 3.5 or later at run time: Laravel's Http facade hands TLS to Guzzle and curl, so the key exchange depends on the system library, not on Laravel.
You can see it from inside the app. Cloudflare's trace endpoint reports the key exchange of the connection that fetched it:
use Illuminate\Support\Facades\Http;
$trace = Http::get('https://www.cloudflare.com/cdn-cgi/trace')->body();
// tls=TLSv1.3
// kex=X25519 <- classical: OpenSSL 3.0.2 on Ubuntu 22.04On my Ubuntu 22.04 machine, both Laravel's client and plain file_get_contents() reported kex=X25519. With OpenSSL 3.5 or later, the same call offers X25519MLKEM768 with no code change. A developer who tested PHP against OpenSSL 3.5.8 and 4.0.2 told the php.internals list that "X25519MLKEM768-by-default TLS" already works as-is.
There are two details that trip people up. First, OPENSSL_VERSION_TEXT names the OpenSSL that PHP was compiled against, not the library it loads, so check curl_version()['ssl_version'] or the "OpenSSL Library Version" line of php -i. Second, the other side must support the hybrid too. An API behind Cloudflare does, but most origins do not yet. PHP 8.6's official Windows builds will ship OpenSSL 4, which settles the question for that platform.
Database connections need their own look. PostgreSQL 18.7's ssl_groups setting defaults to X25519:prime256v1, so a Laravel app talking to a remote Postgres over TLS stays classical until you add X25519MLKEM768 to that list on an OpenSSL 3.5 server. For the wider pattern of server-to-API calls, our Laravel GA4 server-side tracking tutorial shows the same Http client at work.
How do you encrypt data that only your back office can read?
Seal it to a public key with X-Wing, the hybrid of ML-KEM-768 and X25519, and let Laravel's own AES-256-GCM encrypter handle the data, as the sealer in this guide's repository does.
This is the job PHP apps have long done with openssl_seal(): web servers hold a public key and encrypt a PAN, an Aadhaar number or a medical note, and only an offline worker holds the private key. With RSA, anyone who copies your database today can read those values once RSA falls. I wrote trickyworld_laravel_quantum_safe, a Laravel 13 app, to replace that pattern. Its HybridSealer runs X-Wing for a fresh secret per value, derives an AES-256 key with HKDF-SHA256, and encrypts with Laravel's Encrypter.
php artisan pq:keygen
# Secret key written to storage/pq-seal.key (mode 0600)
# PQ_SEAL_PUBLIC_KEY=ZZ3x... <- add to .env on every web serverA write-only Eloquent cast does the rest. It uses Laravel's CastsInboundAttributes, so the value is sealed on the way in and stays sealed on the way out:
protected function casts(): array
{
return ['pan' => SealOnWrite::class];
}
// On the back-office machine, which holds the secret key:
$pan = app(HybridSealer::class)->open($record->pan, 'kyc_records.pan');The context string, here the table and column, must match to open a value. A sealed value copied into another column therefore fails, like a tampered one.
The costs are real. On an Intel Core i5-10210U laptop, sealing took 9.1 ms and opening took 20.4 ms in pure PHP. RSA-2048 openssl_seal() took about 0.6 ms each way. A 10-character PAN became 1,629 bytes, because the X-Wing ciphertext alone is 1,120 bytes. That suits a form submission or a queue job, not every request, and it needs a text column.
PHP's options for quantum-safe encryption at the application level are still young:
Paragon's pure-PHP pqcrypto_compat has never been independently audited, and Paragon's April 2026 announcement warns: "There will be bugs. Don't rush to deploy this into production yet."
Paragon's ext-pqcrypto extension, written in Rust, is faster, and the sealer switches to it automatically when it is installed.
PHP 8.6 adds
sodium_crypto_kem_*()for X-Wing, but only when PHP is built against libsodium 1.0.22 or later. Ubuntu 26.04 and Debian 13 still ship libsodium 1.0.18.
The library's own tests check that X-Wing round-trips, not that it matches published test vectors. So the repository's tests check it against the three vectors in the X-Wing Internet-Draft (version 11, September 2026), and all three match. The hybrid design also limits the damage of an implementation bug. If the ML-KEM half failed, the X25519 half would still protect the data against today's attackers. X-Wing itself is still a draft, though ML-KEM-768 inside it is FIPS 203.
What should you do about Passport and JWT signatures?
Nothing urgent for confidentiality, because a signature cannot be decrypted later; shorten token lifetimes and rotate keys now, then move to ML-DSA once PHP's JWT libraries support it.
Passport 13.11's passport:keys command creates a 4,096-bit RSA key, and league/oauth2-server 9.4.1 hard-codes RS256 for access tokens. By default those tokens last a year, so a key that leaks or is broken stays useful for a long time. Passport's documentation shows how to shorten that:
// AppServiceProvider::boot()
Passport::tokensExpireIn(CarbonInterval::days(15));
Passport::refreshTokensExpireIn(CarbonInterval::days(30));
Passport::personalAccessTokensExpireIn(CarbonInterval::months(6));The post-quantum replacement exists on paper. RFC 9964, published in May 2026, registers ML-DSA for JSON Web Tokens. PHP's libraries have not caught up. lcobucci/jwt 5.6.1 and firebase/php-jwt 7.2.1 have no ML-DSA. web-token/jwt-framework added ML-DSA-44, -65 and -87 on its unreleased 4.3 branch, and it needs PHP 8.4 with OpenSSL 3.5. A phpseclib pull request for ML-DSA is still open. Google's 2029 announcement is a fair hint about priorities: it has "adjusted our threat model to prioritize PQC migration for authentication services" and recommends "that other engineering teams follow suit".
How do you audit a Laravel app for quantum-vulnerable code?
Run an inventory that separates the safe symmetric parts from the public-key parts; the repository's pq:audit command does that for the TLS library, live handshakes, Passport keys and your own code.
# after copying app/Crypto/Audit, app/Console/Commands/PqAudit.php
# and config/pq.php from the repository into your app:
php artisan pq:audit --probeHere is its real output on the Laravel 13.42 test app with Passport 13.11, PHP 8.3.36 and OpenSSL 3.0.2, showing the four findings with their lines shortened:
[todo] TLS library ext/openssl loads OpenSSL 3.0.2 15 Mar 2022 (no ML-KEM)
[todo] Outbound TLS TLSv1.3, kex=X25519: classical
[todo] Passport signing key RSA-4096 (storage/oauth-public.key)
[todo] Public-key code 5 place(s) in app, tests/Fixtures/legacyThe first check reads the run-time library, not the compile-time constant. The second makes one request through Laravel's Http client, so it reports what your API calls get. The code scan reads PHP tokens, so it lists real calls to openssl_seal(), openssl_verify() or JWT algorithms such as 'RS256', and skips comments and methods that share their names. Add --json --strict to fail a CI build.

An inventory like this is the first step of any quantum-safe encryption plan, and it is what regulators are starting to ask for. India's roadmap recommends requiring cryptographic bills of materials from vendors from FY 2027–28. The 47 tests in the repository pass on PHP 8.3.36, and the probe tests fake the network.
Which quantum-safe advice for Laravel is wrong?
Three claims come up often and are wrong: that AES-256 must be doubled, that bcrypt needs replacing, and that any Composer package named after Kyber is safe to install.
The first two come from treating Grover's algorithm like Shor's. NIST's FAQ answers the doubling idea directly: AES-192 and AES-256 "will still be safe for a very long time". bcrypt and Argon2id are not public-key cryptography, so Shor's algorithm has nothing to attack. Re-encrypting Laravel data or rehashing passwords "for quantum" spends effort on the wrong layer.
The third is the dangerous one. A tutorial titled "Generate Keypair using Kyber in Laravel" told readers to run composer require kyber/sdk-php, according to the Internet Archive's copy from 17 July 2026. No package by that name exists on Packagist; I checked kyber/sdk-php, dilithium/sdk-php and sphincs/sdk-php on 16 November 2026, and all three returned 404. An unclaimed name invites anyone to publish code under it, and installing it would run that code in your app. Before you install any quantum-safe encryption package, check who publishes it, how many people use it, and whether its tests use official test vectors.
It is also wrong to call X-Wing a standard. It sits in the RFC Editor's independent stream as an Internet-Draft. The standards are ML-KEM, ML-DSA and SLH-DSA, and RFC 10024 for the TLS hybrids.
Which deadlines apply to a Laravel team?
NIST will deprecate RSA and elliptic-curve cryptography after 2030 and disallow it after 2035, while India's roadmap asks banks and other critical sectors to finish migrating by 2029.
NIST IR 8547 deprecates every quantum-vulnerable public-key algorithm after 2030 and disallows it under NIST standards after 2035. US federal high-value systems must use post-quantum key establishment by 31 December 2030 and post-quantum signatures by 31 December 2031.
India's Department of Science and Technology published its roadmap to quantum resiliency in May 2026. Critical sectors, including banking, financial services and insurance, should lay foundations by 2027, migrate high-priority systems by 2028 and complete adoption by 2029. Other enterprises get 2028, 2030 and 2033.
The roadmap binds no one by itself. It asks regulators such as RBI and SEBI to issue sector guidance, "including necessary legal and regulatory frameworks for implementation and compliance".
The roadmap also asks critical sectors to write post-quantum readiness into procurement. A bank, an NBFC or an insurer may therefore ask its Laravel vendors about it before any regulator does. Google's and Cloudflare's own 2029 targets matter as well: one makes Chrome, and the other runs the CDN in front of many Laravel sites.
What should a Laravel team change first?
Start with the server's OpenSSL, because it protects every connection at once; then fix pinned curve lists, shorten Passport token lifetimes, and replace RSA sealing only where data must stay secret for years.
Run
php artisan pq:audit --probe, or checkcurl_version()by hand, to see which OpenSSL your PHP really loads.Move the web and PHP hosts to an OpenSSL 3.5 distribution such as Ubuntu 26.04 or Debian 13.
Search your nginx, Apache and Caddy files for pinned curve lists and add X25519MLKEM768 or remove them.
Check the origin connection if you sit behind a CDN, and the
ssl_groupssetting of any remote PostgreSQL.Cut Passport's one-year default token lifetime and rotate its RSA key on a schedule.
Replace
openssl_seal()andopenssl_public_encrypt()where the data must stay secret for years. Use X-Wing, accepting today's library caveats, or wait for PHP 8.6's sodium functions on your platform.Leave AES, HMAC, bcrypt and Argon2id alone: they are not the problem.
The basics of Laravel security still come first. Our guide to authentication and security in Laravel covers them, and the post on the PHP session bug CVE-2026-115560 is a reminder that today's flaws still need patching. Quantum-safe encryption is a migration with a deadline, not an emergency. The cheapest step, an OpenSSL upgrade, also covers the most traffic.
Frequently asked questions
Do I need a new TLS certificate for post-quantum HTTPS?
You don't. The hybrid X25519MLKEM768 key exchange works with the RSA or ECDSA certificate you already have, and the key exchange is the part that stops recorded traffic from being decrypted later. Post-quantum certificates for the public web are still being designed. Cloudflare's support notes say Chrome is not planning to add standard X.509 post-quantum certificates to its root store and is developing Merkle Tree Certificates instead.
Should a Laravel app use ML-KEM-1024 instead of ML-KEM-768?
In most cases it should not. NIST IR 8547 recommends ML-KEM-768 as the default parameter set, because it "provides a large security margin at a reasonable performance cost". It allows the larger ML-KEM-1024 where higher security is required. X25519MLKEM768, the hybrid browsers send, and X-Wing both use ML-KEM-768.
What is HQC, and does a Laravel developer need it?
HQC is a second post-quantum key-exchange algorithm, built on different maths, that NIST selected in March 2025 as a backup to ML-KEM. NIST IR 8547 says a FIPS standard for it is under development. Neither OpenSSL's default TLS groups nor the major browsers use it, so there is nothing to configure in a Laravel stack today.
Are SSH deployments from Forge or CI quantum-safe?
They are once both ends run OpenSSH 10.0 or later, released in April 2025, which uses the hybrid mlkem768x25519-sha256 key exchange by default. OpenSSH 10.1 and later also warn when a connection falls back to a key exchange that is not post-quantum. The SSH host and user keys are signatures, so the same reasoning as for Passport applies to them.

