Movatterモバイル変換


[0]ホーム

URL:



Internet-DraftMLSOctober 2021
Barnes, et al.Expires 14 April 2022[Page]
Workgroup:
Network Working Group
Internet-Draft:
draft-ietf-mls-protocol-12
Published:
Intended Status:
Informational
Expires:
Authors:
R. Barnes
Cisco
B. Beurdouche
Inria & Mozilla
R. Robert
J. Millican
Facebook
E. Omara
Google
K. Cohn-Gordon
University of Oxford

The Messaging Layer Security (MLS) Protocol

Abstract

Messaging applications are increasingly making use of end-to-endsecurity mechanisms to ensure that messages are only accessible tothe communicating endpoints, and not to any servers involved in deliveringmessages. Establishing keys to provide such protections ischallenging for group chat settings, in which more than twoclients need to agree on a key but may not be online at the sametime. In this document, we specify a key establishmentprotocol that provides efficient asynchronous group key establishmentwith forward secrecy and post-compromise security for groupsin size ranging from two to thousands.

Discussion Venues

This note is to be removed before publishing as an RFC.

Source for this draft and an issue tracker can be found athttps://github.com/mlswg/mls-protocol.

Status of This Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is athttps://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."

This Internet-Draft will expire on 14 April 2022.

Copyright Notice

Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved.

This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.

Table of Contents

1.Introduction

DISCLAIMER: This is a work-in-progress draft of MLS and has not yetseen significant security analysis. It should not be used as a basisfor building production systems.

RFC EDITOR: PLEASE REMOVE THE FOLLOWING PARAGRAPH The source forthis draft is maintained in GitHub. Suggested changes should besubmitted as pull requests at https://github.com/mlswg/mls-protocol.Instructions are on that page as well. Editorial changes can bemanaged in GitHub, but any substantive change should be discussed onthe MLS mailing list.

A group of users who want to send each other encrypted messages needsa way to derive shared symmetric encryption keys. For two parties,this problem has been studied thoroughly, with the Double Ratchetemerging as a common solution[doubleratchet][signal].Channels implementing the Double Ratchet enjoy fine-grained forward secrecyas well as post-compromise security, but are nonetheless efficientenough for heavy use over low-bandwidth networks.

For a group of size greater than two, a common strategy is tounilaterally broadcast symmetric "sender" keys over existing sharedsymmetric channels, and then for each member to send messages to thegroup encrypted with their own sender key. Unfortunately, while thisimproves efficiency over pairwise broadcast of individual messages andprovides forward secrecy (with the addition of a hash ratchet),it is difficult to achieve post-compromise security withsender keys. An adversary who learns a sender key can often indefinitely andpassively eavesdrop on that member's messages. Generating anddistributing a new sender key provides a form of post-compromisesecurity with regard to that sender. However, it requirescomputation and communications resources that scale linearly withthe size of the group.

In this document, we describe a protocol based on tree structuresthat enable asynchronous group keying with forward secrecy andpost-compromise security. Based on earlier work on "asynchronousratcheting trees"[art], the protocol presented here uses anasynchronous key-encapsulation mechanism for tree structures.This mechanism allows the members of the group to derive and updateshared keys with costs that scale as the log of the group size.

1.1.Change Log

RFC EDITOR PLEASE DELETE THIS SECTION.

draft-12

  • Use the GroupContext to derive the joiner_secret (*)
  • Make PreSharedKeys non optional in GroupSecrets (*)
  • Update name for this particular key (*)
  • Truncate tree size on removal (*)
  • Use HPKE draft-08 (*)
  • Clarify requirements around identity in MLS groups (*)
  • Signal the intended wire format for MLS messages (*)
  • Inject GroupContext as HPKE info instead of AAD (*)
  • Clarify extension handling and make extension updatable (*)
  • Improve extensibility of Proposals (*)
  • Constrain proposal in External Commit (*)
  • Remove the notion of a 'leaf index' (*)
  • Add group_context_extensions proposal ID (*)
  • Add RequiredCapabilities extension (*)
  • Use cascaded KDF instead of concatenation to consolidate PSKs (*)
  • Use key package hash to index clients in message structs (*)
  • Don't require PublicGroupState for external init (*)
  • Make ratchet tree section clearer.
  • Handle non-member sender cases in MLSPlaintextTBS
  • Clarify encoding of signatures with NIST curves
  • Remove OPEN ISSUEs and TODOs
  • Normalize the description of the zero vector

draft-11

  • Include subtree keys in parent hash (*)
  • Pin HPKE to draft-07 (*)
  • Move joiner secret to the end of the first key schedule epoch (*)
  • Add an AppAck proposal
  • Make initializations of transcript hashes consistent

draft-10

  • Allow new members to join via an external Commit (*)
  • Enable proposals to be sent inline in a Commit (*)
  • Re-enable constant-time Add (*)
  • Change expiration extension to lifetime extension (*)
  • Make the tree in the Welcome optional (*)
  • PSK injection, re-init, sub-group branching (*)
  • Require the initial init_secret to be a random value (*)
  • Remove explicit sender data nonce (*)
  • Do not encrypt to joiners in UpdatePath generation (*)
  • Move MLSPlaintext signature under the confirmation tag (*)
  • Explicitly authenticate group membership with MLSPLaintext (*)
  • Clarify X509Credential structure (*)
  • Remove uneeded interim transcript hash from GroupInfo (*)
  • IANA considerations
  • Derive an authentication secret
  • Use Extract/Expand from HPKE KDF
  • Clarify that application messages MUST be encrypted

draft-09

  • Remove blanking of nodes on Add (*)
  • Change epoch numbers to uint64 (*)
  • Add PSK inputs (*)
  • Add key schedule exporter (*)
  • Sign the updated direct path on Commit, using "parent hashes" and onesignature per leaf (*)
  • Use structured types for external senders (*)
  • Redesign Welcome to include confirmation and use derived keys (*)
  • Remove ignored proposals (*)
  • Always include an Update with a Commit (*)
  • Add per-message entropy to guard against nonce reuse (*)
  • Use the same hash ratchet construct for both application and handshake keys (*)
  • Add more ciphersuites
  • Use HKDF to derive key pairs (*)
  • Mandate expiration of ClientInitKeys (*)
  • Add extensions to GroupContext and flesh out the extensibility story (*)
  • Rename ClientInitKey to KeyPackage

draft-08

  • Change ClientInitKeys so that they only refer to one ciphersuite (*)
  • Decompose group operations into Proposals and Commits (*)
  • Enable Add and Remove proposals from outside the group (*)
  • Replace Init messages with multi-recipient Welcome message (*)
  • Add extensions to ClientInitKeys for expiration and downgrade resistance (*)
  • Allow multiple Proposals and a single Commit in one MLSPlaintext (*)

draft-07

  • Initial version of the Tree based Application Key Schedule (*)
  • Initial definition of the Init message for group creation (*)
  • Fix issue with the transcript used for newcomers (*)
  • Clarifications on message framing and HPKE contexts (*)

draft-06

  • Reorder blanking and update in the Remove operation (*)
  • Rename the GroupState structure to GroupContext (*)
  • Rename UserInitKey to ClientInitKey
  • Resolve the circular dependency that draft-05 introduced in theconfirmation MAC calculation (*)
  • Cover the entire MLSPlaintext in the transcript hash (*)

draft-05

  • Common framing for handshake and application messages (*)
  • Handshake message encryption (*)
  • Convert from literal state to a commitment via the "tree hash" (*)
  • Add credentials to the tree and remove the "roster" concept (*)
  • Remove the secret field from tree node values

draft-04

  • Updating the language to be similar to the Architecture document
  • ECIES is now renamed in favor of HPKE (*)
  • Using a KDF instead of a Hash in TreeKEM (*)

draft-03

  • Added ciphersuites and signature schemes (*)
  • Re-ordered fields in UserInitKey to make parsing easier (*)
  • Fixed inconsistencies between Welcome and GroupState (*)
  • Added encryption of the Welcome message (*)

draft-02

  • Removed ART (*)
  • Allowed partial trees to avoid double-joins (*)
  • Added explicit key confirmation (*)

draft-01

  • Initial description of the Message Protection mechanism. (*)
  • Initial specification proposal for the Application Key Scheduleusing the per-participant chaining of the Application Secret design. (*)
  • Initial specification proposal for an encryption mechanism to protectApplication Messages using an AEAD scheme. (*)
  • Initial specification proposal for an authentication mechanismof Application Messages using signatures. (*)
  • Initial specification proposal for a padding mechanism to improvingprotection of Application Messages against traffic analysis. (*)
  • Inversion of the Group Init Add and Application Secret derivationsin the Handshake Key Schedule to be ease chaining in case we switchdesign. (*)
  • Removal of the UserAdd construct and split of GroupAdd into Addand Welcome messages (*)
  • Initial proposal for authenticating handshake messages by signingover group state and including group state in the key schedule (*)
  • Added an appendix with example code for tree math
  • Changed the ECIES mechanism used by TreeKEM so that it uses noncesgenerated from the shared secret

draft-00

  • Initial adoption of draft-barnes-mls-protocol-01 as a WG item.

2.Terminology

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT","SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and"OPTIONAL" in this document are to be interpreted as described inBCP 14[RFC2119][RFC8174] when, and only when, they appear in allcapitals, as shown here.

Client:

An agent that uses this protocol to establish shared cryptographicstate with other clients. A client is defined by thecryptographic keys it holds.

Group:

A collection of clients with shared cryptographic state.

Member:

A client that is included in the shared state of a group, hencehas access to the group's secrets.

Key Package:

A signed object describing a client's identity and capabilities, and includinga hybrid public-key encryption (HPKE[I-D.irtf-cfrg-hpke]) public key thatcan be used to encrypt to that client.

Initialization Key (InitKey):

A key package that is prepublished by a client, which other clients can use tointroduce the client to a new group.

Signature Key:

A signing key pair used to authenticate the sender of a message.

Terminology specific to tree computations is described inSection 5.

We use the TLS presentation language[RFC8446] todescribe the structure of protocol messages.

3.Basic Assumptions

This protocol is designed to execute in the context of a Service Provider (SP)as described in[I-D.ietf-mls-architecture]. In particular, we assumethe SP provides the following services:

  • A signature key provider which allows clients to authenticateprotocol messages in a group.
  • A broadcast channel, for each group, which will relay a message to all membersof a group. For the most part, we assume that this channel delivers messagesin the same order to all participants. (SeeSection 13 for furtherconsiderations.)
  • A directory to which clients can publish key packages and downloadkey packages for other participants.

4.Protocol Overview

The goal of this protocol is to allow a group of clients to exchangeconfidential and authenticated messages. It does so by deriving a sequenceof secrets and keys known only to members. Those should be secret against anactive network adversary and should have both forward secrecy andpost-compromise security with respect to compromise of any members.

We describe the information stored by each client asstate, which includesboth public and private data. An initial state is set up by a group creator,which is a group containing only itself. The creator then sendsAddproposals for each client in the initial set of members, followed by aCommitmessage which incorporates all of theAdds into the group state. Finally, thegroup creator generates aWelcome message corresponding to the Commit andsends this directly to all the new members, who can use the informationit contains to set up their own group state and derive a sharedsecret. Members exchange Commit messages for post-compromise security, to add newmembers, and to remove existing members. These messages produce new sharedsecrets which are causally linked to their predecessors, forming a logicalDirected Acyclic Graph (DAG) of states.

The protocol algorithms we specify here follow. Each algorithm specifiesboth (i) how a client performs the operation and (ii) how other clientsupdate their state based on it.

There are three major operations in the lifecycle of a group:

  • Adding a member, initiated by a current member;
  • Updating the leaf secret of a member;
  • Removing a member.

Each of these operations is "proposed" by sending a message of the correspondingtype (Add / Update / Remove). The state of the group is not changed, however,until a Commit message is sent to provide the group with fresh entropy. In thissection, we show each proposal being committed immediately, but in more advanceddeployment cases an application might gather several proposals beforecommitting them all at once.

Before the initialization of a group, clients publish InitKeys (as KeyPackageobjects) to a directory provided by the Service Provider.

                                                               GroupA                B                C            Directory       Channel|                |                |                |              || KeyPackageA    |                |                |              ||------------------------------------------------->|              ||                |                |                |              ||                | KeyPackageB    |                |              ||                |-------------------------------->|              ||                |                |                |              ||                |                | KeyPackageC    |              ||                |                |--------------->|              ||                |                |                |              |

When a client A wants to establish a group with B and C, it first initializes agroup state containing only itself and downloads KeyPackages for B and C. Foreach member, A generates an Add and Commit message adding that member, andbroadcasts them to the group. It also generates a Welcome message and sends thisdirectly to the new member (there's no need to send it to the group). Only afterA has received its Commit message back from the server does it update its stateto reflect the new member's addition.

Upon receiving the Welcome message, the new member will be able to read and sendnew messages to the group. Messages received before the client has joined thegroup are ignored.

                                                               GroupA              B              C          Directory            Channel|              |              |              |                   ||         KeyPackageB, KeyPackageC           |                   ||<-------------------------------------------|                   ||state.init()  |              |              |                   ||              |              |              |                   ||              |              |              | Add(A->AB)        ||              |              |              | Commit(Add)       ||--------------------------------------------------------------->||              |              |              |                   ||  Welcome(B)  |              |              |                   ||------------->|state.join()  |              |                   ||              |              |              |                   ||              |              |              | Add(A->AB)        ||              |              |              | Commit(Add)       ||<---------------------------------------------------------------||state.add(B)  |              |              |                   ||              |              |              |                   ||              |              |              |                   ||              |              |              | Add(AB->ABC)      ||              |              |              | Commit(Add)       ||--------------------------------------------------------------->||              |              |              |                   ||              |  Welcome(C)  |              |                   ||---------------------------->|state.join()  |                   ||              |              |              |                   ||              |              |              | Add(AB->ABC)      ||              |              |              | Commit(Add)       ||<---------------------------------------------------------------||state.add(C)  |<------------------------------------------------||              |state.add(C)  |              |                   ||              |              |              |                   |

Subsequent additions of group members proceed in the same way. Anymember of the group can download a KeyPackage for a new clientand broadcast an Add message that the current group can use to updatetheir state, and a Welcome message that the new client can use toinitialize its state and join the group.

To enforce the forward secrecy and post-compromise security of messages,each member periodically updates their leaf secret.Any member can update this information at any time by generating a freshKeyPackage and sending an Update message followed by a Commit message.Once all members have processed both, the group's secrets will be unknown to anattacker that had compromised the sender's prior leaf secret.

Update messages should be sent at regular intervals of time as long as the groupis active, and members that don't update should eventually be removed from thegroup. It's left to the application to determine an appropriate amount of timebetween Updates.

                                                          GroupA              B     ...      Z          Directory        Channel|              |              |              |              ||              | Update(B)    |              |              ||              |------------------------------------------->|| Commit(Upd)  |              |              |              ||---------------------------------------------------------->||              |              |              |              ||              |              |              | Update(B)    ||              |              |              | Commit(Upd)  ||<----------------------------------------------------------||state.upd(B)  |<-------------------------------------------||              |state.upd(B)  |<----------------------------||              |              |state.upd(B)  |              ||              |              |              |              |

Members are removed from the group in a similar way.Any member of the group can send a Remove proposal followed by aCommit message, which adds new entropy to the group statethat's known to all except the removed member.Note that this does not necessarily imply that any memberis actually allowed to evict other members; groups canenforce access control policies on top of thesebasic mechanism.

                                                          GroupA              B     ...      Z          Directory       Channel|              |              |              |              ||              |              | Remove(B)    |              ||              |              | Commit(Rem)  |              ||              |              |---------------------------->||              |              |              |              ||              |              |              | Remove(B)    ||              |              |              | Commit(Rem)  ||<----------------------------------------------------------||state.rem(B)  |              |<----------------------------||              |              |state.rem(B)  |              ||              |              |              |              ||              |              |              |              |

5.Ratchet Trees

The protocol uses "ratchet trees" for deriving shared secrets amonga group of clients.

5.1.Tree Computation Terminology

Trees consist ofnodes. A node is aleaf if it has no children, and aparent otherwise; note that allparents in our trees have preciselytwo children, aleft child and aright child. A node is therootof a tree if it has no parents, andintermediate if it has bothchildren and parents. Thedescendants of a node are that node, itschildren, and the descendants of its children, and we say a treecontains a node if that node is a descendant of the root of thetree. Nodes aresiblings if they share the same parent.

Asubtree of a tree is the tree given by the descendants of anynode, thehead of the subtree. Thesize of a tree or subtree is thenumber of leaf nodes it contains. For a given parent node, itsleftsubtree is the subtree with its left child as head (respectivelyright subtree).

All trees used in this protocol are left-balanced binary trees. Abinary tree isfull (andbalanced) if its size is a power oftwo and for any parent node in the tree, its left and right subtreeshave the same size.

A binary tree isleft-balanced if for everyparent, either the parent is balanced, or the left subtree of thatparent is the largest full subtree that could be constructed fromthe leaves present in the parent's own subtree.Given a list ofn items, there is a unique left-balancedbinary tree structure with these elements as leaves.

(Note that left-balanced binary trees are the same structure that isused for the Merkle trees in the Certificate Transparency protocol[I-D.ietf-trans-rfc6962-bis].)

Thedirect path of a root is the empty list, and of any other nodeis the concatenation of that node's parent along with the parent's direct path.Thecopath of a node is the node's sibling concatenated with the list ofsiblings of all the nodes in its direct path, excluding the root.

For example, in the below tree:

  • The direct path of C is (CD, ABCD, ABCDEFG)
  • The copath of C is (D, AB, EFG)
              7 = root        ______|______       /             \      3              11    __|__           __|   /     \         /   \  1       5       9     | / \     / \     / \    |A   B   C   D   E   F   G                    1 1 10 1 2 3 4 5 6 7 8 9 0 1 2

Each node in the tree is assigned anindex, starting at zero andrunning from left to right. A node is a leaf node if and only if ithas an even index. The node indices for the nodes in the above treeare as follows:

A tree withn leaves has2*n - 1 nodes. For example, the above tree has 7leaves (A, B, C, D, E, F, G) and 13 nodes. The root of a tree withn leavesis always the node with index2^k - 1, wherek is the largest number suchthat2^k < n.

5.2.Ratchet Tree Nodes

A particular instance of a ratchet tree is defined by the same parameters thatdefine an instance of HPKE, namely:

  • A Key Encapsulation Mechanism (KEM), including aDeriveKeyPair function thatcreates a key pair for the KEM from a symmetric secret
  • A Key Derivation Function (KDF), includingExtract andExpand functions
  • An AEAD encryption scheme

Each node in a ratchet tree contains up to five values:

  • A private key (only within the member's direct path, see below)
  • A public key
  • An ordered list of node indices for "unmerged" leaves (seeSection 5.3)
  • A credential (only for leaf nodes)
  • A hash of certain information about the node's parent, as of the last time thenode was changed (seeSection 7.5).

The conditions under which each of these values must or must not bepresent are laid out inSection 5.3.

A node in the tree may also beblank, indicating that no value ispresent at that node. Theresolution of a node is an ordered listof non-blank nodes that collectively cover all non-blank descendantsof the node.

  • The resolution of a non-blank node comprises the node itself,followed by its list of unmerged leaves, if any
  • The resolution of a blank leaf node is the empty list
  • The resolution of a blank intermediate node is the result ofconcatenating the resolution of its left child with the resolutionof its right child, in that order

For example, consider the following tree, where the "_" characterrepresents a blank node and unmerged leaves are indicated in squarebrackets:

      _    __|__   /     \  _       5[C] / \     / \A   _   C   D0 1 2 3 4 5 6

In this tree, we can see all of the above rules in play:

  • The resolution of node 5 is the list [CD, C]
  • The resolution of node 2 is the empty list []
  • The resolution of node 3 is the list [A, CD, C]

Every node, regardless of whether the node is blank or populated, hasa correspondinghash that summarizes the contents of the subtreebelow that node. The rules for computing these hashes are describedinSection 7.6.

5.3.Views of a Ratchet Tree

We generally assume that each participant maintains a complete andup-to-date view of the public state of the group's ratchet tree,including the public keys for all nodes and the credentialsassociated with the leaf nodes.

No participant in an MLS group knows the private key associated withevery node in the tree. Instead, each member is assigned to a leaf of the tree,which determines the subset of private keys it knows. Thecredential stored at that leaf is one provided by the member.

In particular, MLS maintains the members' views of the tree in sucha way as to maintain thetree invariant:

The private key for a node in the tree is known to a member ofthe group only if that member's leaf is a descendant ofthe node.

In other words, if a node is not blank, then it holds a public key.The corresponding private key is known only to members occupyingleaves below that node.

The reverse implication is not true: A member may not know the private keys ofall the intermediate nodes they're below. Such a member has anunmerged leaf.Encrypting to an intermediate node requires encrypting to the node's public key,as well as the public keys of all the unmerged leaves below it. A leaf isunmerged when it is first added, because the process of adding the leaf does notgive it access to all of the nodes above it in the tree. Leaves are "merged" asthey receive the private keys for nodes, as described inSection 5.4.

5.4.Ratchet Tree Evolution

A member of an MLS group advances the key schedule to provide forward secrecyand post-compromise security by providing the group with fresh key material tobe added into the group's shared secret.To do so, one member of the group generates fresh keymaterial, applies it to their local tree state, and then sends this key materialto other members in the group via an UpdatePath message (seeSection 7.8) .All other group members then apply the key material in the UpdatePath to theirown local tree state to derive the group's now-updated shared secret.

To begin, the generator of the UpdatePath updates its leafKeyPackage and its direct path to the root with new secret values. TheHPKE leaf public key within the KeyPackage MUST be derived from a freshlygenerated HPKE secret key to provide post-compromise security.

The generator of the UpdatePath starts by sampling a fresh random value called"leaf_secret", and uses the leaf_secret to generate their leaf HPKE key pair(seeSection 7) and to seed a sequence of "path secrets", one for eachancestor of its leaf. In this setting,path_secret[0] refers to the node directly above the leaf,path_secret[1] for its parent, and so on. At each step, the pathsecret is used to derive a new secret value for the correspondingnode, from which the node's key pair is derived.

leaf_node_secret = DeriveSecret(leaf_secret, "node")path_secret[0] = DeriveSecret(leaf_secret, "path")path_secret[n] = DeriveSecret(path_secret[n-1], "path")node_secret[n] = DeriveSecret(path_secret[n], "node")leaf_priv, leaf_pub = KEM.DeriveKeyPair(leaf_node_secret)node_priv[n], node_pub[n] = KEM.DeriveKeyPair(node_secret[n])

For example, suppose there is a group with four members, with C an unmerged leafat node 5:

      3    __|__   /     \  1       5[C] / \     / \A   B   C   D0 1 2 3 4 5 6

If member B subsequently generates an UpdatePath based on a secret"leaf_secret", then it would generate the following sequenceof path secrets:

path_secret[1] --> node_secret[1] --> node_priv[1], node_pub[1]     ^     |path_secret[0] --> node_secret[0] --> node_priv[0], node_pub[0]     ^     |leaf_secret    --> leaf_node_secret --> leaf_priv, leaf_pub                                     ~> leaf_key_package

After applying the UpdatePath, the tree will have the following structure, wherelp andnp[i] represent the leaf_priv and node_priv values generated asdescribed above:

    np[1] -> 3           __|__          /     \np[0] -> 1       5[C]        / \     / \       A   B   C   D           ^           |           lp       0 1 2 3 4 5 6

After performing these operations, the generator of the UpdatePath MUSTdelete the leaf_secret.

5.5.Synchronizing Views of the Tree

After generating fresh key material and applying it to ratchet forward theirlocal tree state as described in the prior section, the generator must broadcastthis update to other members of the group in a Commit message, whoapply it to keep their local views of the tree insync with the sender's. More specifically, when a member commits a change tothe tree (e.g., to add or remove a member), it transmits an UpdatePathcontaining a set of public keys and encrypted path secretsfor intermediate nodes in the direct path of its leaf. Theother members of the group use these values to updatetheir view of the tree, aligning their copy of the tree to thesender's.

An UpdatePath containsthe following information for each node in the direct path of thesender's leaf, including the root:

  • The public key for the node
  • Zero or more encrypted copies of the path secret corresponding tothe node

The path secret value for a given node is encrypted for the subtreecorresponding to the parent's non-updated child, that is, the childon the copath of the sender's leaf node.There is one encryption of the path secret to each public key in the resolutionof the non-updated child.

The recipient of an UpdatePath processes it with the following steps:

  1. Compute the updated path secrets.

    • Identify a node in the direct path for which the local memberis in the subtree of the non-updated child.
    • Identify a node in the resolution of the copath node forwhich this node has a private key.
    • Decrypt the path secret for the parent of the copath node usingthe private key from the resolution node.
    • Derive path secrets for ancestors of that node using thealgorithm described above.
    • The recipient SHOULD verify that the received public keys agreewith the public keys derived from the new path_secret values.
  2. Merge the updated path secrets into the tree.

    • For all updated nodes,

      • Replace the public key for each node with the received public key.
      • Set the list of unmerged leaves to the empty list.
      • Store the updated hash of the node's parent (represented as a ParentNodestruct), going from root to leaf, so that each hash incorporates all thenodes above it. The root node always has a zero-length hash for thisvalue.
    • For nodes where an updated path secret was computed in step 1,compute the corresponding node key pair and replace the valuesstored at the node with the computed values.

For example, in order to communicate the example update described inthe previous section, the sender would transmit the followingvalues:

Table 1
Public KeyCiphertext(s)
node_pub[1]E(pk(5), path_secret[1]), E(pk(C), path_secret[1])
node_pub[0]E(pk(A), path_secret[0])

In this table, the value pk(ns[X]) represents the public keyderived from the node secret X, whereas pk(X) represents the public leaf keyfor user X. The value E(K, S) representsthe public-key encryption of the path secret S to thepublic key K (using HPKE).

After processing the update, each recipient MUST delete outdated key material,specifically:

  • The path secrets used to derive each updated node key pair.
  • Each outdated node key pair that was replaced by the update.

6.Cryptographic Objects

6.1.Ciphersuites

Each MLS session uses a single ciphersuite that specifies thefollowing primitives to be used in group key computations:

  • HPKE parameters:

    • A Key Encapsulation Mechanism (KEM)
    • A Key Derivation Function (KDF)
    • An AEAD encryption algorithm
  • A hash algorithm
  • A signature algorithm

MLS uses draft-08 of HPKE[I-D.irtf-cfrg-hpke] for public-key encryption.TheDeriveKeyPair function associated to the KEM for the ciphersuite mapsoctet strings to HPKE key pairs.

Ciphersuites are represented with the CipherSuite type. HPKE public keysare opaque values in a format defined by the underlyingprotocol (see the Cryptographic Dependencies section of the HPKE specification for moreinformation).

opaque HPKEPublicKey<1..2^16-1>;

The signature algorithm specified in the ciphersuite is the mandatory algorithmto be used for signatures in MLSPlaintext and the tree signatures. It MUST bethe same as the signature algorithm specified in the credential field of theKeyPackage objects in the leaves of the tree (including the InitKeysused to add new members).

The ciphersuites are defined in sectionSection 16.1.

6.2.Credentials

A member of a group authenticates the identities of other participants by meansof credentials issued by some authentication system, like a PKI. Each type ofcredential MUST express the following data in the context of the group it isused with:

  • The public key of a signature key pair matching the SignatureScheme specifiedby the CipherSuite of the group
  • The identity of the holder of the private key

Credentials MAY also include information that allows a relying partyto verify the identity / signing key binding.

Additionally, Credentials SHOULD specify the signature scheme corresponding toeach contained public key.

// See RFC 8446 and the IANA TLS SignatureScheme registryuint16 SignatureScheme;// See IANA registry for registered valuesuint16 CredentialType;struct {    opaque identity<0..2^16-1>;    SignatureScheme signature_scheme;    opaque signature_key<0..2^16-1>;} BasicCredential;struct {    opaque cert_data<0..2^16-1>;} Certificate;struct {    CredentialType credential_type;    select (Credential.credential_type) {        case basic:            BasicCredential;        case x509:            Certificate chain<1..2^32-1>;    };} Credential;

A BasicCredential is a raw, unauthenticated assertion of an identity/keybinding. The format of the key in thepublic_key field is defined by therelevant ciphersuite: the group ciphersuite for a credential in a ratchet tree,the KeyPackage ciphersuite for a credential in a KeyPackage object.

For X509Credential, each entry in the chain represents a single DER-encodedX509 certificate. The chain is ordered such that the first entry (chain[0])is the end-entity certificate and each subsequent certificate in the chainMUST be the issuer of the previous certificate. The algorithm for thepublic_key in the end-entity certificate MUST match the relevantciphersuite.

For ciphersuites using Ed25519 or Ed448 signature schemes, the public key is inthe format specified[RFC8032]. For ciphersuites using ECDSA with the NISTcurves P-256 or P-521, the public key is the output of the uncompressedElliptic-Curve-Point-to-Octet-String conversion according to[SECG].

The signatures used throughout this document are encoded as specified in[RFC8446]. In particular, ECDSA signatures are DER-encoded and EdDSA signaturesare defined as the concatenation ofr ands as specified in[RFC8032].

Note that each new credential that has not already been validatedby the application MUST be validated against the AuthenticationService.

7.Key Packages

In order to facilitate asynchronous addition of clients to agroup, it is possible to pre-publish key packages thatprovide some public information about a user. KeyPackagestructures provide information about a client that any existingmember can use to add this client to the group asynchronously.

A KeyPackage object specifies a ciphersuite that the client supports, as well asproviding a public key that others can use for key agreement.

Theidentity arising from the credential, together with theendpoint_id inthe KeyPackage serve to uniquely identify a client in a group.

When used as InitKeys, KeyPackages are intended to be used only once and SHOULD NOTbe reused except in case of last resort. (SeeSection 15.4).Clients MAY generate and publish multiple InitKeys tosupport multiple ciphersuites.

KeyPackages contain a public key chosen by the client, which theclient MUST ensure uniquely identifies a given KeyPackage objectamong the set of KeyPackages created by this client.

The value for hpke_init_key MUST be a public key for the asymmetricencryption scheme defined by cipher_suite. The whole structureis signed using the client's signature key. A KeyPackage objectwith an invalid signature field MUST be considered malformed.The input to the signature computation comprises all of the fieldsexcept for the signature field.

enum {    reserved(0),    mls10(1),    (255)} ProtocolVersion;// See IANA registry for registered valuesuint16 ExtensionType;struct {    ExtensionType extension_type;    opaque extension_data<0..2^32-1>;} Extension;struct {    ProtocolVersion version;    CipherSuite cipher_suite;    HPKEPublicKey hpke_init_key;    opaque endpoint_id<0..255>;    Credential credential;    Extension extensions<8..2^32-1>;    opaque signature<0..2^16-1>;} KeyPackage;

KeyPackage objects MUST contain at least two extensions, one of typecapabilities, and one oftypelifetime. Thecapabilities extensionallow MLS session establishment to be safe from downgrade attacks on theparameters described (as discussed inSection 10), while still only advertisingone version / ciphersuite per KeyPackage.

As theKeyPackage is a structure which is stored in the RatchetTree and updated depending on the evolution of this tree, eachmodification of its content MUST be reflected by a change of itssignature. This allow other members to control the validity of the KeyPackageat any time and in particular in the case of a newcomer joining the group.

7.1.Key Package IDs

When it is necessary to refer to a specific KeyPackage, protocol messagesincorporate a KeyPackageID:

struct { opaque key_package_hash<0..255>;} KeyPackageID

This value is the hash of the KeyPackage, using the hash indicated by thecipher_suite field. KeyPackage hashes are used in a Welcome message toindicate which KeyPackage is being used to include the new member. Since membersof a group are uniquely identified by their leaf KeyPackages, messages within agroup use the hash of this key package to refer to group members, e.g., tospecify the target of a Remove proposal or the signer of an MLSPlaintext.

7.2.Client Capabilities

Thecapabilities extension indicates what protocol versions, ciphersuites,protocol extensions, and non-default proposal types are supported by a client.Proposal types defined in this document are considered "default" and thus neednot be listed.

struct {    ProtocolVersion versions<0..255>;    CipherSuite ciphersuites<0..255>;    ExtensionType extensions<0..255>;    ProposalType proposals<0..255>;} Capabilities;

This extension MUST be always present in a KeyPackage. Extensions that appearin theextensions field of a KeyPackage MUST be included in theextensionsfield of thecapabilities extension.

7.3.Lifetime

Thelifetime extension represents the times between which clients willconsider a KeyPackage valid. This time is represented as an absolute time,measured in seconds since the Unix epoch (1970-01-01T00:00:00Z). A client MUSTNOT use the data in a KeyPackage for any processing before thenot_beforedate, or after thenot_after date.

uint64 not_before;uint64 not_after;

Applications MUST define a maximum total lifetime that is acceptable for aKeyPackage, and reject any KeyPackage where the total lifetime is longer thanthis duration.

This extension MUST always be present in a KeyPackage.

7.4.KeyPackage Identifiers

Within MLS, a KeyPackage is identified by its hash (see, e.g.,Section 11.2.2). Theexternal_key_id extension allows applications to addan explicit, application-defined identifier to a KeyPackage.

opaque external_key_id<0..2^16-1>;

7.5.Parent Hash

Theparent_hash extension carries information to authenticate the structure ofthe tree, as described below.

opaque parent_hash<0..255>;

Consider a ratchet tree with a parent node P and children V and S. The parent hashof P changes whenever anUpdatePath object is applied to the ratchet tree alonga path traversing node V (and hence also P). The new "Parent Hash of P (with Co-PathChild S)" is obtained by hashing P'sParentHashInput struct using the resolutionof S to populate theoriginal_child_resolution field. This way, P's Parent Hashfixes the new HPKE public keys of all nodes on the path from P to the root.Furthermore, for each such key PK the hash also binds the set of HPKE public keysto which PK's secret key was encrypted in the commit packet that anounced theUpdatePath object.

struct {    HPKEPublicKey public_key;    opaque parent_hash<0..255>;    HPKEPublicKey original_child_resolution<0..2^32-1>;} ParentHashInput;

The Parent Hash of P with Co-Path Child S is the hash of aParentHashInput objectpopulated as follows. The fieldpublic_key contains the HPKE public key of P. If Pis the root, thenparent_hash is set to a zero-length octet string.Otherwiseparent_hash is the Parent Hash of P's parent with P's sibling as theco-path child.

Finally,original_child_resolution is the array ofHPKEPublicKey values of thenodes in the resolution of S but with theunmerged_leaves of P omitted. Forexample, in the ratchet tree depicted inSection 5.2 theParentHashInput of node 5 with co-path child 4 would contain an emptyoriginal_child_resolution since 4's resolution includes only itself but 4 is alsoan unmerged leaf of 5. Meanwhile, theParentHashInput of node 5 with co-path child6 has an array with one element in it: the HPKE public key of 6.

7.5.1.Using Parent Hashes

The Parent Hash of P appears in three types of structs. If V is itself a parent nodethen P's Parent Hash is stored in theparent_hash fields of both V'sParentHashInput struct and V'sParentNode struct. (TheParentNode struct isused to encapsulate all public information about V that must be conveyed to a newmember joining the group as well as to define the Tree Hash of node V.)

If, on the other hand, V is a leaf and its KeyPackage contains theparent_hashextension then the Parent Hash of P (with V's sibling as co-path child) is stored inthat field. In particular, the extension MUST be present in theleaf_key_packagefield of anUpdatePath object. (This way, the signature of such a KeyPackage alsoserves to attest to which keys the group member introduced into the ratchet tree andto whom the corresponding secret keys were sent. This helps prevent malicious insidersfrom constructing artificial ratchet trees with a node V whose HPKE secret key isknown to the insider yet where the insider isn't assigned a leaf in the subtree rootedat V. Indeed, such a ratchet tree would violate the tree invariant.)

7.5.2.Verifying Parent Hashes

To this end, when processing a Commit message clients MUST recompute theexpected value ofparent_hash for the committer's new leaf and verify that itmatches theparent_hash value in the suppliedleaf_key_package. Moreover, whenjoining a group, new members MUST authenticate each non-blank parent node P. A parentnode P is authenticated by performing the following check:

  • Let L and R be the left and right children of P, respectively
  • If L.parent_hash is equal to the Parent Hash of P with Co-Path Child R, the check passes
  • If R is blank, replace R with its left child until R is either non-blank or a leaf node
  • If R is a blank leaf node, the check fails
  • If R.parent_hash is equal to the Parent Hash of P with Co-Path Child L, the check passes
  • Otherwise, the check fails

The left-child recursion under the right child of P is necessary because the expansion ofthe tree to the right due to Add proposals can cause blank nodes to be interposedbetween a parent node and its right child.

7.6.Tree Hashes

To allow group members to verify that they agree on the public cryptographic stateof the group, this section defines a scheme for generating a hash value (calledthe "tree hash") that represents the contents of the group's ratchet tree and themembers' KeyPackages. The tree hash of a tree is the tree hash of its root node,which we define recursively, starting with the leaves.

As some nodes may be blank while others contain data we use the following structto include data if present.

struct {    uint8 present;    select (present) {        case 0: struct{};        case 1: T value;    }} optional<T>;

The tree hash of a leaf node is the hash of leaf'sLeafNodeHashInput object whichmight include a Key Package depending on whether or not it is blank.

struct {    uint32 node_index;    optional<KeyPackage> key_package;} LeafNodeHashInput;

Now the tree hash of any non-leaf node is recursively defined to be the hash ofitsParentNodeTreeHashInput. This includes an optionalParentNodeobject depending on whether the node is blank or not.

struct {    HPKEPublicKey public_key;    opaque parent_hash<0..255>;    uint32 unmerged_leaves<0..2^32-1>;} ParentNode;struct {    uint32 node_index;    optional<ParentNode> parent_node;    opaque left_hash<0..255>;    opaque right_hash<0..255>;} ParentNodeTreeHashInput;

Theleft_hash andright_hash fields hold the tree hashes of the node'sleft and right children, respectively.

7.7.Group State

Each member of the group maintains a GroupContext object thatsummarizes the state of the group:

struct {    opaque group_id<0..255>;    uint64 epoch;    opaque tree_hash<0..255>;    opaque confirmed_transcript_hash<0..255>;    Extension extensions<0..2^32-1>;} GroupContext;

The fields in this state have the following semantics:

  • Thegroup_id field is an application-defined identifier for thegroup.
  • Theepoch field represents the current version of the group key.
  • Thetree_hash field contains a commitment to the contents of thegroup's ratchet tree and the credentials for the members of thegroup, as described inSection 7.6.
  • Theconfirmed_transcript_hash field contains a running hash overthe messages that led to this state.

When a new member is added to the group, an existing member of thegroup provides the new member with a Welcome message. The Welcomemessage provides the information the new member needs to initializeits GroupContext.

Different changes to the group will have different effects on the group state.These effects are described in their respective subsections ofSection 11.1.The following general rules apply:

  • Thegroup_id field is constant
  • Theepoch field increments by one for each Commit message thatis processed
  • Thetree_hash is updated to represent the current tree andcredentials
  • Theconfirmed_transcript_hash is updated with the data for anMLSPlaintext message encoding a Commit message in two parts:
struct {    WireFormat wire_format;    opaque group_id<0..255>;    uint64 epoch;    Sender sender;    opaque authenticated_data<0..2^32-1>;    ContentType content_type = commit;    Commit commit;    opaque signature<0..2^16-1>;} MLSPlaintextCommitContent;struct {    optional<MAC> confirmation_tag;} MLSPlaintextCommitAuthData;interim_transcript_hash_[0] = ""; // zero-length octet stringconfirmed_transcript_hash_[n] =    Hash(interim_transcript_hash_[n] ||        MLSPlaintextCommitContent_[n]);interim_transcript_hash_[n+1] =    Hash(confirmed_transcript_hash_[n] ||        MLSPlaintextCommitAuthData_[n]);

Thus theconfirmed_transcript_hash field in a GroupContext object represents atranscript over the whole history of MLSPlaintext Commit messages, up to theconfirmation tag field in the current MLSPlaintext message. The confirmationtag is then included in the transcript for the next epoch. The interimtranscript hash is computed by new members using the confirmation tag in theGroupInfo struct, and enables existing members to incorporate a Commit messageinto the transcript without having to store the whole MLSPlaintextCommitAuthDatastructure.

As shown above, when a new group is created, theinterim_transcript_hash fieldis set to the zero-length octet string.

7.8.Update Paths

As described inSection 11.2, each MLS Commit message may optionallytransmit a KeyPackage leaf and node values along its direct path.The path contains a public key and encrypted secret value for allintermediate nodes in the path above the leaf. The path is orderedfrom the closest node to the leaf to the root; each node MUST be theparent of its predecessor.

struct {    opaque kem_output<0..2^16-1>;    opaque ciphertext<0..2^16-1>;} HPKECiphertext;struct {    HPKEPublicKey public_key;    HPKECiphertext encrypted_path_secret<0..2^32-1>;} UpdatePathNode;struct {    KeyPackage leaf_key_package;    UpdatePathNode nodes<0..2^32-1>;} UpdatePath;

For eachUpdatePathNode, the resolution of the corresponding copath node MUSTbe filtered by removing all new leaf nodes added as part of this MLS Commitmessage. The number of ciphertexts in theencrypted_path_secret vector MUST beequal to the length of the filtered resolution, with each ciphertext being theencryption to the respective resolution node.

The HPKECiphertext values are computed as

kem_output, context = SetupBaseS(node_public_key, group_context)ciphertext = context.Seal("", path_secret)

wherenode_public_key is the public key of the node that the pathsecret is being encrypted for, group_context is the current GroupContext objectfor the group, and the functionsSetupBaseS andSeal are defined according to[I-D.irtf-cfrg-hpke].

Decryption is performed in the corresponding way, using the privatekey of the resolution node and the ephemeral public keytransmitted in the message.

8.Key Schedule

Group keys are derived using theExtract andExpand functions from the KDFfor the group's ciphersuite, as well as the functions defined below:

ExpandWithLabel(Secret, Label, Context, Length) =    KDF.Expand(Secret, KDFLabel, Length)Where KDFLabel is specified as:struct {    uint16 length = Length;    opaque label<7..255> = "mls10 " + Label;    opaque context<0..2^32-1> = Context;} KDFLabel;DeriveSecret(Secret, Label) =    ExpandWithLabel(Secret, Label, "", KDF.Nh)

The valueKDF.Nh is the size of an output fromKDF.Extract, in bytes. Inthe below diagram:

  • KDF.Extract takes its salt argument from the top and its IKMargument from the left
  • DeriveSecret takes its Secret argument from the incoming arrow
  • 0 represents an all-zero byte string of lengthKDF.Nh.

When processing a handshake message, a client combines thefollowing information to derive new epoch secrets:

  • The init secret from the previous epoch
  • The commit secret for the current epoch
  • The GroupContext object for current epoch

Given these inputs, the derivation of secrets for an epochproceeds as shown in the following diagram:

                   init_secret_[n-1]                         |                         V    commit_secret -> KDF.Extract                         |                         V                   ExpandWithLabel(., "joiner", GroupContext_[n], KDF.Nh)                         |                         V                    joiner_secret                         |                         Vpsk_secret (or 0) -> KDF.Extract                         |                         +--> DeriveSecret(., "welcome")                         |    = welcome_secret                         |                         V                   ExpandWithLabel(., "epoch", GroupContext_[n], KDF.Nh)                         |                         V                    epoch_secret                         |                         +--> DeriveSecret(., <label>)                         |    = <secret>                         |                         V                   DeriveSecret(., "init")                         |                         V                   init_secret_[n]

A number of secrets are derived from the epoch secret for different purposes:

Table 2
SecretLabel
sender_data_secret"sender data"
encryption_secret"encryption"
exporter_secret"exporter"
authentication_secret"authentication"
external_secret"external"
confirmation_key"confirm"
membership_key"membership"
resumption_secret"resumption"

The "external secret" is used to derive an HPKE key pair whose private key isheld by the entire group:

external_priv, external_pub = KEM.DeriveKeyPair(external_secret)

The public keyexternal_pub can be published as part of thePublicGroupStatestruct in order to allow non-members to join the group using an external commit.

8.1.External Initialization

In addition to initializing a new epoch via KDF invocations as described above,an MLS group can also initialize a new epoch via an asymmetric interaction usingthe external key pair for the previous epoch. This is done when an new memberis joining via an external commit.

In this process, the joiner sends a newinit_secret value to the group usingthe HPKE export method. The joiner then uses thatinit_secret withinformation provided in the PublicGroupState and an external Commit to initializetheir copy of the key schedule for the new epoch.

kem_output, context = SetupBaseS(external_pub, "")init_secret = context.export("MLS 1.0 external init secret", KDF.Nh)

Members of the group receive thekem_output in an ExternalInit proposal andpreform the corresponding calculation to retrieve theinit_secret value.

context = SetupBaseR(kem_output, external_priv, "")init_secret = context.export("MLS 1.0 external init secret", KDF.Nh)

In both cases, theinfo input to HPKE is set to the PublicGroupState for theprevious epoch, encoded using the TLS serialization.

8.2.Pre-Shared Keys

Groups which already have an out-of-band mechanism to generateshared group secrets can inject those into the MLS key schedule to seedthe MLS group secrets computations by this external entropy.

Injecting an external PSK can improve security in the casewhere having a full run of updates across members is too expensive, or ifthe external group key establishment mechanism providesstronger security against classical or quantum adversaries.

Note that, as a PSK may have a different lifetime than an update, it does notnecessarily provide the same Forward Secrecy (FS) or Post-Compromise Security(PCS) guarantees as a Commit message. Unlike the key pairs populated in thetree by an Update or Commit, which always freshly generated, PSKs may bepre-distributed and stored. This creates the risk that a PSK may be compromisedin the process of distribution and storage. The security that the group getsfrom injecting a PSK thus depends on both the entropy of the PSK and the risk ofcompromise. These factors are outside of the scope of this document, but shouldbe considered by application designers relying on PSKs.

Each PSK in MLS has a type that designates how it was provisioned.External PSKs are provided by the application, while recovery and re-init PSKsare derived from the MLS key schedule and used in cases where it isnecessary to authenticate a member's participation in a prior group state.In particular, in addition to external PSK types, a PSK derived from within MLSmay be used in the following cases:

  • Re-Initialization: If during the lifetime of a group, the group membersdecide to switch to a more secure ciphersuite or newer protocol version,a PSK can be used to carry entropy from the old group forward into a newgroup with the desired parameters.
  • Branching: A PSK may be used to bootstrap a subset of current groupmembers into a new group. This applies if a subset of current groupmembers wish to branch based on the current group state.

The injection of one or more PSKs into the key schedule is signaled in two ways:1) as aPreSharedKey proposal, and 2) in theGroupSecrets object of aWelcome message sent to new members added in that epoch.

