RFC 9420 | MLS | July 2023 |
Barnes, et al. | Standards Track | [Page] |
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 (FS) and post-compromise security (PCS) for groupsin size ranging from two to thousands.¶
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained athttps://www.rfc-editor.org/info/rfc9420.¶
Copyright (c) 2023 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 Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
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 todistribute symmetric "sender keys" over existing 1:1secure channels, and then for each member to send messages to thegroup encrypted with their own sender key. On the one hand, using sender keysimproves efficiency relative to pairwise transmission of individual messages, andit provides forward secrecy (with the addition of a hash ratchet).On the other hand, it is difficult to achieve post-compromise security withsender keys, requiring a number of key update messages that scales as the squareof the group size.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 enables 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.¶
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 all capitals, as shown here.¶
Terminology specific to tree computations is described inSection 4.1.¶
In general, symmetric values are referred to as "keys" or "secrets"interchangeably. Either term denotes a value thatMUST be kept confidential toa client. When labeling individual values, we typically use "secret" to referto a value that is used to derive further secret values and "key" to refer to avalue that is used with an algorithm such as Hashed Message Authentication Code(HMAC) or an Authenticated Encryption with Associated Data (AEAD) algorithm.¶
The PublicMessage and PrivateMessage formats are defined inSection 6.Security notions such as forward secrecy and post-compromisesecurity are defined inSection 16.¶
As detailed inSection 13.5, MLS uses the "Generate Random Extensions And SustainExtensibility" (GREASE) approach to maintaining extensibility, where senders insert randomvalues into fields in which receivers are required to ignore unknown values.Specific "GREASE values" for this purpose are registered in the appropriate IANAregistries.¶
We use the TLS presentation language[RFC8446] to describe the structure ofprotocol messages. In addition to the base syntax, we add two additionalfeatures: the ability for fields to be optional and the ability for vectors tohave variable-size length headers.¶
An optional value is encoded with a presence-signaling octet, followed by thevalue itself if present. When decoding, a presence octet with a value otherthan 0 or 1MUST be rejected as malformed.¶
struct { uint8 present; select (present) { case 0: struct{}; case 1: T value; };} optional<T>;¶
In the TLS presentation language, vectors are encoded as a sequence of encodedelements prefixed with a length. The length field has a fixed size set byspecifying the minimum and maximum lengths of the encoded sequence of elements.¶
In MLS, there are several vectors whose sizes vary over significant ranges. Soinstead of using a fixed-size length field, we use a variable-size length usinga variable-length integer encoding based on the one described inSection 16 of [RFC9000]. They differ only in that the one here requires a minimum-sizeencoding. Instead of presenting min and max values, the vector descriptionsimply includes aV
. For example:¶
struct { uint32 fixed<0..255>; opaque variable<V>;} StructWithVectors;¶
Such a vector can represent values with length from 0 bytes to 230 bytes.The variable-length integer encoding reserves the two most significant bitsof the first byte to encode the base 2 logarithm of the integer encoding lengthin bytes. The integer value is encoded on the remaining bits, so that theoverall value is in network byte order.The encoded valueMUST use the smallest number of bits required torepresent the value. When decoding, values using more bits than necessaryMUSTbe treated as malformed.¶
This means that integers are encoded in 1, 2, or 4 bytes and can encode 6-,14-, or 30-bit values, respectively.¶
Prefix | Length | Usable Bits | Min | Max |
---|---|---|---|---|
00 | 1 | 6 | 0 | 63 |
01 | 2 | 14 | 64 | 16383 |
10 | 4 | 30 | 16384 | 1073741823 |
11 | invalid | - | - | - |
Vectors that start with the prefix "11" are invalid andMUST be rejected.¶
For example:¶
The following figure adapts the pseudocode provided in[RFC9000] to add acheck for minimum-length encoding:¶
ReadVarint(data): // The length of variable-length integers is encoded in the // first two bits of the first byte. v = data.next_byte() prefix = v >> 6 if prefix == 3: raise Exception('invalid variable length integer prefix') length = 1 << prefix // Once the length is known, remove these bits and read any // remaining bytes. v = v & 0x3f repeat length-1 times: v = (v << 8) + data.next_byte() // Check if the value would fit in half the provided length. if prefix >= 1 && v < (1 << (8*(length/2) - 2)): raise Exception('minimum encoding was not used') return v¶
The use of variable-size integers for vector lengths allows vectors to growvery large, up to 230 bytes. Implementations should take care not to allowvectors to overflow available storage. To facilitate debugging of potentialinteroperability problems, implementationsSHOULD provide a clear error whensuch an overflow condition occurs.¶
MLS is designed to operate in the context described in[MLS-ARCH]. In particular, we assume that the followingservices are provided:¶
MLS assumes a trusted AS but a largely untrusted DS.Section 16.10describes the impact of compromise ormisbehavior of an AS. MLS is designed to protect the confidentiality and integrity ofthe group data even in the face of a compromised DS;in general, the DS is only expected to reliably deliver messages.Section 16.9 describes the impact of compromise ormisbehavior of a DS.¶
The core functionality of MLS is continuous group authenticated key exchange(AKE). As with other authenticated key exchange protocols (such as TLS), theparticipants in the protocol agree on a common secret value, and eachparticipant can verify the identity of the other participants. That secretcan then be used to protect messages sent from one participant in thegroup to the other participants using the MLS framing layeror can be exported for use with other protocols. MLS providesgroup AKE in the sense that there can be more than two participants in theprotocol, and continuous group AKE in the sense that the set of participants inthe protocol can change over time.¶
The core organizing principles of MLS aregroups andepochs. A grouprepresents a logical collection of clients that share a common secret value atany given time. The history of a group is divided into a linear sequence ofepochs. In each epoch, a set of authenticatedmembers agree on anepochsecret that is known only to the members of the group in that epoch. The setof members involved in the group can change from one epoch to the next, and MLSensures that only the members in the current epoch have access to the epochsecret. From the epoch secret, members derive further shared secrets formessage encryption, group membership authentication, and so on.¶
The creator of an MLS group creates the group's first epoch unilaterally, withno protocol interactions. Thereafter, the members of the group advance theirshared cryptographic state from one epoch to another by exchanging MLS messages.¶
KeyPackage and Welcome messages are used to initiate a group or introduce newmembers, so they are exchanged between group members and clients not yet in thegroup. A client publishes a KeyPackage via the DS, thus enabling otherclients to add it to groups. When a group member wants to add a new member to agroup, it uses the new member's KeyPackage to add them and constructs a Welcomemessage with which the new member can initialize their local state.¶
Proposal and Commit messages are sent from one member of a group to the others.MLS provides a common framing layer for sending messages within a group:APublicMessage provides sender authentication for unencrypted Proposal and Commitmessages. APrivateMessage provides encryption and authentication forboth Proposal/Commit messages as well as any application data.¶
The cryptographic state at the core of MLS is divided into three areas of responsibility:¶
Akey schedule that describes the chain of key derivations used to progress fromepoch to epoch (mainly using theinit_secret andepoch_secret), as well as the derivation ofa variety of other secrets (seeTable 4). For example:¶
Each member of the group maintains a partial view of these components of the group'sstate. MLS messages are used to initialize these views and keep them in sync asthe group transitions between epochs.¶
Each new epoch is initiated with a Commit message. The Commit instructsexisting members of the group to update their views of the ratchet tree by applyinga set of Proposals, and uses the updated ratchet tree to distribute freshentropy to the group. This fresh entropy is provided only to members in the newepoch and not to members who have been removed. Commits thus maintain the property thatthe epoch secret is confidential to the members in the current epoch.¶
For each Commit that adds one or more members to the group, there are one or more correspondingWelcome messages. Each Welcome message provides new members with the informationthey need to initialize their views of the key schedule and ratchet tree, sothat these views align with the views held by other members of the groupin this epoch.¶
There are three major operations in the life of a group:¶
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. In the illustrations below, we show the Proposaland Commit messages directly, while in reality they would be sent encapsulated inPublicMessage or PrivateMessage objects.¶
Before the initialization of a group, clients publish KeyPackages to a directoryprovided by the DS (seeFigure 2).¶
Figure 3 shows how these pre-published KeyPackages are used to create a group.When client A wants to establish a group with clients B and C, it first initializes agroup state containing only itself and downloads KeyPackages for B and C. Foreach member, A generates an Add proposal and a Commit message to add that member and thenbroadcasts the two messages to the group. Client A also generates a Welcome message and sends itdirectly to the new member (there's no need to send it to the group). Only afterA has received its Commit message back from the Delivery Service does it update itsstate to reflect the new member's addition.¶
Once A has updated its state, the new member has processed the Welcome, and anyother group members have processed the Commit, they will all have consistentrepresentations of the group state, including a group secret that is known onlyto the members the group. The new member will be able to read and send newmessages to the group, but messages sent before they were added to the groupwill not be accessible.¶
Subsequent additions of group members proceed in the same way. Anymember of the group can download a KeyPackage for a new client,broadcast Add and Commit messages that the current group will use to updatetheir state, and send 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, eachmember periodically updates the keys that represent them to the group. A memberdoes this by sending a Commit (possibly with no proposals) or by sending anUpdate message that is committed by another member (seeFigure 4).Once the other members ofthe group have processed these messages, the group's secrets will be unknown toan attacker that had compromised the secrets corresponding to the sender's leaf in the tree.At the end of the scenario shown inFigure 4, the group haspost-compromise security with respect to both A and B.¶
Update messagesSHOULD be sent at regular intervals of time as long as the groupis active, and members that don't updateSHOULD eventually be removed from thegroup. It's left to the application to determine an appropriate amount of timebetween Updates. Since the purpose of sending an Update is to proactivelyconstrain a compromise window, the right frequency is usually on the order ofhours or days, not milliseconds. For example, an application might send anUpdate each time a member sends an application message after receiving anymessage from another member, or daily if no application messages are sent.¶
The MLS architecture recommends that MLS be operated over a secure transport(seeSection 7.1 of [MLS-ARCH]). Such transport protocolswill typically provide functions such as congestion control that manage theimpact of an MLS-using application on other applications sharing the samenetwork. Applications should take care that they do not send MLS messages at arate that will cause problems such as network congestion, especially if they arenot following the above recommendation (e.g., sending MLS directly over UDP instead).¶
Members are removed from the group in a similar way, as shown inFigure 5.Any member of the group can send a Remove proposal followed by aCommit message. The Commit message provides new entropy to all members of thegroup except the removed member. This new entropy is added to the epoch secretfor the new epoch so that it is not known to 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 mechanisms.¶
Note that the flows in this section are examples; applications can arrangemessage flows in other ways. For example:¶
In addition to the Welcome-based flow for adding a new member to the group, itis also possible for a new member to join by means of an "external Commit".This mechanism can be used when the existing members don't have a KeyPackage forthe new member, for example, in the case of an "open" group that can be joinedby new members without asking permission from existing members.¶
Figure 6 shows a typical message flow for an external join. To enablea new member to join the group in this way, a member of the group (A, B)publishes a GroupInfo object that includes the GroupContext for the group aswell as a public key that can be used to encrypt a secret to the existingmembers of the group. When the new member Z wishes to join, they download theGroupInfo object and use it to form a Commit of a special form that adds Z tothe group (as detailed inSection 12.4.3.2). The existingmembers of the group process this external Commit in a similar way to a normalCommit, advancing to a new epoch in which Z is now a member of the group.¶
GroupA B Z Directory Channel| | | | || GroupInfo | | | |+------------------------------------------->| || | | GroupInfo | || | |<-------------+ || | | | || | | Commit(ExtZ) | || | +---------------------------->|| | | | Commit(ExtZ) ||<----------------------------------------------------------+| |<-------------------------------------------+| | |<----------------------------+| | | | |
A group has a single linear sequence of epochs. Groups and epochs are generallyindependent of one another. However, it can sometimes be useful to link epochscryptographically, either within a group or across groups. MLS derives aresumption pre-shared key (PSK) from each epoch to allow entropy extracted fromone epoch to be injected into a future epoch. A group member that wishes toinject a PSK issues a PreSharedKey proposal (Section 12.1.4) describing thePSK to be injected. When this proposal is committed, the corresponding PSK willbe incorporated into the key schedule as described inSection 8.4.¶
Linking epochs in this wayguarantees that members entering the new epoch agree on a key if and only ifthey were members of the group during the epoch from which the resumption keywas extracted.¶
MLS supports two ways to tie a new group to an existing group, which are illustrated inFigures7 and8. Reinitializationcloses one group and creates a new group comprising the same members withdifferent parameters. Branching starts a new group with a subset of the originalgroup's participants (with no effect on the original group). In both cases,the new group is linked to the old group via a resumption PSK.¶
Applications may also choose to use resumption PSKs to link epochs in otherways. For example,Figure 9 shows a case where a resumption PSKfrom epochn
is injected into epochn+k
. This demonstrates that the membersof the group at epochn+k
were also members at epochn
, irrespective of anychanges to these members' keys due to Updates or Commits.¶
The protocol uses "ratchet trees" for deriving shared secrets among a group ofclients. A ratchet tree is an arrangement of secrets and key pairs among themembers of a group in a way that allows for secrets to be efficiently updated toreflect changes in the group.¶
Ratchet trees allow a group to efficiently remove any member by encrypting newentropy to a subset of the group. A ratchet tree assigns shared keys tosubgroups of the overall group, so that, for example, encrypting to all but onemember of the group requires onlylog(N)
encryptions to subtrees, instead of theN-1
encryptions that would be needed to encrypt to each participant individually(where N is the number of members in the group).¶
This remove operation allows MLS to efficiently achievepost-compromise security. In an Update proposal or a full Commit message, an old (possiblycompromised) representation of a member is efficiently removed from the group andreplaced with a freshly generated instance.¶
Trees consist ofnodes. A node is aleaf if it has no children; otherwise, it is aparent.All parents in our trees have preciselytwo children, aleft child and aright child. A node is therootof a tree if it has no parent, andintermediate if it has bothchildren and a parent. Thedescendants of a node are that node'schildren, and the descendants of its children. We say a treecontains a node if that node is a descendant of the root of the tree,or if the node itself is the root of the tree. Nodes aresiblings if they share the same parent.¶
Asubtree of a tree is the tree given by any node (thehead of thesubtree) and its descendants. 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 and itsright subtree is the subtree with its right child as head.¶
Every tree used in this protocol is a perfect binary tree, that is, a completebalanced binary tree with 2d leaves all at the same depthd
. Thisstructure is unique for a given depthd
.¶
There are multiple ways that an implementation might represent a ratchet tree inmemory. A convenient property of left-balanced binary trees (including thecomplete trees used here) is that they can be represented as an array of nodes,with node relationships computed based on the nodes' indices in the array. Amore traditional representation based on linked node objects may also be used.AppendicesC andD provide some details on how toimplement the tree operations required for MLS in these representations. MLSplaces no requirements on implementations' internal representations of ratchettrees. An implementation may use any tree representation and associatedalgorithms, as long as they produce correct protocol messages.¶
Each leaf node in a ratchet tree is given anindex (orleaf index), startingat 0 from the left to 2d - 1 at the right (for a tree with 2d leaves). A treewith 2d leaves has 2d+1 - 1 nodes, including parent nodes.¶
Each node in a ratchet tree is eitherblank (containing no value) or it holdsan HPKE public key with some associated data:¶
As described inSection 4.2, different members know different subsets of the setof private keys corresponding to the public keys in nodes in the tree. Theprivate key corresponding to a parent node is known only to members at leafnodes that are descendants of that node. The private key corresponding to a leafnode is known only to the member at that leaf node. A leaf node isunmergedrelative to one of its ancestor nodes if the member at the leaf node does notknow the private key corresponding to the ancestor node.¶
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.8.¶
Theresolution of a node is an ordered list of non-blank nodesthat collectively cover all non-blank descendants of the node.The resolution of the root contains the set of keys that are collectively necessary toencrypt to every node in the group. The resolutionof a node is effectively a depth-first, left-first enumeration of the nearestnon-blank nodes below the node:¶
For example, consider the following subtree, where the_
characterrepresents a blank node and unmerged leaves are indicated in squarebrackets:¶
... / _ ______|______ / \ X[B] _ __|__ __|__ / \ / \ _ _ Y _ / \ / \ / \ / \A B _ D E F _ H0 1 2 3 4 5 6 7
In this tree, we can see all of the above rules in play:¶
Thedirect path of a root is the empty list. The direct path 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.¶
Thefiltered direct path of a leaf node L is the node's direct path, with anynode removed whose child on the copath of L has an empty resolution (keeping inmind that any unmerged leaves of the copath child count toward its resolution).The removed nodes do not need their own key pairs because encrypting to thenode's key pair would be equivalent to encrypting to its non-copath child.¶
For example, consider the following tree (where blank nodes are indicated with_
, but also assigned a label for reference):¶
In this tree, the direct paths, copaths, and filtered direct paths for the leafnodes are as follows:¶
Node | Direct path | Copath | Filtered Direct Path |
---|---|---|---|
A | T, U, W | B, V, Y | T, W |
B | T, U, W | A, V, Y | T, W |
E | X, Y, W | F, Z, U | X, Y, W |
F | X, Y, W | E, Z, U | X, Y, W |
G | Z, Y, W | H, X, U | Y, W |
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 of the group only if the node's subtree contains that member's leaf.¶
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 key ofan intermediate node above them. Such a member has anunmerged leaf at theintermediate node. Encrypting to an intermediate node requires encrypting tothe node's public key, as well as the public keys of all the unmerged leavesbelow it. A leaf is unmerged with regard to all of its ancestors when it isfirst added, because the process of adding the leaf does not give it access tothe private keys for all of the nodes above it in the tree. Leaves are "merged"as they receive the private keys for nodes, as described inSection 7.4.¶
For example, consider a four-member group (A, B, C, D) where the node above theright two members is blank. (This is what it would look like if A created agroup with B, C, and D.) Then the public state of the tree and the views of theprivate keys of the tree held by each participant would be as follows, where_
represents a blank node,?
represents an unknown private key, andpk(X)
represents the public key corresponding to the private keyX
:¶
Public Tree============================ pk(ABCD) / \ pk(AB) _ / \ / \pk(A) pk(B) pk(C) pk(D) Private @ A Private @ B Private @ C Private @ D============= ============= ============= ============= ABCD ABCD ABCD ABCD / \ / \ / \ / \ AB _ AB _ ? _ ? _ / \ / \ / \ / \ / \ / \ / \ / \A ? ? ? ? B ? ? ? ? C ? ? ? ? D¶
Note how the tree invariant applies: Each member knows only their own leaf,the private key AB is known only to A and B, and the private key ABCDis known to all four members. This also illustrates another importantpoint: it is possible for there to be "holes" on the path from a member's leafto the root in which the member knows the key both above and belowa given node, but not for that node, as in the case with D.¶
Each MLS session uses a single cipher suite that specifies thefollowing primitives to be used in group key computations:¶
HPKE parameters:¶
MLS uses HPKE for public key encryption[RFC9180]. TheDeriveKeyPair
function associated to the KEM for the cipher suite maps octetstrings to HPKE key pairs. As in HPKE, MLS assumes that an AEAD algorithmproduces a single ciphertext output from AEAD encryption (aligning with[RFC5116]), as opposed to a separate ciphertext and tag.¶
Cipher suites are represented with the CipherSuite type. The cipher suites aredefined inSection 17.1.¶
HPKE public keys are opaque values in a format defined by the underlyingprotocol (seeSection 4 of [RFC9180] for more information).¶
opaque HPKEPublicKey<V>;¶
Signature public keys are likewise represented as opaque values in a formatdefined by the cipher suite's signature scheme.¶
opaque SignaturePublicKey<V>;¶
For cipher suites using the Edwards-curve Digital Signature Algorithm (EdDSA)signature schemes (Ed25519 or Ed448), the public key is in the format specifiedin[RFC8032].¶
For cipher suites using the Elliptic Curve Digital Signature Algorithm (ECDSA)with the NIST curves (P-256, P-384, or P-521), the public key is represented asan encoded UncompressedPointRepresentation struct, as defined in[RFC8446].¶
The signature algorithm specified in a group's cipher suite is the mandatory algorithmto be used for signing messages within the group. ItMUST be the same as the signature algorithm specified in the credentials in theleaves of the tree (including the leaf node information in KeyPackages used toadd new members).¶
The signatures used in this document are encoded as specified in[RFC8446].In particular, ECDSA signatures are DER encoded, and EdDSA signatures are definedas the concatenation ofR
andS
, as specified in[RFC8032].¶
To disambiguate different signatures used in MLS, each signed value is prefixedby a label as shown below:¶
SignWithLabel(SignatureKey, Label, Content) = Signature.Sign(SignatureKey, SignContent)VerifyWithLabel(VerificationKey, Label, Content, SignatureValue) = Signature.Verify(VerificationKey, SignContent, SignatureValue)¶
Where SignContent is specified as:¶
struct { opaque label<V>; opaque content<V>;} SignContent;¶
And its fields are set to:¶
label = "MLS 1.0 " + Label;content = Content;¶
The functionsSignature.Sign
andSignature.Verify
are defined by thesignature algorithm. If MLS extensions require signatures by group members,they should reuse the SignWithLabel construction, using a distinct label. Toavoid collisions in these labels, an IANA registry is defined inSection 17.6.¶
As with signing, MLS includes a label and context in encryption operations toavoid confusion between ciphertexts produced for different purposes. Encryptionand decryption including this label and context are done as follows:¶
EncryptWithLabel(PublicKey, Label, Context, Plaintext) = SealBase(PublicKey, EncryptContext, "", Plaintext)DecryptWithLabel(PrivateKey, Label, Context, KEMOutput, Ciphertext) = OpenBase(KEMOutput, PrivateKey, EncryptContext, "", Ciphertext)¶
Where EncryptContext is specified as:¶
struct { opaque label<V>; opaque context<V>;} EncryptContext;¶
And its fields are set to:¶
label = "MLS 1.0 " + Label;context = Context;¶
The functionsSealBase
andOpenBase
are defined inSection 6.1 of [RFC9180] (with "Base" as the MODE), using the HPKE algorithms specified by thegroup's cipher suite. If MLS extensions require HPKE encryption operations, theyshould reuse the EncryptWithLabel construction, using a distinct label. Toavoid collisions in these labels, an IANA registry is defined inSection 17.7.¶
Some MLS messages refer to other MLS objects by hash. For example, Welcomemessages refer to KeyPackages for the members being welcomed, and Commits referto Proposals they cover. These identifiers are computed as follows:¶
opaque HashReference<V>;HashReference KeyPackageRef;HashReference ProposalRef;¶
MakeKeyPackageRef(value) = RefHash("MLS 1.0 KeyPackage Reference", value)MakeProposalRef(value) = RefHash("MLS 1.0 Proposal Reference", value)RefHash(label, value) = Hash(RefHashInput)¶
Where RefHashInput is defined as:¶
struct { opaque label<V>; opaque value<V>;} RefHashInput;¶
And its fields are set to:¶
label = label;value = value;¶
For a KeyPackageRef, thevalue
input is the encoded KeyPackage, and thecipher suite specified in the KeyPackage determines the KDF used. For aProposalRef, thevalue
input is the AuthenticatedContent carrying theProposal. In the latter two cases, the KDF is determined by the group'scipher suite.¶
Each member of a group presents a credential that provides one or moreidentities for the member and associates them with the member's signing key.The identities and signing key are verified by the Authentication Service in usefor a group.¶
It is up to the application to decide which identifiers to use atthe application level. For example,a certificate in an X509Credential may attest to several domain names or emailaddresses in its subjectAltName extension. An application may decide topresent all of these to a user, or if it knows a "desired" domain name or emailaddress, it can check that the desired identifier is among those attested.Using the terminology from[RFC6125], a credential provides "presentedidentifiers", and it is up to the application to supply a "reference identifier"for the authenticated client, if any.¶
// See the "MLS Credential Types" IANA registry for valuesuint16 CredentialType;struct { opaque cert_data<V>;} Certificate;struct { CredentialType credential_type; select (Credential.credential_type) { case basic: opaque identity<V>; case x509: Certificate certificates<V>; };} Credential;¶
A "basic" credential is a bare assertion of an identity, without any additionalinformation. The format of the encoded identity is defined by the application.¶
For an X.509 credential, each entry in thecertificates
field represents a single DER-encodedX.509 certificate. The chain is ordered such that the first entry (certificates[0]) isthe end-entity certificate. The public key encoded in thesubjectPublicKeyInfo
of the end-entity certificateMUST be identical to thesignature_key
in the LeafNode containing this credential. A chainMAY omit anynon-leaf certificates that supported peers are known to already possess.¶
The application using MLS is responsible for specifying which identifiers itfinds acceptable for each member in a group. In other words, following themodel that[RFC6125] describes for TLS, the application maintains a list of"reference identifiers" for the members of a group, and the credentials provide"presented identifiers". A member of a group is authenticated by firstvalidating that the member's credential legitimately represents some presentedidentifiers, and then ensuring that the reference identifiers for the member areauthenticated by those presented identifiers.¶
The parts of the system that perform these functions are collectively referredto as the Authentication Service (AS)[MLS-ARCH]. Amember's credential is said to bevalidated with the AS when the AS verifiesthat the credential's presented identifiers are correctly associated with thesignature_key
field in the member's LeafNode, and that thoseidentifiers match the reference identifiers for the member.¶
Whenever a new credential is introduced in the group, itMUST be validated withthe AS. In particular, at the following events in the protocol:¶
external_senders
extension is added to the group¶external_senders
extension is updated¶In cases where a member's credential is being replaced, such as the Update andCommit cases above, the ASMUST also verify that the set of presentedidentifiers in the new credential is valid as a successor to the set ofpresented identifiers in the old credential, according to the application'spolicy.¶
In some credential schemes, a valid credential can "expire" or become invalidafter a certain point in time. For example, each X.509 certificate has anotAfter
field, expressing a time after which the certificate is not valid.¶
Expired credentials can cause operational problems in light of the validationrequirements ofSection 5.3.1. Applications can apply someoperational practices and adaptations to Authentication Service policies tomoderate these impacts.¶
In general, to avoid operational problems such as new joiners rejecting expiredcredentials in a group, applications that use such credentials should ensure tothe extent practical that all of the credentials in use in a group are valid atall times.¶
If a member finds that its credential has expired (or will soon), it shouldissue an Update or Commit that replaces it with a valid credential. For thisreason, membersSHOULD accept Update proposals and Commits issued by memberswith expired credentials, if the credential in the Update or Commit is valid.¶
Similarly, when a client is processing messages sent some time in the past(e.g., syncing up with a group after being offline), the clientSHOULD acceptsignatures from members with expired credentials, since the credential mayhave been valid at the time the message was sent.¶
If a member finds that another member's credential has expired, they may issue aRemove that removes that member. For example, an application could require amember preparing to issue a Commit to check the tree for expired credentials andinclude Remove proposals for those members in its Commit. In situations wherethe group tree is known to the DS, the DS could also monitor the tree forexpired credentials and issue external Remove proposals.¶
Some credential schemes also allow credentials to be revoked. Revocation issimilar to expiry in that a previously valid credential becomes invalid.As such, most of the considerations above also apply to revoked credentials.However, applications may want to treat revoked credentials differently, e.g.,by removing members with revoked credentials while allowing members with expiredcredentials time to update.¶
MLS implementations will presumably provide applications with a way to requestprotocol operations with regard to other clients (e.g., removing clients). Suchfunctions will need to refer to the other clients using some identifier. MLSclients have a few types of identifiers, with different operational properties.¶
Internally to the protocol, group members are uniquely identified by their leafindex. However, a leaf index is only valid for referring to members in a givenepoch. The same leaf index may represent a different member, or no member atall, in a subsequent epoch.¶
The Credentials presented by the clients in a group authenticateapplication-level identifiers for the clients. However, these identifiers may notuniquely identify clients. For example, if a user has multiple devices that areall present in an MLS group, then those devices' clients could all present theuser's application-layer identifiers.¶
If needed, applications may add application-specific identifiers to theextensions
field of a LeafNode object with theapplication_id
extension.¶
opaque application_id<V>;¶
However, applicationsMUST NOT rely on the data in anapplication_id
extensionas if it were authenticated by the Authentication Service, andSHOULD gracefullyhandle cases where the identifier presented is not unique.¶
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.¶
In most of the protocol, messages are handled in the form ofAuthenticatedContent objects. These structures contain the content of themessage itself as well as information to authenticate the sender (seeSection 6.1). The additional protections required to transmitthese messages over an untrusted channel (group membership authentication orAEAD encryption) are added by encoding the AuthenticatedContent as aPublicMessage or PrivateMessage message, which can then be sent as an MLSMessage.Likewise, these protections are enforced (via membership verification or AEADdecryption) when decoding a PublicMessage or PrivateMessage into anAuthenticatedContent object.¶
PrivateMessage represents a signed and encrypted message, withprotections for both the content of the message and relatedmetadata. PublicMessage represents a message that is only signed,and not encrypted. ApplicationsMUST use PrivateMessage to encryptapplication messages andSHOULD use PrivateMessage to encodehandshake messages, but theyMAY transmit handshake messages encodedas PublicMessage objects in cases where it is necessary for theDelivery Service to examine such messages.¶
enum { reserved(0), mls10(1), (65535)} ProtocolVersion;enum { reserved(0), application(1), proposal(2), commit(3), (255)} ContentType;enum { reserved(0), member(1), external(2), new_member_proposal(3), new_member_commit(4), (255)} SenderType;struct { SenderType sender_type; select (Sender.sender_type) { case member: uint32 leaf_index; case external: uint32 sender_index; case new_member_commit: case new_member_proposal: struct{}; };} Sender;// See the "MLS Wire Formats" IANA registry for valuesuint16 WireFormat;struct { opaque group_id<V>; uint64 epoch; Sender sender; opaque authenticated_data<V>; ContentType content_type; select (FramedContent.content_type) { case application: opaque application_data<V>; case proposal: Proposal proposal; case commit: Commit commit; };} FramedContent;struct { ProtocolVersion version = mls10; WireFormat wire_format; select (MLSMessage.wire_format) { case mls_public_message: PublicMessage public_message; case mls_private_message: PrivateMessage private_message; case mls_welcome: Welcome welcome; case mls_group_info: GroupInfo group_info; case mls_key_package: KeyPackage key_package; };} MLSMessage;¶
Messages from senders that aren't in the group are sent as PublicMessage. SeeSections12.1.8 and12.4.3.2 for more details.¶
The following structure is used to fully describe the data transmitted inplaintexts or ciphertexts.¶
struct { WireFormat wire_format; FramedContent content; FramedContentAuthData auth;} AuthenticatedContent;¶
The following figure illustrates how the various structures described in thissection relate to each other, and the high-level operations used to produce andconsume them:¶
FramedContent is authenticated using the FramedContentAuthData structure.¶
struct { ProtocolVersion version = mls10; WireFormat wire_format; FramedContent content; select (FramedContentTBS.content.sender.sender_type) { case member: case new_member_commit: GroupContext context; case external: case new_member_proposal: struct{}; };} FramedContentTBS;opaque MAC<V>;struct { /* SignWithLabel(., "FramedContentTBS", FramedContentTBS) */ opaque signature<V>; select (FramedContent.content_type) { case commit: /* MAC(confirmation_key, GroupContext.confirmed_transcript_hash) */ MAC confirmation_tag; case application: case proposal: struct{}; };} FramedContentAuthData;¶
The signature is computed usingSignWithLabel
with label"FramedContentTBS"
and with a content that covers the message content andthe wire format that will be used for this message. If the sender'ssender_type
ismember
, the content also covers the GroupContext for thecurrent epoch so that signatures are specific to a given group and epoch.¶
The senderMUST use the private key corresponding to the following signature keydepending on the sender'ssender_type
:¶
member
: The signature key contained in the LeafNode at the indexindicated byleaf_index
in the ratchet tree.¶external
: The signature key at the indexindicated bysender_index
in theexternal_senders
group contextextension (seeSection 12.1.8.1). Thecontent_type
of the messageMUST beproposal
and theproposal_type
MUST be a value that is allowed for external senders.¶new_member_commit
: The signature key in the LeafNode in the Commit's path (seeSection 12.4.3.2). Thecontent_type
of the messageMUST becommit
.¶new_member_proposal
: The signature key in the LeafNode in the KeyPackage embedded in an external Add proposal. Thecontent_type
of the messageMUST beproposal
and theproposal_type
of the ProposalMUST beadd
.¶Recipients of an MLSMessageMUST verify the signature with the key depending onthesender_type
of the sender as described above.¶
The confirmation tag value confirms that the members of the group have arrivedat the same state of the group. A FramedContentAuthData is said to be valid when boththesignature
andconfirmation_tag
fields are valid.¶
Messages that are authenticated but not encrypted are encoded using the PublicMessage structure.¶
struct { FramedContent content; FramedContentAuthData auth; select (PublicMessage.content.sender.sender_type) { case member: MAC membership_tag; case external: case new_member_commit: case new_member_proposal: struct{}; };} PublicMessage;¶
Themembership_tag
field in the PublicMessage object authenticates the sender'smembership in the group. For messages sent by members, itMUST be set to thefollowing value:¶
struct { FramedContentTBS content_tbs; FramedContentAuthData auth;} AuthenticatedContentTBM;¶
membership_tag = MAC(membership_key, AuthenticatedContentTBM)¶
When decoding a PublicMessage into an AuthenticatedContent,the applicationMUST checkmembership_tag
andMUST check that theFramedContentAuthData is valid.¶
Authenticated and encrypted messages are encoded using the PrivateMessage structure.¶
struct { opaque group_id<V>; uint64 epoch; ContentType content_type; opaque authenticated_data<V>; opaque encrypted_sender_data<V>; opaque ciphertext<V>;} PrivateMessage;¶
encrypted_sender_data
andciphertext
are encrypted using the AEAD functionspecified by the cipher suite in use, using the SenderDataand PrivateMessageContent structures as input.¶
Content to be encrypted is encoded in a PrivateMessageContent structure.¶
struct { select (PrivateMessage.content_type) { case application: opaque application_data<V>; case proposal: Proposal proposal; case commit: Commit commit; }; FramedContentAuthData auth; opaque padding[length_of_padding];} PrivateMessageContent;¶
Thepadding
field is set by the sender, by first encoding the content (via theselect
) and theauth
field, and then appending the chosen number of zero bytes.A receiver identifies the padding field in a plaintext decoded fromPrivateMessage.ciphertext
by first decoding the content and theauth
field;then thepadding
field comprises any remaining octets of plaintext. Thepadding
fieldMUST be filled with all zero bytes. A receiverMUST verify thatthere are no non-zero bytes in thepadding
field, and if this check fails, theenclosing PrivateMessageMUST be rejected as malformed. This check ensures thatthe padding process is deterministic, so that, for example, padding cannot beused as a covert channel.¶
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 ratchet or the application ratchet,depending 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 clientMUST 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 messageMUST generate a fresh randomfour-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 senderMUSTinclude 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<V>; uint64 epoch; ContentType content_type; opaque authenticated_data<V>;} PrivateContentAAD;¶
When decoding a PrivateMessageContent, the applicationMUST check that theFramedContentAuthData is valid.¶
It is up to the application to decide whatauthenticated_data
to provide andhow much padding to add to a given message (if any). The overall size of theAAD and ciphertextMUST fit within the limits established for the group's AEADalgorithm in[CFRG-AEAD-LIMITS].¶
The "sender data" used to look up the key for content encryption isencrypted with the cipher suite'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 { uint32 leaf_index; uint32 generation; opaque reuse_guard[4];} SenderData;¶
When constructing a SenderData object from a Sender object, the senderMUST verifySender.sender_type ismember
and use Sender.leaf_index forSenderData.leaf_index.¶
Thereuse_guard
field contains a fresh random value used to avoid nonce reusein the case of state loss or corruption, as described inSection 6.3.1.¶
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 used.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 AAD for the SenderData ciphertext is thefirst three fields of PrivateMessage:¶
struct { opaque group_id<V>; uint64 epoch; ContentType content_type;} SenderDataAAD;¶
When parsing a SenderData struct as part of message decryption, the recipientMUST verify that the leaf index indicated in theleaf_index
field identifies anon-blank node.¶
The ratchet tree for an epoch describes the membership of a group in that epoch,providing public key encryption (HPKE) keys that can be used to encrypt to subsets ofthe group as well as information to authenticate the members. In order toreflect changes to the membership of the group from one epoch to the next,corresponding changes are made to the ratchet tree. In this section, wedescribe the content of the tree and the required operations.¶
As discussed inSection 4.1.1, the nodes of a ratchet tree containseveral types of data describing individual members (for leaf nodes) orsubgroups of the group (for parent nodes). Parent nodes are simpler:¶
struct { HPKEPublicKey encryption_key; opaque parent_hash<V>; uint32 unmerged_leaves<V>;} ParentNode;¶
Theencryption_key
field contains an HPKE public key whose private key is held onlyby the members at the leaves among its descendants. Theparent_hash
fieldcontains a hash of this node's parent node, as described inSection 7.9.Theunmerged_leaves
field lists the leaves under this parent node that areunmerged, according to their indices among all the leaves in the tree. Theentries in theunmerged_leaves
vectorMUST be sorted in increasing order.¶
A leaf node in the tree describes all the details of an individual client'sappearance in the group, signed by that client. It is also used in clientKeyPackage objects to store the information that will be needed to add aclient to a group.¶
enum { reserved(0), key_package(1), update(2), commit(3), (255)} LeafNodeSource;struct { ProtocolVersion versions<V>; CipherSuite cipher_suites<V>; ExtensionType extensions<V>; ProposalType proposals<V>; CredentialType credentials<V>;} Capabilities;struct { uint64 not_before; uint64 not_after;} Lifetime;// See the "MLS Extension Types" IANA registry for valuesuint16 ExtensionType;struct { ExtensionType extension_type; opaque extension_data<V>;} Extension;struct { HPKEPublicKey encryption_key; SignaturePublicKey signature_key; Credential credential; Capabilities capabilities; LeafNodeSource leaf_node_source; select (LeafNode.leaf_node_source) { case key_package: Lifetime lifetime; case update: struct{}; case commit: opaque parent_hash<V>; }; Extension extensions<V>; /* SignWithLabel(., "LeafNodeTBS", LeafNodeTBS) */ opaque signature<V>;} LeafNode;struct { HPKEPublicKey encryption_key; SignaturePublicKey signature_key; Credential credential; Capabilities capabilities; LeafNodeSource leaf_node_source; select (LeafNodeTBS.leaf_node_source) { case key_package: Lifetime lifetime; case update: struct{}; case commit: opaque parent_hash<V>; }; Extension extensions<V>; select (LeafNodeTBS.leaf_node_source) { case key_package: struct{}; case update: opaque group_id<V>; uint32 leaf_index; case commit: opaque group_id<V>; uint32 leaf_index; };} LeafNodeTBS;¶
Theencryption_key
field contains an HPKE public key whose private key is held onlyby the member occupying this leaf (or in the case of a LeafNode in a KeyPackageobject, the issuer of the KeyPackage). Thesignature_key
field contains themember's public signing key. Thecredential
field contains informationauthenticating both the member's identity and the provided signing key, asdescribed inSection 5.3.¶
Thecapabilities
field indicates the protocol features that the clientsupports, including protocol versions, cipher suites, credential types,non-default proposal types, and non-default extension types. The followingproposal and extension types are considered "default" andMUST NOT belisted:¶
There are no default values for the other fields of a capabilities object. TheclientMUST list all values for the respective parameters that it supports.¶
The types of any non-default extensions that appear in theextensions
field of a LeafNodeMUST be included in theextensions
field of thecapabilities
field, and thecredential type used in the LeafNodeMUST be included in thecredentials
fieldof thecapabilities
field.¶
As discussed inSection 13, unknown valuesincapabilities
MUST be ignored, and the creator of acapabilities
fieldSHOULD include some random GREASE values to help ensure that other clients correctlyignore unknown values.¶
Theleaf_node_source
field indicates how this LeafNode came to be added to thetree. This signal tells other members of the group whether the leaf node isrequired to have alifetime
orparent_hash
, and whether thegroup_id
isadded as context to the signature.These fields are included selectively because the client creating a LeafNode isnot always able to compute all of them.For example, a KeyPackage is created before the client knows which group it willbe used with, so its signature can't bind to agroup_id
.¶
In the case where the leaf was added to the tree based on a pre-publishedKeyPackage, thelifetime
field represents the times between which clients willconsider a LeafNode valid. These times are represented as absolute times,measured in seconds since the Unix epoch (1970-01-01T00:00:00Z). ApplicationsMUST define a maximum total lifetime that is acceptable for a LeafNode, andreject any LeafNode where the total lifetime is longer than this duration. Inorder to avoid disagreements about whether a LeafNode has a valid lifetime, theclients in a groupSHOULD maintain time synchronization (e.g., using the NetworkTime Protocol[RFC5905]).¶
In the case where the leaf node was inserted into the tree via a Commit message,theparent_hash
field contains the parent hash for this leaf node (seeSection 7.9).¶
The LeafNodeTBS structure covers the fields above the signature in the LeafNode.In addition, when the leaf node was created in the context of a group (theupdate
andcommit
cases), the group ID of the group is added as context to thesignature.¶
LeafNode objects stored in the group's ratchet treeare updated according to the evolution of the tree. Each modification ofLeafNode contentMUST be reflected by a change in its signature. This allows othermembers to verify the validity of the LeafNode at any time, particularly in thecase of a newcomer joining the group.¶
The validity of a LeafNode needs to be verified at the following stages:¶
The client verifies the validity of a LeafNode using the following steps:¶
signature_key
.¶required_capabilities
extension, then the requiredextensions, proposals, and credential typesMUST be listed in the LeafNode'scapabilities
field.¶capabilities
field of each member's LeafNode, and that thecapabilities
field of this LeafNode indicates support for all the credentialtypes currently in use by other members.¶Verify thelifetime
field:¶
lifetime
field.¶lifetime
field. (This check is not mandatory because the LeafNodemight have expired in the time between when the message was sent and when itwas received.)¶extensions
field is listed in thecapabilities.extensions
field of the LeafNode.¶Verify theleaf_node_source
field:¶
leaf_node_source
isset tokey_package
.¶leaf_node_source
is set toupdate
and thatencryption_key
represents a different publickey than theencryption_key
in the leaf node being replaced by the Updateproposal.¶leaf_node
value of the UpdatePath ina Commit, verify thatleaf_node_source
is set tocommit
.¶Verify that the following fields are unique among the members of the group:¶
Whenever a member initiates an epoch change (i.e., commits; seeSection 12.4),they may need to refresh the key pairs of their leaf and of the nodes on theirleaf's direct path in order to maintain forward secrecy and post-compromisesecurity.¶
The member initiating the epoch change generates the fresh key pairs using thefollowing procedure. The procedure is designed in a way that allows group members toefficiently communicate the fresh secret keys to other group members, asdescribed inSection 7.6.¶
A member updates the nodes along its direct path as follows:¶
path_secret[0]
refers to the first parent nodein the filtered direct path,path_secret[1]
to the second parent node, and so on.¶path_secret[0] is sampled at randompath_secret[n] = DeriveSecret(path_secret[n-1], "path")¶
(node_priv,node_pub)
, one for eachnode on the leaf's direct path, as follows.¶node_secret[n] = DeriveSecret(path_secret[n], "node")node_priv[n], node_pub[n] = KEM.DeriveKeyPair(node_secret[n])¶
The node secret is derived as a temporary intermediate secret so that eachsecret is only used with one algorithm: The path secret is used as an input toDeriveSecret, and the node secret is used as an input to DeriveKeyPair.¶
For example, suppose there is a group with four members, with C an unmerged leafat Z:¶
If member B subsequently generates an UpdatePath based on a secret"leaf_secret", then it would generate the following sequenceof path secrets:¶
After applying the UpdatePath, the tree will have the following structure:¶
After generating fresh key material and applying it to update theirlocal tree state as described inSection 7.4, thegenerator broadcaststhis 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 filtered 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 filtered direct path of thesender's leaf, including the root:¶
The path secret value for a given node is encrypted to the subtreerooted at the parent's non-updated child, i.e., 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.¶
A member of the groupupdates their direct path by computing new values fortheir leaf node and the nodes along their filtered direct path as follows:¶
Compute updated path secrets and public keys for the nodes on the sender'sfiltered direct path.¶
node_pub[n]
value derived from the corresponding path secretpath_secret[n]
.¶Update the leaf node for the sender.¶
Since the new leaf node effectively updates an existing leaf node in the group,itMUST adhere to the same restrictions as LeafNodes used in Update proposals(aside fromleaf_node_source
). The applicationMAY specify other changes tothe leaf node, e.g., providing a new signature key, updated capabilities, ordifferent extensions.¶
The member thenencrypts path secrets to the group. For each node in themember's filtered direct path, the member takes the following steps:¶
The recipient of an UpdatePath performs the corresponding steps. First, therecipientmerges UpdatePath into the tree:¶
For all nodes on the filtered direct path of the sender's leaf,¶
Compute parent hashes for the nodes in the sender's filtered direct path,and verify that theparent_hash
field of the leaf node matches the parenthash for the first node in its filtered direct path.¶
Second, the recipientdecrypts the path secrets:¶
For example, in order to communicate the example update described inSection 7.4, the member at node B would transmit the followingvalues:¶
Public Key | Ciphertext(s) |
---|---|
node_pub[1] | E(pk(Z), path_secret[1]) ,E(pk(C), path_secret[1] ) |
node_pub[0] | E(pk(A), path_secret[0]) |
In this table, the value node_pub[i] represents the public keyderived from node_secret[i], pk(X) represents the current public keyof node X, and E(K, S) representsthe public key encryption of the path secret S to thepublic key K (using HPKE).¶
A recipient at node A would decryptE(pk(A), path_secret\[0\])
to obtainpath_secret\[0\]
, then use it to derivepath_secret[1]
and the resultingnode secrets and key pairs. Thus, A would have the private keys to nodes X'and Y', in accordance with the tree invariant.¶
Similarly, a recipient at node D would decryptE(pk(Z), path_secret[1])
toobtainpath_secret[1]
, then use it to derive the node secret and key pairfor the node Y'. As required to maintain the tree invariant, node D does notreceive the private key for the node X', since X' is not an ancestor of D.¶
After processing the update, each recipientMUST delete outdated key material,specifically:¶
As described inSection 12.4, each Commit message may optionally contain anUpdatePath, with a new LeafNode and set of parent nodes for the sender'sfiltered direct path. For each parent node, the UpdatePath contains a newpublic key and encrypted path secret. The parent nodes are kept in the sameorder as the filtered direct path.¶
struct { opaque kem_output<V>; opaque ciphertext<V>;} HPKECiphertext;struct { HPKEPublicKey encryption_key; HPKECiphertext encrypted_path_secret<V>;} UpdatePathNode;struct { LeafNode leaf_node; UpdatePathNode nodes<V>;} UpdatePath;¶
For each UpdatePathNode, the resolution of the corresponding copath nodeMUSTexclude all new leaf nodes added as part of the current Commit. The length oftheencrypted_path_secret
vectorMUST be equal to the length of the resolutionof the copath node (excluding new leaf nodes), with each ciphertext being theencryption to the respective resolution node.¶
The HPKECiphertext values are encrypted and decrypted as follows:¶
(kem_output, ciphertext) = EncryptWithLabel(node_public_key, "UpdatePathNode", group_context, path_secret)path_secret = DecryptWithLabel(node_private_key, "UpdatePathNode", group_context, kem_output, ciphertext)¶
Herenode_public_key
is the public key of the node for which the path secret isencrypted,group_context
is the provisional GroupContext object forthe group, and theEncryptWithLabel
function is as defined inSection 5.1.3.¶
In addition to the path-based updates to the tree described above, it is alsonecessary to add and remove leaves of the tree in order to reflect changes tothe membership of the group (see Sections12.1.1 and12.1.3). Since the tree isalways full, adding or removing leaves corresponds to increasing or decreasingthe depth of the tree, resulting in the number of leaves being doubled orhalved. These operations are also known asextending andtruncating thetree.¶
Leaves are always added and removed at the right edge of the tree. When thesize of the tree needs to be increased, a new blank root node is added, whoseleft subtree is the existing tree and right subtree is a new all-blank subtree.This operation is typically done when adding a member to the group.¶
_ <-- new blank root _ __|__ __|__ / \ / \ X ===> X _ <-- new blank subtree ===> X _ / \ / \ / \ / \ / \A B A B _ _ A B C _ ^ | new member --+
When the right subtree of the tree no longer has any non-blank nodes, it can besafely removed. The root of the tree and the right subtree are discarded(whether or not the root node is blank). The left child of the root becomes thenew root node, and the left subtree becomes the new tree. This operation istypically done after removing a member from the group.¶
Y Y __|__ __|__ / \ / \ X _ ===> X _ ==> X <-- new root / \ / \ / \ / \ / \ A B C _ A B _ _ A B ^ |removed member --+
Concrete algorithms for these operations on array-based and link-based trees areprovided in AppendicesC andD. The concretealgorithms are non-normative. An implementation may use any algorithm thatproduces the correct tree in its internal representation.¶
MLS hashes the contents of the tree in two ways to authenticate differentproperties of the tree.Tree hashes are defined in this section, andparenthashes are defined inSection 7.9.¶
Each node in a ratchet tree has a tree hash that summarizes the subtree belowthat node. The tree hash of the root is used in the GroupContext to confirmthat the group agrees on the whole tree. Tree hashes are computed recursivelyfrom the leaves up to the root.¶
The tree hash of an individual node is the hash of the node's TreeHashInputobject, which may contain either a LeafNodeHashInput or aParentNodeHashInput depending on the type of node. LeafNodeHashInput objectscontain theleaf_index
and the LeafNode (if any). ParentNodeHashInputobjects contain the ParentNode (if any) and the tree hash of the node's leftand right children. For both parent and leaf nodes, the optional node valueMUST be absent if the node is blank and present if the node contains a value.¶
enum { reserved(0), leaf(1), parent(2), (255)} NodeType;struct { NodeType node_type; select (TreeHashInput.node_type) { case leaf: LeafNodeHashInput leaf_node; case parent: ParentNodeHashInput parent_node; };} TreeHashInput;struct { uint32 leaf_index; optional<LeafNode> leaf_node;} LeafNodeHashInput;struct { optional<ParentNode> parent_node; opaque left_hash<V>; opaque right_hash<V>;} ParentNodeHashInput;¶
The tree hash of an entire tree corresponds to the tree hash of the root node,which is computed recursively by starting at the leaf nodes and building up.¶
While tree hashes summarize the state of a tree at point in time, parent hashescapture information about how keys in the tree were populated.¶
When a client sends a Commit to change a group, it can include an UpdatePath toassign new keys to the nodes along its filtered direct path. When a clientcomputes an UpdatePath (as defined inSection 7.5), itcomputes and signs a parent hash that summarizes the state of the tree after theUpdatePath has been applied. These summaries are constructed in a chain fromthe root to the member's leaf so that the part of the chain closer to the rootcan be overwritten as nodes set in one UpdatePath are reset by a laterUpdatePath.¶
As a result, the signature over the parent hash in each member's leafeffectively signs the subtree of the tree that hasn't been changed since thatleaf was last changed in an UpdatePath. A new member joining the group usesthese parent hashes to verify that the parent nodes in the tree were set bymembers of the group, not chosen by an external attacker. For an example of howthis works, seeAppendix B.¶
Consider a ratchet tree with a non-blank parent node P and children D and S (for"parent", "direct path", and "sibling"), with D and P in the direct path of aleaf node L (for "leaf"):¶
... / P __|__ / \ D S / \ / \ ... ... ... ... /L
The parent hash of P changes whenever an UpdatePath object is applied tothe ratchet tree along a path from a leaf L traversing node D (and hence alsoP). The new "Parent hash of P (with copath child S)" is obtained by hashing P'sParentHashInput struct.¶
struct { HPKEPublicKey encryption_key; opaque parent_hash<V>; opaque original_sibling_tree_hash<V>;} ParentHashInput;¶
The fieldencryption_key
contains the HPKE public key of P. If P is the root,then theparent_hash
field is set to a zero-length octet string. Otherwise,parent_hash
is the parent hash of the next node after P on the filtereddirect path of the leaf L. This way, P's parent hash fixesthe new HPKE public key of each non-blank node on the path from P to the root. Notethat the path from P to the root may contain some blank nodes that are notfixed by P's parent hash. However, for each node that has an HPKE key, this keyis fixed by P's parent hash.¶
Finally,original_sibling_tree_hash
is the tree hash of S in the ratchet treemodified as follows: For each leaf L inP.unmerged_leaves
, blank L and removeit from theunmerged_leaves
sets of all parent nodes.¶
Observe thatoriginal_sibling_tree_hash
does not change between updates of P.This property is crucial for the correctness of the protocol.¶
Note thatoriginal_sibling_tree_hash
is the tree hash of S, not the parenthash. Theparent_hash
field in ParentHashInput captures information about thenodes above P. theoriginal_sibling_tree_hash
captures information about thesubtree under S that is not being updated (and thus the subtree to which a pathsecret for P would be encrypted according toSection 7.5).¶
For example, in the following tree:¶
W [F] ______|_____ / \ U Y [F] __|__ __|__ / \ / \ T _ _ _ / \ / \ / \ / \A B C D E F G _
With P = W and S = Y,original_sibling_tree_hash
is the tree hash of thefollowing tree:¶
Y __|__ / \ _ _ / \ / \E _ G _¶
BecauseW.unmerged_leaves
includes F, F is blanked and removed fromY.unmerged_leaves
.¶
Note that no recomputation is needed if the tree hash of S is unchanged sincethe last time P was updated. This is the case for computing or processing aCommit whose UpdatePath traverses P, since the Commit itself resets P. (Inother words, it is only necessary to recompute the original sibling tree hashwhen validating a group's tree on joining.) More generally, if none of the entriesinP.unmerged_leaves
are in the subtree under S (and thus no leaves were blanked),then the original tree hash at S is the tree hash of S in the current tree.¶
If it is necessary to recompute the original tree hash of a node, the efficiencyof recomputation can be improved by caching intermediate tree hashes, to avoidrecomputing over the subtree when the subtree is included in multiple parenthashes. A subtree hash can be reused as long as the intersection of theparent's unmerged leaves with the subtree is the same as in the earliercomputation.¶
In ParentNode objects and LeafNode objects withleaf_node_source
set tocommit
, the value of theparent_hash
field is the parent hash of the nextnon-blank parent node above the node in question (the next node in the filtereddirect path). Using the node labels inFigure 20, theparent_hash
field of D is equal to the parent hash of P with copath child S.This is the case even when the node D is a leaf node.¶
Theparent_hash
field of a LeafNode is signed by the member. The signature ofsuch a LeafNode thus attests to which keys the group member introduced intothe ratchet tree and to whom the corresponding secret keys were sent, inaddition to the other contents of the LeafNode. Thisprevents malicious insiders from constructing artificial ratchet trees with anode D whose HPKE secret key is known to the insider, yet where the insider isn'tassigned a leaf in the subtree rooted at D. Indeed, such a ratchet tree wouldviolate the tree invariant.¶
Parent hashes are verified at two points in the protocol: When joining a groupand when processing a Commit.¶
The parent hash in a node D is valid with respect to a parent node P if thefollowing criteria hold. Here C and S are the children of P (for "child" and"sibling"), with C being the child that is on the direct path of D (possibly Ditself) and S being the other child:¶
parent_hash
field of D is equal to the parent hash of P with copathchild S.¶unmerged_leaves
with the subtree under C is equal to the resolution of C with D removed.¶These checks verify that D and P were updated at the same time (in the sameUpdatePath), and that they were neighbors in the UpdatePath because the nodes inbetween them would have omitted from the filtered direct path.¶
A parent node P is "parent-hash valid" if it can be chained back to a leaf nodein this way. That is, if there is leaf node L and a sequence of parent nodesP_1, ..., P_N such that P_N = P and each step in the chain is authenticatedby a parent hash, then L's parent hash is valid with respect to P_1, P_1's parenthash is valid with respect to P_2, and so on.¶
When joining a group, the new memberMUST authenticate that each non-blankparent node P is parent-hash valid. This can be done "bottom up" by buildingchains up from leaves and verifying that all non-blank parent nodes are coveredby exactly one such chain, or "top down" by verifying that there is exactly onedescendant of each non-blank parent node for which the parent node isparent-hash valid.¶
When processing a Commit message that includes an UpdatePath, clientsMUSTrecompute the expected value ofparent_hash
for the committer's new leaf andverify that it matches theparent_hash
value in the suppliedleaf_node
.After being merged into the tree, the nodes in the UpdatePath form a parent-hashchain from the committer's leaf to the root.¶
Group keys are derived using theExtract
andExpand
functions from the KDFfor the group's cipher suite, as well as the functions defined below:¶
ExpandWithLabel(Secret, Label, Context, Length) = KDF.Expand(Secret, KDFLabel, Length)DeriveSecret(Secret, Label) = ExpandWithLabel(Secret, Label, "", KDF.Nh)¶
Where KDFLabel is specified as:¶
struct { uint16 length; opaque label<V>; opaque context<V>;} KDFLabel;¶
And its fields are set to:¶
length = Length;label = "MLS 1.0 " + Label;context = Context;¶
The valueKDF.Nh
is the size of an output fromKDF.Extract
, in bytes. Inthe below diagram:¶
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:¶
Given these inputs, the derivation of secrets for an epochproceeds as shown in the following diagram:¶
A number of values are derived from the epoch secret for different purposes:¶
Label | Secret | Purpose |
---|---|---|
"sender data" | sender_data_secret | Deriving keys to encrypt sender data |
"encryption" | encryption_secret | Deriving message encryption keys (via the secret tree) |
"exporter" | exporter_secret | Deriving exported secrets |
"external" | external_secret | Deriving the external init key |
"confirm" | confirmation_key | Computing the confirmation MAC for an epoch |
"membership" | membership_key | Computing the membership MAC for a PublicMessage |
"resumption" | resumption_psk | Proving membership in this epoch (via a PSK injected later) |
"authentication" | epoch_authenticator | Confirming that two clients have the same view of the group |
Theexternal_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 the GroupInfo structin order to allow non-members to join the group using an external Commit.¶
Each member of the group maintains a GroupContext object thatsummarizes the state of the group:¶
struct { ProtocolVersion version = mls10; CipherSuite cipher_suite; opaque group_id<V>; uint64 epoch; opaque tree_hash<V>; opaque confirmed_transcript_hash<V>; Extension extensions<V>;} GroupContext;¶
The fields in this state have the following semantics:¶
cipher_suite
is the cipher suite used by the group.¶group_id
field is an application-defined identifier for thegroup.¶epoch
field represents the current version of the group.¶tree_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.8.¶confirmed_transcript_hash
field contains a running hash overthe messages that led to this state.¶extensions
field contains the details of any protocol extensions thatapply to the group.¶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 12.1.The following general rules apply:¶
group_id
field is constant.¶epoch
field increments by one for each Commit message thatis processed.¶tree_hash
is updated to represent the current tree andcredentials.¶confirmed_transcript_hash
field is updated with the data for anAuthenticatedContent encoding a Commit message, as described below.¶extensions
field changes when a GroupContextExtensions proposal iscommitted.¶The transcript hashes computed in MLS represent a running hash over all Proposaland Commit messages that have ever been sent in a group. Commit messages areincluded directly. Proposal messages are indirectly included via the Commit thatapplied them. Messages of both types are included by hashing the AuthenticatedContentobject in which they were sent.¶
The transcript hash comprises two individual hashes:¶
confirmed_transcript_hash
that represents a transcript over the wholehistory of Commit messages, up to and including the signature of the mostrecent Commit.¶interim_transcript_hash
that covers the confirmed transcript hash plustheconfirmation_tag
of the most recent Commit.¶New members compute the interim transcript hash using theconfirmation_tag
field of the GroupInfo struct, while existing members can compute it directly.¶
Each Commit message updates these hashes by way of its enclosingAuthenticatedContent. The AuthenticatedContent struct is split intoConfirmedTranscriptHashInput and InterimTranscriptHashInput. The former is used toupdate the confirmed transcript hash and the latter is used to update the interimtranscript hash.¶
struct { WireFormat wire_format; FramedContent content; /* with content_type == commit */ opaque signature<V>;} ConfirmedTranscriptHashInput;struct { MAC confirmation_tag;} InterimTranscriptHashInput;¶
confirmed_transcript_hash_[0] = ""; /* zero-length octet string */interim_transcript_hash_[0] = ""; /* zero-length octet string */confirmed_transcript_hash_[epoch] = Hash(interim_transcript_hash_[epoch - 1] || ConfirmedTranscriptHashInput_[epoch]);interim_transcript_hash_[epoch] = Hash(confirmed_transcript_hash_[epoch] || InterimTranscriptHashInput_[epoch]);¶
In this notation,ConfirmedTranscriptHashInput_[epoch]
andInterimTranscriptHashInput_[epoch]
are based on the Commit that initiated theepoch with epoch numberepoch. (Note that the
epoch field in thisCommit will be set to
epoch - 1`, since it is sent within the previous epoch.)¶
The transcript hashConfirmedTranscriptHashInput_[epoch]
is used as theconfirmed_transcript_hash
input to theconfirmation_tag
field for thisCommit. Each Commit thus confirms the whole transcript of Commits up to thatpoint, except for the latest Commit's confirmation tag.¶
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 a 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 GroupInfo 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 andperform 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)¶
Groups that already have an out-of-band mechanism to generateshared group secrets can inject them into the MLS key schedule toincorporate this external entropy in the computation of MLS group secrets.¶
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 or post-compromise securityguarantees as a Commit message. Unlike the key pairs populated in thetree by an Update or Commit, which are 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 they 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 resumption PSKsare derived from the MLS key schedule and used in cases where it isnecessary to authenticate a member's participation in a prior epoch.¶
The injection of one or more PSKs into the key schedule is signaled in two ways:Existing members are informed via PreSharedKey proposals covered by a Commit,and new members added in the Commit are informed by the GroupSecrets object in theWelcome message corresponding to the Commit. To ensure that existing and newmembers compute the same PSK input to the key schedule, the Commit andGroupSecrets objectsMUST indicate the same set of PSKs, in the same order.¶
enum { reserved(0), external(1), resumption(2), (255)} PSKType;enum { reserved(0), application(1), reinit(2), branch(3), (255)} ResumptionPSKUsage;struct { PSKType psktype; select (PreSharedKeyID.psktype) { case external: opaque psk_id<V>; case resumption: ResumptionPSKUsage usage; opaque psk_group_id<V>; uint64 psk_epoch; }; opaque psk_nonce<V>;} PreSharedKeyID;¶
Each time a client injects a PSK into a group, thepsk_nonce
of itsPreSharedKeyIDMUST be set to a fresh random value of lengthKDF.Nh
, whereKDF
is the KDF for the cipher suite of the group into which the PSK is beinginjected. This ensures that even when a PSK is used multiple times, the valueused as an input into the key schedule is different each time.¶
Upon receiving a Commit with a PreSharedKey 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_psk
of the group andepoch specified in the PreSharedKeyID 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 (labeled "Extract" for brevityin the diagram), as follows:¶
In particular, if there are no PreSharedKey proposals in a given Commit, thenthe resultingpsk_secret
ispsk_secret_[0]
, the all-zero vector.¶
The main MLS key schedule provides anexporter_secret
that canbe used by an application to derive new secrets for use outside of MLS.¶
MLS-Exporter(Label, Context, Length) = ExpandWithLabel(DeriveSecret(exporter_secret, Label), "exported", Hash(Context), Length)¶
ApplicationsSHOULD provide a unique label toMLS-Exporter
thatidentifies the secret's intended purpose. This is to help prevent the samesecret from being generated and used in two different places. To help avoidthe same label being used in different applications, an IANA registry for theselabels has been defined inSection 17.8.¶
The exported values are bound to the group epoch from which theexporter_secret
is derived, and hence reflect a particular state ofthe group.¶
It isRECOMMENDED for the application generating exported valuesto refresh those values after a Commit is processed.¶
The main MLS key schedule provides aresumption_psk
that is used as a PSKto inject entropy from one epoch into another. This functionality is used in thereinitialization and branching processes described in Sections11.2 and11.3, but it may be used by applications for other purposes.¶
Some uses of resumption PSKs might call for the use of PSKs from historicalepochs. The applicationSHOULD specify an upper limit on the number of pastepochs for which theresumption_psk
may be stored.¶
The main MLS key schedule provides a per-epochepoch_authenticator
. If onemember of the group is being impersonated by an active attacker, theepoch_authenticator
computed by their client will differ from those computedby the other group members.¶
This property can be used to construct defenses against impersonation attacksthat are effective even if members' signature keys are compromised. As a trivialexample, if the users of the clients in an MLS group were to meet in person andreliably confirm that their epoch authenticator values were equal (using somesuitable user interface), then each user would be assured that the others werenot being impersonated in the current epoch. As soon as the epoch changed,though, they would need to redo this confirmation. The state of the group wouldhave changed, possibly introducing an attacker.¶
More generally, in order for the members of an MLS group to obtain concreteauthentication protections using theepoch_authenticator
, they will need touse it in some secondary protocol (such as the face-to-face protocol above).The details of that protocol will then determine the specific authenticationprotections provided to the MLS group.¶
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.¶
If N is a parent node in the secret tree, then the secrets of the children of Nare defined as follows (where left(N) and right(N) denote the children of N):¶
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 9.1. The root of each ratchet is computed as:¶
As described inSection 6, MLS encrypts three differenttypes of information:¶
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".¶
The following figure shows a secret tree for a four-member group, with thehandshake and application ratchets that member D will use for sending and thefirst two application keys and nonces.¶
A sender ratchet starts from a per-sender base secret derived from a SecretTree, as described inSection 9. 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 pairMUST 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 current positionin the ratchet.¶
DeriveTreeSecret(Secret, Label, Generation, Length) = ExpandWithLabel(Secret, Label, Generation, Length)¶
WhereGeneration
is encoded as a big endian uint32.¶
HereAEAD.Nn
andAEAD.Nk
denote the lengthsin bytes of the nonce and key for the AEAD scheme defined bythe cipher suite.¶
It is important to delete all security-sensitive values as soon as they areconsumed. A sensitive value S is said to beconsumed if:¶
Here S may be theinit_secret
,commit_secret
,epoch_secret
, orencryption_secret
as well as any secret in a secret tree or one of theratchets.¶
As soon as a group member consumes a value, theyMUST immediately delete(all representations of) that value. This is crucial to ensuringforward secrecy for past messages. MembersMAY 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 leaf nodeL in some epoch n. Then, for that member, at least the followingvalues have been consumed andMUST be deleted:¶
commit_secret
,joiner_secret
,epoch_secret
, andencryption_secret
ofthat epoch n as well as theinit_secret
of the previous epoch n-1,¶application_ratchet_nonce_[L]_[j]
andapplication_ratchet_key_[L]_[j]
.¶Concretely, consider the secret tree shown inFigure 27. ClientA, B, or C would generate the illustrated values on receiving a message from Dwith generation equal to 1, having not received a message with generation 0(e.g., due to out-of-order delivery). In such a case, the following valueswould be consumed:¶
encryption_secret
for theepoch)¶epoch_secret
,commit_secret
,psk_secret
, andjoiner_secret
for thecurrent epoch¶Other values may be retained (not consumed):¶
In order to facilitate the asynchronous addition of clients to agroup, clients can pre-publish KeyPackage objects thatprovide some public information about a user. A KeyPackage object specifies:¶
KeyPackages are intended to be used only once andSHOULD NOTbe reused except in the case of a "last resort" KeyPackage (seeSection 16.8).ClientsMAY generate and publish multiple KeyPackages tosupport multiple cipher suites.¶
The value forinit_key
MUST be a public key for the asymmetric encryptionscheme defined bycipher_suite
, and itMUST be unique among the set ofKeyPackages created by this client. Likewise, theleaf_node
fieldMUST bevalid for the cipher suite, including both theencryption_key
andsignature_key
fields. The whole structure is signed using the client'ssignature key. A KeyPackage object with an invalid signature fieldMUST beconsidered malformed.¶
The signature is computed by the functionSignWithLabel
with a label"KeyPackageTBS"
and aContent
input comprising all of the fields except for thesignature field.¶
struct { ProtocolVersion version; CipherSuite cipher_suite; HPKEPublicKey init_key; LeafNode leaf_node; Extension extensions<V>; /* SignWithLabel(., "KeyPackageTBS", KeyPackageTBS) */ opaque signature<V>;} KeyPackage;struct { ProtocolVersion version; CipherSuite cipher_suite; HPKEPublicKey init_key; LeafNode leaf_node; Extension extensions<V>;} KeyPackageTBS;¶
If a client receives a KeyPackage carried within an MLSMessage object, then itMUST verify that theversion
field of the KeyPackage has the same value as theversion
field of the MLSMessage. Theversion
field in the KeyPackageprovides an explicit signal of the intended version to the other members ofgroup when they receive the KeyPackage in an Add proposal.¶
The fieldleaf_node.capabilities
indicates what protocol versions,cipher suites, credential types, and non-default proposal/extension types are supportedby the client. (As discussed inSection 7.2, some proposal and extension types defined in this document are considered"default" and thus are not listed.) This information allows MLS sessionestablishment to be safe from downgrade attacks on the parameters described (asdiscussed inSection 11), while still only advertising one version andone cipher suite per KeyPackage.¶
The fieldleaf_node.leaf_node_source
of the LeafNode in a KeyPackageMUST beset tokey_package
.¶
Extensions included in theextensions
orleaf_node.extensions
fieldsMUSTbe included in theleaf_node.capabilities
field. As discussed inSection 13, unknown extensions inKeyPackage.extensions
MUST beignored, and the creator of a KeyPackage objectSHOULD include some random GREASEextensions to help ensure that other clients correctly ignore unknownextensions.¶
The validity of a KeyPackage needs to be verified at a few stages:¶
The client verifies the validity of a KeyPackage using the following steps:¶
leaf_node
of the KeyPackage is valid for a KeyPackageaccording toSection 7.3.¶leaf_node.credential
.¶leaf_node.encryption_key
is different from the value oftheinit_key
field.¶A group is always created with a single member, the "creator". Other membersare then added to the group using the usual Add/Commit mechanism.¶
The creator of a group is responsible for setting the group ID, cipher suite, andinitial extensions for the group. If the creator intends to add other membersat the time of creation, then itSHOULD fetch KeyPackages for the members to beadded, and select a cipher suite and extensions according to the capabilities ofthe members. To protect against downgrade attacks, the creatorMUST use thecapabilities
information in these KeyPackages to verify that the chosenversion and cipher suite is the best option supported by all members.¶
Group IDsSHOULD be constructed in such a way that there is an overwhelmingly lowprobability of honest group creators generating the same group ID, even withoutassistance from the Delivery Service. This can be done, for example, by making the group ID afreshly generated random value of sizeKDF.Nh
. The Delivery ServiceMAYattempt to ensure that group IDs are globally unique by rejecting the creationof new groups with a previously used ID.¶
To initialize a group, the creator of the groupMUST take thefollowing steps:¶
Initialize a one-member group with the following initial values:¶
KDF.Nh
¶Calculate the interim transcript hash:¶
confirmation_key
for the epoch as described inSection 8.¶confirmation_tag
over the emptyconfirmed_transcript_hash
using theconfirmation_key
as described inSection 6.1.¶interim_transcript_hash
from theconfirmed_transcript_hash
and theconfirmation_tag
as described inSection 8.2.¶At this point, the creator's state represents a one-member group with a fullyinitialized key schedule, transcript hashes, etc. Proposals and Commits can begenerated for this group state just like any other state of the group, such asAdd proposals and Commits to add other members to the group. A GroupInfo objectfor this group state can also be published to facilitate external joins.¶
Members other than the creator join either by being sent a Welcome message (asdescribed inSection 12.4.3.1) or by sending an external Commit(seeSection 12.4.3.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 and the leaf secret from which the Commit is built.¶
The configuration of a group imposes certain requirements on clients in thegroup. At a minimum, all members of the group need to support the cipher suiteand protocol version in use. Additional requirements can be imposed byincluding arequired_capabilities
extension in the GroupContext.¶
struct { ExtensionType extension_types<V>; ProposalType proposal_types<V>; CredentialType credential_types<V>;} RequiredCapabilities;¶
This extension lists the extensions, proposals, and credential types that must be supported byall members of the group. The "default" proposal and extension types defined in thisdocument are assumed to be implemented by all clients, and need not be listed inRequiredCapabilities in order to be safely used. Note that this is not true forcredential types.¶
For new members, support for required capabilities is enforced by existingmembers during the application of Add commits. Existing members should ofcourse be in compliance already. In order to ensure this continues to be thecase even as the group's extensions are updated, a GroupContextExtensionsproposal is deemed invalid if it contains arequired_capabilities
extension thatrequires non-default capabilities not supported by all current members.¶
A group may be reinitialized by creating a new group with the same membershipand different parameters, and linking it to the old group via a resumption PSK.The members of a group reinitialize it using the following steps:¶
A member of the old group creates an initial Commit that sets up a new groupthat matches the ReInit and sends a Welcome message:¶
version
,cipher_suite
,group_id
, andextensions
fields of the GroupContext object in the WelcomemessageMUST be the same as the corresponding fields in the ReInitproposal. Theepoch
in the Welcome messageMUST be 1.¶resumption
with usagereinit
, where thegroup_id
field matches the old group and theepoch
field indicates the epoch after the Commit covering the ReInit.¶Note that these three steps may be done by the same group member or differentmembers. For example, if a group member sends a Commit with an inline ReInitproposal (steps 1 and 2) but then goes offline, another group member mayrecreate the group instead. This flexibility avoids situations where a groupgets stuck between steps 2 and 3.¶
Resumption PSKs with usagereinit
MUST NOT be used in other contexts. APreSharedKey proposal with typeresumption
and usagereinit
MUST beconsidered invalid.¶
A new group can be formed from a subset of an existing group's members, usingthe same parameters as the old group.¶
A member can create a subgroup by performing the following steps:¶
resumption
with usagebranch
. To avoid keyreuse, thepsk_nonce
included in the PreSharedKeyID objectMUST be arandomly sampled nonce of lengthKDF.Nh
.¶A client receiving a Welcome message including a PreSharedKey of typeresumption
withusagebranch
MUST verify that the new group reflects a subgroup branched fromthe referenced group by checking that:¶
version
andcipher_suite
values in the Welcome message are the same asthose used by the old group.¶epoch
in the Welcome messageMUST be 1.¶Resumption PSKs with usagebranch
MUST NOT be used in other contexts. APreSharedKey proposal with typeresumption
and usagebranch
MUST beconsidered invalid.¶
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.In MLS, each such change is accomplished by a two-step process:¶
In cases where the Proposal and Commit are sent by the same member, these two stepscan be combined by sending the proposals in the commit.¶
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.¶
Proposals are included in a FramedContent by way of a Proposal structurethat indicates their type:¶
// See the "MLS Proposal Types" IANA registry for valuesuint16 ProposalType;struct { ProposalType proposal_type; select (Proposal.proposal_type) { case add: Add; case update: Update; case remove: Remove; case psk: PreSharedKey; case reinit: ReInit; case external_init: ExternalInit; case group_context_extensions: GroupContextExtensions; };} Proposal;¶
On receiving a FramedContent containing a Proposal, a clientMUST verify thesignature inside FramedContentAuthData and that theepoch
field of the enclosingFramedContent is equal to theepoch
field of the current GroupContext object.If the verification is successful, then the Proposal should be cached in such a waythat it can be retrieved by hash (as a ProposalOrRef object) in a later Commit message.¶
An Add proposal requests that a client with a specified KeyPackage be addedto the group.¶
struct { KeyPackage key_package;} Add;¶
An Add proposal is invalid if the KeyPackage is invalid according toSection 10.1.¶
An Add is applied after being included in a Commit message. The position of theAdd in the list of proposals determines the leaf node where the new member willbe added. For the first Add in the Commit, the corresponding new member will beplaced in the leftmost empty leaf in the tree, for the second Add, the nextempty leaf to the right, etc. If no empty leaf exists, the tree is extended tothe right.¶
unmerged_leaves
list for the node.¶leaf_node
field of the KeyPackage in the Add.¶An Update proposal is a similar mechanism to Add with the distinctionthat it replaces the sender's LeafNode in the tree instead of adding a new leafto the tree.¶
struct { LeafNode leaf_node;} Update;¶
An Update proposal is invalid if the LeafNode is invalid for an Updateproposal according toSection 7.3.¶
A member of the group applies an Update message by taking the following steps:¶
A Remove proposal requests that the member with the leaf indexremoved
be removedfrom the group.¶
struct { uint32 removed;} Remove;¶
A Remove proposal is invalid if theremoved
field does not identify a non-blankleaf node.¶
A member of the group applies a Remove message by taking the following steps:¶
removed
. Let L be this leaf node.¶d
isthe smallest value such that 2d >L
.¶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;¶
A PreSharedKey proposal is invalid if any of the following is true:¶
psktype
set toresumption
andusage
set toreinit
.¶psktype
set toresumption
andusage
set tobranch
.¶psk_nonce
is not of lengthKDF.Nh
.¶Thepsk_nonce
MUST be randomly sampled. When processinga Commit message that includes one or more PreSharedKey proposals, groupmembers derivepsk_secret
as described inSection 8.4, where theorder of the PSKs corresponds to the order of the PreSharedKey proposalsin the Commit.¶
A ReInit proposal represents a request to reinitialize the group with differentparameters, for example, to increase the version number or to change thecipher suite. The reinitialization is done by creating a completely new groupand shutting down the old one.¶
struct { opaque group_id<V>; ProtocolVersion version; CipherSuite cipher_suite; Extension extensions<V>;} ReInit;¶
A ReInit proposal is invalid if theversion
field is less than the versionfor the current group.¶
A member of the group applies a ReInit proposal by waiting for the committer tosend the Welcome message that matches the ReInit, according to the criteria inSection 11.2.¶
An ExternalInit proposal is used by new members that want to join a group byusing an external commit. This proposal can only be used in that context.¶
struct { opaque kem_output<V>;} ExternalInit;¶
A member of the group applies an ExternalInit message by initializing the nextepoch using an init secret computed as described inSection 8.3.Thekem_output
field contains the required KEM output.¶
A GroupContextExtensions proposal is used to update the list of extensions inthe GroupContext for the group.¶
struct { Extension extensions<V>;} GroupContextExtensions;¶
A GroupContextExtensions proposal is invalid if it includes arequired_capabilities
extension and some members of the group do not supportsome of the required capabilities (including those added in the same Commit,and excluding those removed).¶
A member of the group applies a GroupContextExtensions proposal with thefollowing steps:¶
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.¶
Proposals can be constructed and sent to the group by a partythat is outside the group in two cases. One case, indicated by theexternal
SenderType,allows an entity outside the group to submit proposals to the group.For example, an automated service might proposeremoving 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.Anexternal
sender might send a ReInit proposal to enforce a changed policyregarding MLS versions or cipher suites.¶
Theexternal
SenderType requires that signers are pre-provisionedto the clients within a group and can only be used if theexternal_senders
extension is present in the group's GroupContext.¶
The other case, indicated by thenew_member_proposal
SenderType, is usefulwhen existing members of the group can independently verify that an Add proposalsent by the new joiner itself (not an existing member) is authorized. Externalproposals that are not authorized are considered invalid.¶
An external proposalMUST be sent as a PublicMessage object, since the senderwill not have the keys necessary to construct a PrivateMessage object.¶
Proposals of some types cannot be sent by anexternal
sender. Among theproposal types defined in this document, only the following types may be sent byanexternal
sender:¶
Messages fromexternal
senders containing proposal types other than the aboveMUST be rejected as malformed. New proposal types defined in the futureMUSTdefine whether they may be sent byexternal
senders. The "Ext" column inthe "MLS Proposal Types" registry (Section 17.4) reflects this property.¶
Theexternal_senders
extension is a group context extension that containsthe credentials and signature keys of senders that are permitted to sendexternal proposals to the group.¶
struct { SignaturePublicKey signature_key; Credential credential;} ExternalSender;ExternalSender external_senders<V>;¶
A group member creating a Commit and a group member processing a CommitMUST verify that the list of committed proposals is valid using one of the followingprocedures, depending on whether the Commit is external or not. If the list ofproposals is invalid, then the Commit messageMUST be rejected as invalid.¶
For a regular, i.e., not external, Commit, the list is invalid if any of thefollowing occurs:¶
An application may extend the above procedure by additional rules, for example,requiring application-level permissions to add members, or rules concerningnon-default proposal types.¶
For an external Commit, the list is valid if it contains only the following proposals(not necessarily in this order):¶
path
field of the external CommitMUST meet the same criteria as would the LeafNodein an Update for the removed leaf (seeSection 12.1.2). In particular, thecredential
in the LeafNodeMUST present a set of identifiers that is acceptable to theapplication for the removed participant.¶Proposal types defined in the future may make updates to the above validationlogic to incorporate considerations related to proposals of the new type.¶
The sections above defining each proposal type describe how each individualproposal is applied. When creating or processing a Commit, a client applies alist of proposals to the ratchet tree and GroupContext. The clientMUST applythe proposals in the list in the following order:¶
extensions
fieldof the GroupContext for the group with the contents of the proposal. Thenewextensions
MUST be used when evaluating other proposals in this list. Forexample, if a GroupContextExtensions proposal adds arequired_capabilities
extension, then any Add proposals need to indicate support for thosecapabilities.¶init_secret
foruse later in Commit processing.¶Proposal types defined in the futureMUST specify how the above steps are to beadjusted to accommodate the application of proposals of the new type.¶
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. Commits thatrefer to new Proposals from the committer can be included by value. Commitsfor previously sent proposals from anyone (including the committer) can be sentby reference. Proposals sent by reference are specified by including the hash ofthe AuthenticatedContent object in which the proposal was sent (seeSection 5.2).¶
enum { reserved(0), proposal(1), reference(2), (255)} ProposalOrRefType;struct { ProposalOrRefType type; select (ProposalOrRef.type) { case proposal: Proposal proposal; case reference: ProposalRef reference; };} ProposalOrRef;struct { ProposalOrRef proposals<V>; optional<UpdatePath> path;} Commit;¶
A group member that has observed one or more valid proposals within an epochMUST 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.¶
A sender and a receiver of a CommitMUST verify that the committed list ofproposals is valid as specified inSection 12.2. A list is invalid if, for example,it includes an Update and a Remove for the same member, or an Add when the sender does not havethe application-level permission to add new users.¶
The sender of a CommitSHOULD include all proposals that it has receivedduring the current epoch that are valid according to the rules for theirproposal types and according to application policy, as long as this results ina valid proposal list.¶
Due to the asynchronous nature of proposals, receivers of a CommitSHOULD NOT enforcethat all valid proposals sent within the current epoch are referenced by the nextCommit. In the event that a valid proposal is omitted from the next Commit, andthat proposal is still valid in the current epoch, the sender of the proposalMAY resend it after updating it to reflect the current epoch.¶
A member of the groupMAY 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.¶
By default, thepath
field of a CommitMUST be populated. Thepath
fieldMAY be omitted if (a) it covers at least one proposal and (b) none of the proposalscovered by the Commit are of "path required" types. A proposal type requires apath if it cannot change the group membership in a way that requires the forwardsecrecy and post-compromise security guarantees that an UpdatePath provides.The only proposal types defined in this document that do not require a path are:¶
New proposal typesMUST state whether they require a path. If any instance of aproposal type requires a path, then the proposal type requires a path. Thisattribute of a proposal type is reflected in the "Path Required" field of the"MLS Proposal Types" registry defined inSection 17.4.¶
Update and Remove proposals are the clearest examples of proposals that requirea path. An UpdatePath is required to evict the removed member or the oldappearance of the updated member.¶
In pseudocode, the logic for validating thepath
field of a Commit is asfollows:¶
pathRequiredTypes = [ update, remove, external_init, group_context_extensions]pathRequired = falsefor proposal in commit.proposals: pathRequired = pathRequired || (proposal.msg_type in pathRequiredTypes)if len(commit.proposals) == 0 || pathRequired: assert(commit.path != null)¶
To summarize, a Commit can have three different configurations, with differentuses:¶
When creating or processing a Commit, a client updates the ratchet tree andGroupContext for the group. These values advance from an "old" state reflectingthe current epoch to a "new" state reflecting the new epoch initiated by theCommit. When the Commit includes an UpdatePath, a "provisional" group contextis constructed that reflects changes due to the proposals and UpdatePath, butwith the old confirmed transcript hash.¶
A member of the group creates a Commit message and the corresponding Welcomemessage at the same time, by taking the following steps:¶
proposals
field populated fromProposals received during the current epoch, and with thepath
field empty.¶path
field: If thepath
field is requiredbased on the proposals that are in the Commit (see above), then itMUST bepopulated. Otherwise, the senderMAY omit thepath
field at its discretion.¶If populating thepath
field:¶
commit_secret
as the valuepath_secret[n+1]
derived from thelast path secret value (path_secret[n]
) derived for the UpdatePath.¶Construct a provisional GroupContext object containing the following values:¶
path
field in the Commit.¶path
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).¶psk_secret
as specified inSection 8.4, where the orderof PSKs in the derivation corresponds to the order of PreSharedKey proposalsin theproposals
vector.¶Construct a FramedContent object containing the Commit object. Sign theFramedContent using the old GroupContext as context.¶
init_secret
from the previous epoch, thecommit_secret
andpsk_secret
defined in the previous steps, and the new GroupContext tocompute the newjoiner_secret
,welcome_secret
,epoch_secret
, andderived secrets for the new epoch.¶confirmation_key
for the new epoch to compute theconfirmation_tag
value.¶confirmation_tag
from the FramedContentAuthData.¶Protect the AuthenticatedContent object using keys from the old epoch:¶
Construct a GroupInfo reflecting the new state:¶
group_id
,epoch
,tree
,confirmed_transcript_hash
,interim_transcript_hash
, andgroup_context_extensions
fields to reflectthe new state.¶confirmation_tag
field to the value of the corresponding field inthe FramedContentAuthData object.¶joiner_secret
.for the new epoch (seeSection 12.4.3.1).¶For each new member in the group:¶
path
field was populated above: Compute the path secretcorresponding to the common ancestor node.¶init_secret
for the current epoch and the path secret (if present).¶psks
MUST be the same as the order ofPreSharedKey proposals in theproposals
vector. As discussed inSection 12.4.3.1, the committer is free to choose how manyWelcome messages to construct. However, the set of Welcome messages producedin this stepMUST cover every new member added in the Commit.¶If a ReInit proposal was part of the Commit, the committerMUST create a newgroup with the parameters specified in the ReInit proposal,and with the same members as the original group.The Welcome messageMUST include a PreSharedKeyID with the followingparameters:¶
A member of the group applies a Commit message by taking the following steps:¶
epoch
field of the enclosing FramedContent is equalto theepoch
field of the current GroupContext object.¶Unprotect the Commit using the keys from the current epoch:¶
proposals
vector is valid according to the rules inSection 12.2.¶proposals
vector are available.¶path
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, validate it and apply it to the tree:¶
leaf_node_source
fieldMUST be set tocommit
.¶encryption_key
value in the LeafNode is different from thecommitter's current leaf node.¶Construct a provisional GroupContext object containing the following values:¶
commit_secret
as the valuepath_secret[n+1]
derived from thelast path secret value (path_secret[n]
) derived for the UpdatePath.¶path
value is not populated, definecommit_secret
as the all-zerovector of lengthKDF.Nh
(the same length as apath_secret
value would be).¶psk_secret
as specified inSection 8.4, where the orderof PSKs in the derivation corresponds to the order of PreSharedKey proposalsin theproposals
vector.¶init_secret
from the previous epoch, thecommit_secret
andpsk_secret
defined in the previous steps, and the new GroupContext tocompute the newjoiner_secret
,welcome_secret
,epoch_secret
, andderived secrets for the new epoch.¶confirmation_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 FramedContentAuthData object.¶Note that clients need to be prepared to receive a valid Commit message that removesthem from the group. In this case, the client cannot send any more messages in thegroup andSHOULD promptly delete its group state and secret tree. (A client might keepthe secret tree for a short time to decrypt late messages in the previous epoch.)¶
New members can join the group in two ways: by being added by a groupmember or by adding themselves through an external Commit. In both cases, thenew members need information to bootstrap their local group state.¶
struct { GroupContext group_context; Extension extensions<V>; MAC confirmation_tag; uint32 signer; /* SignWithLabel(., "GroupInfoTBS", GroupInfoTBS) */ opaque signature<V>;} GroupInfo;¶
Thegroup_context
field represents the current state of the group. Theextensions
field allows the sender to provide additional data that might beuseful to new joiners. Theconfirmation_tag
represents the confirmation tagfrom the Commit that initiated the current epoch, or for epoch 0, theconfirmation tag computed in the creation of the group (seeSection 11).(In either case, the creator of a GroupInfo may recompute the confirmation tagasMAC(confirmation_key, confirmed_transcript_hash)
.)¶
As discussed inSection 13, unknown extensions inGroupInfo.extensions
MUST be ignored, and the creator of a GroupInfo objectSHOULD include somerandom GREASE extensions to help ensure that other clients correctly ignore unknownextensions. Extensions inGroupInfo.group_context.extensions
, however,MUSTbe supported by the new joiner.¶
New membersMUST verify thatgroup_id
is unique among the groups they arecurrently participating in.¶
New members alsoMUST verify thesignature
using the public key taken from theleaf node of the ratchet tree with leaf indexsigner
. Thesignature covers the following structure, comprising all the fields in theGroupInfo abovesignature
:¶
struct { GroupContext group_context; Extension extensions<V>; MAC confirmation_tag; uint32 signer;} GroupInfoTBS;¶
The sender of a Commit message is responsible for sending a Welcome message toeach new member added via Add proposals. The format of the Welcome messageallows a single Welcome message to be encrypted for multiple new members. It isup to the committer to decide how many Welcome messages to create for a givenCommit. The committer could create one Welcome that is encrypted for all newmembers, a different Welcome for each new member, or Welcome messages forbatches of new members (according to some batching scheme that works well forthe application). The processes for creating and processing the Welcome are thesame in all cases, aside from the set of new members for whom a given Welcome isencrypted.¶
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 they 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 multiple 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 (closest to the leaf) nodethat is contained in the direct 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
fieldindicating which PSK to use.¶
struct { opaque path_secret<V>;} PathSecret;struct { opaque joiner_secret<V>; optional<PathSecret> path_secret; PreSharedKeyID psks<V>;} GroupSecrets;struct { KeyPackageRef new_member; HPKECiphertext encrypted_group_secrets;} EncryptedGroupSecrets;struct { CipherSuite cipher_suite; EncryptedGroupSecrets secrets<V>; opaque encrypted_group_info<V>;} 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 clientMUST download the tree beforeprocessing the Welcome.¶
On receiving a Welcome message, a client processes it using the following steps:¶
secrets
array where thenew_member
value corresponds to one of this client's KeyPackages, using the hashindicated by thecipher_suite
field. If no such field exists, or if thecipher suite indicated in the KeyPackage does not match the one in theWelcome message, return an error.¶encrypted_group_secrets
value with the algorithms indicated bythe cipher suite and the private keyinit_key_priv
corresponding toinit_key
in the referenced KeyPackage.¶encrypted_group_secrets = EncryptWithLabel(init_key, "Welcome", encrypted_group_info, group_secrets)group_secrets = DecryptWithLabel(init_key_priv, "Welcome", encrypted_group_info, kem_output, ciphertext)¶
resumption
with usagereinit
orbranch
, verifythat it is the only such PSK.¶joiner_secret
in the decrypted GroupSecrets object and the PSKsspecified in the GroupSecrets, derive thewelcome_secret
and thenthewelcome_key
andwelcome_nonce
. Use the key and nonce to decrypt theencrypted_group_info
field.¶welcome_nonce = ExpandWithLabel(welcome_secret, "nonce", "", AEAD.Nn)welcome_key = ExpandWithLabel(welcome_secret, "key", "", AEAD.Nk)¶
signer
. If the node is blank or ifsignature verification fails, return an error.¶group_id
is unique among the groups that the client iscurrently participating in.¶cipher_suite
in the GroupInfo matches thecipher_suite
inthe KeyPackage.¶Verify the integrity of the ratchet tree.¶
tree_hash
fieldin GroupInfo.¶For each non-empty parent node and each entry in the node'sunmerged_leaves
field:¶
unmerged_leaves
.¶my_leaf
represent this leaf in the tree.¶Construct a new group state using the information in the GroupInfo object.¶
group_context
fieldfrom the GroupInfo object.¶my_leaf
with the private key corresponding to thepublic key in the node, wheremy_leaf
is the new member's leaf node inthe ratchet tree, as defined above.¶path_secret
value is set in the GroupSecrets object: Identify thelowest common ancestor of the leaf nodemy_leaf
and of the node ofthe member with leaf indexGroupInfo.signer
. Set the private key forthis node to the private key derived from thepath_secret
.¶joiner_secret
from the GroupSecrets object to generate the epoch secretand other derived secrets for the current epoch.¶confirmed_transcript_hash
in the GroupInfo.¶confirmed_transcript_hash
from the GroupInfo.¶If a PreSharedKeyID was used that has typeresumption
with usagereinit
orbranch
, verify that theepoch
field in the GroupInfo is equal to 1.¶
reinit
, verify that the last Commit to the referenced groupcontains a ReInit proposal and that thegroup_id
,version
,cipher_suite
, andgroup_context.extensions
fields of the GroupInfo matchthe ReInit proposal. Additionally, verify that all the members of the oldgroup are also members of the new group, according to the application.¶branch
, verify that theversion
andcipher_suite
of the newgroup match those of the old group, and that the members of the new groupcompose a subset of the members of the old group, according to theapplication.¶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:¶
In other words, to join a group via an external Commit, a new member needs aGroupInfo with anexternal_pub
extension present in itsextensions
field.¶
struct { HPKEPublicKey external_pub;} ExternalPub;¶
Thus, a member of the group can enable new clients to join by making a GroupInfoobject available to them. Note that because a GroupInfo object is specific to anepoch, it will need to be updated as the group advances. In particular, eachGroupInfo object can be used for one external join, since that external joinwill cause the epoch to change.¶
Note that thetree_hash
field is used the same way as in the Welcome message.The full tree can be included via theratchet_tree
extension(seeSection 12.4.3.3).¶
The information in a GroupInfo is not generally public information, but applicationscan choose to make it available to new members in order to allow ExternalCommits.¶
In principle, external Commits work like regular Commits. However, their contenthas to meet a specific set of requirements:¶
path
field (and is therefore a "full"Commit). The joiner is added at the leftmost free leaf node (just as if theywere added with an Add proposal), and the path is calculated relative to thatleaf node.¶leaf_node
of thepath
field.¶new_member_commit
.¶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 it 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 attacker would need to compromise the PSKas well as the signing key, but the application will need to ensure thatcontinuing, non-resynchronizing members have the required PSK.¶
By default, a GroupInfo message only provides the joiner with a hash ofthe 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 the 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:¶
struct { NodeType node_type; select (Node.node_type) { case leaf: LeafNode leaf_node; case parent: ParentNode parent_node; };} Node;optional<Node> ratchet_tree<V>;¶
Each entry in theratchet_tree
vector provides the value for a node in thetree, or the null optional for a blank node.¶
The nodes are listed in the order specified by a left-to-right in-ordertraversal of the ratchet tree. Each node is listed between its left subtree andits right subtree. (This is the same ordering as specified for the array-basedtrees outlined inAppendix C.)¶
If the tree has 2d leaves, then it has 2d+1 - 1 nodes. Theratchet_tree
vector logically has this number of entries, but the senderMUST NOT include blank nodes after the last non-blank node. The receiverMUSTcheck that the last node inratchet_tree
is non-blank, and then extend the tree to theright until it has a length of the form 2d+1 - 1, adding the minimum numberof blank values possible. (Obviously, this may be done "virtually", bysynthesizing blank nodes when required, as opposed to actually changing thestructure in memory.)¶
The leaves of the tree are stored in even-numbered entries in the array (theleaf with indexL
in array position2*L
). The root node of the tree is atposition 2d - 1 of the array. Intermediate parent nodes can be identified byperforming the same calculation to the subarrays to the left and right of theroot, following something like the following algorithm:¶
# Assuming a class Node that has left and right membersdef subtree_root(nodes): # If there is only one node in the array, return it if len(nodes) == 1: return Node(nodes[0]) # Otherwise, the length of the array MUST be odd if len(nodes) % 2 == 0: raise Exception("Malformed node array {}", len(nodes)) # Identify the root of the subtree d = 0 while (2**(d+1)) < len(nodes): d += 1 R = 2**d - 1 root = Node(nodes[R]) root.left = subtree_root(nodes[:R]) root.right = subtree_root(nodes[(R+1):]) return root¶
(Note that this is the same ordering of nodes as in the array-based tree representationdescribed inAppendix C. The algorithms in that section may be used tosimplify decoding this extension into other representations.)¶
For example, the following tree with six non-blank leaves would be representedas an array of eleven elements,[A, W, B, X, C, _, D, Y, E, Z, F]
. The abovedecoding procedure would identify the subtree roots as follows (using R torepresent a subtree root):¶
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.¶
Regardless of how the client obtains the tree, the clientMUST verify that theroot hash of the ratchet tree matches thetree_hash
of the GroupContext beforeusing the tree for MLS operations.¶
The base MLS protocol can be extended in a few ways. New cipher suites can beadded to enable the use of new cryptographic algorithms. New types of proposalscan be used to perform new actions within an epoch. Extension fields can beused to add additional information to the protocol. In this section, we discusssome constraints on these extensibility mechanisms that are necessary to ensurebroad interoperability.¶
As discussed inSection 5.1, MLS allows the participants in a group tonegotiate the cryptographic algorithms used within the group. Thisextensibility is important for maintaining the security of the protocol overtime[RFC7696]. It also creates a risk of interoperability failure due toclients not supporting a common cipher suite.¶
The cipher suite registry defined inSection 17.1 attempts to strike abalance on this point. On the one hand, the base policy for the registry isSpecification Required, a fairly low bar designed to avoid the need forstandards work in cases where different ciphers are needed for nicheapplications. On the other hand, there is a higher bar (Standards Action) for ciphers to set theRecommended field in the registry. This higher bar is there in part to ensurethat the interoperability implications of new cipher suites are considered.¶
MLS cipher suites are defined independent of MLS versions, so that in principle,the same cipher suite can be used across versions. Standards work defining newversions of MLS should consider whether it is desirable for the new version tobe compatible with existing cipher suites, or whether the new version should ruleout some cipher suites. For example, a new version could follow the example ofHTTP/2, which restricted the set of allowed TLS ciphers (seeSection 9.2.2 of [RFC9113]).¶
Commit messages do not have an extension field because the set of proposals isextensible. As discussed inSection 12.4, Proposals with a non-default proposaltypeMUST NOT be included in a commit unless the proposal type is supported byall the members of the group that will process the Commit.¶
In order to ensure that MLS provides meaningful authentication, it is importantthat each member is able to authenticate some identity information for eachother member. Identity information is encoded in Credentials, so this propertyis provided by ensuring that members use compatible credential types.¶
The only types of credential that may be used in a group are those that allmembers of the group support, as specified by thecapabilities
field of eachLeafNode in the ratchet tree. An application can introduce new credential typesby choosing an unallocated identifier from the registry inSection 17.5 and indicating support for the credential type inpublished LeafNodes, whether in Update proposals to existing groups orKeyPackages that are added to new groups. Once all members in a group indicatesupport for the credential type, members can start using LeafNodes with the newcredential. Application may enforce that certain credential types always remainsupported by adding arequired_capabilities
extension to the group'sGroupContext, which would prevent any member from being added to the group thatdoesn't support them.¶
In future extensions to MLS, it may be useful to allow a member to present morethan one credential. For example, such credentials might present differentattributes attested by different authorities. To be consistent with the generalprinciple stated at the beginning of this section, such an extension would needto ensure that each member can authenticate some identity for each other member.For each pair of members (Alice, Bob), Alice would need to present at least onecredential of a type that Bob supports.¶
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 other words, an application can use GroupContext extensions to ensure thatall members of the group agree on a set of parameters. Clients indicate theirsupport for parameters in thecapabilities
field of their LeafNode. Newmembers of a group are informed of the group's GroupContext extensions via theextensions
field in thegroup_context
field of the GroupInfo object. Theextensions
field in a GroupInfo object (outside of thegroup_context
field)can be used to provide additional parameters to new joiners that are used tojoin the group.¶
This extension mechanism is designed to allow for the secure and forward-compatiblenegotiation of extensions. For this to work, implementationsMUST correctlyhandle extensible fields:¶
capabilities
field of the LeafNode and all unknown extensions intheextensions
andleaf_node.extensions
fields. Otherwise, it could failto interoperate with newer clients.¶extensions
field.¶capabilities
fieldMUST indicate support for each extension in the GroupContext.¶Note that the latter two requirements mean that all MLS GroupContext extensionsare mandatory, in the sense that an extension in use by the groupMUST besupported by all members of the group.¶
The parameters of a group may be changed by sending a GroupContextExtensionsproposal to enable additional extensions (Section 12.1.7), orby reinitializing the group (Section 11.2).¶
As described inSection 13.4, clients are required to ignore unknown valuesfor certain parameters. To help ensure that other clients implement thisbehavior, a client can follow the "Generate Random Extensions And SustainExtensibility" or GREASE approach described in[RFC8701]. In the context ofMLS, this means that a client generating a KeyPackage, LeafNode, or GroupInfo object includesrandom values in certain fields which would be ignored by acorrectly implemented client processing the message. A client that incorrectlyrejects unknown code points will fail to process such a message, providing asignal to its implementer that the client needs to be fixed.¶
When generating the following fields, an MLS clientSHOULD include a randomselection of values chosen from these GREASE values:¶
LeafNode.capabilities.cipher_suites
¶LeafNode.capabilities.extensions
¶LeafNode.capabilities.proposals
¶LeafNode.capabilities.credentials
¶LeafNode.extensions
¶KeyPackage.extensions
¶GroupInfo.extensions
¶For the KeyPackage and GroupInfo extensions, theextension_data
for GREASEextensionsMAY have any contents selected by the sender, since they will beignored by a correctly implemented receiver. For example, a sender mightpopulate these extensions with a randomly sized amount of random data.¶
Note that any GREASE values added toLeafNode.extensions
need to be reflectedinLeafNode.capabilities.extensions
, since the LeafNode validation processdescribed inSection 7.3 requires that these two fields beconsistent.¶
GREASE valuesMUST NOT be sent in the following fields, because an unsupportedvalue in one these fields (including a GREASE value) will cause the enclosingmessage to be rejected:¶
Proposal.proposal_type
¶Credential.credential_type
¶GroupContext.extensions
¶GroupContextExtensions.extensions
¶Values reserved for GREASE have been registered in the variousregistries inSection 17. This prevents conflict between GREASEand real future values. The following values are reserved in each registry:0x0A0A
,0x1A1A
,0x2A2A
,0x3A3A
,0x4A4A
,0x5A5A
,0x6A6A
,0x7A7A
,0x8A8A
,0x9A9A
,0xAAAA
,0xBABA
,0xCACA
,0xDADA
, and0xEAEA
. (Thevalue0xFAFA
falls within the private use range.) These valuesMUST onlyappear in the fields listed above, and not, for example, in theproposal_type
field of a Proposal. ClientsMUST NOT implement any special processing rulesfor how to handle these values when receiving them, since this negates theirutility for detecting extensibility failures.¶
GREASE valuesMUST be handled using normal logic for processing unsupportedvalues. When comparing lists of capabilities to identify mutually supportedcapabilities, clientsMUST represent their own capabilities with a listcontaining only the capabilities actually supported, without any GREASE values.In other words, lists including GREASE values are only sent to other clients;representations of a client's own capabilitiesMUST NOT contain GREASE values.¶
Each Commit message is premised on a given starting state,indicated by theepoch
field of the enclosing FramedContent.If the changes implied by a Commit message 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 simultaneouslybased on the same state.¶
ApplicationsMUST have an established way to resolve conflicting Commit messagesfor the same epoch. They can do this either by preventing conflicting messagesfrom occurring in the first place, or by developing rules for deciding whichCommit out of several sent in an epoch will be canonical. The approach chosenMUST minimize the amount of time that forked or previous group states are keptin memory, and promptly delete them once they're no longer necessary to ensureforward secrecy.¶
The generation of Commit messagesMUST NOT modify a client's state, since theclient doesn't know at that time whether the changes implied by the Commitmessage will conflict with another Commit or not. Similarly, the Welcomemessage corresponding to a CommitMUST NOT be delivered to a newjoiner until it's clear that the Commit has been accepted.¶
Regardless of how messages are kept in sequence, there is a risk thatin a sufficiently busy group, a given member may neverbe able to send a Commit message because they always lose to othermembers. The degree to which this is a practical problem will dependon the dynamics of the application.¶
The primary purpose of handshake messages is to provide an authenticated groupkey exchange to clients. In order to protect application messages sent among themembers of a group, theencryption_secret
provided by the key schedule is usedto derive a sequence of nonces and keys for message encryption. Every epochmoves the key schedule forward, which triggers the creation of a new secrettree, as described inSection 9, along with a new set of symmetricratchets of nonces and keys for each member.¶
Each client maintains their own local copy of the 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.¶
The group identifier and epoch allow a recipient to know which group secretsshould be used and from whichepoch_secret
to start computing other secrets.The sender identifier and content type are used to identify whichsymmetric ratchet to use from the secret tree. Thegeneration
counter determines how far into the ratchet to iterate inorder to produce the required nonce and key for encryption or decryption.¶
Application messagesMAY 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?", then the answer "Wednesday" could be leakedto an adversary solely by the ciphertext length.¶
The length of thepadding
field in PrivateMessageContent can bechosen by the sender at the time of message encryption. Senders may use paddingto reduce the ability of attackers outside the group to infer the size of theencrypted content. Note, however, that the transports used to carry MLSmessages may have maximum message sizes, so padding schemesSHOULD avoidincreasing message size beyond any such limits that exist in a givendeployment scenario.¶
During each epoch, sendersMUST NOT encrypt more data than permitted by thesecurity bounds of the AEAD scheme used[CFRG-AEAD-LIMITS].¶
Note that each change to the group through a handshake message will also set anewencryption_secret
. Hence this changeMUST 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.¶
Since each application message contains the group identifier, the epoch, and ageneration counter, a client can receive messages out of order. When messagesare received out of order, the client moves the sender ratchet forward to matchthe received generation counter. Any unused nonce and key pairs from the ratchetare potentially stored so that they can be used to decrypt the messages thatwere delayed or reordered.¶
ApplicationsSHOULD define a policy on how long to keep unused nonce and keypairs for a sender, and the maximum number to keep. This is in addition toensuring that these secrets are deleted according to the deletion scheduledefined inSection 9.2. ApplicationsSHOULD also define a policylimiting the maximum number of steps that clients will move the ratchet forwardin response to a new message. Messages received with a generation counterthat is too much higher than the last message received would then be rejected.This avoids causing a denial-of-service attack by requiring the recipient toperform an excessive number of key derivations. For example, a malicious groupmember could send a message withgeneration = 0xffffffff
at the beginning of anew epoch, forcing recipients to perform billions of key derivations unless theyapply limits of the type discussed above.¶
The security goals of MLS are described in[MLS-ARCH].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. The Security Considerations section of[MLS-ARCH]provides some citations to detailed security analyses.¶
Because MLS messages are protected at the message level, theconfidentiality and integrity of the group state do not depend onthose messages being protected in transit. However, an attacker whocan observe those messages in transit will be able to learn about thegroup state, including potentially the group membership (seeSection 16.4.3 below). Such an attacker might also be able tomount denial-of-service attacks on the group or exclude new members byselectively removing messages in transit. In order to prevent thisform of attack, it isRECOMMENDED that all MLS messages be carriedover a secure transport such as TLS[RFC8446] or QUIC[RFC9000].¶
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 thetree invariant, and it makes it possible toencrypt to all group members except one, with a number of ciphertexts that islogarithmic 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 theirkey pair such that the old private key can no longer be used to decrypt newmessages.¶
The PrivateMessage framing encrypts "sender data" that identifies which groupmember sent an encrypted message, as described inSection 6.3.2.As with the QUIC header protection scheme[RFC9001],Section 5.4, this schemeis a variant of the HN1 construction analyzed in[NAN]. A sample of theciphertext is combined with asender_data_secret
to derive a key and noncethat are used for AEAD encryption of the sender data.¶
(key, nonce) = PRF(sender_data_secret, sample)encrypted_sender_data = AEAD.Seal(key, nonce, sender_data_aad, sender_data)¶
The only differences between this construction and HN1 as described in[NAN]are that it (1) uses authenticated encryption instead of unauthenticatedencryption and (2) protects information used to derive a nonce instead of thenonce itself.¶
Since thesender_data_secret
is distinct from the content encryption key, itfollows that the sender data encryption scheme achieves AE2 security as definedin[NAN], and therefore guarantees the confidentiality of the sender data.¶
Use of the samesender_data_secret
and ciphertext sample more than once riskscompromising sender data protection by reusing an AEAD (key, nonce) pair. Forexample, in many AEAD schemes, reusing a key and nonce reveals the exclusive ORof the two plaintexts. Assuming the ciphertext output of the AEAD algorithm isindistinguishable from random data (i.e., the AEAD is AE1-secure in the phrasingof[NAN]), the odds of two ciphertext samples being identical is roughly2-L/2, i.e., the birthday bound.¶
The AEAD algorithms for cipher suites defined in this document all provide thisproperty. The size of the sample depends on the cipher suite's hash function, butin all cases, the probability of collision is no more than 2-128.Any future cipher suiteMUST use an AE1-secure AEAD algorithm.¶
MLS does not provide confidentiality protection to some messages and fieldswithin messages:¶
The only mechanism MLS provides for confidentially distributing a group'sratchet tree to new members is to send it in a Welcome message as aratchet_tree
extension. If an application distributes the tree in some otherway, its security will depend on that application mechanism.¶
A party observing these fields might be able to infer certain properties of thegroup:¶
The amount of metadata exposed to parties outside the group, and thus theability of these parties to infer the group's properties, depends on severalaspects of the DS design, such as:¶
In the remainder of this section, we note the ways that the above properties ofthe group are reflected in unprotected group messages, as a guide tounderstanding how they might be exposed or protected in a given application.¶
MLS provides no mechanism to protect the group ID and epoch of a message fromthe DS, so the group ID and the frequency of messages and epoch changes are notprotected against inspection by the DS. However, any modifications to thesewill cause decryption failure.¶
A group's extensions are first set by the group's creator and then updated byGroupContextExtensions proposals. A GroupContextExtensions proposal sent asa PublicMessage leaks the group's extensions.¶
A new member learns the group's extensions via a GroupInfo object. When the newmember joins via a Welcome message, the Welcome message's encryption protectsthe GroupInfo message. When the new member joins via an external join, theymust be provided with a GroupInfo object. Protection of this GroupInfo objectis up to the application -- if it is transmitted over a channel that is notconfidential to the group and the new joiner, then it will leak the group'sextensions.¶
The group's membership is represented directly by its ratchet tree, since eachmember's LeafNode contains members' cryptographic keys, a credential thatcontains information about the member's identity, and possibly otheridentifiers. Applications that expose the group's ratchet tree outside thegroup also leak the group's membership.¶
Changes to the group's membership are made by means of Add and Remove proposals.If these proposals are sent as PublicMessage, then information will be leakedabout the corresponding changes to the group's membership. A party that seesall of these changes can reconstruct the group membership.¶
Welcome messages contain a hash of each KeyPackage for which the Welcome messageis encrypted. If a party has access to a pool of KeyPackages and observes aWelcome message, then they can identify the KeyPackage representing the newmember. If the party can also associate the Welcome with a group, then theparty can infer that the identified new member was added to that group.¶
Note that these information leaks reveal the group's membership only to the degreethat membership is revealed by the contents of a member's LeafNode in theratchet tree. In some cases, this may be quite direct, e.g., due to credentialsattesting to identifiers such as email addresses. An application couldconstruct a member's leaf node to be less identifying, e.g., by using apseudonymous credential and frequently rotating encryption and signature keys.¶
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 LeafNodes and 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 have therequired PSKs.¶
Forward secrecy and post-compromise security are important security notions forlong-lived MLS groups. Forward secrecy means that messages sent at a certainpoint in time are secure in the face of later compromise of a group member.Post-compromise security means that messages are secure even if a group memberwas compromised at some point in the past.¶
Post-compromise security is provided between epochs by membersregularly updating their leaf key in the ratchet tree. Updating theirleaf key prevents group secrets from continuing to be encrypted topublic keys whose private keys had previously been compromised. Notethat sending an Update proposal does not achieve PCS until anothermember includes it in a Commit. Members can achieve immediate PCS bysending their own Commit and populating thepath
field, as describedinSection 12.4. To be clear, in all these cases, the PCS guaranteescome into effect when the members of the group process the relevantCommit, not when the sender creates it.¶
Forward secrecy between epochs is provided by deleting private keys from pastversions 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.Note that group secrets and message encryption keys are shared by thegroup. There is thus a risk to forward secrecy as long as anymember has not deleted these keys. This is a particular risk if a memberis offline for a long period of time. ApplicationsSHOULD have mechanismsfor evicting group members that are offline for too long (i.e., havenot changed their key within some period).¶
New groups are also at risk of using previously compromised keys (as withpost-compromise security) if a member is added to a new group via an oldKeyPackage whose corresponding private key has been compromised. This risk canbe mitigated by having clients regularly generate new KeyPackages and uploadthem to the Delivery Service. This way, the key material used to add a memberto a new group is more likely to be fresh and less likely to be compromised.¶
The encryption and signature keys stored in theencryption_key
andsignature_key
fields of ratchet tree nodesMUST be distinct from one another.If two members' leaf nodes have the same signature key, for example, then thedata origin authentication properties afforded by signatures within the groupare degraded.¶
Uniqueness of keys in leaf nodes is assured by explicitly checking each leaf nodeas it is added to the tree, whether in an Add proposal, in an Update proposal, or in thepath
field of aCommit. Details can be found in Sections7.3,12.2, and12.4.2. Uniqueness ofencryption keys in parent nodes is assured by checking that the keys in anUpdatePath are not found elsewhere in the tree (seeSection 12.4.2).¶
KeyPackages are intended to be used only once. That is, once a KeyPackagehas been used to introduce the corresponding client to a group, itSHOULD bedeleted from the KeyPackage publication system. Reuse of KeyPackages can leadto replay attacks.¶
An applicationMAY allow for reuse of a "last resort" KeyPackage in order toprevent denial-of-service attacks. Since a KeyPackage is needed to add aclient to a new group, an attacker could prevent a client from being added to newgroups by exhausting all available KeyPackages. To prevent such a denial-of-serviceattack, the KeyPackage publication systemSHOULD rate-limit KeyPackagerequests, especially if not authenticated.¶
MLS is designed to protect the confidentiality and integrity ofthe group data even in the face of a compromised DS. However, a compromisedDS can still mount some attacks. While it cannot forge messages,it can selectively delay or remove them. In some cases, this can beobserved by detecting gaps in the per-sender generation counter,though it may not always be possible to distinguish an attack from messageloss. In addition, the DS can permanently block messages to and froma group member. This will not always be detectable by other members.If an application uses the DS to resolve conflicts betweensimultaneous Commits (seeSection 14), it is also possible for theDS to influence which Commit is applied, even to the point ofpreventing a member from ever having its Commits applied.¶
When put together, these abilities potentially allow a DS to colludewith an attacker who has compromised a member's state to defeat PCS bysuppressing the valid Update and Commit messages from the member thatwould lock out the attacker and update the member's leaf to a new,uncompromised state. Aside from the SenderData.generation value, MLSleaves loss detection up to the application.¶
Authentication Service compromise is much more serious than compromiseof the Delivery Service. A compromised AS can assert a binding for asignature key and identity pair of its choice, thus allowingimpersonation of a given user. This ability is sufficient to allow theAS to join new groups as if it were that user. Depending on theapplication architecture, it may also be sufficient to allow thecompromised AS to join the group as an existing user, for instance, asif it were a new device associated with the same user. Ifthe application uses a transparency mechanism such as CONIKS[CONIKS] or Key Transparency[KT], then it may be possible for endusers to detect this kind of misbehavior by the AS. It is also possible toconstruct schemes in which the various clients owned by a user vouchfor each other, e.g., by signing each others' keys.¶
The DS and AS may also apply additional policies to MLS operations to obtainadditional security properties. For example, MLS enables any participant to addor remove members of a group; a DS could enforce a policy that only certainmembers are allowed to perform these operations. MLS authenticates all membersof a group; a DS could help ensure that only clients with certain types ofcredentials are admitted. MLS provides no inherent protection against denial ofservice; a DS could also enforce rate limits in order to mitigatethese risks.¶
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 7.4, but the UpdatePath syntax allows the sender toencrypt arbitrary, unrelated secrets. The syntax also does not guarantee thatthe encrypted path secret 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. ApplicationsSHOULD provide mechanisms for failedcommits to be reported, so that group members who were not able to recognize theerror themselves can reinitialize the group if necessary.¶
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 will possibly be 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. These memberswill need to either add themselves back with an external Commit or reinitializethe group from scratch.¶
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. MLS does notprovide a built-in mechanism for such acknowledgements, but they canbe added at the application layer.¶
IANA has created the following registries:¶
All of these registries are under the "Messaging Layer Security" group registry heading,and assignments are made via the Specification Required policy[RFC8126]. SeeSection 17.9 for additional information about the MLS Designated Experts (DEs).¶
A cipher suite is a combination of a protocol version and the set ofcryptographic algorithms that should be used.¶
Cipher suite names follow the naming convention:¶
CipherSuite MLS_LVL_KEM_AEAD_HASH_SIG = VALUE;¶
Where VALUE is represented as a 16-bit integer:¶
uint16 CipherSuite;¶
Component | Contents |
---|---|
LVL | The security level (in bits) |
KEM | The KEM algorithm used for HPKE in ratchet tree operations |
AEAD | The AEAD algorithm used for HPKE and message protection |
HASH | The hash algorithm used for HPKE and the MLS transcript hash |
SIG | The signature algorithm used for message authentication |
The columns in the registry are as follows:¶
Recommended: Whether support for this cipher suite is recommended by the IETF.Valid values are "Y", "N", and "D", as described below. The defaultvalue of the "Recommended" column is "N". Setting the Recommended item to "Y"or "D", or changing an item whose current value is "Y" or "D", requiresStandards Action[RFC8126].¶
Initial contents:¶
Value | Name | R | Ref |
---|---|---|---|
0x0000 | RESERVED | - | RFC 9420 |
0x0001 | MLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519 | Y | RFC 9420 |
0x0002 | MLS_128_DHKEMP256_AES128GCM_SHA256_P256 | Y | RFC 9420 |
0x0003 | MLS_128_DHKEMX25519_CHACHA20POLY1305_SHA256_Ed25519 | Y | RFC 9420 |
0x0004 | MLS_256_DHKEMX448_AES256GCM_SHA512_Ed448 | Y | RFC 9420 |
0x0005 | MLS_256_DHKEMP521_AES256GCM_SHA512_P521 | Y | RFC 9420 |
0x0006 | MLS_256_DHKEMX448_CHACHA20POLY1305_SHA512_Ed448 | Y | RFC 9420 |
0x0007 | MLS_256_DHKEMP384_AES256GCM_SHA384_P384 | Y | RFC 9420 |
0x0A0A | GREASE | Y | RFC 9420 |
0x1A1A | GREASE | Y | RFC 9420 |
0x2A2A | GREASE | Y | RFC 9420 |
0x3A3A | GREASE | Y | RFC 9420 |
0x4A4A | GREASE | Y | RFC 9420 |
0x5A5A | GREASE | Y | RFC 9420 |
0x6A6A | GREASE | Y | RFC 9420 |
0x7A7A | GREASE | Y | RFC 9420 |
0x8A8A | GREASE | Y | RFC 9420 |
0x9A9A | GREASE | Y | RFC 9420 |
0xAAAA | GREASE | Y | RFC 9420 |
0xBABA | GREASE | Y | RFC 9420 |
0xCACA | GREASE | Y | RFC 9420 |
0xDADA | GREASE | Y | RFC 9420 |
0xEAEA | GREASE | Y | RFC 9420 |
0xF000 - 0xFFFF | Reserved for Private Use | - | RFC 9420 |
All of the non-GREASE cipher suites use HMAC[RFC2104] as their MAC function, withdifferent hashes per cipher suite. The mapping of cipher suites to HPKEprimitives[RFC9180], HMAC hash functions, and TLS signature schemes[RFC8446] is as follows:¶
Value | KEM | KDF | AEAD | Hash | Signature |
---|---|---|---|---|---|
0x0001 | 0x0020 | 0x0001 | 0x0001 | SHA256 | ed25519 |
0x0002 | 0x0010 | 0x0001 | 0x0001 | SHA256 | ecdsa_secp256r1_sha256 |
0x0003 | 0x0020 | 0x0001 | 0x0003 | SHA256 | ed25519 |
0x0004 | 0x0021 | 0x0003 | 0x0002 | SHA512 | ed448 |
0x0005 | 0x0012 | 0x0003 | 0x0002 | SHA512 | ecdsa_secp521r1_sha512 |
0x0006 | 0x0021 | 0x0003 | 0x0003 | SHA512 | ed448 |
0x0007 | 0x0011 | 0x0002 | 0x0002 | SHA384 | ecdsa_secp384r1_sha384 |
The hash used for the MLS transcript hash is the one referenced in thecipher suite name. In the cipher suites defined above, "SHA256", "SHA384", and"SHA512" refer, respectively, to the SHA-256, SHA-384, and SHA-512 functionsdefined in[SHS].¶
In addition to the general requirements ofSection 13.1, futurecipher suitesMUST meet the requirements ofSection 16.3.¶
It is advisable to keep the number of cipher suites low to increase the likelihoodthat clients can interoperate in a federated environment. The cipher suites thereforeinclude only 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 curves compliant with FIPS 140-2 for Diffie-Hellman keynegotiations. Clients may also choose ChaCha20Poly1305 or AES-GCM, e.g., forperformance reasons. Since ChaCha20Poly1305 is not listed by FIPS 140-2, it isnot paired with curves compliant with FIPS 140-2. The security level of symmetricencryption algorithms and hash functions is paired with the security level ofthe curves.¶
The mandatory-to-implement cipher suite for MLS 1.0 isMLS_128_DHKEMX25519_AES128GCM_SHA256_Ed25519
, which usesCurve25519 for key exchange, AES-128-GCM for HPKE, HKDF over SHA2-256, andEd25519 for signatures. MLS clientsMUST implement this cipher suite.¶
The "MLS Wire Formats" registry lists identifiers for the types of messages that can be sent inMLS. The wire format field is two bytes wide, so the valid wire format valuesare in the range 0x0000 to 0xFFFF.¶
Template:¶
Initial contents:¶
Value | Name | R | Ref |
---|---|---|---|
0x0000 | RESERVED | - | RFC 9420 |
0x0001 | mls_public_message | Y | RFC 9420 |
0x0002 | mls_private_message | Y | RFC 9420 |
0x0003 | mls_welcome | Y | RFC 9420 |
0x0004 | mls_group_info | Y | RFC 9420 |
0x0005 | mls_key_package | Y | RFC 9420 |
0xF000 - 0xFFFF | Reserved for Private Use | - | RFC 9420 |
The "MLS Extension Types" 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:¶
Message(s): The messages in which the extension may appear, drawn from the followinglist:¶
Initial contents:¶
Value | Name | Message(s) | R | Ref |
---|---|---|---|---|
0x0000 | RESERVED | N/A | - | RFC 9420 |
0x0001 | application_id | LN | Y | RFC 9420 |
0x0002 | ratchet_tree | GI | Y | RFC 9420 |
0x0003 | required_capabilities | GC | Y | RFC 9420 |
0x0004 | external_pub | GI | Y | RFC 9420 |
0x0005 | external_senders | GC | Y | RFC 9420 |
0x0A0A | GREASE | KP, GI, LN | Y | RFC 9420 |
0x1A1A | GREASE | KP, GI, LN | Y | RFC 9420 |
0x2A2A | GREASE | KP, GI, LN | Y | RFC 9420 |
0x3A3A | GREASE | KP, GI, LN | Y | RFC 9420 |
0x4A4A | GREASE | KP, GI, LN | Y | RFC 9420 |
0x5A5A | GREASE | KP, GI, LN | Y | RFC 9420 |
0x6A6A | GREASE | KP, GI, LN | Y | RFC 9420 |
0x7A7A | GREASE | KP, GI, LN | Y | RFC 9420 |
0x8A8A | GREASE | KP, GI, LN | Y | RFC 9420 |
0x9A9A | GREASE | KP, GI, LN | Y | RFC 9420 |
0xAAAA | GREASE | KP, GI, LN | Y | RFC 9420 |
0xBABA | GREASE | KP, GI, LN | Y | RFC 9420 |
0xCACA | GREASE | KP, GI, LN | Y | RFC 9420 |
0xDADA | GREASE | KP, GI, LN | Y | RFC 9420 |
0xEAEA | GREASE | KP, GI, LN | Y | RFC 9420 |
0xF000 - 0xFFFF | Reserved for Private Use | N/A | - | RFC 9420 |
The "MLS Proposal Types" 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:¶
external
sender(seeSection 12.1.8)¶path
field populated (seeSection 12.4)¶Initial contents:¶
Value | Name | R | Ext | Path | Ref |
---|---|---|---|---|---|
0x0000 | RESERVED | - | - | - | RFC 9420 |
0x0001 | add | Y | Y | N | RFC 9420 |
0x0002 | update | Y | N | Y | RFC 9420 |
0x0003 | remove | Y | Y | Y | RFC 9420 |
0x0004 | psk | Y | Y | N | RFC 9420 |
0x0005 | reinit | Y | Y | N | RFC 9420 |
0x0006 | external_init | Y | N | Y | RFC 9420 |
0x0007 | group_context_extensions | Y | Y | Y | RFC 9420 |
0x0A0A | GREASE | Y | - | - | RFC 9420 |
0x1A1A | GREASE | Y | - | - | RFC 9420 |
0x2A2A | GREASE | Y | - | - | RFC 9420 |
0x3A3A | GREASE | Y | - | - | RFC 9420 |
0x4A4A | GREASE | Y | - | - | RFC 9420 |
0x5A5A | GREASE | Y | - | - | RFC 9420 |
0x6A6A | GREASE | Y | - | - | RFC 9420 |
0x7A7A | GREASE | Y | - | - | RFC 9420 |
0x8A8A | GREASE | Y | - | - | RFC 9420 |
0x9A9A | GREASE | Y | - | - | RFC 9420 |
0xAAAA | GREASE | Y | - | - | RFC 9420 |
0xBABA | GREASE | Y | - | - | RFC 9420 |
0xCACA | GREASE | Y | - | - | RFC 9420 |
0xDADA | GREASE | Y | - | - | RFC 9420 |
0xEAEA | GREASE | Y | - | - | RFC 9420 |
0xF000 - 0xFFFF | Reserved for Private Use | - | - | - | RFC 9420 |
The "MLS Credential Types" 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:¶
Initial contents:¶
Value | Name | R | Ref |
---|---|---|---|
0x0000 | RESERVED | - | RFC 9420 |
0x0001 | basic | Y | RFC 9420 |
0x0002 | x509 | Y | RFC 9420 |
0x0A0A | GREASE | Y | RFC 9420 |
0x1A1A | GREASE | Y | RFC 9420 |
0x2A2A | GREASE | Y | RFC 9420 |
0x3A3A | GREASE | Y | RFC 9420 |
0x4A4A | GREASE | Y | RFC 9420 |
0x5A5A | GREASE | Y | RFC 9420 |
0x6A6A | GREASE | Y | RFC 9420 |
0x7A7A | GREASE | Y | RFC 9420 |
0x8A8A | GREASE | Y | RFC 9420 |
0x9A9A | GREASE | Y | RFC 9420 |
0xAAAA | GREASE | Y | RFC 9420 |
0xBABA | GREASE | Y | RFC 9420 |
0xCACA | GREASE | Y | RFC 9420 |
0xDADA | GREASE | Y | RFC 9420 |
0xEAEA | GREASE | Y | RFC 9420 |
0xF000 - 0xFFFF | Reserved for Private Use | - | RFC 9420 |
TheSignWithLabel
function defined inSection 5.1.2 avoids the risk ofconfusion between signatures in different contexts. Each context is assigned adistinct label that is incorporated into the signature. The "MLS Signature Labels" registry recordsthe labels defined in this document and allows additional labels to beregistered in case extensions add other types of signatures using the samesignature keys used elsewhere in MLS.¶
Template:¶
Label
parameter toSignWithLabel
¶Initial contents:¶
Label | R | Ref |
---|---|---|
"FramedContentTBS" | Y | RFC 9420 |
"LeafNodeTBS" | Y | RFC 9420 |
"KeyPackageTBS" | Y | RFC 9420 |
"GroupInfoTBS" | Y | RFC 9420 |
TheEncryptWithLabel
function defined inSection 5.1.3 avoids therisk of confusion between ciphertexts produced for different purposes indifferent contexts. Each context is assigned a distinct label that isincorporated into the signature. The "MLS Public Key Encryption Labels" registry records the labels defined inthis document and allows additional labels to be registered in case extensionsadd other types of public key encryption using the same HPKE keys used elsewherein MLS.¶
Template:¶
Label
parameter toEncryptWithLabel
¶Initial contents:¶
Label | R | Ref |
---|---|---|
"UpdatePathNode" | Y | RFC 9420 |
"Welcome" | Y | RFC 9420 |
The exporter function defined inSection 8.5 allows applications to derive keymaterial from the MLS key schedule. Like the TLS exporter[RFC8446], the MLSexporter uses a label to distinguish between different applications' use of theexporter. The "MLS Exporter Labels" registry allows applications to register their usage to avoidcollisions.¶
Template:¶
Label
parameter toMLS-Exporter
¶The registry has no initial contents, since it is intended to be used byapplications, not the core protocol. The table below is intended only to showthe column layout of the registry.¶
Label | Recommended | Reference |
---|---|---|
(N/A) | (N/A) | (N/A) |
Specification Required[RFC8126] registry requests are registeredafter a three-week review period on the MLS Designated Expert (DE) mailing list<mailto: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 DEs'mailing list and IANA. DenialsSHOULD 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 usingthe<mailto:iesg@ietf.org> mailing list.¶
Criteria thatSHOULD 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, for cipher suite registrations, the MLS DEs will apply theadvisory found inSection 17.1.¶
IANAMUST only accept registry updates from the MLS DEs andSHOULDdirect all requests for registration to the MLS DEs' mailing list.¶
It is suggested that multiple MLS DEs who are able torepresent the perspectives of different applications using thisspecification be appointed, in order to enable a 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 DESHOULD defer to the judgment of the other MLS DEs.¶
This document registers the "message/mls" media type in the "message" registry in order to allow otherprotocols (e.g., HTTP[RFC9113]) to convey MLS messages.¶
<major>.<minor>
. If omitted, the version is "1.0", which corresponds to MLS ProtocolVersion mls10. If for some reason the version number in the media type parameter differs from the ProtocolVersion embedded in the protocol, the protocol takes precedence.¶Protocol operations in MLS give rise to specific forms of ratchet tree,typically affecting a whole direct path at once. In this section, we describethe protocol operations that could have given rise to the various example treesin this document.¶
To construct the tree inFigure 11:¶
To construct the tree inFigure 10:¶
D removes B and C, with the following effects:¶
To better understand how parent hashes are maintained, let's look in detail athow they evolve in a small group. Consider the following sequence ofoperations:¶
Then the parent hashes associated to the nodes will be updated as follows (wherewe use the shorthandph
for parent hash,th
for tree hash, andosth
fororiginal sibling tree hash):¶
A adds B: set X¶
A.parent_hash = ph(X) = H(X, ph="", osth=th(B))
¶B adds C, D: set B', X', and Y¶
C sends empty Commit: set C', Z', Y'¶
When a new member joins, they will receive a tree that has the following parenthash values and compute the indicated parent hash validity relationships:¶
Node | Parent Hash Value | Valid? |
---|---|---|
A | H(X, ph="", osth=th(B)) | No, B changed |
B' | H(X', ph=X'.parent_hash, osth=th(A)) | Yes |
C' | H(Z', ph=Z'.parent_hash, osth=th(D)) | Yes |
D | (none, never sent an UpdatePath) | N/A |
X' | H(Y, ph="", osth=th(Z)) | No, Y and Z changed |
Z' | H(Y', ph="", osth=th(X')) | Yes |
In other words, the joiner will find the following path-hash links in the tree:¶
Since these chains collectively cover all non-blank parent nodes in the tree,the tree is parent-hash valid.¶
Note that this tree, though valid, contains invalid parent-hash links. If aclient were checking parent hashes top-down from Y', for example, they wouldfind that X' has an invalid parent hash relative to Y', but that Z' has a validparent hash. Likewise, if the client were checking bottom-up, they would findthat the chain from B' ends in an invalid link from X' to Y'. These invalidlinks are the natural result of multiple clients having committed.¶
Note also the way the tree hash and the parent hash interact. The parent hashof node C' includes the tree hash of node D. The parent hash of node Z'includes the tree hash of X', which covers nodes A and B' (including the parenthash of B'). Although the tree hash and the parent hash depend on each other,the dependency relationships are structured so that there is never a circulardependency.¶
In the particular case where a new member first receives the tree for a group(e.g., in a ratchet tree GroupInfo extensionSection 12.4.3.3), theparent hashes will be expressed in the tree representation, but the tree hashneed not be. Instead, the new member will recompute the tree hashes for all thenodes in the tree, verifying that this matches the tree hash in the GroupInfoobject. If the tree is valid, then the subtree hashes computed in thisway will align with the inputs needed for parent hash validation (except whererecomputation is needed to account for unmerged leaves).¶
One benefit of using complete balanced trees is that they admit a simpleflat array representation. In this representation, leaf nodes areeven-numbered nodes, with then
-th leaf at2*n
. Intermediate nodesare held in odd-numbered nodes. For example, the tree with 8 leaves hasthe following structure:¶
This allows us to compute relationships between tree nodes simply bymanipulating indices, rather than having to maintain complicated structures inmemory. The basic rule is that the high-order bits of parent and child nodesindices have the following relation (wherex
is an arbitrary bit string):¶
parent=01x => left=00x, right=10x¶
Since node relationships are implicit, the algorithms for adding and removingnodes at the right edge of the tree are quite simple. If there areN
nodes inthe array:¶
N + 1
blank values to the end of the array.¶(N-1) / 2
entries.¶The following python code demonstrates the tree computations necessary to use anarray-based tree for MLS.¶
# 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.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.def right(x): k = level(x) if k == 0: raise Exception('leaf node has no children') return x ^ (0x03 << (k - 1))# The parent of a node.def parent(x, n): if x == root(n): raise Exception('root node has no parent') k = level(x) b = (x >> (k + 1)) & 0x01 return (x | (1 << k)) ^ (b << (k + 1))# The other child of the node's parent.def sibling(x, n): p = parent(x, n) if x < p: return right(p) 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¶
An implementation may choose to store ratchet trees in a "link-based"representation, where each node stores references to its parents and/orchildren (as opposed to the array-based representation suggested above, wherethese relationships are computed from relationships between nodes' indices inthe array). Such an implementation needs to update these links to maintain thebalanced structure of the tree as the tree is extended to add new membersor truncated when members are removed.¶
The following code snippet shows how these algorithms could be implemented inPython.¶
class Node: def __init__(self, value, left=None, right=None): self.value = value # Value of the node self.left = left # Left child node self.right = right # Right child node @staticmethod def blank_subtree(depth): if depth == 1: return Node(None) L = Node.blank_subtree(depth-1) R = Node.blank_subtree(depth-1) return Node(None, left=L, right=R) def empty(self): L_empty = (self.left == None) or self.left.empty() R_empty = (self.right == None) or self.right.empty() return (self.value == None) and L_empty and R_emptyclass Tree: def __init__(self): self.depth = 0 # Depth of the tree self.root = None # Root node of the tree, initially empty # Add a blank subtree to the right def extend(self): if self.depth == 0: self.depth = 1 self.root = Node(None) L = self.root R = Node.blank_subtree(self.depth) self.root = Node(None, left=L, right=R) self.depth += 1 # Truncate the right subtree def truncate(self): if self.root == None: return if not self.root.right.empty(): raise Exception("Cannot truncate non-blank subtree") self.depth -= 1 self.root = self.root.left¶