Cyber Security / Cryptography
Ratcheting: How Signal Keeps Encryption Keys Moving
Fresh message keys, forward secrecy, and recovery after compromise—inside the Double Ratchet and its post-quantum evolution.
A key that keeps moving
End-to-end encryption is not just a question of choosing a strong cipher. A long conversation also needs a strategy for changing its keys. A ratchet advances cryptographic state so that yesterday’s message key does not become tomorrow’s message key.
Signal made the Double Ratchet widely known: a symmetric-key ratchet produces a fresh key for each message, while a Diffie–Hellman ratchet periodically injects new shared secret material. The result is key evolution in two complementary directions—not simply encrypting every message with one permanent secret. 1
The symmetric-key ratchet
Think of a chain key as a sealed state that advances one step whenever a message is sent. A key derivation function produces both the next chain key and a message key:
The message key is used with authenticated encryption; old message keys and obsolete chain state should then be erased when no longer needed. The intended one-way property means possession of the current chain key should not reveal earlier message keys. However, possession of that chain key can reveal later keys in the same chain. Merely advancing this symmetric chain does not heal a compromise. 1
CK_0 ----------> CK_1 ----------> CK_2
| | |
v v v
MK_0 MK_1 MK_2
| | |
message 0 message 1 message 2
The Diffie–Hellman ratchet
When a party receives a new ratchet public key, it combines that key with its own private key to compute a fresh Diffie–Hellman output. The root-key derivation mixes this output into the previous root key and creates a new chain key:
Here is a private scalar and is the other party’s public key, using additive group notation. In the standard exchange, receiving a new remote key advances the receiving chain; generating a fresh local ratchet key then advances the sending chain. This is asynchronous: there is not necessarily a new Diffie–Hellman exchange for every message. 1
Forward secrecy and recovery
Forward secrecy limits how a later compromise exposes earlier messages, provided obsolete secrets were securely deleted. Post-compromise security aims to protect future messages after an attacker loses access and fresh secret contributions enter the conversation.
Recovery is conditional, not instantaneous magic. An attacker still controlling an endpoint can read plaintext and new keys. Authentication, correct key handling, and an honest fresh ratchet contribution are essential. Neither property hides message timing, social relationships, or every other piece of metadata. 1
Messages can arrive out of order
Real networks delay, duplicate, and reorder messages. Ratchet headers identify a public ratchet key and message counters, allowing a receiver to advance a chain and retain skipped message keys temporarily. Those saved keys permit delayed messages to be decrypted, but their number and lifetime must be bounded. Otherwise an attacker can turn skipped-key storage into a denial-of-service target or enlarge the window of exposure. 1
Ratcheting in the post-quantum era
The classical Double Ratchet is a foundation, not a claim that every Signal session today is only classical Diffie–Hellman. In October 2025, Signal announced its Sparse Post-Quantum Ratchet (SPQR), extending continuous key evolution against future quantum threats. Its updated specification describes a hybrid Triple Ratchet combining the classical Double Ratchet with a sparse post-quantum ratchet. PQXDH addresses session establishment; ongoing ratcheting addresses continued key evolution. 2
What to carry into a design review
- Use a reviewed protocol and maintained implementation, not a homemade ratchet built from this sketch.
- Establish and authenticate the initial shared secret; a key exchange alone does not establish identity.
- Erase obsolete secrets and bound skipped-key storage.
- Handle counters, duplicates, session state, and concurrent devices deliberately.
- Treat endpoint compromise and metadata protection as separate problems.
Ratcheting is best understood as damage containment through evolving secrets. It narrows the consequences of a stolen key; it does not turn an untrusted device into a trusted one.
References
Comments (3)
Demo discussion
Milovan@happybutterfly832
Does retaining skipped message keys weaken forward secrecy for delayed messages? The storage limits seem as important as the derivation itself.

Téo@purplegoose693
The post-quantum section is helpful. Protecting session establishment and continuously refreshing shared secrets solve different parts of the problem.
Lorraine@lazybird503
The distinction between advancing a chain and recovering from compromise is crucial: a stolen chain key can expose later keys until fresh secret material arrives.