How I Built a Hybrid Post Quantum DNSSEC Gateway in Rust (And Why the Internet Needs It Now)
Solving the UDP fragmentation crisis of quantum-resistant cryptography before “Store Now, Decrypt Later” breaks the web.
How I Built a Hybrid Post Quantum DNSSEC Gateway in Rust (And Why the Internet Needs It Now)
Solving the UDP fragmentation crisis of quantum-resistant cryptography before “Store Now, Decrypt Later” breaks the web.

Let’s start with an uncomfortable truth. Right now, quantum computers are mostly experimental. They sit in super cooled laboratories at places like IBM and Google, struggling with qubit coherence and error rates. They can’t break standard internet encryption today.
But here is the terrifying reality: hackers don’t need a working quantum computer today to steal your data tomorrow.
Across the globe, nation-state actors and Advanced Persistent Threat (APT) groups are currently scraping and hoarding petabytes of encrypted internet traffic. Why would they waste storage on gibberish they can’t read? Because of a strategy known in the cybersecurity and intelligence world as SNDL Store Now, Decrypt Later. They are patiently stockpiling encrypted banking handshakes, secure military communications, and confidential intellectual property. In 5 to 10 years, when a Cryptanalytically Relevant Quantum Computer (CRQC) finally comes online, they will simply run Shor’s algorithm and instantly decrypt everything they’ve collected over the past decade.
The DNSSEC Blind Spot
When the tech industry talks about the quantum threat, everyone rushes to upgrade web servers to use Post Quantum TLS. That’s a great start, but it completely ignores the internet’s most critical infrastructure: the Domain Name System (DNS).
DNSSEC (DNS Security Extensions) uses traditional publickey cryptography mostly RSA and ECDSA to digitally sign DNS records. This ensures that when you type bank.com, you aren't being secretly redirected to a malicious server in a different country. If a quantum computer breaks DNSSEC, an attacker doesn't even need to decrypt your TLS traffic. They can just poison the DNS cache, hijack the top-level domains, and route your entire connection to a fake server they control from the very first millisecond.
We need to upgrade DNSSEC to NIST approved Post Quantum Cryptography (PQC) algorithms, like CRYSTALS Dilithium or Falcon, immediately.
So, what’s stopping us from just swapping out the old keys for the new ones? One word: Physics. (Well, network physics).
The UDP Fragmentation Crisis (Why I Built This)
The Domain Name System was built in the 1980s. It is fundamentally optimized for the User Datagram Protocol (UDP). UDP is incredibly fast and stateless, but it has a massive limitation it can only safely carry small payloads, historically 512 bytes, and even with modern EDNS0 extensions, you really don’t want to push it past 1232 bytes to avoid network issues.
Traditional RSA or ECC signatures easily fit into these tiny packets. Post Quantum signatures do not.
A standard CRYSTALS Dilithium2 signature is massive often exceeding 2,400 bytes. When you try to stuff a 2,500-byte PQC signature into a UDP packet, the router realizes it exceeds the Maximum Transmission Unit (MTU). The packet gets chopped up into multiple IP fragments.
If you are a network engineer, you know exactly what happens next. Modern firewalls, load balancers, and middleboxes absolutely despise IP fragments. They view them as potential DDoS attacks and silently drop them. The result? The DNS query times out. The website doesn’t load. The internet breaks.
While brilliant minds at places like SIDN Labs and ICANN have been publishing academic whitepapers on this exact UDP/TCP dynamic, finding a working, deployable, open-source proxy that engineers can actually spin up and test today is remarkably difficult. I wanted to move from theory to practice.
So, I built one myself. I wrote a custom, multi-threaded Hybrid Post-Quantum DNSSEC Gateway from scratch in Rust.
The Architecture: Where Does This Fit?
To understand how this works, we need to look at enterprise DNS setups.
Normally, an enterprise uses a DNS server like BIND9. The safest architecture involves a Hidden Master (a highly secured server deep inside the intranet holding the actual zone files) which pushes zone transfers to public facing Slave (Authoritative) Servers.
My Rust gateway is designed to sit directly at the edge, sitting right in front of your public Authoritative Slave servers. It acts as a transparent reverse proxy and a cryptographic bouncer.
The A-Z Flow: How the Gateway Saves the Packet
Here is exactly what happens in a fraction of a millisecond when a query hits the gateway:
- The Ignorant UDP Query: A client (like a stub resolver) sends a standard UDP query for a domain on port 53.
- The Truncation Trap: My Rust gateway intercepts it. It knows that the upstream BIND9 response, once signed with a PQC algorithm, will result in a massive 3000-byte payload. Instead of letting the network fragment and drop the packets, the gateway takes control. It immediately replies to the client over UDP, but it flips a very specific switch: the TC (Truncation) bit in the DNS header. It essentially tells the client: “Listen, the data you requested is way too big for UDP. Come back using TCP.”
- The TCP Fallback: The client, strictly following RFC 1035 protocols, sees the
TC=1flag. It instantly drops the UDP connection and initiates a 3-way TCP handshake with the gateway. TCP is a stream oriented protocol built for large data, so packet size limits disappear. - The Quantum Signature Injection: Once the secure TCP stream is open, the Rust gateway proxies the request to the upstream BIND9 server, retrieves the raw DNS record, and uses
liboqsto dynamically sign the payload with Falcon-512 or Dilithium2 in real-time. - The Safe Delivery: The massive, quantum-secure payload is streamed safely down the TCP pipe to the client. Zero fragmentation. Zero dropped packets. Total quantum immunity.
The Elephant in the Room: “Won’t this slow down the Internet?”
If there are any network professors, master’s students, or senior architects reading this, I can already hear you screaming at your monitors: “Are you crazy? TCP for DNS? You just added a 3-way TCP handshake to name resolution! You are going to add massive latency to every single web request!”
You are absolutely right to ask that. Forcing a TCP fallback adds at least a 2x to 3x latency penalty (Round Trip Time RTT) compared to a single UDP burst. But here is why that doesn’t actually matter in the real world: ISP DNS Caching.
End users (like you and me on our laptops) almost never query an authoritative name server directly. We query our ISP’s Recursive Resolvers or public resolvers like Cloudflare’s 1.1.1.1.
When the first person in London tries to access a PQC secured site in the morning, the ISP’s resolver will hit my Rust gateway. That resolver will experience the UDP truncation, do the TCP fallback, and suffer a 150ms penalty. But then, the ISP’s resolver caches that quantum-signed response for the duration of the Time-To-Live (TTL) let’s say, 24 hours.
For the rest of the day, if a million other people in London want to visit that site, the ISP hands them the answer directly from its local cache in 5 milliseconds over standard UDP. The heavy TCP latency penalty is paid exactly once per region, per day. For the sake of saving the internet’s naming system from quantum decryption, a one-time 150ms delay is an incredibly cheap price to pay.
Test It Yourself
I didn’t just write this to keep it on my hard drive. I’ve made the entire project open-source because developers, researchers, and system admins need to start experimenting with this infrastructure today.
You can find the full source code on my GitHub here: [Link to your GitHub Repo: https://github.com/amilakothalawalasolo-droid/post-quantum-dns-proxy]
How to run it in 3 minutes:
- Clone the repo and ensure you have Rust and
liboqsinstalled. - Edit the
config.tomlto point to your existing upstream DNS server (e.g., your BIND9 IP). - Build and run it:
cargo build --release && ./target/release/pqc_gateway - In a separate terminal, simulate a client query using
digto watch the magic happen:dig @127.0.0.1 -p 5353 yourdomain.com +dnssec
If you tail the gateway.log file, you will literally see the gateway forcing the TCP fallback and then logging the microsecond processing times for the Dilithium and Falcon signatures.
Why We Must Act Now
Transitioning the core protocols of the internet isn’t like pushing a software update to a smartphone. It takes years of testing, standardizing, and upgrading legacy middle boxes.
We cannot wait for IBM or Google to announce that they have built a fully stable, cryptanalytically relevant quantum computer. By the time that happens, the SNDL data harvesting will have already compromised decades of our digital lives. The transition to Post-Quantum DNSSEC must start now. We need to accept that the era of UDP only DNS is coming to an end, embrace TCP fallbacks, and start building the smart proxies required to keep the internet running.
I built this gateway as a proof of concept to show that it is possible. Feel free to clone it, break it, improve it, and let’s secure the internet before it’s too late.
메타데이터
- post_id
- ca874c5b9534
- slug
- how-i-built-a-hybrid-post-quantum-dnssec-gateway-in-rust-and-why-the-internet-needs-it-now-ca874c5b9534
- url
- https://medium.com/@amilakothalawala/how-i-built-a-hybrid-post-quantum-dnssec-gateway-in-rust-and-why-the-internet-needs-it-now-ca874c5b9534
- canonical_url
- https://medium.com/@amilakothalawala/how-i-built-a-hybrid-post-quantum-dnssec-gateway-in-rust-and-why-the-internet-needs-it-now-ca874c5b9534
- author_url
- https://medium.com/@amilakothalawala
- status
- ok
- fetched_at
- 2026-07-10 22:23:26