DEV Community

Cover image for Post-Quantum Cryptography - A Practical Migration Guide for PHP Developers and System Administrators
Lars Moelleken
Lars Moelleken

Posted on

Post-Quantum Cryptography - A Practical Migration Guide for PHP Developers and System Administrators

There is currently a lot of discussion about the future of RSA and elliptic-curve cryptography. Amazon, Anthropic, Apple, Cloudflare, Google, Microsoft, OpenAI and Oracle have jointly called for an accelerated migration towards post-quantum cryptography.

At the time of writing, I haven't seen publicly available evidence demonstrating a practical break of RSA-2048 or Curve25519.

But waiting for such evidence before preparing a migration seems like a rather questionable disaster recovery strategy.

I'm not a cryptographer. However, as software developers and system administrators, we don't necessarily need to understand the mathematical details of every cryptographic algorithm. We do need to understand where we use them, what security guarantees they provide and how to replace them.

And there is already quite a lot we can do.

1. Encryption and authentication are different problems

Let's distinguish between four things that developers frequently throw into the same conceptual bucket:

Purpose Existing algorithms Migration direction
Key establishment RSA, ECDH, X25519 Hybrid ML-KEM
Digital signatures RSA, ECDSA, Ed25519 ML-DSA, hybrid signatures
Symmetric encryption AES-256-GCM, XChaCha20-Poly1305 Generally retain
Password hashing Argon2id Retain

NIST standardized three relevant post-quantum algorithms in August 2024:

  • ML-KEM (FIPS 203): key encapsulation.
  • ML-DSA (FIPS 204): digital signatures.
  • SLH-DSA (FIPS 205): hash-based digital signatures.

These algorithms run on ordinary computers. You don't need a quantum computer to use post-quantum cryptography.

Also, replacing RSA-2048 with RSA-4096 or switching from RSA to Ed25519 is not a long-term solution to the quantum computing problem.

You are still relying on mathematical problems that a sufficiently powerful quantum computer could solve efficiently.

Harvest now, decrypt later

Imagine someone recording encrypted network traffic today.

They don't need to decrypt it immediately. They can simply store it until the underlying cryptography becomes practically breakable.

This is particularly relevant for:

  • Medical records.
  • Employee and customer information.
  • Intellectual property.
  • Database backups.
  • Credentials and confidential business communications.

Upgrading your encryption tomorrow does not protect a copy of your encrypted data that someone obtained yesterday.

Authentication might become the more immediate problem

Now imagine that an attacker can forge signatures created using your SSH key.

They don't necessarily need to steal your private key anymore. Under the assumed attack, they could derive the necessary signing capability from your public key.

The same applies to other systems relying on vulnerable digital signatures:

  • SSH authentication.
  • TLS certificates.
  • Signed JWTs.
  • Software updates.
  • Git commit signatures.
  • Identity providers and SAML assertions.

Encryption protects information. Authentication establishes whom we trust.

Breaking the latter can give an attacker access to information that was never intercepted in the first place.

2. SSH: something we can actually fix

For many software companies, SSH is probably one of the most practical places to start.

We use it for deployments, Git operations, server administration, backups, automation and CI/CD pipelines.

Fortunately, OpenSSH has already done much of the necessary work.

OpenSSH version Post-quantum support
9.0 Hybrid NTRU Prime key exchange by default
9.9 ML-KEM hybrid key exchange added
10.0 ML-KEM hybrid key exchange preferred
10.1 Warnings for non-PQ key exchange
10.6 Stable hybrid ML-DSA/Ed25519 signatures

OpenSSH 10.6 was released on October 6, 2026. Its portable maintenance release, 10.6p2, followed on November 5.

Check your existing connection

ssh -V

ssh -v user@server.example.com exit 2>&1 |
    grep -E 'kex: algorithm|kex: host key algorithm'
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

A connection might report:

kex: algorithm: mlkem768x25519-sha256
kex: host key algorithm: ssh-ed25519
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

The first line is encouraging.

The second line illustrates the remaining problem: we have post-quantum key establishment but classical server authentication.

Check support for post-quantum authentication

ssh -Q key | grep mldsa
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

With stable OpenSSH support, expect:

ssh-mldsa44-ed25519
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Older experimental implementations used an @openssh.com suffix. Keys generated using those experimental implementations need to be regenerated.

Generate a hybrid SSH key

ssh-keygen \
    -t mldsa44-ed25519 \
    -f ~/.ssh/id_mldsa44_ed25519
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

