Messenger Secret Conversations Technical Whitep
Messenger Secret Conversations Technical Whitep
eps
Version 2.0
May 18, 2017
Version History:
2.0 — May 18, 2017
1.0 — Jul 8, 2016
Contents
Introduction 4
Abuse Reporting 11
Message Storage 13
Conclusion 15
messenger secret conversations technical whitepaper 4
Introduction
apps.apple.com
More to explore
Visit Save
messenger secret conversations technical whitepaper 5
Device Management
Keys
Each device manages various cryptographic keys. All keys are gener-
ated or derived on-device. Private keys are never sent to Facebook.
Public keys All public key operations use Curve25519. Each device
uses the following public-secret keypairs:
• The Root Key (RK) is a 256-bit key which is used to derive Chain
Keys in the Signal Protocol ratchets.
• Chain Keys (CK) are each 256-bit values which are used to derive
Message Keys.
• Message Keys (MK) are each 640-bit values which consist of 256 bits
for an AES-256 key, 256 bits for an HMAC·SHA256 key, and 128 bits
for an Initialization Vector (IV) for AES-CBC encryption.
• Sender Chain Keys (SCK) are 256-bit values used to derive Sender
Message Keys.
messenger secret conversations technical whitepaper 7
• Sender Message Keys (SMK) are 384-bit values consisting of 256 bits
for an AES-256 key, and 128 bits for an Initialization Vector (IV) for
AES-CBC encryption.
• Sender Signing Keys (SSK) are key pairs used to sign multicast
messages.
When Messenger initialises Secret Conversations it generates
and then uploads to Facebook its permanent IK pk and the current
SPK pk . It generates a batch of one-time pre-key keypairs and uploads
their public parts to Facebook on demand.
1. The Initiator obtains from Facebook IKRpk , SPKRpk and OTPKRpk for
an one-time pre-key keypair generated by the Responder device.
CK = RK
MK = HKDF(CK)
In each message exchange, the sender generates a fresh ephemeral
keypair (EKsender
pk , EKsender
sk ) and includes the public part in the out-
going message. The recipient calculates the current MK value using
EKsender
pk and can decrypt the message. It too then generates a fresh
ephemeral keypair (EKreceiver
pk , EKreceiver
sk ) and derives new keys RK0 ,
0 0
CK and MK for use with the next response by updating the previous
symmetric key values as follows:
MK0 = HKDF(CK0 )
If a second message is sent before the opposing party responds, the
sender uses a new chain key CK00 = HKDF(CK) and a corresponding
MK00 = HKDF(CK00 ).
When a secret conversation contains just two devices, we use the
pairwise channel for transmitting messages directly. The Signal
Protocol’s implementation is open-source and available at https:
//github.com/whispersystems/libsignal-protocol-java/.
Secret conversations with more than two devices use the Signal Pro-
tocol’s Group Messaging protocol.
All messages have a Sender and at least two Receivers. Prior to
sending to a multi-device conversation Sender must have a pairwise
channel with every Receiver. Sender also generates a SCK and SSK,
and sends them along its pairwise channel to each Receiver.
Each multi-device message is encrypted with AES·CBC and signed
by the SSK. The unique SMK is derived from the SCK similarly to the
pairwise channel:
SMK = HKDF(SCK)
For subsequent messages the Sender ratchets the SCK using HKDF
SCK0 = HKDF(SCK)
messenger secret conversations technical whitepaper 9
and uses each subsequent SCK0 key to derive SMK and SSK. This
approach provides forward secrecy, as earlier SCKs and SMKs cannot
be calculated from the current state.
When a new device is added to a secret conversation, each other
device will send the new device their latest SCK upon sending their
next message. When a device is removed however, each device will
generate a new SCK. This ensures that the necessary key material is
restricted to the devices within the thread.
Attachments
If a message includes attachments, such as images or videos, they
are encrypted and uploaded to Facebook. For each attachment, the
sender:
Stickers
Conversation Metadata
During a secret conversation, devices generate metadata such as de-
livery and read receipts to indicate successful message transmission
and display, respectively. Conversation metadata such as delivery
and read receipts do not contain message plaintext and are not end-
to-end encrypted.
Key Verification
Abuse Reporting
Franking
TF = HMAC·SHA256(NF , M)
RF = HMAC·SHA256(KF , TF kcontext)
Both TF and RF are sent to the recipient along with the encrypted
message. The recipient decrypts the ciphertext, parses the resulting
plaintext to obtain NF , and verifies the structure of TF prior to dis-
playing the message. If TF is not verified then the recipient discards
the message without displaying it. The recipient stores the message
M, NF , TF , RF and context in its local storage.
Conclusion