Privacy

Signal Protocol Explained: Double Ratchet and X3DH

The Signal Protocol powers encrypted messaging for billions of users. Learn how X3DH, the Double Ratchet, and sealed sender make messages truly private.

Editorial Team ·
10 min read intermediate

Introduction

WhatsApp, Signal, and Google Messages all run on the same underlying cryptographic protocol — one designed so that even if an attacker seized every Signal server in the world, they would see no message content.

The Signal Protocol is not the Signal app. It is the cryptographic specification that defines how end-to-end encrypted messaging works for over a billion users across multiple platforms. WhatsApp adopted it in 2016. Google Messages uses it for RCS encryption. Skype’s Private Conversations and Facebook Messenger’s Secret Conversations both implement it.

What distinguishes the Signal Protocol from ordinary TLS or HTTPS encryption is what it protects against. TLS encrypts data in transit between client and server — but the server sees the plaintext. The Signal Protocol ensures the server never sees plaintext. More importantly, it is designed to remain secure even if an attacker compromises a session mid-conversation: future messages automatically recover their security through a mechanism called the Double Ratchet.

These properties are not hypothetical. In 2019, a reported vulnerability in an intermediary could have exposed some WhatsApp messages. Because WhatsApp uses the Signal Protocol, encrypted message content was never accessible from the server side regardless of infrastructure vulnerabilities. The cryptographic guarantees held.

This article explains the three components that make the Signal Protocol work: X3DH (for setting up a session when the recipient is offline), the Double Ratchet (for per-message key rotation), and sealed sender (for hiding who is talking to whom).

What Is the Signal Protocol?

The Signal Protocol is an open-source, end-to-end encryption specification for asynchronous messaging. “Asynchronous” means the recipient does not need to be online when the sender sends a message — a fundamental difference from protocols like TLS, which require both parties to be present for key exchange.

The protocol was created by Moxie Marlinspike and Trevor Perrin at Open Whisper Systems and open-sourced in 2013. The Signal app was the first implementation; the protocol was later published as a specification that other applications could implement.

The formal security analysis published at IEEE Security and Privacy 2020 (Cohn-Gordon et al.) verified the protocol’s cryptographic properties mathematically, confirming the security guarantees its designers intended.

The protocol uses Curve25519 (RFC 7748) for all Diffie-Hellman operations — a high-performance elliptic curve with strong security properties and a design that avoids many of the implementation pitfalls of older NIST curves.

How the Signal Protocol Works

Component 1: X3DH — Setting Up a Session

X3DH (Extended Triple Diffie-Hellman) solves a core problem in asynchronous messaging: how do Alice and Bob establish a shared secret when Bob might be offline for days?

Each Signal user maintains four key types on the server:

  1. Identity Key (IK): A long-term key pair representing the user’s permanent identity.
  2. Signed Pre-Key (SPK): A medium-term key pair signed by the Identity Key; rotated weekly or monthly.
  3. One-Time Pre-Key (OPK): Short-lived key pairs, each used only once for forward secrecy.
  4. Ephemeral Key (EK): Generated fresh by the sender for each session initiation.

When Alice wants to message Bob (who is offline):

  1. Alice fetches Bob’s public keys from the Signal server.
  2. Alice generates a fresh Ephemeral Key.
  3. Alice computes four Diffie-Hellman operations — one for each combination of her ephemeral key with Bob’s stored keys.
  4. Alice derives a master secret from the four DH results using HKDF.
  5. This master secret initializes the Double Ratchet.
  6. When Bob comes online, he uses his private keys to compute the same four DH operations and reconstruct the identical master secret.

Each DH operation contributes a distinct security property: mutual authentication, identity binding, forward secrecy, and one-time key forward secrecy. The combination means a session is cryptographically complete even though the two parties never communicated in real time.

Component 2: The Double Ratchet — Per-Message Keys

The Double Ratchet is what generates a new, unique encryption key for every single message — forward and backward.

The symmetric ratchet (KDF chain):