This combines ML-DSA-44 and Ed25519 signatures.

Install the public key on an upgraded server:

ssh-copy-id \
    -i ~/.ssh/id_mldsa44_ed25519.pub \
    user@server.example.com
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Then test authentication using the new identity:

ssh -v \
    -o IdentitiesOnly=yes \
    -o PubkeyAcceptedAlgorithms=ssh-mldsa44-ed25519 \
    -i ~/.ssh/id_mldsa44_ed25519 \
    user@server.example.com
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Both the client and the server need compatible implementations.

Migrate the server identity as well

Generating a new user key only solves part of the problem.

The server itself needs a post-quantum host key:

sudo ssh-keygen \
    -t mldsa44-ed25519 \
    -N '' \
    -f /etc/ssh/ssh_host_mldsa44_ed25519_key
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

For a fully migrated, public-key-only server, the eventual SSH configuration could include:

HostKey /etc/ssh/ssh_host_mldsa44_ed25519_key

KexAlgorithms mlkem768x25519-sha256
HostKeyAlgorithms ssh-mldsa44-ed25519
PubkeyAcceptedAlgorithms ssh-mldsa44-ed25519

AuthenticationMethods publickey
PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin no
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

This is a target configuration for compatible infrastructure, not something to blindly paste into every production server.

Existing configuration files, SSH certificate authorities, MFA requirements and distribution-specific settings need to be considered.

Before enforcing anything:

  1. Keep your existing administrative session open.
  2. Ensure independent emergency console access.
  3. Validate the server configuration with sshd -t.
  4. Inspect the effective configuration with sshd -T.
  5. Verify the new host key fingerprint through a trusted channel.
  6. Reload SSH and test a separate connection.
  7. Only then retire the legacy authentication paths.

Congratulations, you now have a cryptographically stronger server without having accidentally removed your own access to it.

Supporting an algorithm is not the same as enforcing it

During migration, accepting both old and new keys is useful for compatibility.

But if classical signatures eventually become forgeable, accepting classical authentication alongside post-quantum authentication still leaves the classical attack path available.

An attacker does not have to select your preferred algorithm.

For Git hosting providers, hardware tokens and managed infrastructure, we also depend on vendor support. Check compatibility rather than assuming that a newly generated SSH key will work everywhere.

Sources:

3. HTTPS: verify what your infrastructure actually negotiates

Cloudflare, Google, browser vendors and operating system developers will handle a significant part of the public internet's migration.

That doesn't mean your entire infrastructure magically becomes post-quantum secure.

Consider a typical PHP application:

Browser
   |
Cloudflare
   |
Apache / Nginx
   |
PHP application
   |
MariaDB / LDAP / APIs
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

There may be several independent encrypted connections.

Each has its own cryptographic configuration, libraries and authentication mechanisms.

Check your website

Using a recent curl build with a compatible TLS backend:

curl -V

curl -vI \
    --tlsv1.3 \
    --curves X25519MLKEM768 \
    https://example.com
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Look for X25519MLKEM768 in the negotiated TLS connection details.

Alternatively, using OpenSSL 3.5 or later:

openssl s_client \
    -connect example.com:443 \
    -servername example.com \
    -tls1_3 \
    -groups X25519MLKEM768 \
    -brief </dev/null
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

The command explicitly tests whether the endpoint can establish a connection using the hybrid group.

It does not prove that every client always negotiates that group.

Check the origin connection

If you use Cloudflare, the browser-to-Cloudflare connection and the Cloudflare-to-origin connection are separate security boundaries.

Cloudflare supports hybrid post-quantum key establishment towards compatible origin servers. It also supports ML-DSA authentication for certain origin-facing configurations, including Authenticated Origin Pulls and Custom Origin Trust Store.

You still need to verify your own infrastructure.

In particular, don't forget the boring internal connections:

  • LDAPS connections to Active Directory.
  • MariaDB connections.
  • Internal REST APIs.
  • SMTP and mail relays.
  • Kubernetes ingress controllers.
  • Backup servers and monitoring infrastructure.

These are often precisely the connections carrying the most interesting data.

TLS key exchange is not TLS authentication

A TLS connection can negotiate X25519MLKEM768 while continuing to authenticate the server using an RSA or ECDSA certificate.

This provides protection against passive retrospective decryption, assuming the hybrid construction and implementations remain secure.

It does not solve the problem of an active attacker capable of forging the classical certificate signatures.

Migrating public Web PKI authentication requires coordinated support across certificate authorities, browsers, operating systems and TLS implementations.

