transport: ML-KEM-768 hybrid prelude and onionwire:v2 invites
Adds an ML-KEM-768 install key beside the ed25519 identity and x25519 prekey. A friend added from a v2 invite always gets a version-2 PQ prelude before Noise msg 1, and both sides bind (ct, ss_kem) into the Noise prologue (onionwire-v2 \0 ct \0 ss_kem). The row decides: a kem_pk friend without a prelude is rejected with 'prelude required', a prelude for a classical row with 'unexpected prelude'. Invites are now onionwire:v2 with kem=<base64url pk>; decode still accepts v1 (no kem) and yields a classical friend. F8 rotates the KEM key with the prekey and hard-cuts stored ratchet state. The TUI labels a legacy friend 'classical'. Docs: PROTOCOL (keys, framing, prologues, no-downgrade, invite v2), THREAT_MODEL (what PQ transport does and does not buy; epoch 0 stays classical), README (invite size, F8, legacy caveat). SDK exposes pq on InviteInfo/FriendInfo and gains a v2 decode round-trip test.
This commit is contained in:
parent
00bb95675f
commit
c741b660e4
26 changed files with 1637 additions and 177 deletions
|
|
@ -20,7 +20,41 @@ A signed `loc` frame (`onion`, `ts`, `sig`) rewrites a friend’s locator **only
|
|||
|
||||
## Rotating the prekey is a hard cut, and it is wider than F4
|
||||
|
||||
`F8` rotates the long-lived signed prekey. The identity key and the onion are unchanged, but the prekey is our Noise static **and** the seed of the bootstrap ratchet epoch, so once it moves nothing is reachable any more: a friend's dial uses the prekey they pinned from your invite, and their stored epoch is derived from the old one. There is no push path for a prekey — it only travels inside a signed invite — so every friend, online or offline, has to F3-paste the new invite before chat works in either direction again. F8 therefore also drops the local ratchet state for every friend, exactly as a peer's own prekey change does. Rotating the prekey shrinks the forward-secrecy window of the long-lived static; it is not a revocation (the old invite holder still learns nothing new, but they also cannot talk to you).
|
||||
`F8` rotates the long-lived signed prekey **and the ML-KEM-768 install key**. The identity key and the onion are unchanged, but the prekey is our Noise static **and** the seed of the bootstrap ratchet epoch, and the KEM key is what peers encapsulate to, so once either moves nothing is reachable any more: a friend's dial uses the prekey and `kem=` they pinned from your invite, and their stored epoch is derived from the old prekey. There is no push path for either key — they only travel inside a signed invite — so every friend, online or offline, has to F3-paste the new invite before chat works in either direction again. F8 therefore also drops the local ratchet state for every friend, exactly as a peer's own prekey change does. Rotating the prekey shrinks the forward-secrecy window of the long-lived static; it is not a revocation (the old invite holder still learns nothing new, but they also cannot talk to you).
|
||||
|
||||
## Post-quantum transport does not make messaging post-quantum
|
||||
|
||||
Every Noise session to a v2 friend carries an ML-KEM-768 secret. The
|
||||
initiator sends a `version = 2` prelude with `ct = Encapsulate(friend.kem_pk)`
|
||||
before Noise msg 1, and both sides mix `(ct, ss_kem)` into the Noise prologue
|
||||
(`"onionwire-v2" || 0x00 || ct || 0x00 || ss_kem`). A recorded handshake
|
||||
therefore exposes an X25519 DH and an ML-KEM-768 encapsulation; a future
|
||||
cryptographically relevant quantum adversary has to break ML-KEM-768 as well as
|
||||
X25519 to recover the Noise transport keys. That removes the
|
||||
harvest-now-decrypt-later exposure of the **one-shot transport**.
|
||||
|
||||
What this does **not** buy:
|
||||
|
||||
- **The chat ratchet stays classical.** Chat messages are `rat ` frames
|
||||
(Double Ratchet, `docs/PROTOCOL.md`). The **bootstrap epoch is derived only
|
||||
from the two long-lived X25519 prekeys** (HKDF over their DH, with the
|
||||
identity pubkeys mixed in), so an adversary who records a `rat ` chain and
|
||||
later obtains both prekeys can reconstruct epoch 0 even though the Noise
|
||||
session that carried it was hybrid. Later epoch chains use fresh X25519 DH
|
||||
steps, which are equally quantum-vulnerable. PQ ratchet steps are a separate
|
||||
follow-up, not part of this transport work.
|
||||
- **Identity and invite signatures are ed25519**, still classical. The KEM key
|
||||
is authenticated by a v1-style ed25519 invite signature; an adversary who can
|
||||
forge it can also swap `kem=`. Hybrid transport protects confidentiality, not
|
||||
the long-term authentication root.
|
||||
- **Legacy friends get nothing.** A friend added from an `onionwire:v1` invite
|
||||
has no `kem_pk`; sessions to them are the old classical `onionwire-v1`
|
||||
prologue, and the UI labels that friend as lacking PQ protection. The choice
|
||||
is derived from the roster row, never from the wire: a `kem_pk` friend
|
||||
rejects a prelude-less session with `prelude required` before any application
|
||||
frame, so an active attacker cannot downgrade it.
|
||||
- **Mixed-version fleets break.** A v1-only build cannot open a session with a
|
||||
v2 friend; that is accepted rather than adding a fallback path.
|
||||
|
||||
## Your store is encrypted
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue