<?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-00" 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-00"/>
    <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="08"/>
    <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 key<V>;
  opaque nonce<V>;
} MessageKeyAndNonce;

MessageKeyAndNonce 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 220?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>TODO acknowledge.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA81Z3XbbNhK+x1Og8o2dY8lxNmfbymlaxz+JT/23ttNsTk+P
BJGQhJokuABpR5vjPMs+yz7ZfgOAFCnRbrp7s7lIRPwMZr6Z+WaA9Pt9Vqgi
kUPeu5ap6l8adScKyc+ktWImLVcZL+bVt8pm/FQspOHXMiqNKhZ88+z0eotf
Gl3oSCc9JiYTI+8gDuOcRAaJQWCPRfiYabMYQvRUMxbrKBMpFIiNmBb9VMwX
/TSxfYu9ud+b+r3958+ZLSepslbprFjk2HRydHPM+QYXidU4VGWxzCX+yore
Nu/JWBXaKJHQx8n+G/yjDX5d3Rz3WFamE2mGLMYJQxbpzMrMlnbIC1NKBhP+
woSRYsivjw7YvTa3M6PLfMjJsA9v2a1cY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