For most developers, waiting for interoperable vendor support here is reasonable. For private PKI and internal services, we can start evaluating the migration ourselves.

Sources:

4. PHP: what do we actually need to change?

The good news is that a typical PHP application doesn't implement most of these protocols itself.

The bad news is that some applications do implement parts of their cryptographic infrastructure themselves. Usually with a helper class written eight years ago that nobody wants to touch.

Start by searching your codebase.

rg -n \
    'openssl_(public_encrypt|private_decrypt|private_encrypt|public_decrypt|sign|verify|pkey_new|pkey_derive)|sodium_crypto_(box|sign|kx)|RS256|RS384|RS512|PS256|PS384|PS512|ES256|ES384|ES512|EdDSA' \
    --glob '*.php' \
    --glob '!vendor/**' \
    .
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Also inspect your dependencies:

composer show --direct
composer audit
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

composer audit reports known dependency vulnerabilities. It does not tell you whether your application is post-quantum secure.

The goal is to identify where your application relies on asymmetric cryptography and whether those implementations are owned by your application or a dependency.

RSA encryption

A common pattern is to encrypt a symmetric data key using RSA:

<?php

declare(strict_types=1);

if (!openssl_public_encrypt(
    $dataKey,
    $encryptedKey,
    $recipientPublicKey,
    OPENSSL_PKCS1_OAEP_PADDING,
)) {
    throw new RuntimeException(
        'Unable to encrypt the data key.',
    );
}
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

The actual payload might be encrypted using AES-256-GCM.

That doesn't make the entire construction post-quantum resistant. If an attacker can recover the AES key by breaking its RSA protection, the AES encryption becomes irrelevant.

This is where migration becomes more than replacing one function with another.

ML-KEM is not RSA with a different function name

RSA encryption allows you to encrypt an existing message or key.

A Key Encapsulation Mechanism (KEM) works differently:

Recipient:
    Generate public/private key pair.

Sender:
    Use recipient's public key.
    Generate shared secret + encapsulated key.

Recipient:
    Use private key + encapsulated key.
    Recover the shared secret.
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

An established encryption protocol can then derive and use symmetric encryption keys from that shared secret.

The KEM itself does not encrypt arbitrary application data and does not authenticate the sender.

5. Native post-quantum cryptography in PHP 8.6

PHP 8.6, released on November 19, 2026, introduces native Sodium functions for X-Wing and ML-KEM-768.

The functionality requires PHP to be built against libsodium 1.0.22 or later.

Check your installation:

php --version
php --ri sodium

php -r 'var_dump(function_exists("sodium_crypto_kem_enc"));'
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

X-Wing combines the classical X25519 mechanism with ML-KEM-768.

Here is a minimal example demonstrating key establishment:

<?php

declare(strict_types=1);

if (!function_exists('sodium_crypto_kem_enc')) {
    throw new RuntimeException(
        'X-Wing requires PHP 8.6 with libsodium 1.0.22 or later.',
    );
}

// Recipient: create a key pair.
$recipientKeyPair = sodium_crypto_kem_keypair();

$recipientPublicKey = sodium_crypto_kem_publickey(
    $recipientKeyPair,
);

$recipientSecretKey = sodium_crypto_kem_secretkey(
    $recipientKeyPair,
);

// Sender: establish a shared secret.
[$encapsulatedKey, $senderSecret] = sodium_crypto_kem_enc(
    $recipientPublicKey,
);

// Recipient: recover the shared secret.
$recipientSecret = sodium_crypto_kem_dec(
    $encapsulatedKey,
    $recipientSecretKey,
);

if (!hash_equals($senderSecret, $recipientSecret)) {
    throw new RuntimeException('Key agreement failed.');
}

echo 'Key agreement successful.', PHP_EOL;
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

The example intentionally stops at key establishment.

It is not a complete encryption protocol. In production, we would also need authenticated public keys, appropriate key derivation, authenticated encryption, message framing, protocol versioning and secure key management.

We should use an established implementation that already handles those requirements.

Having cryptographic primitives available in PHP is useful. Inventing a new cryptographic protocol because they are available is considerably less useful.

Sources:

6. Post-quantum cryptography for older PHP applications

Not everyone can upgrade production applications to PHP 8.6 immediately.

In April 2026, Paragon Initiative Enterprises introduced two projects for the PHP ecosystem:

  • ext-pqcrypto: a native PHP extension wrapping RustCrypto implementations.
  • pqcrypto_compat: a PHP implementation that can also use the native extension when available.

