<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.17 (Ruby 3.3.2) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-mahy-mls-semiprivatemessage-02" category="info" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.22.0 -->
  <front>
    <title abbrev="MLS SemiPrivateMessage">Semi-Private Messages in the Messaging Layer Security (MLS) Protocol</title>
    <seriesInfo name="Internet-Draft" value="draft-mahy-mls-semiprivatemessage-02"/>
    <author fullname="Rohan Mahy">
      <organization>Rohan Mahy Consulting Services</organization>
      <address>
        <email>rohan.ietf@gmail.com</email>
      </address>
    </author>
    <date year="2024" month="August" day="01"/>
    <area>Security</area>
    <workgroup>Messaging Layer Security</workgroup>
    <keyword>SemiPrivateMessage</keyword>
    <abstract>
      <?line 34?>

<t>This document defines a SemiPrivateMessage for the Messaging Layer
Security (MLS) protocol. It allows members to share otherwise private
commits and proposals with a designated list of external receivers
rather than send these handshakes in a PublicMessage.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://rohanmahy.github.io/mls-semiprivatemessage/draft-mahy-mls-semiprivatemessage.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-mahy-mls-semiprivatemessage/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        Messaging Layer Security Working Group mailing list (<eref target="mailto:mls@ietf.org"/>),
        which is archived at <eref target="https://mailarchive.ietf.org/arch/browse/mls/"/>.
        Subscribe at <eref target="https://www.ietf.org/mailman/listinfo/mls/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/rohanmahy/mls-semiprivatemessage"/>.</t>
    </note>
  </front>
  <middle>
    <?line 41?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>This document defines two extensions of MLS <xref target="RFC9420"/>. The first is the
