← Cryptography guide

K079 / Cryptographic protocols and formats

Signal Protocol

Signal protocol double ratchet · Survey date 2026-12-05

The Double Ratchet algorithm, central to the Signal Protocol, supports encrypted messaging between two parties based on shared secret keys.

CRYPTOGRAPHY LAB / K079

Cryptography Lab · Signal Protocol

Run real computations and inspect intermediate states step by step.

Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.

Scope: Limited implementation

Signal Double Ratchet (symmetric chain KDF only; no DH ratchet/session)

See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.

Reference ↗

Open lab →

Definition and overview
The Double Ratchet algorithm, central to the Signal Protocol, supports encrypted messaging between two parties based on shared secret keys. Source document ↗
Classification and reversibility
Reversible cryptographic protocol with SessionCipher.encrypt and corresponding decryption API. Source document ↗
Key or secret requirements
Requires X3DH-seeded root, chain and message keys and DH secrets. Source document ↗
Operating principle and structure
HKDF-SHA256 derives new root/chain keys from root key and new X25519 DH output; chain derives message keys. Source document ↗
Key size, block size and parameters
80-byte message key material: AES-256 key, HMAC-SHA256 key and IV. Source document ↗
Security strength and recommendation
Targets forward secrecy and post-compromise security, strengthened quantum security through SPQR/Triple Ratchet. Source document ↗
Known attacks and vulnerabilities
Encrypted backup design flaws may allow injection attacks inferring metadata when backup access is available. Source document ↗
Standards and certification
Not confirmed in the survey
Typical uses
Large-scale E2EE messengers including Signal, WhatsApp, Google Messages and Facebook Messenger. Source document ↗
Implementations, libraries and tools
Official libsignal Rust implementation with Java/Swift/TypeScript APIs. Source document ↗
Decryption or decoding
Decrypt using SessionCipher decryptWhisperMessage or decryptPreKeyWhisperMessage. Source document ↗
Advantages
Fresh message keys prevent computing previous keys from later keys, providing forward secrecy. Source document ↗
Limitations and cautions
Official libsignal does not support non-Signal use, complicating independent integration. Source document ↗
Distinguishing encryption, encoding and hashing
HMAC-SHA256 KDF derives keys, not message encryption/hashing/encoding. Source document ↗

Practical examples

Examples are illustrative; they are not execution-tested implementations or operational recommendations.

Example

Two users establish session by key agreement, derive new key per message and exchange ciphertext/DH public values. Recipient decrypts using session state and discards used message key.

Procedure

Set up session/key agreement, derive message keys, send ciphertext, authentication info and headers. Check state, update DH ratchet if needed, decrypt/verify integrity. Encoding bytes as text is separate.

Scenario

One-to-one E2EE messaging such as Signal/WhatsApp; PreKey starts sessions with offline peers and session state handles out-of-order messages.

Pitfalls and alternatives

Protect session state, keys and backups; handle reordering/retransmission and official-library support limits. Prefer vetted libsignal implementations; Base64/hex is not encryption.

References