The Double Ratchet Algorithm

https://signal.org/docs/specifications/doubleratchet/
webpage banner

The Double Ratchet Algorithm

The Double Ratchet algorithm is a key management protocol used by two parties to exchange encrypted messages, based on a shared secret key. It uses a combination of a symmetric-key ratchet and a Diffie-Hellman ratchet to provide both forward and post-compromise security. The symmetric-key ratchet ensures that every message is encrypted with a distinct key, while the Diffie-Hellman ratchet periodically updates keys based on Diffie-Hellman outputs, protecting against the compromise of keys. The protocol is designed to handle out-of-order messages and also includes an optional feature for header encryption to protect metadata. This paper provides a detailed specification of the algorithm, covering its components, state, initialization, and the processes for encryption and decryption, as well as security considerations and recommendations for implementation.

Note

many simple implementations of encrypted messaging takes the step to ensure that every message between two parties are encrypted with different keys

this paper outlines a method for evolving how the messages are encrypted in chains, such that any private key exposure to an attacker, ensures they have not gained access to past messages.

i was able to implement most of this algorithm in nodejs thanks to the solid and accessible nature of this document.

Published

2016

Summary

The Double Ratchet algorithm is a key management protocol used by two parties to exchange encrypted messages, based on a shared secret key. It uses a combination of a symmetric-key ratchet and a Diffie-Hellman ratchet to provide both forward and post-compromise security. The symmetric-key ratchet ensures that every message is encrypted with a distinct key, while the Diffie-Hellman ratchet periodically updates keys based on Diffie-Hellman outputs, protecting against the compromise of keys. The protocol is designed to handle out-of-order messages and also includes an optional feature for header encryption to protect metadata. This paper provides a detailed specification of the algorithm, covering its components, state, initialization, and the processes for encryption and decryption, as well as security considerations and recommendations for implementation.

Image

Image for The Double Ratchet Algorithm