<tt>SemiPrivateMessage</tt> wire format Safe Extension (see <xref section="2.1.7.1" sectionFormat="of" target="I-D.ietf-mls-extensions"/>, which allows an otherwise PrivateMessage
to be shared with a predefined list of external receivers. It is restricted
for use only with commits or proposals. The second is the
<tt>external_receivers</tt> GroupContext extension that contains the list of
external receivers and allows members to agree on that list.</t>
      <t>SemiPrivateMessages are expected to be useful in federated environments
where messages routinely cross multiple administrative domains, but the MLS
Distribution Service needs to see the content of commits and proposals where
group members would otherwise send handshakes using PublicMessage.</t>
    </section>
    <section anchor="conventions-and-definitions">
      <name>Conventions and Definitions</name>
      <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
appear in all capitals, as shown here.</t>
      <?line -18?>

<t>This document uses terminology extensively from MLS <xref target="RFC9420"/> and
the Safe Extensions framework, defined in <xref section="2" sectionFormat="of" target="I-D.ietf-mls-extensions"/>.</t>
    </section>
    <section anchor="syntax-and-usage">
      <name>Syntax and Usage</name>
      <t>The <tt>external_receivers</tt> GroupContext extension is used for all members
to agree on the list of external receivers in the current epoch. Its
construction mirrors the syntax of the <tt>external_senders</tt> extension in
<xref target="RFC9420"/>.</t>
      <sourcecode type="tls"><![CDATA[
struct {
  HPKEPublicKey external_receiver_public_key;
  Credential credential;
} ExternalReceiver;
]]></sourcecode>
      <t>The <tt>SemiPrivateMessage</tt> wire format Safe Extension also has an
extension type which is carried in the GroupContext to indicate use
of the wire format in a group (and in the Capabilities of LeafNodes).
SemiPrivateMessage substantially reuses the construction of PrivateMessage,
but like a Welcome message also contains information (<tt>keys_and_nonces</tt>)
necessary to decrypt the <tt>SemiPrivateMessage</tt> struct's <tt>ciphertext</tt> and
<tt>encrypted_sender_data</tt>, encrypted once for each external receiver in the
<tt>external_receivers</tt> extension.</t>
      <t>The snippet below shows the syntax and encryption and decryption
construction of <tt>keys_and_nonces</tt> into <tt>encrypted_keys_and_nonces</tt></t>
      <sourcecode type="tls"><![CDATA[
struct {
  opaque sender_data_key<V>;
  opaque sender_data_nonce<V>;
  opaque key<V>;
  opaque nonce<V>;
} PerMessageKeysAndNonces;

PerMessageKeysAndNonces keys_and_nonces;

encrypted_keys_and_nonces = EncryptWithLabel(
  external_receiver_public_key,
  "SemiPrivateMessageReceiver",
  SemiPrivateMessage.ciphertext,   /* context */
  keys_and_nonces)

keys_and_nonces = DecryptWithLabel(
  external_receiver_private_key,
  "SemiPrivateMessageReceiver",
  SemiPrivateMessage.ciphertext,  /* context */
  encrypted_keys_and_nonces.kem_output,
  encrypted_keys_and_nonces.ciphertext)
]]></sourcecode>
      <t>The <tt>KeyForExternalReceiver</tt> structure contains a hash of the
<tt>ExternalReceiver</tt> as a reference and the <tt>encrypted_keys_and_nonces</tt>.</t>
      <sourcecode type="tls"><![CDATA[
/* Using the hash function of the group ciphersuite */
ExternalReceiverRef = hash(ExternalReceiver)

struct {
  ExternalReceiverRef external_receiver_ref;
  HPKECiphertext encrypted_keys_and_nonces;
} KeyForExternalReceiver;
]]></sourcecode>
      <t>The <tt>SemiPrivateMessage</tt> struct mirrors the <tt>PrivateMessage</tt> struct and adds
the <tt>keys_for_external_receivers</tt> list. The <tt>SemiPrivateContentAAD</tt> struct
mirrors the <tt>PrivateContentAAD</tt> struct. It likewise adds the
<tt>keys_for_external_receivers</tt> list, and also adds a hash of the
<tt>FramedContentTBS</tt> struct to insure that the content encrypted to an
external receiver is that same as that provided to members.</t>
      <t>The <tt>SemiPrivateMessageContent</tt> struct is the same as
<tt>PrivateMessageContent</tt> except for the addition of
<tt>keys_for_external_receivers</tt>, and that application messages are
not included.</t>
      <t>Encryption of the <tt>ciphertext</tt> and <tt>encrypted_sender_data</tt> proceed in the
same way for <tt>SemiPrivateMessage</tt> as for <tt>PrivateMessage</tt>. Finally, as a safe wire format extension, the <tt>SemiPrivateMessage</tt> is wrapped in an
<tt>ExtensionContent</tt> struct.</t>
      <sourcecode type="tls"><![CDATA[
struct {
    opaque group_id<V>;
    uint64 epoch;
    ContentType content_type;
    opaque authenticated_data<V>;
    KeyForExternalReceiver keys_for_external_receivers<V>;
    opaque encrypted_sender_data<V>;
    opaque ciphertext<V>;
} SemiPrivateMessage;

struct {
    select (PrivateMessage.content_type) {
        case proposal:
          Proposal proposal;
        case commit:
          Commit commit;
    };
    KeyForExternalReceiver keys_for_external_receivers<V>;
    FramedContentAuthData auth;
    opaque padding[length_of_padding];
} SemiPrivateMessageContent;

struct {
    opaque group_id<V>;
    uint64 epoch;
    ContentType content_type;
    opaque authenticated_data<V>;
    KeyForExternalReceiver keys_for_external_receivers<V>;
    opaque framed_content_tbs_hash<V>;
} SemiPrivateContentAAD;

/* IANA-registered value for semi_private_message */
extension_type = TBD2
SemiPrivateMessage extension_data;
]]></sourcecode>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>These two extensions provide a privacy improvement over sending
handshake messages using PublicMessage. The handshake is shared
with a specific list of receivers, and that list is visible as
part of the GroupContext.</t>
      <t>TODO More Security.</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <section anchor="semiprivatemessage-wire-format">
        <name>SemiPrivateMessage Wire Format</name>
        <t>The <tt>semi_private_message</tt> MLS Extension Type is used to signal support
for the <tt>SemiPrivateMessage</tt> Wire Format (a Safe Extension).</t>
        <ul spacing="normal">
          <li>
            <t>Value: TBD1 (to be assigned by IANA)</t>
          </li>
          <li>
            <t>Name: semi_private_message</t>
          </li>
          <li>
            <t>Recommended: Y</t>
          </li>
          <li>
            <t>Reference: RFC XXXX</t>
          </li>
        </ul>
      </section>
      <section anchor="external-receivers-extension-type">
        <name>External Receivers Extension Type</name>
        <t>The <tt>external_receivers</tt> extension contains a list of external receivers
targeted in a SemiPrivateMessage.</t>
        <ul spacing="normal">
          <li>
            <t>Value: TBD2 (to be assigned by IANA)</t>
          </li>
          <li>
            <t>Name: external_receivers</t>
          </li>
          <li>
            <t>Message(s): GC. This extension may appear in GroupContext objects.</t>
          </li>
          <li>
            <t>Recommended: Y</t>
          </li>
          <li>
            <t>Reference: RFC XXXX</t>
          </li>
        </ul>
      </section>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="RFC9420">
        <front>
          <title>The Messaging Layer Security (MLS) Protocol</title>
          <author fullname="R. Barnes" initials="R." surname="Barnes"/>
          <author fullname="B. Beurdouche" initials="B." surname="Beurdouche"/>
          <author fullname="R. Robert" initials="R." surname="Robert"/>
          <author fullname="J. Millican" initials="J." surname="Millican"/>
          <author fullname="E. Omara" initials="E." surname="Omara"/>
          <author fullname="K. Cohn-Gordon" initials="K." surname="Cohn-Gordon"/>
          <date month="July" year="2023"/>
          <abstract>
            <t>Messaging applications are increasingly making use of end-to-end security mechanisms to ensure that messages are only accessible to the communicating endpoints, and not to any servers involved in delivering messages. Establishing keys to provide such protections is challenging for group chat settings, in which more than two clients need to agree on a key but may not be online at the same time. In this document, we specify a key establishment protocol that provides efficient asynchronous group key establishment with forward secrecy (FS) and post-compromise security (PCS) for groups in size ranging from two to thousands.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="9420"/>
        <seriesInfo name="DOI" value="10.17487/RFC9420"/>
      </reference>
      <reference anchor="I-D.ietf-mls-extensions">
        <front>
          <title>The Messaging Layer Security (MLS) Extensions</title>
          <author fullname="Raphael Robert" initials="R." surname="Robert">
            <organization>Phoenix R&amp;D</organization>
          </author>
          <date day="24" month="April" year="2024"/>
          <abstract>
            <t>   This document describes extensions to the Messaging Layer Security
   (MLS) protocol.

Discussion Venues

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

   Source for this draft and an issue tracker can be found at
   https://github.com/mlswg/mls-extensions.

            </t>
          </abstract>
        </front>
        <seriesInfo name="Internet-Draft" value="draft-ietf-mls-extensions-04"/>
      </reference>
      <reference anchor="RFC2119">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author fullname="S. Bradner" initials="S." surname="Bradner"/>
          <date month="March" year="1997"/>
          <abstract>
            <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC8174">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author fullname="B. Leiba" initials="B." surname="Leiba"/>
          <date month="May" year="2017"/>
          <abstract>
            <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
    </references>
    <?line 231?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA9VZ3XIbtxW+x1Mg1EUlD0lFqqdJKMcJrZ9YE/1VkuN6MhkS
3AVJVMvFFtgVzXrkZ+mz9Mn6HQC7XJJLOZn2pr5IuADOwTnf+Yc6nQ7LVZ7I
Hm/d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