The compatibility library follows a similar idea to sodium_compat.

composer require paragonie/pqcrypto_compat
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

An equivalent X-Wing experiment:

<?php

declare(strict_types=1);

require __DIR__ . '/vendor/autoload.php';

use ParagonIE\PQCrypto\Compat;

[$secretKey, $publicKey] = Compat::xwing_keygen();

$encapsulation = Compat::xwing_encaps($publicKey);

$recoveredSecret = Compat::xwing_decaps(
    $secretKey,
    $encapsulation['ciphertext'],
);

if (!hash_equals(
    $encapsulation['sharedKey'],
    $recoveredSecret,
)) {
    throw new RuntimeException('Key agreement failed.');
}

echo 'Key agreement successful.', PHP_EOL;
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Notice that the compatibility library and the native Sodium implementation have different APIs.

Also notice that installing this package doesn't automatically upgrade any existing encrypted data or signatures in your application.

Paragonie's original announcement explicitly cautioned against premature production deployment. Check the project's current audit, release and implementation status before relying on it for sensitive production workloads.

These projects are already useful for interoperability experiments, migration planning, test suites and evaluating the architectural changes ahead.

Further reading:

Post-Quantum Cryptography for the PHP Community

7. JWTs, OAuth, OpenID Connect and SAML

Many PHP applications don't perform encryption directly but still rely heavily on digital signatures.

For example, a JWT might be signed using:

{
    "alg": "RS256",
    "typ": "JWT",
    "kid": "production-key-2026"
}
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

The application trusts the token because its signature can be verified against a known public key.

If the signing algorithm becomes forgeable, authentication and authorization decisions based on those signatures could become unreliable.

This is not just a PHP problem.

It affects the entire chain:

Identity provider
    |
Signing key
    |
JWT / SAML assertion
    |
Application validation
    |
Authorization decision
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Replacing the signing algorithm requires support from all involved components.

RFC 9964, published in May 2026, specifies ML-DSA for JOSE and COSE.

But a published standard doesn't automatically mean that your identity provider, JWT library, API gateway and every consuming application support it.

For now:

  • Inventory token issuers and consumers.
  • Identify signing algorithms and key management systems.
  • Make key rotation a tested operation.
  • Configure explicit algorithm allowlists.
  • Keep token lifetimes appropriately short.
  • Plan coordinated retirement of classical signing keys.

Short-lived tokens are good security practice, but they are not a solution to a broken signature algorithm. An attacker capable of forging signatures could simply generate another token.

And please don't implement a new JWT algorithm yourself because you found a convenient signing function.

Sources:

8. Your database schema might not survive the migration

This is where cryptography becomes an ordinary software engineering problem.

Post-quantum keys and signatures can be substantially larger than their classical counterparts.

Algorithm Public key Signature
Ed25519 32 bytes 64 bytes
X25519 32 bytes N/A
ML-KEM-768 1,184 bytes N/A
X-Wing 1,216 bytes N/A
ML-DSA-44 1,312 bytes 2,420 bytes
ML-DSA-87 2,592 bytes 4,627 bytes

These are raw sizes, before Base64, PEM or other protocol encoding.

An ML-DSA-44 signature requires 3,227 characters when encoded using unpadded Base64url. That's just the signature, without a JWT header or payload.

Remember that VARCHAR(255) someone used to store cryptographic material?

Also check:

  • Database column sizes and indexes.
  • HTTP header size limits.
  • Cookies.
  • Reverse proxy and gateway limits.
  • LDAP attribute schemas.
  • API validation rules.
  • Message queue payload limits.
  • Certificate storage.
  • Hardware security module capabilities.

You can implement the cryptography perfectly and still have a broken application because your reverse proxy rejects the resulting authentication token.

That particular bug won't require a quantum computer.

9. Encrypted files and backups

This is another area where developers and system administrators can already take practical action.

Consider an encrypted database export:

database.sql.gz
    |
Symmetric encryption
    |
File encryption key
    |
RSA / X25519 recipient key protection
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

The symmetric encryption may remain secure while the mechanism protecting its key becomes vulnerable.

For file encryption, age provides an established tool with hybrid post-quantum support.

Version 1.3 introduced post-quantum recipient keys. Version 1.4 makes their generation the default.

Generate a new recipient

umask 077

age-keygen -o backup-key.txt
age-keygen -y backup-key.txt > backup-recipient.txt
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

