$linuxjunkies
>

X3DH

also: Extended Triple Diffie-Hellman

X3DH (Extended Triple Diffie-Hellman) is a key agreement protocol that establishes a shared secret between two parties for end-to-end encrypted messaging, even when they are offline or have never communicated before.

X3DH is a cryptographic handshake protocol designed to enable secure asynchronous messaging. It combines three Diffie-Hellman key exchanges to derive a shared secret that two parties can use to initialize an encrypted session, without requiring them to be online simultaneously or to have previously exchanged keys.

The protocol uses four key pairs: each party's long-term identity key and a medium-term signed prekey, plus an optional one-time prekey from the recipient. This multi-layer approach provides forward secrecy—even if some keys are compromised later, past messages remain protected.

X3DH is widely used in modern messaging applications like Signal, WhatsApp, and others to establish the initial encrypted channel before ongoing messages are encrypted with a separate protocol (typically the Double Ratchet Algorithm). Example: Alice wants to send a message to Bob without waiting for him to come online; X3DH lets her derive a shared key using Bob's published prekeys and establish encryption immediately.

Related terms