Group E2EE at Scale: Sender Keys & MLS
Why pairwise fan-out breaks large encrypted groups, where Sender Keys leak on removal, and how RFC 9420 MLS TreeKEM achieves O(log N) group key updates.
In this lesson (3 bite-sized sections)
Why pairwise E2EE collapses in large groups
The Double Ratchet is phenomenal for 1:1 chats, and small groups of 5-10 people can run client-side pairwise fan-out: Alice maintains N-1 separate Double Ratchet sessions and encrypts every message N-1 times. That simplicity hits a wall fast. In a 1,000-person enterprise channel, sending one 5 MB photo requires encrypting and uploading 999 separate ciphertexts (~5 GB from a single mobile uplink) and maintaining 999 independent ratchet states. Every member addition or removal costs O(N) handshakes, making large corporate or community E2EE groups unusable.
Sender Keys: fast messaging, expensive removal
WhatsApp and Signal groups originally solved the upload bottleneck with Sender Keys. Each sender generates one symmetric chain key (their Sender Key), distributes it once to every group member over their pairwise Double Ratchet channels, and then encrypts each group message once under that symmetric chain key (plus a signature). The server fans out that single ciphertext to all N-1 recipients, dropping message send cost from O(N) to O(1).
The hidden cost shows up the second someone leaves or is removed. Because the evicted member still holds everyone's current Sender Keys, every remaining member must re-generate and redistribute a fresh Sender Key to all N-1 others before sending again. In a 5,000-person group with constant churn, every single removal triggers O(N) pairwise re-keying, and an offline member who never sends a message cannot heal a compromised state quickly.
| Group E2EE design | Send message cost | Remove member cost | PCS healing | Practical ceiling |
|---|---|---|---|---|
| Pairwise Double Ratchet | O(N) encrypts & uploads | O(1) local drop | Per-pair DH ratchet | ~10-50 members |
| Sender Keys | O(1) encrypt & upload | O(N) re-key per remaining sender | Only on full O(N) re-distribution | ~100-1,000 members |
| MLS (RFC 9420 TreeKEM) | O(1) encrypt & upload | O(log N) path update | O(log N) via leaf key update | 10,000-50,000+ members |
How RFC 9420 MLS (TreeKEM) achieves O(log N)
Messaging Layer Security (MLS, RFC 9420) organizes group members as the leaves of a binary Ratchet Tree. Every interior node holds a key pair derived by hashing its child's path secret upward, and the root secret feeds the group's epoch key schedule (which derives O(1) symmetric message keys for all members in that epoch).
When Alice removes Bob or rotates her own key for Post-Compromise Security, she blanks Bob's leaf, picks a new leaf secret, hashes upward along her direct path of log2(N) ancestors, and encrypts each ancestor's new path secret under the public key of its sibling (copath) subtree. Every other member belongs to exactly one copath subtree, decrypts that single node's secret, and hashes upward to reach the identical new root secret.
MLS cleanly separates two server roles so the cryptography stays untrusted:
- Delivery Service (DS): stores asynchronous KeyPackages (like X3DH pre-key bundles), sequences competing Commit messages into a single strict epoch order (preventing group state forks), and fans out ciphertexts.
- Authentication Service (AS): binds cryptographic credentials to real user identities (certificates or enterprise directory assertions) so the DS cannot silently inject a rogue spy leaf into the tree.
MLS architecture: untrusted Delivery Service vs Authentication Service: an architecture diagram of 4 components and 4 connections. Full description follows.
- Authentication Service (identity credentials): service.
- Delivery Service (epoch sequencer & fan-out): service.
- KeyPackage store (offline join keys): database.
- Group clients (shared Ratchet Tree, epoch E): client.
- Authentication Service (identity credentials) calls synchronously Group clients (shared Ratchet Tree, epoch E) (issues signed identity credentials).
- Group clients (shared Ratchet Tree, epoch E) sends asynchronously to KeyPackage store (offline join keys) (uploads fresh KeyPackages).
- Group clients (shared Ratchet Tree, epoch E) calls synchronously Delivery Service (epoch sequencer & fan-out) (submits O(log N) Commit / O(1) App Msg).
- Delivery Service (epoch sequencer & fan-out) sends asynchronously to Group clients (shared Ratchet Tree, epoch E) (orders epoch E+1 & broadcasts ciphertext).
Sort each responsibility to the MLS component that owns it.
Sort 4 more items to check
Recap: pairwise Signal breaks past ~50 users on O(N) uploads, Sender Keys cut sending to O(1) but pay O(N) on every removal, and RFC 9420 MLS uses binary Ratchet Trees plus a sequencing Delivery Service and identity-binding Authentication Service to deliver O(1) sends and O(log N) group key updates for tens of thousands of members.
Sources: RFC 9420, Messaging Layer Security · RFC 9750, MLS Architecture · Signal Sesame and Group Design
Apply
Your turn
The task this lesson builds to.
Architect the end-to-end encrypted group messaging subsystem for an enterprise collaboration platform supporting channels from 5 people up to 25,000 employees with daily join/leave churn.
Think about
- Why do pairwise Signal fan-out and Sender Keys break at 25,000 members with daily removals?
- How do MLS Ratchet Trees, Delivery Service epoch sequencing, and Authentication Service credentials fit together?
- How do you handle concurrent commits and offline members joining a 25,000-member group?
Draft your design answer here Save your draft, compare against the model answer, and track progress.
Practice
Make it stick
A second problem on the same idea, so it survives past today.
Diagnose why a 10,000-member MLS group suffers frequent 'blank node degradation' where commit sizes silently swell from ~14 encryptions toward hundreds, and design the tree-maintenance policy that restores O(log N) efficiency without weakening Post-Compromise Security.
Think about
- What happens to an MLS binary Ratchet Tree when many leaves are removed (blanked) and few active members commit updates?
- Why does a blank parent node force a committer to encrypt to its non-blank children instead?
- How do lazy self-updates and tree pruning keep resolution sizes small?
Draft your design answer here Save your draft, compare against the model answer, and track progress.