Each message key is derived from the previous key using HKDF. After Alice uses a key to encrypt a message, she deletes it. Because the derivation is a one-way function, an attacker who obtains the current key cannot work backward to decrypt past messages. This is forward secrecy at the message level — not just the session level as in TLS.

The Diffie-Hellman ratchet:

Each message exchange includes new DH ratchet key material. When both parties complete a DH exchange — which happens naturally as messages flow back and forth — they derive entirely fresh chain keys. This provides break-in recovery (also called post-compromise security): if Alice’s device is compromised today and her current keys are exposed, the next DH ratchet exchange produces keys the attacker cannot derive. Future messages become secure again automatically.

The combination means: past messages are protected by forward secrecy; future messages are protected by break-in recovery; only the current message window is exposed in a compromise.

Component 3: Sealed Sender

Sealed sender hides the sender’s identity from Signal’s servers. In a standard messaging protocol, the server routes messages by knowing both the sender and recipient. This metadata — who is talking to whom — is often as valuable to surveillance as message content.

Signal’s sealed sender mechanism has Alice encrypt her identity key alongside the message payload. The Signal server sees only the recipient (Bob’s address) — it cannot identify who sent the message. When Bob decrypts, he learns Alice sent it. The server never does.

This video explains how the Signal Protocol works, including the Double Ratchet mechanism. The sections above build on this to cover X3DH for offline session setup and sealed sender for metadata protection.
Trace the X3DH setup (left): four DH operations combining Alice's ephemeral key with Bob's stored pre-keys. Then follow the Double Ratchet (right): the symmetric chain derives per-message keys while the DH ratchet heals sessions after compromise.

Signal Protocol vs Standard TLS 1.3

PropertySignal ProtocolStandard TLS 1.3
Designed forAsynchronous messagingReal-time client-server
Forward secrecyPer-message (Double Ratchet)Per-session (ECDHE)
Break-in recoveryYes (DH ratchet)No
Offline message supportYes (X3DH pre-keys)No
Server sees senderNo (sealed sender)Yes
Key agreementX25519 (X3DH)X25519 (ECDHE)
Message content visible to serverNeverAt TLS termination point

The critical distinction is that TLS protects data between you and the server — the server decrypts and processes your data. The Signal Protocol protects data between users — the server sees only ciphertext it cannot decrypt. Both use Curve25519 for key exchange (RFC 7748), but for fundamentally different purposes.

Real-World Use Cases

Journalism and source protection: Reporters communicating with sources through Signal benefit from sealed sender (the server cannot confirm who contacted whom), per-message forward secrecy (a compromised later key does not expose early messages), and an open-source protocol audited by the academic security community. The IEEE S&P 2020 formal analysis gave journalists and security researchers the confidence that the protocol’s guarantees were mathematically verified, not just asserted.

Healthcare messaging: Medical providers using Signal or WhatsApp for patient communication rely on end-to-end encryption to meet HIPAA’s minimum necessary standard for protected health information. The Signal Protocol’s design means that a healthcare messaging platform’s servers hold no plaintext patient data — a server breach exposes only encrypted blobs.

Cross-platform encryption: Because the Signal Protocol is a public specification, multiple applications implement it independently. An organization choosing a messaging tool can verify the encryption protocol rather than trusting a vendor’s marketing. WhatsApp’s use of the Signal Protocol means its encrypted conversations have the same formal security guarantees as Signal itself — both have been analyzed using the same specification.

Common Mistakes to Avoid

Confusing end-to-end encryption with anonymity. The Signal Protocol encrypts message content and hides the sender from the server. It does not hide that a conversation is happening. Cell carriers and ISPs can observe that you are communicating with Signal’s servers. Metadata (timing and frequency of messages) is still visible even with sealed sender. For true anonymity, the Signal Protocol must be combined with a privacy-preserving transport like Tor.

Assuming break-in recovery is instantaneous. After a device compromise, break-in recovery requires a complete DH ratchet exchange — meaning both parties must exchange messages after the compromise for new secure key material to flow. If an attacker has compromised Alice’s device and is silently reading messages, future messages become secure only after the next DH ratchet completes. This is still far better than protocols without break-in recovery, where a compromise exposes all subsequent traffic indefinitely.

