<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" docName="draft-farrell-tls-pemesni-13" number="9934" ipr="trust200902" obsoletes="" updates="" submissionType="IETF" xml:lang="en" tocInclude="true" symRefs="true" sortRefs="true" version="3" consensus="true">

  <front>
    <title abbrev="PEM File Format for ECH">Privacy-Enhanced Mail (PEM) File Format for Encrypted ClientHello (ECH)</title>
    <seriesInfo name="RFC" value="9934"/>

    <author fullname="Stephen Farrell" initials="S." surname="Farrell">
      <organization>Trinity College Dublin</organization>
      <address>
        <postal>
          <city>Dublin</city>
          <code>2</code>
          <country>Ireland</country>
        </postal>
        <phone>+353-1-896-2354</phone>
        <email>stephen.farrell@cs.tcd.ie</email>
      </address>
    </author>
    <date month="March" year="2026"/>

    <area>Security Area</area>

    <keyword>TLS</keyword>
    <keyword>ESNI</keyword>

    <abstract>
      <t>
            Encrypted ClientHello (ECH) key pairs need to be configured into TLS
            servers, which can be built using different TLS libraries.
            This document specifies a standard file format for this purpose,
            similar to how RFC 7468 defines other Privacy-Enhanced Mail (PEM) file formats.
      </t>
    </abstract>
  </front>
  <middle>
    <section numbered="true" toc="default">
      <name>Introduction</name>
      <t>Encrypted ClientHello (ECH)
            <xref target="RFC9849" format="default"/> for TLS1.3 <xref target="RFC8446" format="default"/>
            defines a confidentiality mechanism for server names and other ClientHello
            content in TLS.
            That requires publication of an ECHConfigList data structure in an HTTPS or SVCB RR
            <xref target="RFC9460" format="default"/> in the DNS.
            An ECHConfigList can contain one or more ECHConfig values.
            An ECHConfig structure contains the public component of a key pair
            that will typically be periodically (re-)generated by some key manager
            for a TLS server.
            TLS servers then need to be configured to use these key pairs,
            and given that various TLS servers can be built with different
            TLS libraries, there is a benefit in having a standard format for
            ECH key pairs and configs, just as was done with <xref target="RFC7468" format="default"/>.
      </t>
    </section>
    <section numbered="true" toc="default">
      <name>Terminology</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&nbsp;14 <xref target="RFC2119"/> <xref
    target="RFC8174"/> when, and only when, they appear in all capitals, as
    shown here.
        </t>
    </section>
    <section numbered="true" toc="default">
      <name>ECHConfig File</name>
      <t>A PEM ECH file contains zero or one private key and one encoded ECHConfigList.</t>
      <t>The public and private keys <bcp14>MUST</bcp14> both
              be PEM encoded <xref target="RFC7468" format="default"/>.
              The file contains the concatenation of the PEM encoding
              of the private key (if present) followed by the PEM encoding of the public key(s) as
              an ECHConfigList.
              When a private key is present, the ECHConfigList <bcp14>MUST</bcp14> contain an ECHConfig that matches the private key.
              The private key <bcp14>MUST</bcp14> be encoded as a PKCS #8 PrivateKey <xref target="RFC7468" format="default"/>.
              The public
              key(s) <bcp14>MUST</bcp14> be the base64-encoded form (see <xref target="RFC4648" section="4"/>) of an ECHConfigList value that
                  can be published in the DNS using an HTTPS RR as described in
              <xref target="RFC9848" format="default"/>.
              The string "ECHCONFIG" <bcp14>MUST</bcp14> be used in the PEM
                  file delimiter for the public key.</t>
      <t>Any content after the PEM encoded ECHConfigList <bcp14>SHOULD</bcp14> be ignored.</t>
      <t><xref target="sample" format="default"/> shows an example ECHConfig PEM File</t>
      <figure anchor="sample">
        <name>Example ECHConfig PEM File</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VuBCIEICjd4yGRdsoP9gU7YT7My8DHx1Tjme8GYDXrOMCi8v1V
-----END PRIVATE KEY-----
-----BEGIN ECHCONFIG-----
AD7+DQA65wAgACA8wVN2BtscOl3vQheUzHeIkVmKIiydUhDCliA4iyQRCwAEAAEA
AQALZXhhbXBsZS5jb20AAA==
-----END ECHCONFIG-----]]></artwork>
      </figure>
      <t>
                If the above ECHConfigList were published in the DNS for
                foo.example.com, then one could access that as shown
                in <xref target="dig" format="default"/>.
      </t>
      <figure anchor="dig">
        <name>Use of Dig to Get the ECHConfigList from DNS</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
$ dig +short HTTPS foo.example.com
1 . ech=AD7+DQA65wAgACA8wVN2BtscOl3vQheUzHeIkVmKIiydUhDCliA4iyQR
wAEAAEAAQALZXhhbXBsZS5jb20AAA==]]></artwork>
      </figure>
      <t>
                TLS servers using this file format might configure
                multiple file names as part of their overall configuration,
                if, for example, only the ECHConfigList values
                from a subset of those files are to be used as the value for
                retry_configs in the ECH fallback scenario.
      </t>
      <t>
                The ECHConfigList in a PEM file might contain more than one
                ECHConfig if, for example, those ECHConfig values contain
                different extensions or different public_name
                values. Consistent with <xref target="RFC9849" format="default"/>,
                the ECHConfig values within an ECHConfigList appear in
                decreasing order of preference. If the
                ECHConfigList value is to be used as the retry_configs value,
                then that might contain different public keys. (Nonetheless,
                when a private key is present, that <bcp14>MUST</bcp14> match the public key
                from one of the ECHConfig values.)
      </t>
    </section>
    <section numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>Storing cryptographic keys in files leaves them vulnerable should
            anyone get read access to the filesystem on which they are stored.
            The same protection mechanisms that would be used for a server's PEM-encoded HTTPS certificate private key should be used for the PEM ECH
            configuration.
      </t>
      <t>
                The security considerations of <xref target="RFC9848" format="default"/>
                apply when retrieving an ECHConfigList from the DNS.
      </t>
      <t>
                For clarity, only the ECHConfigList is to be published
                in the DNS - the private key from an ECH PEM file <bcp14>MUST
                NOT</bcp14> be published in the DNS.
      </t>
    </section>

    <section numbered="true" toc="default">
      <name>IANA Considerations</name>
<t>This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4648.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7468.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/>

        <reference anchor="RFC9849" target="https://www.rfc-editor.org/info/rfc9849">
          <front>
            <title>TLS Encrypted Client Hello</title>
            <author initials="E." surname="Rescorla" fullname="Eric Rescorla">
              <organization>Independent</organization>
            </author>
            <author initials="K." surname="Oku" fullname="Kazuho Oku">
              <organization>Fastly</organization>
            </author>
            <author initials="N." surname="Sullivan" fullname="Nick Sullivan">
              <organization>Cryptography Consulting LLC</organization>
            </author>
            <author initials="C. A." surname="Wood" fullname="Christopher A. Wood">
              <organization>Cloudflare</organization>
            </author>
            <date month='March' year='2026'/>
          </front>
          <seriesInfo name="RFC" value="9849"/>
          <seriesInfo name="DOI" value="10.17487/RFC9849"/>
        </reference>

      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9460.xml"/>

<reference anchor="RFC9848" target="https://www.rfc-editor.org/info/rfc9848">
<front>
<title>
Bootstrapping TLS Encrypted ClientHello with DNS Service Bindings
</title>
<author fullname="Benjamin M. Schwartz" initials="B." surname="Schwartz">
<organization>Meta Platforms, Inc.</organization>
</author>
<author fullname="Mike Bishop" initials="M." surname="Bishop">
<organization>Akamai Technologies</organization>
</author>
<author fullname="Erik Nygren" initials="E." surname="Nygren">
<organization>Akamai Technologies</organization>
</author>
<date month="March" year="2026"/>
</front>
<seriesInfo name="RFC" value="9848"/>
</reference>



      </references>
    </references>

    <section numbered="false" toc="default">
      <name>Acknowledgements</name>
      <t>Thanks to <contact fullname="Daniel McCarney"/>, <contact
      fullname="Jim Reid"/>, and <contact fullname="Peter Yee"/> for
      comments.</t>
    </section>

  </back>
</rfc>