With age 1.4, the public recipient should begin with:

age1pq1...
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Keep the private identity securely stored. The system creating backups usually only needs the public recipient.

Encrypt a backup

age -R backup-recipient.txt \
    -o database.sql.gz.age \
    database.sql.gz
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Inspect an encrypted file

age-inspect database.sql.gz.age
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

The inspection should identify post-quantum recipient protection.

Test decryption

age -d \
    -i backup-key.txt \
    -o restored.sql.gz \
    database.sql.gz.age
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

As always, a backup that has never been restored is primarily an optimistic assumption.

Migrate existing encrypted files

For existing age archives, a controlled re-encryption can avoid writing an intermediate plaintext file to disk.

set -o pipefail
umask 077

age -d -i old-key.txt old-backup.age |
    age -R backup-recipient.txt \
        -o new-backup.age
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Validate the resulting archive and perform a restore test before removing the old copy.

If an attacker has already obtained a legacy encrypted archive, re-encrypting your own copy won't protect theirs.

For archived credentials, API tokens and other rotatable secrets, evaluate whether those secrets also need to be replaced.

Also, don't assume that generating a post-quantum SSH authentication key gives you a suitable file encryption key. Modern signature algorithms and key encapsulation mechanisms deliberately serve different purposes.

Sources:

10. Passwords: please don't start encrypting them

Password hashing does not rely on RSA or elliptic-curve cryptography.

If you're already using Argon2id, there is no immediate reason to replace it specifically because of the RSA migration.

<?php

declare(strict_types=1);

$hash = password_hash(
    $password,
    PASSWORD_ARGON2ID,
);

$isValid = password_verify(
    $password,
    $hash,
);
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Continue using appropriate memory and time parameters, unique salts, rate limiting and sensible password policies.

Similarly, securely generated random tokens remain appropriate:

$token = bin2hex(random_bytes(32));
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

AES-256 and XChaCha20-Poly1305 also remain reasonable choices for symmetric encryption.

That doesn't mean passwords and symmetric cryptography are invulnerable. Weak passwords, stolen encryption keys, incorrect nonce handling and implementation vulnerabilities still exist.

Quantum computing hasn't made ordinary security mistakes obsolete.

What about password managers?

A password manager might encrypt its vault with AES-256 while using RSA or ECC elsewhere for:

  • Vault sharing.
  • Account recovery.
  • Organization-wide key distribution.
  • Device enrollment.
  • Authentication.
  • Synchronization.

The vault encryption algorithm alone doesn't establish the security of the entire system.

The same distinction applies to passkeys and hardware security tokens.

Existing YubiKeys remain useful against conventional attacks, while Yubico is evaluating native post-quantum capabilities in its next-generation hardware beta program.

Don't remove working MFA or hardware-backed authentication merely because the replacement isn't available yet. Migrate once a suitable replacement exists and has been validated.

11. Software supply chains and CI/CD

Your production servers aren't necessarily the weakest link.

Consider how software reaches them:

Developer
    |
Git hosting
    |
CI/CD runner
    |
Artifact registry
    |
Deployment
    |
Production
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

Asymmetric cryptography can appear at every step.

You should inventory:

  • Git authentication and deploy keys.
  • Commit and tag signing.
  • Package and container signing.
  • CI/CD credentials.
  • SSH-based deployments.
  • Artifact verification.
  • Internal certificate authorities.
  • Hardware-backed signing keys.

A quantum-resistant production TLS connection doesn't help if an attacker can impersonate the developer or forge a trusted software update.

For managed platforms, much of this migration will depend on provider support.

For self-hosted infrastructure, we own considerably more of the problem.

12. Crypto agility without overengineering

The architecture of our applications should allow cryptographic algorithms to evolve.

That doesn't mean we need an abstract factory that dynamically creates another factory for every conceivable cryptographic algorithm.

What we actually need is fairly straightforward:

  • Explicitly versioned encrypted data formats.
  • Identifiable keys and algorithm suites.
  • Clearly defined trust boundaries.
  • Supported migration and key rotation procedures.
  • Independent read and write policies during transitions.
  • Explicit retirement of vulnerable algorithms.
  • Tests covering existing and new data formats.

For example, an encrypted record might contain metadata describing its format:

{
    "version": 2,
    "suite": "application-encryption-v2",
    "key_id": "backup-2026-12",
    "encapsulated_key": "...",
    "ciphertext": "..."
}
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

This is illustrative metadata, not a complete encryption format.