Treating the protocol as a substitute for endpoint security. The Signal Protocol cannot protect against malware on your device reading messages before they are encrypted or after they are decrypted. A keylogger, a screen capture tool, or a forensic image of an unlocked device bypasses all cryptographic protections. Endpoint security — device encryption, screen locks, minimal app permissions — is complementary, not redundant.

Using Signal Protocol without verifying safety numbers. The protocol’s authentication relies on users verifying that they have the correct key for each contact. Signal exposes this as “safety numbers” — a code derived from both parties’ Identity Keys. Without verifying safety numbers out-of-band, a man-in-the-middle attack during X3DH setup is theoretically possible.

Getting Started

If you are evaluating messaging tools for sensitive use, check whether the application uses an independently audited implementation of the Signal Protocol. Signal, WhatsApp, and Google Messages all use the libsignal library. Look for applications that publish their cryptographic specifications, support safety number verification, and have undergone third-party security audits.

For organizations deploying Signal Protocol-based messaging, configure sealed sender and verify that pre-key bundles are refreshed regularly. The one-time pre-keys provide an additional layer of forward secrecy for session initiation — systems should monitor whether pre-key pools are being consumed and replenished to avoid fallback to signed pre-keys only.

For developers integrating the protocol, the official Signal specification documents (doubleratchet.md and x3dh.md) at signal.org are the authoritative implementation references. Use the libsignal library directly rather than implementing the protocol from scratch — cryptographic protocol implementation errors are subtle and dangerous.

To understand the broader concept of end-to-end encryption and how it differs from transport encryption, read end-to-end encryption explained. For the TLS protocol that Signal Protocol’s Curve25519 shares primitives with, see TLS 1.3 vs TLS 1.2.

FAQ

Common questions — answered in plain English.

What is the Signal Protocol and how does it work?
The Signal Protocol is an end-to-end encryption protocol for asynchronous messaging. It combines X3DH (Extended Triple Diffie-Hellman) for initial key agreement with the Double Ratchet algorithm for per-message key derivation. Together, these provide forward secrecy (past messages cannot be decrypted if keys are compromised) and break-in recovery (future messages become secure after a new key exchange).
Does WhatsApp use the Signal Protocol?
Yes. WhatsApp adopted the Signal Protocol for its end-to-end encryption in 2016, making it the largest deployment of the protocol globally — over one billion users. Google Messages (for RCS end-to-end encryption), Skype Private Conversations, and Facebook Messenger Secret Conversations also use the Signal Protocol. The protocol is open-source and publicly audited.
Is Signal Protocol truly unbreakable?
No cryptographic protocol is unconditionally unbreakable. The Signal Protocol provides strong mathematical guarantees — a formal security analysis was published at IEEE S&P 2020 — but it cannot protect against endpoint compromise (malware on your device), screenshots shared by the recipient, or legal orders compelling device access. The protocol protects the communication channel; endpoint security protects the device.
What is the Double Ratchet algorithm?
The Double Ratchet is the key derivation mechanism that generates a new encryption key for every message. It runs two ratchets simultaneously: a symmetric ratchet (each key derived from the previous one, providing forward secrecy) and a Diffie-Hellman ratchet (each message exchange includes new DH key material, providing break-in recovery). The combination means past messages and future messages are both protected even if current keys are exposed.
Can Signal see my messages?
No. The Signal Protocol encrypts messages on your device before transmission. Signal's servers relay encrypted blobs they cannot decrypt. With sealed sender, the server does not know who sent the message — only who receives it. Signal's servers see delivery timestamps and approximate message sizes, but never message content or sender identity.
What is sealed sender in Signal?
Sealed sender is a mechanism that hides the sender's identity from Signal's servers. Normally, a messaging server needs to know who is sending to route the message. Signal's sealed sender encrypts the sender's identity key alongside the message, so the server sees only the recipient's address. The recipient decrypts and learns who sent it; the server never does.

References

  1. [1]
  2. [2]
  3. [3]
  4. [4]
  5. [5]