K079 / Cryptographic protocols and formats
Signal Protocol
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.
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.Output
Previous state
- 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
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
- Signal >> Specifications >> The Double Ratchet Algorithm ↗
- API · signalapp/libsignal-protocol-javascript Wiki · GitHub ↗
- Double Ratchet · Encra Docs ↗
- End-to-End Encrypted Messaging with Signal ↗
- The Double Ratchet ↗
- Signal >> Blog >> Signal Protocol and Post-Quantum Ratchets ↗
- Injection Attacks Against End-to-End Encrypted Applications ↗
- On the Tight Security of the Double Ratchet ↗
- signalapp/libsignal ↗