<?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-01" 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-01"/>
    <author fullname="Rohan Mahy">
      <organization>Rohan Mahy Consulting Services</organization>
      <address>
        <email>rohan.ietf@gmail.com</email>
      </address>
    </author>
    <date year="2024" month="July" day="21"/>
    <area>SEC</area>
    <workgroup>MLS WG</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-semiprivate/draft-mahy-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
        MLS WG 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>key_and_nonce</tt>)
necessary to decrypt the <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>key_and_nonce</tt> into <tt>encrypted_key_and_nonce</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 key_and_nonce;

encrypted_key_and_nonce = EncryptWithLabel(
  external_receiver_pulic_key,
  "SemiPrivateMessageReceiver",
  private_message, key_and_nonce)

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

struct {
  ExternalReceiverRef external_receiver_ref;
  HPKECiphertext encrypted_key_and_nonce;
} KeyForExternalReceiver;
]]></sourcecode>
      <t>The <tt>SemiPrivateMessage</tt> and <tt>SemiPrivateContentAAD</tt> structs mirror
the <tt>PrivateMessage</tt> and <tt>PrivateContentAAD</tt> structs and add the
<tt>keys_for_external_receivers</tt> list. 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, 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>;
} 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 222?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA81Z3XbbNhK+x1Ogyo2dY8l1Nmfbymla1z+JT/23ttNsTk+P
BJGQhJokuABpRZvjPMs+yz7ZfgOAFCnRbrp7s7lIRPwMZr6Z+WaA9Pt9Vqgi
kUPeu5Gp6l8ZdS8Kyc+ltWImLVcZL+bVt8pm/EwspeE3MiqNKpZ86/zsZptf
GV3oSCc9JiYTI+8hDuOcRAaJQWCPRfiYabMcQvRUMxbrKBMpFIiNmBb9VMyX
/TSxfYu9ud+b+r39r/eYLSepslbprFjm2HR6fHvC+TMuEqtxqMpimUv8lRW9
Hd6TsSq0USKhj9ODn/CPNvh1fXvSY1mZTqQZshgnDFmkMyszW9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