enum {  reserved(0),  external(1),  reinit(2),  branch(3)  (255)} PSKType;struct {  PSKType psktype;  select (PreSharedKeyID.psktype) {    case external:      opaque psk_id<0..255>;    case reinit:      opaque psk_group_id<0..255>;      uint64 psk_epoch;    case branch:      opaque psk_group_id<0..255>;      uint64 psk_epoch;  }  opaque psk_nonce<0..255>;} PreSharedKeyID;struct {    PreSharedKeyID psks<0..2^16-1>;} PreSharedKeys;

On receiving a Commit with aPreSharedKey proposal or a GroupSecrets objectwith thepsks field set, the receiving Client includes them in the keyschedule in the order listed in the Commit, or in thepsks field respectively.For resumption PSKs, the PSK is defined as theresumption_secret of the group andepoch specified in thePreSharedKeyID object. Specifically,psk_secret iscomputed as follows:

struct {    PreSharedKeyID id;    uint16 index;    uint16 count;} PSKLabel;psk_extracted_[i] = KDF.Extract(0, psk_[i])psk_input_[i] = ExpandWithLabel(psk_extracted_[i], "derived psk", PSKLabel, KDF.Nh)psk_secret_[0] = 0psk_secret_[i] = KDF.Extract(psk_input[i-1], psk_secret_[i-1])psk_secret     = psk_secret[n]

Here0 represents the all-zero vector of lengthKDF.Nh. Theindex field inPSKLabel corresponds to the index of the PSK in thepsk array, while thecount field contains the total number of PSKs. In other words, the PSKs arechained together with KDF.Extract invocations, as follows:

                0                                   0       = psk_secret_[0]                |                                   |                V                                   Vpsk_[0] --> KDF.Extract --> ExpandWithLabel --> KDF.Extract = psk_secret_[1]                                                    |                0                                   |                |                                   |                V                                   Vpsk_[1] --> KDF.Extract --> ExpandWithLabel --> KDF.Extract = psk_secret_[1]                                                    |                0                                  ...                |                                   |                V                                   Vpsk_[n] --> KDF.Extract --> ExpandWithLabel --> KDF.Extract = psk_secret_[n]

In particular, if there are no PreSharedKey proposals in a given Commit, thenthe resultingpsk_secret ispsk_secret_[0], the all-zero vector.

8.3.Secret Tree

For the generation of encryption keys and nonces, the key schedule begins withtheencryption_secret at the root and derives a tree of secrets with the samestructure as the group's ratchet tree. Each leaf in the Secret Tree isassociated with the same group member as the corresponding leaf in the ratchettree. Nodes are also assigned an index according to their position in the arrayrepresentation of the tree (described inAppendix A). If N is a node index inthe Secret Tree then left(N) and right(N) denote the children of N (if theyexist).

The secret of any other node in the tree is derived from its parent's secretusing a call to DeriveTreeSecret:

DeriveTreeSecret(Secret, Label, Node, Generation, Length) =    ExpandWithLabel(Secret, Label, TreeContext, Length)Where TreeContext is specified as:struct {    uint32 node = Node;    uint32 generation = Generation;} TreeContext;

If N is a node index in the Secret Tree then the secrets of the childrenof N are defined to be:

tree_node_[N]_secret        |        |        +--> DeriveTreeSecret(., "tree", left(N), 0, KDF.Nh)        |    = tree_node_[left(N)]_secret        |        +--> DeriveTreeSecret(., "tree", right(N), 0, KDF.Nh)             = tree_node_[right(N)]_secret

The secret in the leaf of the Secret Tree is used to initiate two symmetric hashratchets, from which a sequence of single-use keys and nonces are derived, asdescribed inSection 8.4. The root of each ratchet is computed as:

tree_node_[N]_secret        |        |        +--> DeriveTreeSecret(., "handshake", N, 0, KDF.Nh)        |    = handshake_ratchet_secret_[N]_[0]        |        +--> DeriveTreeSecret(., "application", N, 0, KDF.Nh)             = application_ratchet_secret_[N]_[0]

8.4.Encryption Keys

As described inSection 9, MLS encrypts three differenttypes of information:

  • Metadata (sender information)
  • Handshake messages (Proposal and Commit)
  • Application messages

The sender information used to look up the key for content encryption isencrypted with an AEAD where the key and nonce are derived from bothsender_data_secret and a sample of the encrypted message content.

For handshake and application messages, a sequence of keys is derived via a"sender ratchet". Each sender has their own sender ratchet, and each step alongthe ratchet is called a "generation".

A sender ratchet starts from a per-sender base secret derived from a SecretTree, as described inSection 8.3. The base secret initiates a symmetrichash ratchet which generates a sequence of keys and nonces. The sender uses thej-th key/nonce pair in the sequence to encrypt (using the AEAD) the j-th messagethey send during that epoch. Each key/nonce pair MUST NOT be used to encryptmore than one message.

Keys, nonces, and the secrets in ratchets are derived usingDeriveTreeSecret. The context in a given call consists of the indexof the sender's leaf in the ratchet tree and the current position inthe ratchet. In particular, the node index of the sender's leaf in theratchet tree is the same as the node index of the leaf in the Secret Treeused to initialize the sender's ratchet.

ratchet_secret_[N]_[j]      |      +--> DeriveTreeSecret(., "nonce", N, j, AEAD.Nn)      |    = ratchet_nonce_[N]_[j]      |      +--> DeriveTreeSecret(., "key", N, j, AEAD.Nk)      |    = ratchet_key_[N]_[j]      |      VDeriveTreeSecret(., "secret", N, j, KDF.Nh)= ratchet_secret_[N]_[j+1]

Here, AEAD.Nn and AEAD.Nk denote the lengthsin bytes of the nonce and key for the AEAD scheme defined bythe ciphersuite.

8.5.Deletion Schedule

It is important to delete all security-sensitive values as soon as they areconsumed. A sensitive value S is said to beconsumed if

  • S was used to encrypt or (successfully) decrypt a message, or if
  • a key, nonce, or secret derived from S has been consumed. (This goes forvalues derived via DeriveSecret as well as ExpandWithLabel.)

Here, S may be theinit_secret,commit_secret,epoch_secret,encryption_secret as well as any secret in a Secret Tree or one of theratchets.

As soon as a group member consumes a value they MUST immediately delete(all representations of) that value. This is crucial to ensuringforward secrecy for past messages. Members MAY keep unconsumed values aroundfor some reasonable amount of time to handle out-of-order message delivery.

For example, suppose a group member encrypts or (successfully) decrypts anapplication message using the j-th key and nonce in the ratchet of nodeindex N in some epoch n. Then, for that member, at least the followingvalues have been consumed and MUST be deleted:

  • thecommit_secret,joiner_secret,epoch_secret,encryption_secret ofthat epoch n as well as theinit_secret of the previous epoch n-1,
  • all node secrets in the Secret Tree on the path from the root to the leaf withnode index N,
  • the first j secrets in the application data ratchet of node index N and
  • application_ratchet_nonce_[N]_[j] andapplication_ratchet_key_[N]_[j].

Concretely, suppose we have the following Secret Tree and ratchet forparticipant D:

       G     /   \    /     \   E       F  / \     / \ A   B   C   D            / \          HR0  AR0 -+- K0                |   |                |   +- N0                |               AR1 -+- K1                |   |                |   +- N1                |               AR2

Then if a client uses key K1 and nonce N1 during epoch n then it must consume(at least) values G, F, D, AR0, AR1, K1, N1 as well as the key schedule secretsused to derive G (theencryption_secret), namelyinit_secret of epoch n-1andcommit_secret,joiner_secret,epoch_secret of epoch n. The client MAYretain (not consume) the values K0 and N0 to allow for out-of-order delivery,and SHOULD retain AR2 for processing future messages.

8.6.Exporters

The main MLS key schedule provides anexporter_secret which canbe used by an application as the basis to derive new secrets calledexported_value outside the MLS layer.

MLS-Exporter(Label, Context, key_length) =       ExpandWithLabel(DeriveSecret(exporter_secret, Label),                         "exporter", Hash(Context), key_length)

Each application SHOULD provide a unique label toMLS-Exporter thatidentifies its use case. This is to prevent twoexported outputs from being generated with the same values and usedfor different functionalities.

The exported values are bound to the group epoch from which theexporter_secret is derived, hence reflects a particular state ofthe group.

It is RECOMMENDED for the application generating exported valuesto refresh those values after a Commit is processed.

8.7.Resumption Secret

The main MLS key schedule provides aresumption_secret which can provide extrasecurity in some cross-group operations.

The application SHOULD specify an upper limit on the number of pastepochs for which theresumption_secret may be stored.

There are two ways in which aresumption_secret can be used: to re-initializethe group with different parameters, or to create asub-group of an existing group as detailed inSection 8.2.

Resumption keys are distinguished from exporter keys in that they have specificuse inside the MLS protocol, whereas the use of exporter secrets may bedecided by an external application. They are thus derived separately to avoidkey material reuse.

8.8.State Authentication Keys

The main MLS key schedule provides a per-epochauthentication_secret.If one of the parties is being actively impersonated by an attacker, theirauthentication_secret will differ from that of the other group members.Thus, members of a group MAY use theirauthentication_secrets withinan out-of-band authentication protocol to ensure that theyshare the same view of the group.

9.Message Framing

Handshake and application messages use a common framing structure.This framing provides encryption to ensure confidentiality within thegroup, as well as signing to authenticate the sender within the group.

The two main structures involved are MLSPlaintext and MLSCiphertext.MLSCiphertext represents a signed and encrypted message, withprotections for both the content of the message and relatedmetadata. MLSPlaintext represents a message that is only signed,and not encrypted. Applications MUST use MLSCiphertext to encryptapplication messages and SHOULD use MLSCiphertext to encodehandshake messages, but MAY transmit handshake messages encodedas MLSPlaintext objects in cases where it is necessary for theDelivery Service to examine such messages.

enum {    reserved(0),    application(1),    proposal(2),    commit(3),    (255)} ContentType;enum {    reserved(0),    member(1),    preconfigured(2),    new_member(3),    (255)} SenderType;struct {    SenderType sender_type;    switch (sender_type) {        case member:        KeyPackageID member;        case preconfigured: opaque external_key_id<0..255>;        case new_member:    struct{};    }} Sender;struct {    opaque mac_value<0..255>;} MAC;enum {  reserved(0),  mls_plaintext(1),  mls_ciphertext(2),  (255)} WireFormat;struct {    WireFormat wire_format;    opaque group_id<0..255>;    uint64 epoch;    Sender sender;    opaque authenticated_data<0..2^32-1>;    ContentType content_type;    select (MLSPlaintext.content_type) {        case application:          opaque application_data<0..2^32-1>;        case proposal:          Proposal proposal;        case commit:          Commit commit;    }    opaque signature<0..2^16-1>;    optional<MAC> confirmation_tag;    optional<MAC> membership_tag;} MLSPlaintext;struct {    WireFormat wire_format = mls_ciphertext;    opaque group_id<0..255>;    uint64 epoch;    ContentType content_type;    opaque authenticated_data<0..2^32-1>;    opaque encrypted_sender_data<0..255>;    opaque ciphertext<0..2^32-1>;} MLSCiphertext;

The fieldconfirmation_tag MUST be present ifcontent_type equals commit.Otherwise, it MUST NOT be present.

External sender types are sent as MLSPlaintext, seeSection 11.1.9for their use.

The remainder of this section describes how to compute the signature of anMLSPlaintext object and how to convert it to an MLSCiphertext object formember sender types. The steps are:

  • Setgroup_id,epoch,content_type andauthenticated_data fields from theMLSPlaintext object directly
  • Identify the key and key generation depending on the content type
  • Encrypt an MLSCiphertextContent for the ciphertext field using the keyidentified and MLSPlaintext object
  • Encrypt the sender data using a key and nonce derived from thesender_data_secret for the epoch and a sample of the encryptedMLSCiphertextContent.

Decryption is done by decrypting the sender data, then the message, and thenverifying the content signature.

The following sections describe the encryption and signing processes in detail.

9.1.Content Authentication

Thesignature field in an MLSPlaintext object is computed using the signingprivate key corresponding to the public key, which was authenticated by thecredential at the leaf of the tree indicated by the sender field. The signaturecovers the plaintext metadata and message content, which is all of MLSPlaintextexcept for thesignature, theconfirmation_tag andmembership_tag fields.If the sender is a member of the group, the signature also covers theGroupContext for the current epoch, so that signatures are specific to a givengroup and epoch.

struct {    select (MLSPlaintextTBS.sender.sender_type) {        case member:            GroupContext context;        case preconfigured:        case new_member:            struct{};    }    WireFormat wire_format;    opaque group_id<0..255>;    uint64 epoch;    Sender sender;    opaque authenticated_data<0..2^32-1>;    ContentType content_type;    select (MLSPlaintextTBS.content_type) {        case application:          opaque application_data<0..2^32-1>;        case proposal:          Proposal proposal;        case commit:          Commit commit;    }} MLSPlaintextTBS;

Themembership_tag field in the MLSPlaintext object authenticates the sender'smembership in the group. For an MLSPlaintext with a sender type other thanmember, this field MUST be omitted. For messages sent by members, it MUST bepresent and set to the following value:

struct {  MLSPlaintextTBS tbs;  opaque signature<0..2^16-1>;  optional<MAC> confirmation_tag;} MLSPlaintextTBM;membership_tag = MAC(membership_key, MLSPlaintextTBM);

Note that themembership_tag only needs to be computed for MLSPlaintextmessages that will be sent over the wire (wire_format == mls_plaintext). Itisn't needed for messages that will be encrypted and transmitted asMLSCiphertext messages (wire_format == mls_ciphertext).

9.2.Content Encryption

Theciphertext field of the MLSCiphertext object is produced by supplying theinputs described below to the AEAD function specified by the ciphersuite in use.The plaintext input contains the content and signature of the MLSPlaintext, plusoptional padding. These values are encoded in the following form:

struct {    select (MLSCiphertext.content_type) {        case application:          opaque application_data<0..2^32-1>;        case proposal:          Proposal proposal;        case commit:          Commit commit;    }    opaque signature<0..2^16-1>;    optional<MAC> confirmation_tag;    opaque padding<0..2^16-1>;} MLSCiphertextContent;

In the MLS key schedule, the sender creates two distinct key ratchets forhandshake and application messages for each member of the group. When encryptinga message, the sender looks at the ratchets it derived for its own member andchooses an unused generation from either the handshake or application ratchetdepending on the content type of the message. This generation of the ratchet isused to derive a provisional nonce and key.

Before use in the encryption operation, the nonce is XORed with a fresh randomvalue to guard against reuse. Because the key schedule generates noncesdeterministically, a client must keep persistent state as to where in the keyschedule it is; if this persistent state is lost or corrupted, a client mightreuse a generation that has already been used, causing reuse of a key/nonce pair.

To avoid this situation, the sender of a message MUST generate a fresh random4-byte "reuse guard" value and XOR it with the first four bytes of the noncefrom the key schedule before using the nonce for encryption. The sender MUSTinclude the reuse guard in thereuse_guard field of the sender data object, sothat the recipient of the message can use it to compute the nonce to be used fordecryption.

+-+-+-+-+---------...---+|   Key Schedule Nonce  |+-+-+-+-+---------...---+           XOR+-+-+-+-+---------...---+| Guard |       0       |+-+-+-+-+---------...---+           ===+-+-+-+-+---------...---+| Encrypt/Decrypt Nonce |+-+-+-+-+---------...---+

The Additional Authenticated Data (AAD) input to the encryptioncontains an object of the following form, with the values used toidentify the key and nonce:

struct {    opaque group_id<0..255>;    uint64 epoch;    ContentType content_type;    opaque authenticated_data<0..2^32-1>;} MLSCiphertextContentAAD;

9.3.Sender Data Encryption

The "sender data" used to look up the key for the content encryption isencrypted with the ciphersuite's AEAD with a key and nonce derived from both thesender_data_secret and a sample of the encrypted content. Before beingencrypted, the sender data is encoded as an object of the following form:

struct {    KeyPackageID sender;    uint32 generation;    opaque reuse_guard[4];} MLSSenderData;

MLSSenderData.sender is assumed to be amember sender type. When constructingan MLSSenderData from a Sender object, the sender MUST verify Sender.sender_typeismember and use Sender.sender for MLSSenderData.sender.

Thereuse_guard field contains a fresh random value used to avoid nonce reusein the case of state loss or corruption, as described inSection 9.2.

The key and nonce provided to the AEAD are computed as the KDF of the firstKDF.Nh bytes of the ciphertext generated in the previous section. If thelength of the ciphertext is less thanKDF.Nh, the whole ciphertext is usedwithout padding. In pseudocode, the key and nonce are derived as:

ciphertext_sample = ciphertext[0..KDF.Nh-1]sender_data_key = ExpandWithLabel(sender_data_secret, "key", ciphertext_sample, AEAD.Nk)sender_data_nonce = ExpandWithLabel(sender_data_secret, "nonce", ciphertext_sample, AEAD.Nn)

The Additional Authenticated Data (AAD) for the SenderData ciphertext is all thefields of MLSCiphertext excludingencrypted_sender_data:

struct {    opaque group_id<0..255>;    uint64 epoch;    ContentType content_type;} MLSSenderDataAAD;

When parsing a SenderData struct as part of message decryption, the recipientMUST verify that the KeyPackageID indicated in thesender field identifies amember of the group.

10.Group Creation

A group is always created with a single member, the "creator". The othermembers are added when the creator effectively sends itself an Add proposal andcommits it, then sends the corresponding Welcome message to the newparticipants. These processes are described in detail inSection 11.1.1,Section 11.2,andSection 11.2.2.

The creator of a group MUST take the following steps to initialize the group:

  • Fetch KeyPackages for the members to be added, and select a version andciphersuite according to the capabilities of the members. To protect againstdowngrade attacks, the creator MUST use thecapabilities extensionsin these KeyPackages to verify that thechosen version and ciphersuite is the best option supported by all members.
  • Initialize a one-member group with the following initial values:

    • Ratchet tree: A tree with a single node, a leaf containing an HPKE publickey and credential for the creator
    • Group ID: A value set by the creator
    • Epoch: 0
    • Tree hash: The root hash of the above ratchet tree
    • Confirmed transcript hash: The zero-length octet string
    • Interim transcript hash: The zero-length octet string
    • Init secret: A fresh random value of sizeKDF.Nh
    • Extensions: Any values of the creator's choosing
  • For each member, construct an Add proposal from the KeyPackage for thatmember (seeSection 11.1.1)
  • Construct a Commit message that commits all of the Add proposals, in any orderchosen by the creator (seeSection 11.2)
  • Process the Commit message to obtain a new group state (for the epoch in whichthe new members are added) and a Welcome message
  • Transmit the Welcome message to the other new members

The recipient of a Welcome message processes it as described inSection 11.2.2.

In principle, the above process could be streamlined by having thecreator directly create a tree and choose a random value for firstepoch's epoch secret. We follow the steps above because it removesunnecessary choices, by which, for example, bad randomness could beintroduced. The only choices the creator makes here are its ownKeyPackage, the leaf secret from which the Commit is built, and theintermediate key pairs along the direct path to the root.

10.1.Required Capabilities

The configuration of a group imposes certain requirements on clients in thegroup. At a minimum, all members of the group need to support the ciphersuiteand protocol version in use. Additional requirements can be imposed byincluding arequired_capabilities extension in the GroupContext.

struct {    ExtensionType extensions<0..255>;    ProposalType proposals<0..255>;} RequiredCapabilities;

