I've been thinking about E2E encrypted DMs for quite a while now.
Last week, X and HN were full of rumors that an AI lab had broken RSA.
Then this Monday, Anthropic published an interesting paper that shows a quantum attack on structured lattices (used for ML-KEM / Kyber). ML-KEM is something that some people call a potential "post-quantum standard". The attack is probably too slow in practice, but it's a hint that structured lattices could get broken.
So... it's a good week to ship DMs that assume RSA, elliptic curves and structured lattices are all broken already. Get the itter client:
curl -fsSL https://itter.sh/install | sh
dm @roman
whoop whoopCryptography 101
- RSA and elliptic curves, the most used cryptography algorithms right now, hide their secret in math with a hidden rhythm. Quantum computers are great at finding rhythms (--> Shor's algorithm).
- Nobody has one that is strong enough yet. But anyone can record encrypted traffic today and read it once they do ("harvest now, decrypt later")
- Lattices are a different puzzle: hundreds of equations, each with a small error. Try to solve them and the errors pile up until it's all noise. No rhythm to find
- Rings are a shortcut: each row of equations is the row above, shifted one spot, like beads on a necklace. That makes ML-KEM small (~1 KB keys) and fast
- But patterns are what codebreakers hunt for, and the necklace pattern is what Anthropic's attack goes after
- FrodoKEM skips the shortcut: plain random equations, no pattern. Big (~20 KB keys) and slow, but nothing to latch onto. The name is a LOTR pun: "Frodo: Take off the ring!" (ha...ha...)
- The messages themselves are AES-256. Quantum computers are not much better at breaking these
Protection
There are 3 layers of protection:
- the classics (X25519, Ed25519)
- the new "standards" (ML-KEM, ML-DSA)
- FrodoKEM (unstructured lattices) and SLH-DSA (nothing but hash functions).
- To read your DMs, someone has to break all 3 layers
How it works
- DMs travel through itter's
relay, which only ever sees encrypted bytes - Your keys stay on your computer
- Every message gets a fresh key via Triple Ratchet
- A leaked key doesn't open older messages, and the chat heals itself after a while
- Safety numbers for the paranoid:
/snin a chat, compare with them, then/verify.
Limits
- Most of the code is AI generated (!)
- The relay sees who writes to whom, when, and roughly how much (through bytes)
- The first time you write to someone, you take the relay's word that it's them (but you can check safety numbers!)
- The pipe to the relay is SSH –> elliptic curves + ML-KEM at arrival
- Whoever breaks the pipe sees what the relay sees, and can play relay (but not what you wrote)
- Setting up DMs is tied to your SSH key
- Someone who can break your SSH key could set up DMs in your name before you do (again: check safety numbers)
- Chats start with a signed handshake, so user chat pairs can be traced
- If someone controls your computer they can read your DMs (obviously)
- It's new code and nobody has audited it yet. Don't bet your life on it (yet)
All the details: PROTOCOL.md.
PRs very welcome.