The metadata must be authenticated as required by the actual encryption protocol. An attacker must not be able to modify the algorithm identifier and trick the application into accepting weaker cryptography.

The migration policy should be controlled by the application, not by whatever algorithm a client or encrypted record happens to request.

A sensible migration often looks like this:

Phase 1: Identify existing formats.
Phase 2: Introduce support for the new format.
Phase 3: Write new data using the new format.
Phase 4: Migrate existing data.
Phase 5: Verify migration completeness.
Phase 6: Remove vulnerable legacy support.
✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน ✨ อัปเดตล่าสุด: suckup de/post quantum cryptography a practical migration guide for php developers and system administrators ohm - ประเด็นร้อน

For authentication, the final retirement phase is particularly important. For historical data, legacy decryption might temporarily remain necessary in an isolated migration environment.

Testing matters

A successful round-trip encryption test isn't sufficient.

We also need tests covering:

  • Modified ciphertext.
  • Invalid signatures.
  • Incorrect recipient keys.
  • Unsupported algorithms.
  • Downgrade attempts.
  • Oversized cryptographic material.
  • Key rotation.
  • Restoring migrated backups.
  • Interoperability with independent implementations.
  • Official known-answer test vectors.

PHPStan at its maximum level and php-cs-fixer can help keep the surrounding application maintainable.

They cannot prove that a cryptographic implementation is secure.

For that, we depend on established protocols, independent review, test vectors and cryptographic expertise.

13. What I would prioritize in an average software company

Not everything needs to happen tomorrow morning.

But we can separate practical actions from migrations that still depend on the ecosystem.

Priority 0: Start now

Task Expected outcome
Inventory asymmetric cryptography Understand the affected systems
Update OpenSSH clients and servers Obtain current PQ capabilities
Verify SSH key exchange Protect newly established sessions
Evaluate hybrid SSH authentication Prepare user and server identity migration
Verify TLS negotiation Identify vulnerable network segments
Inspect encrypted backups Identify vulnerable recipient keys
Re-encrypt sensitive archives Protect future copies
Test emergency access and restoration Avoid breaking operations

Priority 1: Prepare application changes

Task Expected outcome
Review PHP cryptographic dependencies Identify migration options
Evaluate PHP 8.6 and Sodium Native post-quantum key establishment
Test Paragonie's implementations Understand compatibility requirements
Review JWT and SAML dependencies Prepare signature migration
Test larger keys and signatures Prevent infrastructure failures
Implement versioned formats Support controlled migration
Test key rotation Retire old cryptography reliably

Priority 2: Coordinate with vendors

Component External dependency
Public HTTPS certificates Browsers and certificate authorities
Managed Git hosting Platform authentication support
Microsoft 365 / enterprise IAM Identity provider support
Hardware security tokens Hardware and firmware capabilities
Cloud services and KMS Provider algorithm support
Package signing infrastructure Ecosystem interoperability

Cloudflare can upgrade its infrastructure. Google can upgrade its infrastructure. Microsoft can upgrade its infrastructure.

They cannot identify the RSA-encrypted database export sitting on your internal backup server since 2018.

That's still your responsibility.

Conclusion

We don't currently need to assume that RSA or elliptic-curve cryptography has already been practically broken.

We do need to recognize that migrating cryptographic infrastructure takes time.

The most useful things we can do today are surprisingly ordinary engineering tasks:

Understand the dependencies. Upgrade the tools. Verify the negotiated algorithms. Test compatibility. Rotate keys. Migrate stored data. Remove insecure fallbacks.

And distinguish what is actually vulnerable from what merely contains the word cryptography.

Keep Argon2id. Keep properly implemented symmetric encryption. Start replacing vulnerable asymmetric cryptography where reliable alternatives are available.

We should prepare the migration while we still have the luxury of doing it carefully.

Because migrating cryptographic infrastructure during a security incident is a rather expensive way to discover your undocumented dependencies.

Further reading

Standards

PHP

Infrastructure

What's next?

The PHP community now has access to native post-quantum key establishment and experimental compatibility implementations.

The next interesting step is not another benchmark measuring how quickly we can generate a key.

It's testing how existing PHP applications can migrate their encrypted data, authentication mechanisms and dependencies without downtime, silent security regressions or permanent reliance on legacy cryptography.


Disclaimer: I'm a software developer, not a cryptographer. The examples are based on the referenced documentation and have not all been executed against the specified runtime versions. Validate compatibility and security requirements in your own environment before deploying changes to production.

Top comments (0)