This extension lists the extensions and proposal types that must be supported byall members of the group. For new members, it is enforced by existing members during theapplication of Add commits. Existing members should of course be in compliancealready. In order to ensure this continues to be the case even as the group'sextensions can be updated, a GroupContextExtensions proposal is invalid if itcontains arequired_capabilities extension that requires capabililities notsupported by all current members.

10.2.Linking a New Group to an Existing Group

A new group may be tied to an already existing group for the purpose ofre-initializing the existing group, or to branch into a sub-group.Re-initializing an existing group may be used, for example, to restart the groupwith a different ciphersuite or protocol version. Branching may be used tobootstrap a new group consisting of a subset of current group members, based onthe current group state.

In both cases, thepsk_nonce included in thePreSharedKeyID object must be arandomly sampled nonce of lengthKDF.Nh to avoid key re-use.

10.2.1.Sub-group Branching

If a client wants to create a subgroup of an existing group, they MAY choose toinclude aPreSharedKeyID in theGroupSecrets object of the Welcome message choosingthepsktypebranch, thegroup_id of the group from which a subgroup is tobe branched, as well as an epoch within the number of epochs for which aresumption_secret is kept.

11.Group Evolution

Over the lifetime of a group, its membership can change, and existing membersmight want to change their keys in order to achieve post-compromise security. InMLS, each such change is accomplished by a two-step process:

  1. A proposal to make the change is broadcast to the group in a Proposal message
  2. A member of the group or a new member broadcasts a Commit message that causes one or moreproposed changes to enter into effect

The group thus evolves from one cryptographic state to another each time aCommit message is sent and processed. These states are referred to as "epochs"and are uniquely identified among states of the group by eight-octet epoch values.When a new group is initialized, its initial state epoch is 0x0000000000000000. Each timea state transition occurs, the epoch number is incremented by one.

11.1.Proposals

Proposals are included in an MLSPlaintext by way of a Proposal structure thatindicates their type:

// See IANA registry for registered valuesuint16 ProposalType;struct {    ProposalType msg_type;    select (Proposal.msg_type) {        case add:                      Add;        case update:                   Update;        case remove:                   Remove;        case psk:                      PreSharedKey;        case reinit:                   ReInit;        case external_init:            ExternalInit;        case app_ack:                  AppAck;        case group_context_extensions: GroupContextExtensions;    };} Proposal;

On receiving an MLSPlaintext containing a Proposal, a client MUST verify thesignature on the enclosing MLSPlaintext. If the signature verifiessuccessfully, then the Proposal should be cached in such a way that it can beretrieved by hash (as a ProposalOrRef object) in a later Commit message.

11.1.1.Add

An Add proposal requests that a client with a specified KeyPackage be addedto the group. The proposer of the Add MUST validate the KeyPackage in the sameway as receipients are required to do below.

struct {    KeyPackage key_package;} Add;

The proposer of the Add does not control where in the group's ratchet tree thenew member is added. Instead, the sender of the Commit message chooses alocation for each added member and states it in the Commit message.

An Add is applied after being included in a Commit message. The position of theAdd in the list of proposals determines the node indexindex of the leaf nodewhere the new member will be added. For the first Add in the Commit,index isthe leftmost empty leaf in the tree, for the second Add, the next empty leaf tothe right, etc.

  • Validate the KeyPackage:

    • Verify that the signature on the KeyPackage is valid using the public keyin the KeyPackage's credential
    • Verify that the following fields in the KeyPackage are unique among themembers of the group (including any other members added in the sameCommit):

      • (credential.identity, endpoint_id) tuple
      • credential.signature_key
      • hpke_init_key
    • Verify that the KeyPackage is compatible with the group's parameters. Theciphersuite and protocol version of the KeyPackage must match those inuse in the group. If the GroupContext has arequired_capabilitiesextension, then the required extensions and proposals MUST be listed inthe KeyPackage'scapabilities extension.
  • If necessary, extend the tree to the right until it has at least index + 1leaves
  • For each non-blank intermediate node along the path from the leaf at positionindex to the root, addindex to theunmerged_leaves list for the node.
  • Set the leaf node in the tree at positionindex to a new node containing thepublic key from the KeyPackage in the Add, as well as the credential underwhich the KeyPackage was signed

11.1.2.Update

An Update proposal is a similar mechanism to Add with the distinctionthat it is the sender's leaf KeyPackage in the tree which would beupdated with a new KeyPackage.

struct {    KeyPackage key_package;} Update;

The values in the following fields of the KeyPackage contained in anUpdateproposal MUST be the same as those of the KeyPackage it replaces in the tree.version,cipher_suite,credential.identity,endpoint_id. However, thevalue of thecredential.signature_key field of the new KeyPackage MUST bedifferent from that of all other KeyPackages in the tree. Furthermore, the valueof thehpke_init_key field of the new KeyPackage MUST be different from thatof the KeyPackage it replaces.

A member of the group applies an Update message by taking the following steps:

  • Replace the sender's leaf KeyPackage with the one contained inthe Update proposal
  • Blank the intermediate nodes along the path from the sender's leaf to the root

11.1.3.Remove

A Remove proposal requests that the member with KeyPackageIDremoved be removedfrom the group.

struct {    KeyPackageID removed;} Remove;

A member of the group applies a Remove message by taking the following steps:

  • Identify a leaf node containing a key package matchingremoved. Thislookup MUST be done on the tree before any non-Remove proposals havebeen applied (the "old" tree in the terminology ofSection 11.2), sinceproposals such as Update can change the KeyPackage stored at a leaf.Letremoved_index be the node index of this leaf node.
  • Replace the leaf node atremoved_index with a blank node
  • Blank the intermediate nodes along the path fromremoved_index to the root
  • Truncate the tree by reducing the size of tree until the rightmost non-blank leaf node

11.1.4.PreSharedKey

A PreSharedKey proposal can be used to request that a pre-shared key beinjected into the key schedule in the process of advancing the epoch.

struct {    PreSharedKeyID psk;} PreSharedKey;

Thepsktype of the pre-shared key MUST beexternal and thepsk_nonce MUSTbe a randomly sampled nonce of lengthKDF.Nh. When processing a Commit messagethat includes one or more PreSharedKey proposals, group members derivepsk_secret as described inSection 8.2, where the order of the PSKscorresponds to the order of thePreSharedKey proposals in the Commit.

11.1.5.ReInit

A ReInit proposal represents a request to re-initialize the group with differentparameters, for example, to increase the version number or to change theciphersuite. The re-initialization is done by creating a completely new groupand shutting down the old one.

struct {    opaque group_id<0..255>;    ProtocolVersion version;    CipherSuite cipher_suite;    Extension extensions<0..2^32-1>;} ReInit;

A member of the group applies a ReInit proposal by waiting for the committer tosend the Welcome message and by checking that thegroup_id and the parametersof the new group corresponds to the ones specified in the proposal. The Welcomemessage MUST specify exactly one pre-shared key withpsktype = reinit, and withpsk_group_id andpsk_epoch equal to thegroup_id andepoch of theexisting group after the Commit containing thereinit Proposal was processed.The Welcome message may specify the inclusion of other pre-shared keys with apsktype different fromreinit.

If a ReInit proposal is included in a Commit, it MUST be the only proposalreferenced by the Commit. If other non-ReInit proposals have been sent duringthe epoch, the committer SHOULD prefer them over the ReInit proposal, allowingthe ReInit to be resent and applied in a subsequent epoch. Theversion fieldin the ReInit proposal MUST be no less than the version for the current group.

11.1.6.ExternalInit

An ExternalInit proposal is used by new members that want to join a group byusing an external commit. This propsal can only be used in that context.

struct {  opaque kem_output<0..2^16-1>;} ExternalInit;

A member of the group applies an ExternalInit message by initializing the nextepoch using an init secret computed as described inSection 8.1.Thekem_output field contains the required KEM output.

11.1.7.AppAck

An AppAck proposal is used to acknowledge receipt of application messages.Though this information implies no change to the group, it is structured as aProposal message so that it is included in the group's transcript by beingincluded in Commit messages.

struct {    KeyPackageID sender;    uint32 first_generation;    uint32 last_generation;} MessageRange;struct {    MessageRange received_ranges<0..2^32-1>;} AppAck;

An AppAck proposal represents a set of messages received by the sender in thecurrent epoch. Messages are represented by thesender andgeneration valuesin the MLSCiphertext for the message. Each MessageRange represents receipt of aspan of messages whosegeneration values form a continuous range fromfirst_generation tolast_generation, inclusive.

AppAck proposals are sent as a guard against the Delivery Service droppingapplication messages. The sequential nature of thegeneration field providesa degree of loss detection, since gaps in thegeneration sequence indicatedropped messages. AppAck completes this story by addressing the scenario wherethe Delivery Service drops all messages after a certain point, so that a latergeneration is never observed. Obviously, there is a risk that AppAck messagescould be suppressed as well, but their inclusion in the transcript means that ifthey are suppressed then the group cannot advance at all.

The schedule on which sending AppAck proposals are sent is up to the application,and determines which cases of loss/suppression are detected. For example:

  • The application might have the committer include an AppAck proposal whenever aCommit is sent, so that other members could know when one of their messagesdid not reach the committer.
  • The application could have a client send an AppAck whenever an applicationmessage is sent, covering all messages received since its last AppAck. Thiswould provide a complete view of any losses experienced by active members.
  • The application could simply have clients send AppAck proposals on a timer, sothat all participants' state would be known.

An application using AppAck proposals to guard against loss/suppression ofapplication messages also needs to ensure that AppAck messages and the Commitsthat reference them are not dropped. One way to do this is to always encryptProposal and Commit messages, to make it more difficult for the Delivery Serviceto recognize which messages conatain AppAcks. The application can also haveclients enforce an AppAck schedule, reporting loss if an AppAck is not receivedat the expected time.

11.1.8.GroupContextExtensions

A GroupContextExtensions proposal is used to update the list of extensions inthe GroupContext for the group.

struct { Extension extensions<0..2^32-1>;} GroupContextExtensions;

A member of the group applies a GroupContextExtensions proposal with thefollowing steps:

  • If the new extensions include arequired_capabilities extension, verify thatall members of the group support the required capabilities (including thoseadded in the same commit, and excluding those removed).
  • Remove all of the existing extensions from the GroupContext object for thegroup and replacing them with the list of extensions in the proposal. (Thisis a wholesale replacement, not a merge. An extension is only carried over ifthe sender of the proposal includes it in the new list.)

Note that once the GroupContext is updated, its inclusion in theconfirmation_tag by way of the key schedule will confirm that all members of thegroup agree on the extensions in use.

11.1.9.External Proposals

Add and Remove proposals can be constructed and sent to the group by a partythat is outside the group. For example, a Delivery Service might propose toremove a member of a group who has been inactive for a long time, or propose addinga newly-hired staff member to a group representing a real-world team. Proposalsoriginating outside the group are identified by apreconfigured ornew_member SenderType in MLSPlaintext.

ReInit proposals can also be sent to the group by apreconfigured sender, forexample to enforce a changed policy regarding MLS version or ciphersuite.

Thenew_member SenderType is used for clients proposing that they themselvesbe added. For this ID type the sender value MUST be zero and the Proposal typeMUST be Add. The MLSPlaintext MUST be signed with the private key correspondingto the KeyPackage in the Add message. Recipients MUST verify that theMLSPlaintext carrying the Proposal message is validly signed with this key.

Thepreconfigured SenderType is reserved for signers that are pre-provisionedto the clients within a group. If proposals with these sender IDs are to beaccepted within a group, the members of the group MUST be provisioned by theapplication with a mapping between these IDs and authorized signing keys.Recipients MUST verify that the MLSPlaintext carrying the Proposal message isvalidly signed with the corresponding key. To ensure consistent handling ofexternal proposals, the application MUST ensure that the members of a grouphave the same mapping and apply the same policies to external proposals.

An external proposal MUST be sent as an MLSPlaintextobject, since the sender will not have the keys necessary to construct anMLSCiphertext object.

11.2.Commit

A Commit message initiates a new epoch for the group, based on a collection ofProposals. It instructs group members to update their representation of thestate of the group by applying the proposals and advancing the key schedule.

Each proposal covered by the Commit is included by a ProposalOrRef value, whichidentifies the proposal to be applied by value or by reference. Proposalssupplied by value are included directly in the Commit object. Proposalssupplied by reference are specified by including the hash of the MLSPlaintext inwhich the Proposal was sent, using the hash function from the group'sciphersuite. For proposals supplied by value, the sender of the proposal is thesame as the sender of the Commit. Conversely, proposals sent by people otherthan the committer MUST be included by reference.

enum {  reserved(0),  proposal(1)  reference(2),  (255)} ProposalOrRefType;struct {  ProposalOrRefType type;  select (ProposalOrRef.type) {    case proposal:  Proposal proposal;    case reference: opaque hash<0..255>;  }} ProposalOrRef;struct {    ProposalOrRef proposals<0..2^32-1>;    optional<UpdatePath> path;} Commit;

A group member that has observed one or more proposals within an epoch MUST senda Commit message before sending application data. This ensures, for example,that any members whose removal was proposed during the epoch are actuallyremoved before any application data is transmitted.

The sender of a Commit MUST include all valid proposals that it has receivedduring the current epoch. Invalid proposals include, for example, proposals withan invalid signature or proposals that are semantically invalid, such as an Addwhen the sender does not have the application-level permission to add new users.Proposals with a non-default proposal type MUST NOT be included in a commitunless the proposal type is supported by all the members of the group that willprocess the Commit (i.e., not including any members being added or removed bythe Commit).

If there are multiple proposals that apply to the same leaf, the committerchooses one and includes only that one in the Commit, considering the restinvalid. The committer MUST prefer any Remove received, or the most recentUpdate for the leaf if there are no Removes. If there are multiple Add proposalscontaining KeyPackages with the same tuple(credential.identity, endpoint_id)the committer again chooses one to include and considers the rest invalid. Addproposals that contain KeyPackages with an(credential.identity, endpoint_id)tuple that matches that of an existing KeyPackage in the group MUST beconsidered invalid. The comitter MUST consider invalid any Add or Updateproposal if the Credential in the contained KeyPackage shares the same signaturekey with a Credential in any leaf of the group, or indeed if the KeyPackageshares the samehpke_init_key with another KeyPackage in the group.

The Commit MUST NOT combine proposals sent within different epochs. In the eventthat a valid proposal is omitted from the next Commit, the sender of theproposal SHOULD retransmit it in the new epoch.

A member of the group MAY send a Commit that references no proposals at all,which would thus have an emptyproposals vector. Sucha Commit resets the sender's leaf and the nodes along its direct path, andprovides forward secrecy and post-compromise security with regard to the senderof the Commit. An Update proposal can be regarded as a "lazy" version of thisoperation, where only the leaf changes and intermediate nodes are blanked out.

Thepath field of a Commit message MUST be populated if the Commit covers atleast one Update or Remove proposal. Thepath field MUST also be populatedif the Commit covers no proposals at all (i.e., if the proposals vectoris empty). Thepath field MAY be omitted if the Commit covers only Addproposals. In pseudocode, the logic for validating a Commit is as follows:

hasUpdates = falsehasRemoves = falsefor i, id in commit.proposals:    proposal = proposalCache[id]    assert(proposal != null)    hasUpdates = hasUpdates || proposal.msg_type == update    hasRemoves = hasRemoves || proposal.msg_type == removeif len(commit.proposals) == 0 || hasUpdates || hasRemoves:  assert(commit.path != null)

To summarize, a Commit can have three different configurations, with differentuses:

  1. An "empty" Commit that references no proposals, which updates the committer'scontribution to the group and provides PCS with regard to the committer.
  2. A "partial" Commit that references Add, PreSharedKey, or ReInit proposals butwhere the path is empty. Such a commit doesn't provide PCS with regard to thecommitter.
  3. A "full" Commit that references proposals of any type, which provides FS withregard to any removed members and PCS for the committer and any updatedmembers.

When creating or processing a Commit, three different ratchet trees andtheir associated GroupContexts are used:

  1. "Old" refers to the ratchet tree and GroupContext for the epoch before thecommit. The old GroupContext is used when signing the MLSPlainText so thatexisting group members can verify the signature before processing thecommit.
  2. "Provisional" refers to the ratchet tree and GroupContext constructed afterapplying the proposals that are referenced by the Commit. The provisionalGroupContext uses the epoch number for the new epoch, and the old confirmedtranscript hash. This is used when creating the UpdatePath, if theUpdatePath is needed.
  3. "New" refers to the ratchet tree and GroupContext constructed after applyingthe proposals and the UpdatePath (if any). The new GroupContext uses theepoch number for the new epoch, and the new confirmed transcript hash. Thisis used when deriving the new epoch secrets, and is the only GroupContextthat newly-added members will have.

A member of the group creates a Commit message and the corresponding Welcomemessage at the same time, by taking the following steps:

  • Construct an initial Commit object with theproposalsfield populated from Proposals received during the current epoch, and an emptypath field.
  • Generate the provisional ratchet tree and GroupContext by applying the proposalsreferenced in the initial Commit object, as described inSection 11.1. Updateproposals are applied first, followed by Remove proposals, and then finallyAdd proposals. Add proposals are applied in the order listed in theproposals vector, and always to the leftmost unoccupied leaf in the tree, orthe right edge of the tree if all leaves are occupied.

    • Note that the order in which different types of proposals are applied shouldbe updated by the implementation to include any new proposals added bynegotiated group extensions.
    • PreSharedKey proposals are processed later when deriving thepsk_secret for the KeySchedule.
  • Decide whether to populate thepath field: If thepath field is requiredbased on the proposals that are in the commit (see above), then it MUST bepopulated. Otherwise, the sender MAY omit thepath field at its discretion.
  • If populating thepath field: Create an UpdatePath using the provisionalratchet tree and GroupContext. Any new member (from an add proposal) MUST beexluded from the resolution during the computation of the UpdatePath. Theleaf_key_package for this UpdatePath must have aparent_hash extension.Note that the KeyPackage in theUpdatePath effectively updates an existingKeyPackage in the group and thus MUST adhere to the same restrictions asKeyPackages used inUpdate proposals.

    • Assign this UpdatePath to thepath field in the Commit.
    • Apply the UpdatePath to the tree, as described inSection 5.5, creating the new ratchet tree. Definecommit_secret as the valuepath_secret[n+1] derived from thepath_secret[n] value assigned to the root node.
  • If not populating thepath field: Set thepath field in the Commit to thenull optional. Definecommit_secret as the all-zero vector of lengthKDF.Nh (the same length as apath_secret value would be). In this case,the new ratchet tree is the same as the provisional ratchet tree.
  • Derive thepsk_secret as specified inSection 8.2, where the orderof PSKs in the derivation corresponds to the order of PreSharedKey proposalsin theproposals vector.
  • Construct an MLSPlaintext object containing the Commit object. Sign theMLSPlaintext using the old GroupContext as context.

    • Use the MLSPlaintext to update the confirmed transcript hash and generatethe new GroupContext.
    • Use theinit_secret from the previous epoch, thecommit_secret and thepsk_secret as defined in the previous steps, and the new GroupContext tocompute the newjoiner_secret,welcome_secret,epoch_secret, andderived secrets for the new epoch.
    • Use theconfirmation_key for the new epoch to compute theconfirmation_tag value, and themembership_key for the old epoch tocompute themembership_tag value in the MLSPlaintext.
    • Calculate the interim transcript hash using the new confirmed transcripthash and theconfirmation_tag from the MLSPlaintext.
  • Construct a GroupInfo reflecting the new state:

    • Group ID, epoch, tree, confirmed transcript hash, interim transcripthash, and group context extensions from the new state
    • The confirmation_tag from the MLSPlaintext object
    • Other extensions as defined by the application
    • Sign the GroupInfo using the member's private signing key
    • Encrypt the GroupInfo using the key and nonce derived from thejoiner_secretfor the new epoch (seeSection 11.2.2)
  • For each new member in the group:

    • Identify the lowest common ancestor in the tree of the new member'sleaf node and the member sending the Commit
    • If thepath field was populated above: Compute the path secretcorresponding to the common ancestor node
    • Compute an EncryptedGroupSecrets object that encapsulates theinit_secretfor the current epoch and the path secret (if present).
  • Construct a Welcome message from the encrypted GroupInfo object, the encryptedkey packages, and any PSKs for which a proposal was included in the Commit. Theorder of thepsks MUST be the same as the order of PreSharedKey proposals in theproposals vector.
  • If a ReInit proposal was part of the Commit, the committer MUST create a newgroup with the parameters specified in the ReInit proposal,and with the same members as the original group.The Welcome message MUST include aPreSharedKeyID withpsktypereinit and withpsk_group_id andpsk_epoch corresponding to the currentgroup and the epoch after the commit was processed.

A member of the group applies a Commit message by taking the following steps:

  • Verify that theepoch field of the enclosing MLSPlaintext message is equalto theepoch field of the current GroupContext object
  • Verify that the signature on the MLSPlaintext message verifies using thepublic key from the credential stored at the leaf in the tree indicated bythesender field.
  • Verify that all PSKs specified in any PreSharedKey proposals in theproposals vectorare available.
  • Generate the provisional ratchet tree and GroupContext by applying the proposalsreferenced in the initial Commit object, as described inSection 11.1. Updateproposals are applied first, followed by Remove proposals, and then finallyAdd proposals. Add proposals are applied in the order listed in theproposals vector, and always to the leftmost unoccupied leaf in the tree, orthe right edge of the tree if all leaves are occupied.

    • Note that the order in which different types of proposals are applied shouldbe updated by the implementation to include any new proposals added bynegotiated group extensions.
  • Verify that thepath value is populated if theproposals vector containsany Update or Remove proposals, or if it's empty. Otherwise, thepath valueMAY be omitted.
  • If thepath value is populated: Process thepath value using theprovisional ratchet tree and GroupContext, to generate the new ratchet treeand thecommit_secret:

    • Apply the UpdatePath to the tree, as described inSection 5.5, and storeleaf_key_package at theCommitter's leaf.
    • Verify that the KeyPackage has aparent_hash extension and that its valuematches the new parent of the sender's leaf node.
    • Definecommit_secret as the valuepath_secret[n+1] derived from thepath_secret[n] value assigned to the root node.
  • If thepath value is not populated: Definecommit_secret as the all-zerovector of lengthKDF.Nh (the same length as apath_secret value would be).
  • Update the confirmed and interim transcript hashes using the new Commit, andgenerate the new GroupContext.
  • Derive thepsk_secret as specified inSection 8.2, where the orderof PSKs in the derivation corresponds to the order of PreSharedKey proposalsin theproposals vector.
  • Use theinit_secret from the previous epoch, thecommit_secret and thepsk_secret as defined in the previous steps, and the new GroupContext tocompute the newjoiner_secret,welcome_secret,epoch_secret, andderived secrets for the new epoch.
  • Use theconfirmation_key for the new epoch to compute the confirmation tagfor this message, as described below, and verify that it is the same as theconfirmation_tag field in the MLSPlaintext object.
  • If the above checks are successful, consider the new GroupContext objectas the current state of the group.
  • If the Commit included a ReInit proposal, the client MUST NOT use the group tosend messages anymore. Instead, it MUST wait for a Welcome message from the committerand check that

    • Theversion,cipher_suite andextensions fields of the new groupcorresponds to the ones in theReInit proposal, and that theversionis greater than or equal to that of the original group.
    • Thepsks field in the Welcome message includes aPreSharedKeyID withpsktype =reinit, andpsk_epoch andpsk_group_id equal to the epochand group ID of the original group after processing the Commit.

The confirmation tag value confirms that the members of the group have arrivedat the same state of the group:

MLSPlaintext.confirmation_tag =    MAC(confirmation_key, GroupContext.confirmed_transcript_hash)

11.2.1.External Commits

External Commits are a mechanism for new members (external parties that want tobecome members of the group) to add themselves to a group, without requiringthat an existing member has to come online to issue a Commit that references anAdd Proposal.

Whether existing members of the group will accept or reject an External Commitfollows the same rules that are applied to other handshake messages.

New members can create and issue an External Commit if they have access to thefollowing information for the group's current epoch:

  • group ID
  • epoch ID
  • ciphersuite
  • public tree hash
  • interim transcript hash
  • group extensions
  • external public key

This information is aggregated in aPublicGroupState object as follows:

struct {    CipherSuite cipher_suite;    opaque group_id<0..255>;    uint64 epoch;    opaque tree_hash<0..255>;    opaque interim_transcript_hash<0..255>;    Extension group_context_extensions<0..2^32-1>;    Extension other_extensions<0..2^32-1>;    HPKEPublicKey external_pub;    KeyPackageID signer;    opaque signature<0..2^16-1>;} PublicGroupState;

Note that thetree_hash field is used the same way as in the Welcome message.The full tree can be included via theratchet_tree extensionSection 11.3.

The signature MUST verify using the public key taken from the credential in theleaf node of the member with KeyPackageIDsigner. The signature covers thefollowing structure, comprising all the fields in the PublicGroupState abovesignature:

struct {    opaque group_id<0..255>;    uint64 epoch;    opaque tree_hash<0..255>;    opaque interim_transcript_hash<0..255>;    Extension group_context_extensions<0..2^32-1>;    Extension other_extensions<0..2^32-1>;    HPKEPublicKey external_pub;    KeyPackageID signer;} PublicGroupStateTBS;

This signature authenticates the HPKE public key, so that the joiner knows thatthe public key was provided by a member of the group. The fields that are notsigned are included in the key schedule via the GroupContext object. If thejoiner is provided an inaccurate data for these fields, then its external Commitwill have an incorrectconfirmation_tag and thus be rejected.

The information in a PublicGroupState is not deemed public in general, butapplications can choose to make it available to new members in order to allowExternal Commits.

External Commits work like regular Commits, with a few differences:

  • The proposals included by value in an External Commit MUST meet the followingconditions:

    • There MUST be a single Add proposal that adds the new issuing new member tothe group
    • There MUST be a single ExternalInit proposal
    • There MUST NOT be any Update proposals
    • If a Remove proposal is present, then thecredential andendpoint_id ofthe removed leaf MUST be the same as the corresponding values in the AddKeyPackage.
  • The proposals included by reference in an External Commit MUST meet the followingconditions:

    • There MUST NOT be any ExternalInit proposals
  • External Commits MUST contain apath field (and is therefore a "full"Commit)
  • External Commits MUST be signed by the new member. In particular, thesignature on the enclosing MLSPlaintext MUST verify using the public key forthe credential in theleaf_key_package of thepath field.
  • When processing a Commit, both existing and new members MUST use the externalinit secret as described inSection 8.1.
  • The sender type for the MLSPlaintext encapsulating the External Commit MUST benew_member

In other words, External Commits come in two "flavors" -- a "join" commit thatadds the sender to the group or a "resync" commit that replaces a member's priorappearance with a new one.

Note that the "resync" operation allows an attacker that has compromised amember's signature private key to introduce themselves into the group and remove theprior, legitimate member in a single Commit. Without resync, thiscan still be done, but requires two operations, the external Commit to join anda second Commit to remove the old appearance. Applications for whom thisdistinction is salient can choose to disallow external commits that contain aRemove, or to allow such resync commits only if they contain a "reinit" PSKproposal that demonstrates the joining member's presence in a prior epoch of thegroup. With the latter approach, the attacke would need to compromise the PSKas well as the signing key, but the application will need to ensure thatcontinuing, non-resync'ing members have the required PSK.

11.2.2.Welcoming New Members

The sender of a Commit message is responsible for sending a Welcome message toany new members added via Add proposals. The Welcome message provides the newmembers with the current state of the group, after the application of the Commitmessage. The new members will not be able to decrypt or verify the Commitmessage, but will have the secrets they need to participate in the epochinitiated by the Commit message.

In order to allow the same Welcome message to be sent to all new members,information describing the group is encrypted with a symmetric key and noncederived from thejoiner_secret for the new epoch. Thejoiner_secret isthen encrypted to each new member using HPKE. In the same encrypted package,the committer transmits the path secret for the lowest node contained in thedirect paths of both the committer and the new member. This allows the newmember to compute private keys for nodes in its direct path that are beingreset by the corresponding Commit.

If the sender of the Welcome message wants the receiving member to include a PSKin the derivation of theepoch_secret, they can populate thepsks field indicating whichPSK to use.

struct {  opaque group_id<0..255>;  uint64 epoch;  opaque tree_hash<0..255>;  opaque confirmed_transcript_hash<0..255>;  Extension group_context_extensions<0..2^32-1>;  Extension other_extensions<0..2^32-1>;  MAC confirmation_tag;  KeyPackageID signer;  opaque signature<0..2^16-1>;} GroupInfo;struct {  opaque path_secret<1..255>;} PathSecret;struct {  opaque joiner_secret<1..255>;  optional<PathSecret> path_secret;  PreSharedKeys psks;} GroupSecrets;struct {  KeyPackageID new_member<1..255>;  HPKECiphertext encrypted_group_secrets;} EncryptedGroupSecrets;struct {  ProtocolVersion version = mls10;  CipherSuite cipher_suite;  EncryptedGroupSecrets secrets<0..2^32-1>;  opaque encrypted_group_info<1..2^32-1>;} Welcome;

The client processing a Welcome message will need to have a copy of the group'sratchet tree. The tree can be provided in the Welcome message, in an extensionof typeratchet_tree. If it is sent otherwise (e.g., provided by a cachingservice on the Delivery Service), then the client MUST download the tree beforeprocessing the Welcome.

On receiving a Welcome message, a client processes it using the following steps:

  • Identify an entry in thesecrets array where thenew_membervalue corresponds to one of this client's KeyPackages, using the hashindicated by thecipher_suite field. If no such field exists, or if theciphersuite indicated in the KeyPackage does not match the one in theWelcome message, return an error.
  • Decrypt theencrypted_group_secrets using HPKE with the algorithms indicatedby the ciphersuite and the HPKE private key corresponding to the GroupSecrets.If aPreSharedKeyID is part of the GroupSecrets and the client is not inpossession of the corresponding PSK, return an error.
  • From thejoiner_secret in the decrypted GroupSecrets object and the PSKsspecified in theGroupSecrets, derive thewelcome_secret and using thatthewelcome_key andwelcome_nonce. Use the key and nonce to decrypt theencrypted_group_info field.
welcome_nonce = KDF.Expand(welcome_secret, "nonce", AEAD.Nn)welcome_key = KDF.Expand(welcome_secret, "key", AEAD.Nk)
  • Verify the signature on the GroupInfo object. The signature input comprisesall of the fields in the GroupInfo object except the signature field. Thepublic key and algorithm are taken from the credential in the leaf node of themember with KeyPackageIDsigner. If there is no matching leaf node, or ifsignature verification fails, return an error.
  • Verify the integrity of the ratchet tree.

    • Verify that the tree hash of the ratchet tree matches thetree_hash fieldin the GroupInfo.
    • For each non-empty parent node, verify that exactly one of the node'schildren are non-empty and have the hash of this node set as theirparent_hash value (if the child is another parent) or has aparent_hashextension in the KeyPackage containing the same value (if the child is aleaf). If either of the node's children is empty, and in particular does nothave a parent hash, then its respective children'sparent_hash values haveto be considered instead.
    • For each non-empty leaf node, verify the signature on the KeyPackage.
  • Identify a leaf in thetree array (any even-numbered node) whosekey_package field is identical to the KeyPackage. If no such fieldexists, return an error. Letindex represent the index of this node in thetree.
  • Construct a new group state using the information in the GroupInfo object.

    • The GroupContext contains thegroup_id,epoch,tree_hash,confirmed_transcript_hash, andgroup_context_extensions fields fromthe GroupInfo object.
    • The new member's position in the tree isindex, as defined above.
    • Update the leaf at indexindex with the private key corresponding to thepublic key in the node.
    • If thepath_secret value is set in the GroupSecrets object: Identify thelowest common ancestor of the node indexindex and of the node index ofthe member with KeyPackageIDGroupInfo.signer. Set the private key forthis node to the private key derived from thepath_secret.
    • For each parent of the common ancestor, up to the root of the tree, derivea new path secret and set the private key for the node to the private keyderived from the path secret. The private key MUST be the private keythat corresponds to the public key in the node.
  • Use thejoiner_secret from the GroupSecrets object to generate the epoch secretand other derived secrets for the current epoch.
  • Set the confirmed transcript hash in the new state to the value of theconfirmed_transcript_hash in the GroupInfo.
  • Verify the confirmation tag in the GroupInfo using the derived confirmationkey and theconfirmed_transcript_hash from the GroupInfo.
  • Use the confirmed transcript hash and confirmation tag to compute the interimtranscript hash in the new state.

11.3.Ratchet Tree Extension

By default, a GroupInfo message only provides the joiner with a commitmentto the group's ratchet tree. In order to process or generate handshakemessages, the joiner will need to get a copy of the ratchet tree from some othersource. (For example, the DS might provide a cached copy.) The inclusion ofthe tree hash in the GroupInfo message means that the source of the ratchettree need not be trusted to maintain the integrity of tree.

In cases where the application does not wish to provide such an external source,the whole public state of the ratchet tree can be provided in an extension oftyperatchet_tree, containing aratchet_tree object of the following form:

enum {    reserved(0),    leaf(1),    parent(2),    (255)} NodeType;struct {    NodeType node_type;    select (Node.node_type) {        case leaf:   KeyPackage key_package;        case parent: ParentNode node;    };} Node;optional<Node> ratchet_tree<1..2^32-1>;

The presence of aratchet_tree extension in a GroupInfo message does notresult in any changes to the GroupContext extensions for the group. The ratchettree provided is simply stored by the client and used for MLS operations.

If this extension is not provided in a Welcome message, then the client willneed to fetch the ratchet tree over some other channel before it can generate orprocess Commit messages. Applications should ensure that this out-of-bandchannel is provided with security protections equivalent to the protections thatare afforded to Proposal and Commit messages. For example, an application thatencrypts Proposal and Commit messages might distribute ratchet trees encryptedusing a key exchanged over the MLS channel.

12.Extensibility

This protocol includes a mechanism for negotiating extension parameters similarto the one in TLS[RFC8446]. In TLS, extension negotiation is one-to-one: Theclient offers extensions in its ClientHello message, and the server expressesits choices for the session with extensions in its ServerHello andEncryptedExtensions messages. In MLS, extensions appear in the followingplaces:

  • In KeyPackages, to describe client capabilities and aspects of theirparticipation in the group (once in the ratchet tree)
  • In the Welcome message, to tell new members of a group what parameters arebeing used by the group, and to provide any additional details required tojoin the group
  • In the GroupContext object, to ensure that all members of the group have thesame view of the parameters in use

In other words, an application can use GroupContext extensions to ensure thatall members of the group agree on a set of parameters. Clients indicatetheir support for parameters in KeyPackage extensions. New members of agroup are informed of the group's GroupContext extensions via thegroup_context_extensions field in the GroupInfo or PublicGroupState object.Theother_extensions field in a GroupInfo object can be used to provideadditional parameters to new joiners that are used to join the group.

This extension mechanism is designed to allow for secure and forward-compatiblenegotiation of extensions. For this to work, implementations MUST correctlyhandle extensible fields:

  • A client that posts a KeyPackage MUST support all parameters advertised init. Otherwise, another client might fail to interoperate by selecting one ofthose parameters.
  • A client initiating a group MUST ignore all unrecognized ciphersuites,extensions, and other parameters. Otherwise, it may fail to interoperate withnewer clients.
  • A client adding a new member to a group MUST verify that the KeyPackagefor the new member contains extensions that are consistent with the group'sextensions. For each extension in the GroupContext, the KeyPackage MUSThave an extension of the same type, and the contents of the extension MUST beconsistent with the value of the extension in the GroupContext, according tothe semantics of the specific extension.
  • If any extension in a GroupInfo message is unrecognized (i.e., not containedin the corresponding KeyPackage), then the client MUST reject the Welcomemessage and not join the group.
  • The extensions populated into a GroupContext object are drawn from those inthe GroupInfo object, according to the definitions of those extensions.

Note that the latter two requirements mean that all MLS extensions aremandatory, in the sense that an extension in use by the group MUST be supportedby all members of the group.

This document does not define any way for the parameters of the group to changeonce it has been created; such a behavior could be implemented as an extension.

13.Sequencing of State Changes

Each Commit message is premised on a given starting state,indicated by theepoch field of the enclosing MLSPlaintextmessage. If the changes implied by a Commit messages are madestarting from a different state, the results will be incorrect.

This need for sequencing is not a problem as long as each time agroup member sends a Commit message, it is based on the mostcurrent state of the group. In practice, however, there is a riskthat two members will generate Commit messages simultaneously,based on the same state.

When this happens, there is a need for the members of the group todeconflict the simultaneous Commit messages. There are twogeneral approaches:

  • Have the Delivery Service enforce a total order
  • Have a signal in the message that clients can use to break ties

As long as Commit messages cannot be merged, there is a risk ofstarvation. In a sufficiently busy group, a given member may neverbe able to send a Commit message, because he always loses to othermembers. The degree to which this is a practical problem will dependon the dynamics of the application.

It might be possible, because of the non-contributivity of intermediatenodes, that Commit messages could be applied one after the otherwithout the Delivery Service having to reject any Commit message,which would make MLS more resilient regarding the concurrency ofCommit messages.The Messaging system can decide to choose the order for applyingthe state changes. Note that there are certain cases (if no totalordering is applied by the Delivery Service) where the ordering isimportant for security, ie. all updates must be executed beforeremoves.

Regardless of how messages are kept in sequence, implementationsMUST only update their cryptographic state when valid Commitmessages are received.Generation of Commit messages MUST NOT modify a client's state, since theendpoint doesn't know at that time whether the changes implied bythe Commit message will succeed or not.

13.1.Server-Enforced Ordering

With this approach, the Delivery Service ensures that incomingmessages are added to an ordered queue and outgoing messages aredispatched in the same order. The server is trusted to break tieswhen two members send a Commit message at the same time.

Messages should have a counter field sent in clear-text that canbe checked by the server and used for tie-breaking. The counterstarts at 0 and is incremented for every new incoming message.If two group members send a message with the same counter, thefirst message to arrive will be accepted by the server and thesecond one will be rejected. The rejected message needs to be sentagain with the correct counter number.

To prevent counter manipulation by the server, the counter'sintegrity can be ensured by including the counter in a signedmessage envelope.

This applies to all messages, not only state changing messages.

13.2.Client-Enforced Ordering

Order enforcement can be implemented on the client as well,one way to achieve it is to use a two step update protocol: thefirst client sends a proposal to update and the proposal isaccepted when it gets 50%+ approval from the rest of the group,then it sends the approved update. Clients which didn't gettheir proposal accepted, will wait for the winner to send theirupdate before retrying new proposals.

While this seems safer as it doesn't rely on the server, it ismore complex and harder to implement. It also could cause starvationfor some clients if they keep failing to get their proposal accepted.

14.Application Messages

The primary purpose of the Handshake protocol is to provide anauthenticated group key exchange to clients. In order to protectApplication messages sent among the members of a group, the Applicationsecret provided by the Handshake key schedule is used to derive noncesand encryption keys for the Message Protection Layer according tothe Application Key Schedule. That is, each epoch is equipped witha fresh Application Key Schedule which consist of a tree of ApplicationSecrets as well as one symmetric ratchet per group member.

Each client maintains their own local copy of the Application KeySchedule for each epoch during which they are a group member. Theyderive new keys, nonces and secrets as needed while deleting oldones as soon as they have been used.

Application messages MUST be protected with the Authenticated-Encryptionwith Associated-Data (AEAD) encryption scheme associated with theMLS ciphersuite using the common framing mechanism.Note that "Authenticated" in this context does not mean messages areknown to be sent by a specific client but only from a legitimatemember of the group.To authenticate a message from a particular member, signatures arerequired. Handshake messages MUST use asymmetric signatures to stronglyauthenticate the sender of a message.

14.1.Message Encryption and Decryption

The group members MUST use the AEAD algorithm associated withthe negotiated MLS ciphersuite to AEAD encrypt and decrypt theirApplication messages according to the Message Framing section.

The group identifier and epoch allow a recipient to know which group secretsshould be used and from which Epoch secret to start computing other secretsand keys. The sender identifier is used to identify the member'ssymmetric ratchet from the initial group Application secret. The applicationgeneration field is used to determine how far into the ratchet to iterate inorder to reproduce the required AEAD keys and nonce for performing decryption.

Application messages SHOULD be padded to provide some resistanceagainst traffic analysis techniques over encrypted traffic.[CLINIC][HCJ16]While MLS might deliver the same payload less frequently acrossa lot of ciphertexts than traditional web servers, it might still providethe attacker enough information to mount an attack. If Alice asks Bob:"When are we going to the movie ?" the answer "Wednesday" might be leakedto an adversary by the ciphertext length. An attacker expecting Alice toanswer Bob with a day of the week might find out the plaintext bycorrelation between the question and the length.

Similarly to TLS 1.3, if padding is used, the MLS messages MUST bepadded with zero-valued bytes before AEAD encryption. Upon AEAD decryption,the length field of the plaintext is used to compute the number of bytesto be removed from the plaintext to get the correct data.As the padding mechanism is used to improve protection against trafficanalysis, removal of the padding SHOULD be implemented in a "constant-time"manner at the MLS layer and above layers to prevent timing side-channels thatwould provide attackers with information on the size of the plaintext.The padding length length_of_padding can be chosen at the time of the messageencryption by the sender. Recipients can calculate the padding size from knowingthe total size of the ApplicationPlaintext and the length of the content.

14.2.Restrictions

During each epoch senders MUST NOT encrypt more data than permitted by thesecurity bounds of the AEAD scheme used.

Note that each change to the Group through a Handshake message will also set anewencryption_secret. Hence this change MUST be applied before encryptingany new application message. This is required both to ensure that any usersremoved from the group can no longer receive messages and to (potentially)recover confidentiality and authenticity for future messages despite a paststate compromise.

14.3.Delayed and Reordered Application messages

Since each Application message contains the group identifier, the epoch and amessage counter, a client can receive messages out of order.If they are able to retrieve or recompute the correct AEAD decryption keyfrom currently stored cryptographic material clients can decryptthese messages.

For usability, MLS clients might be required to keep the AEAD keyand nonce for a certain amount of time to retain the ability to decryptdelayed or out of order messages, possibly still in transit while adecryption is being done.

15.Security Considerations

The security goals of MLS are described in[I-D.ietf-mls-architecture].We describe here how the protocol achieves its goals at a high level,though a complete security analysis is outside of the scope of thisdocument.

15.1.Confidentiality of the Group Secrets

Group secrets are partly derived from the output of a ratchet tree. Ratchettrees work by assigning each member of the group to a leaf in the tree andmaintaining the following property: the private key of a node in the tree isknown only to members of the group that are assigned a leaf in the node'ssubtree. This is called theratchet tree invariant and it makes it possible toencrypt to all group members except one, with a number of ciphertexts that'slogarithmic in the number of group members.

The ability to efficiently encrypt to all members except one allows members tobe securely removed from a group. It also allows a member to rotate theirkeypair such that the old private key can no longer be used to decrypt newmessages.

15.2.Authentication

The first form of authentication we provide is that group members can verify amessage originated from one of the members of the group. For encrypted messages,this is guaranteed because messages are encrypted with an AEAD under a keyderived from the group secrets. For plaintext messages, this is guaranteed bythe use of amembership_tag which constitutes a MAC over the message, under akey derived from the group secrets.

The second form of authentication is that group members can verify a messageoriginated from a particular member of the group. This is guaranteed by adigital signature on each message from the sender's signature key.

The signature keys held by group members are critical to the security of MLSagainst active attacks. If a member's signature key is compromised, then anattacker can create KeyPackages impersonating the member; depending on theapplication, this can then allow the attacker to join the group with thecompromised member's identity. For example, if a group has enabled externalparties to join via external commits, then an attacker that has compromised amember's signature key could use an external commit to insert themselves intothe group -- even using a "resync"-style external commit to replace thecompromised member in the group.

Applications can mitigate the risks of signature key compromise using pre-sharedkeys. If a group requires joiners to know a PSK in addition to authenticatingwith a credential, then in order to mount an impersonation attack, the attackerwould need to compromise the relevant PSK as well as the victim's signature key.The cost of this mitigation is that the application needs some externalarrangement that ensures that the legitimate members of the group to have therequired PSKs.

15.3.Forward Secrecy and Post-Compromise Security

Post-compromise security is provided between epochs by members regularlyupdating their leaf key in the ratchet tree. Updating their leaf key preventsgroup secrets from continuing to be encrypted to previously compromised publickeys.

Forward-secrecy between epochs is provided by deleting private keys from pastversion of the ratchet tree, as this prevents old group secrets from beingre-derived. Forward secrecywithin an epoch is provided by deleting messageencryption keys once they've been used to encrypt or decrypt a message.

Post-compromise security is also provided for new groups by members regularlygenerating new InitKeys and uploading them to the Delivery Service, such thatcompromised key material won't be used when the member is added to a new group.

15.4.InitKey Reuse

InitKeys are intended to be used only once. That is, once an InitKey has beenused to introduce the corresponding client to a group, it SHOULD be deleted fromthe InitKey publication system. Reuse of InitKeys can lead to replay attacks.

An application MAY allow for reuse of a "last resort" InitKey in order toprevent denial of service attacks. Since an InitKey is needed to add a clientto a new group, an attacker could prevent a client being added to new groups byexhausting all available InitKeys.

15.5.Group Fragmentation by Malicious Insiders

It is possible for a malicious member of a group to "fragment" the group bycrafting an invalid UpdatePath. Recall that an UpdatePath encrypts a sequenceof path secrets to different subtrees of the group's ratchet trees. These pathsecrets should be derived in a sequence as described inSection 5.4, but the UpdatePath syntax allows the sender toencrypt arbitrary, unrelated secrets. The syntax also does not guarantee thatthe encrypted path secret encrypted for a given node corresponds to the publickey provided for that node.

Both of these types of corruption will cause processing of a Commit to fail forsome members of the group. If the public key for a node does not match the pathsecret, then the members that decrypt that path secret will reject the commitbased on this mismatch. If the path secret sequence is incorrect at some point,then members that can decrypt nodes before that point will compute a differentpublic key for the mismatched node than the one in the UpdatePath, which alsocauses the Commit to fail. Applications SHOULD provide mechanisms for failedcommits to be reported, so that group members who were not able to recognize theerror themselves can reject the commit and roll back to a previous state ifnecessary.

Even with such an error reporting mechanism in place, however, it is stillpossible for members to get locked out of the group by a malformed commit.Since malformed Commits can only be recognized by certain members of the group,in an asynchronous application, it may be the case that all members that coulddetect a fault in a Commit are offline. In such a case, the Commit will beaccepted by the group, and the resulting state possibly used as the basis forfurther Commits. When the affected members come back online, they will rejectthe first commit, and thus be unable to catch up with the group.

Applications can address this risk by requiring certain members of the group toacknowledge successful processing of a Commit before the group regards theCommit as accepted. The minimum set of acknowledgements necessary to verifythat a Commit is well-formed comprises an acknowledgement from one member pernode in the UpdatePath, that is, one member from each subtree rooted in thecopath node corresponding to the node in the UpdatePath.

16.IANA Considerations

This document requests the creation of the following new IANA registries:

All of these registries should be under a heading of "Messaging Layer Security",and assignments are made via the Specification Required policy[RFC8126]. SeeSection 16.5 for additional information about the MLS Designated Experts (DEs).

RFC EDITOR: Please replace XXXX throughout with the RFC number assigned tothis document

16.1.MLS Ciphersuites

A ciphersuite is a combination of a protocol version and the set ofcryptographic algorithms that should be used.

Ciphersuite names follow the naming convention:

CipherSuite MLS_LVL_KEM_AEAD_HASH_SIG = VALUE;

Where VALUE is represented as a sixteen-bit integer:

uint16 CipherSuite;
Table 3
ComponentContents
MLSThe string "MLS" followed by the major and minor version, e.g. "MLS10"
LVLThe security level
KEMThe KEM algorithm used for HPKE in TreeKEM group operations
AEADThe AEAD algorithm used for HPKE and message protection
HASHThe hash algorithm used for HPKE and the MLS transcript hash
SIGThe Signature algorithm used for message authentication

The columns in the registry are as follows:

  • Value: The numeric value of the ciphersuite
  • Name: The name of the ciphersuite
  • Recommended: Whether support for this ciphersuite is recommended by the IETF MLSWG. Valid values are "Y" and "N". The "Recommended" column is assigned avalue of "N" unless explicitly requested, and adding a value with a"Recommended" value of "Y" requires Standards Action[RFC8126]. IESG Approvalis REQUIRED for a Y->N transition.
  • Reference: The document where this ciphersuite is defined

Initial contents:

Table 4
ValueNameRecommendedReference
0x0000RESERVEDN/ARFC XXXX
0x0001MLS10_128_DHKEMX25519_AES128GCM_SHA256_Ed25519YRFC XXXX
0x0002MLS10_128_DHKEMP256_AES128GCM_SHA256_P256YRFC XXXX
0x0003MLS10_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519YRFC XXXX
0x0004MLS10_256_DHKEMX448_AES256GCM_SHA512_Ed448YRFC XXXX
0x0005MLS10_256_DHKEMP521_AES256GCM_SHA512_P521YRFC XXXX
0x0006MLS10_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448YRFC XXXX
0xff00 - 0xffffReserved for Private UseN/ARFC XXXX

All of these ciphersuites use HMAC[RFC2104] as their MAC function, withdifferent hashes per ciphersuite. The mapping of ciphersuites to HPKEprimitives, HMAC hash functions, and TLS signature schemes is as follows[I-D.irtf-cfrg-hpke][RFC8446]:

Table 5
ValueKEMKDFAEADHashSignature
0x00010x00200x00010x0001SHA256ed25519
0x00020x00100x00010x0001SHA256ecdsa_secp256r1_sha256
0x00030x00200x00010x0003SHA256ed25519
0x00040x00210x00030x0002SHA512ed448
0x00050x00120x00030x0002SHA512ecdsa_secp521r1_sha512
0x00060x00210x00030x0003SHA512ed448

The hash used for the MLS transcript hash is the one referenced in theciphersuite name. In the ciphersuites defined above, "SHA256" and "SHA512"refer to the SHA-256 and SHA-512 functions defined in[SHS].

It is advisable to keep the number of ciphersuites low to increase the chancesclients can interoperate in a federated environment, therefore the ciphersuitesonly inlcude modern, yet well-established algorithms. Depending on theirrequirements, clients can choose between two security levels (roughly 128-bitand 256-bit). Within the security levels clients can choose between fasterX25519/X448 curves and FIPS 140-2 compliant curves for Diffie-Hellman keynegotiations. Additionally clients that run predominantly on mobile processorscan choose ChaCha20Poly1305 over AES-GCM for performance reasons. SinceChaCha20Poly1305 is not listed by FIPS 140-2 it is not paired with FIPS 140-2compliant curves. The security level of symmetric encryption algorithms and hashfunctions is paired with the security level of the curves.

The mandatory-to-implement ciphersuite for MLS 1.0 isMLS10_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 which usesCurve25519 for key exchange, AES-128-GCM for HPKE, HKDF over SHA2-256, andEd25519 for signatures.

Values with the first byte 255 (decimal) are reserved for Private Use.

New ciphersuite values are assigned by IANA as described inSection 16.

16.2.MLS Extension Types

This registry lists identifiers for extensions to the MLS protocol. Theextension type field is two bytes wide, so valid extension type values are inthe range 0x0000 to 0xffff.

Template:

  • Value: The numeric value of the extension type
  • Name: The name of the extension type
  • Message(s): The messages in which the extension may appear, drawn from the followinglist:

    • KP: KeyPackage messages
    • GC: GroupContext objects (and thegroup_context_extensions field ofGroupInfo objects)
    • GI: Theother_extensions field of GroupInfo objects
  • Recommended: Whether support for this extension is recommended by the IETF MLSWG. Valid values are "Y" and "N". The "Recommended" column is assigned avalue of "N" unless explicitly requested, and adding a value with a"Recommended" value of "Y" requires Standards Action[RFC8126]. IESG Approvalis REQUIRED for a Y->N transition.
  • Reference: The document where this extension is defined

Initial contents:

Table 6
ValueNameMessage(s)RecommendedReference
0x0000RESERVEDN/AN/ARFC XXXX
0x0001capabilitiesKPYRFC XXXX
0x0002lifetimeKPYRFC XXXX
0x0003external_key_idKPYRFC XXXX
0x0004parent_hashKPYRFC XXXX
0x0005ratchet_treeGIYRFC XXXX
0xff00 - 0xffffReserved for Private UseN/AN/ARFC XXXX

16.3.MLS Proposal Types

This registry lists identifiers for types of proposals that can be made forchanges to an MLS group. The extension type field is two bytes wide, so validextension type values are in the range 0x0000 to 0xffff.

Template:

  • Value: The numeric value of the proposal type
  • Name: The name of the proposal type
  • Recommended: Whether support for this extension is recommended by the IETF MLSWG. Valid values are "Y" and "N". The "Recommended" column is assigned avalue of "N" unless explicitly requested, and adding a value with a"Recommended" value of "Y" requires Standards Action[RFC8126]. IESG Approvalis REQUIRED for a Y->N transition.
  • Reference: The document where this extension is defined

Initial contents:

Table 7
ValueNameRecommendedReference
0x0000RESERVEDN/ARFC XXXX
0x0001addYRFC XXXX
0x0002updateYRFC XXXX
0x0003removeYRFC XXXX
0x0004pskYRFC XXXX
0x0005reinitYRFC XXXX
0x0006external_initYRFC XXXX
0x0007app_ackYRFC XXXX
0x0008group_context_extensionsYRFC XXXX
0xff00 - 0xffffReserved for Private UseN/ARFC XXXX

16.4.MLS Credential Types

This registry lists identifiers for types of credentials that can be used forauthentication in the MLS protocol. The credential type field is two bytes wide,so valid credential type values are in the range 0x0000 to 0xffff.

Template:

  • Value: The numeric value of the credential type
  • Name: The name of the credential type
  • Recommended: Whether support for this credential is recommended by the IETF MLSWG. Valid values are "Y" and "N". The "Recommended" column is assigned avalue of "N" unless explicitly requested, and adding a value with a"Recommended" value of "Y" requires Standards Action[RFC8126]. IESG Approvalis REQUIRED for a Y->N transition.
  • Reference: The document where this credential is defined

Initial contents:

Table 8
ValueNameRecommendedReference
0x0000RESERVEDN/ARFC XXXX
0x0001basicYRFC XXXX
0x0002x509YRFC XXXX
0xff00 - 0xffffReserved for Private UseN/ARFC XXXX

16.5.MLS Designated Expert Pool

Specification Required[RFC8126] registry requests are registeredafter a three-week review period on the MLS DEs' mailing list:mls-reg-review@ietf.org, on the advice of one or more of the MLS DEs. However,to allow for the allocation of values prior to publication, the MLSDEs may approve registration once they are satisfied that such aspecification will be published.

Registration requests sent to the MLS DEs mailing list for reviewSHOULD use an appropriate subject (e.g., "Request to register valuein MLS Bar registry").

Within the review period, the MLS DEs will either approve or denythe registration request, communicating this decision to the MLS DEsmailing list and IANA. Denials SHOULD include an explanation and, ifapplicable, suggestions as to how to make the request successful.Registration requests that are undetermined for a period longer than21 days can be brought to the IESG's attention for resolution usingtheiesg@ietf.org mailing list.

Criteria that SHOULD be applied by the MLS DEs includes determiningwhether the proposed registration duplicates existing functionality,whether it is likely to be of general applicability or useful onlyfor a single application, and whether the registration descriptionis clear. For example, the MLS DEs will apply the ciphersuite-relatedadvisory found inSection 6.1.

IANA MUST only accept registry updates from the MLS DEs and SHOULDdirect all requests for registration to the MLS DEs' mailing list.

It is suggested that multiple MLS DEs be appointed who are able torepresent the perspectives of different applications using thisspecification, in order to enable broadly informed review ofregistration decisions. In cases where a registration decision couldbe perceived as creating a conflict of interest for a particularMLS DE, that MLS DE SHOULD defer to the judgment of the other MLS DEs.

17.Contributors

  • Joel Alwen
    Wickr
    joel.alwen@wickr.com
  • Karthikeyan Bhargavan
    INRIA
    karthikeyan.bhargavan@inria.fr
  • Cas Cremers
    University of Oxford
    cremers@cispa.de
  • Alan Duric
    Wire
    alan@wire.com
  • Britta Hale
    Naval Postgraduate School
    britta.hale@nps.edu
  • Srinivas Inguva
    Twitter
    singuva@twitter.com
  • Konrad Kohbrok
    Aalto University
    konrad.kohbrok@datashrine.de
  • Albert Kwon
    MIT
    kwonal@mit.edu
  • Brendan McMillion
    Cloudflare
    brendan@cloudflare.com
  • Eric Rescorla
    Mozilla
    ekr@rtfm.com
  • Michael Rosenberg
    Trail of Bits
    michael.rosenberg@trailofbits.com
  • Thyla van der Merwe
    Royal Holloway, University of London
    thyla.van.der@merwe.tech

18.References

18.1.Normative References

[I-D.irtf-cfrg-hpke]
Barnes, R. L.,Bhargavan, K.,Lipp, B., andC. A. Wood,"Hybrid Public Key Encryption",Work in Progress,Internet-Draft, draft-irtf-cfrg-hpke-12,,<https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-hpke-12>.
[RFC2104]
Krawczyk, H.,Bellare, M., andR. Canetti,"HMAC: Keyed-Hashing for Message Authentication",RFC 2104,DOI 10.17487/RFC2104,,<https://www.rfc-editor.org/rfc/rfc2104>.
[RFC2119]
Bradner, S.,"Key words for use in RFCs to Indicate Requirement Levels",BCP 14,RFC 2119,DOI 10.17487/RFC2119,,<https://www.rfc-editor.org/rfc/rfc2119>.
[RFC8126]
Cotton, M.,Leiba, B., andT. Narten,"Guidelines for Writing an IANA Considerations Section in RFCs",BCP 26,RFC 8126,DOI 10.17487/RFC8126,,<https://www.rfc-editor.org/rfc/rfc8126>.
[RFC8174]
Leiba, B.,"Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words",BCP 14,RFC 8174,DOI 10.17487/RFC8174,,<https://www.rfc-editor.org/rfc/rfc8174>.
[RFC8446]
Rescorla, E.,"The Transport Layer Security (TLS) Protocol Version 1.3",RFC 8446,DOI 10.17487/RFC8446,,<https://www.rfc-editor.org/rfc/rfc8446>.

18.2.Informative References

[art]
Cohn-Gordon, K.,Cremers, C.,Garratt, L.,Millican, J., andK. Milner,"On Ends-to-Ends Encryption: Asynchronous Group Messaging with Strong Security Guarantees",,<https://eprint.iacr.org/2017/666.pdf>.
[CLINIC]
Miller, B.,Huang, L.,Joseph, A., andJ. Tygar,"I Know Why You Went to the Clinic: Risks and Realization of HTTPS Traffic Analysis",Privacy Enhancing Technologies pp. 143-163,DOI 10.1007/978-3-319-08506-7_8,,<https://doi.org/10.1007/978-3-319-08506-7_8>.
[doubleratchet]
Cohn-Gordon, K.,Cremers, C.,Dowling, B.,Garratt, L., andD. Stebila,"A Formal Security Analysis of the Signal Messaging Protocol",2017 IEEE European Symposium on Security and Privacy (EuroS&P),DOI 10.1109/eurosp.2017.27,,<https://doi.org/10.1109/eurosp.2017.27>.
[HCJ16]
Husák, M.,Čermák, M.,Jirsík, T., andP. Čeleda,"HTTPS traffic analysis and client identification using passive SSL/TLS fingerprinting",EURASIP Journal on Information Security Vol. 2016,DOI 10.1186/s13635-016-0030-7,,<https://doi.org/10.1186/s13635-016-0030-7>.
[I-D.ietf-mls-architecture]
Beurdouche, B.,Rescorla, E.,Omara, E.,Inguva, S.,Kwon, A., andA. Duric,"The Messaging Layer Security (MLS) Architecture",Work in Progress,Internet-Draft, draft-ietf-mls-architecture-07,,<https://datatracker.ietf.org/doc/html/draft-ietf-mls-architecture-07>.
[I-D.ietf-trans-rfc6962-bis]
Laurie, B.,Langley, A.,Kasper, E.,Messeri, E., andR. Stradling,"Certificate Transparency Version 2.0",Work in Progress,Internet-Draft, draft-ietf-trans-rfc6962-bis-42,,<https://datatracker.ietf.org/doc/html/draft-ietf-trans-rfc6962-bis-42>.
[RFC8032]
Josefsson, S. andI. Liusvaara,"Edwards-Curve Digital Signature Algorithm (EdDSA)",RFC 8032,DOI 10.17487/RFC8032,,<https://www.rfc-editor.org/rfc/rfc8032>.
[SECG]
"Elliptic Curve Cryptography, Standards for Efficient Cryptography Group, ver. 2",,<https://secg.org/sec1-v2.pdf>.
[SHS]
Dang, Q.,"Secure Hash Standard",National Institute of Standards and Technology report,DOI 10.6028/nist.fips.180-4,,<https://doi.org/10.6028/nist.fips.180-4>.
[signal]
Perrin(ed), T. andM. Marlinspike,"The Double Ratchet Algorithm",,<https://www.signal.org/docs/specifications/doubleratchet/>.

Appendix A.Tree Math

One benefit of using left-balanced trees is that they admit a simpleflat array representation. In this representation, leaf nodes areeven-numbered nodes, with the n-th leaf at 2*n. Intermediate nodesare held in odd-numbered nodes. For example, an 11-element tree hasthe following structure:

                                             X                     X         X                       X                       X   X           X           X           X           XX     X     X     X     X     X     X     X     X     X     X0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20

This allows us to compute relationships between tree nodes simply bymanipulating indices, rather than having to maintain complicatedstructures in memory, even for partial trees. The basicrule is that the high-order bits of parent and child nodes have thefollowing relation (wherex is an arbitrary bit string):

parent=01x => left=00x, right=10x

The following python code demonstrates the tree computationsnecessary for MLS. Test vectors can be derived from the diagramabove.

# The exponent of the largest power of 2 less than x. Equivalent to:#   int(math.floor(math.log(x, 2)))def log2(x):    if x == 0:        return 0    k = 0    while (x >> k) > 0:        k += 1    return k-1# The level of a node in the tree. Leaves are level 0, their parents are# level 1, etc. If a node's children are at different levels, then its# level is the max level of its children plus one.def level(x):    if x & 0x01 == 0:        return 0    k = 0    while ((x >> k) & 0x01) == 1:        k += 1    return k# The number of nodes needed to represent a tree with n leaves.def node_width(n):    if n == 0:        return 0    else:        return 2*(n - 1) + 1# The index of the root node of a tree with n leaves.def root(n):    w = node_width(n)    return (1 << log2(w)) - 1# The left child of an intermediate node. Note that because the tree is# left-balanced, there is no dependency on the size of the tree.def left(x):    k = level(x)    if k == 0:        raise Exception('leaf node has no children')    return x ^ (0x01 << (k - 1))# The right child of an intermediate node. Depends on the number of# leaves because the straightforward calculation can take you beyond the# edge of the tree.def right(x, n):    k = level(x)    if k == 0:        raise Exception('leaf node has no children')    r = x ^ (0x03 << (k - 1))    while r >= node_width(n):        r = left(r)    return r# The immediate parent of a node. May be beyond the right edge of the# tree.def parent_step(x):    k = level(x)    b = (x >> (k + 1)) & 0x01    return (x | (1 << k)) ^ (b << (k + 1))# The parent of a node. As with the right child calculation, we have to# walk back until the parent is within the range of the tree.def parent(x, n):    if x == root(n):        raise Exception('root node has no parent')    p = parent_step(x)    while p >= node_width(n):        p = parent_step(p)    return p# The other child of the node's parent.def sibling(x, n):    p = parent(x, n)    if x < p:        return right(p, n)    else:        return left(p)# The direct path of a node, ordered from leaf to root.def direct_path(x, n):    r = root(n)    if x == r:        return []    d = []    while x != r:        x = parent(x, n)        d.append(x)    return d# The copath of a node, ordered from leaf to root.def copath(x, n):    if x == root(n):        return []    d = direct_path(x, n)    d.insert(0, x)    d.pop()    return [sibling(y, n) for y in d]# The common ancestor of two nodes is the lowest node that is in the# direct paths of both leaves.def common_ancestor_semantic(x, y, n):    dx = set([x]) | set(direct_path(x, n))    dy = set([y]) | set(direct_path(y, n))    dxy = dx & dy    if len(dxy) == 0:        raise Exception('failed to find common ancestor')    return min(dxy, key=level)# The common ancestor of two nodes is the lowest node that is in the# direct paths of both leaves.def common_ancestor_direct(x, y, _):    # Handle cases where one is an ancestor of the other    lx, ly = level(x)+1, level(y)+1    if (lx <= ly) and (x>>ly == y>>ly):      return y    elif (ly <= lx) and (x>>lx == y>>lx):      return x    # Handle other cases    xn, yn = x, y    k = 0    while xn != yn:       xn, yn = xn >> 1, yn >> 1       k += 1    return (xn << k) + (1 << (k-1)) - 1

Authors' Addresses

Richard Barnes
Cisco
Benjamin Beurdouche
Inria & Mozilla
Raphael Robert
Jon Millican
Facebook
Emad Omara
Google
Katriel Cohn-Gordon
University of Oxford
Datatracker

draft-ietf-mls-protocol-12

This is an older version of an Internet-Draft that was ultimately published asRFC 9420.

DocumentDocument type
This is an older version of an Internet-Draft that was ultimately published asRFC 9420.
Select version
Compare versions
AuthorsRichard Barnes,Benjamin Beurdouche,Raphael Robert,Jon Millican,Emad Omara,Katriel Cohn-Gordon
Replacesdraft-barnes-mls-protocol
RFC streamIETF LogoIETF Logo
Other formats
Additional resources Mailing list discussion
Report a datatracker bug

[8]ページ先頭

©2009-2026 Movatter.jp