<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc strict="yes"?>
<?rfc symrefs="yes"?>
<?rfc linkmailto="no"?>
<?rfc comments="yes" ?>
<?rfc inline="yes" ?>
<rfc category="std" ipr="trust200902"
   docName='draft-ietf-lamps-eai-addresses-15'>
<front>
<title abbrev="I18N Mail Addresses in X.509 certificates">
 Internationalized Email Addresses in X.509 certificates
</title>
<author initials="A." surname="Melnikov" fullname="Alexey Melnikov" role="editor">
	<organization>Isode Ltd</organization>
	<address>
    <postal>
      <street>14 Castle Mews</street>
      <city>Hampton</city>
      <region>Middlesex</region>
      <code>TW12 2NP</code>
      <country>UK</country>
    </postal>
    <email>Alexey.Melnikov@isode.com</email>
	</address>
</author>
<author initials="W." surname="Chuang" fullname="Weihaw Chuang" role="editor">
    <organization>Google, Inc.</organization>
    <address>
        <postal>
            <street>1600 Amphitheater Parkway</street>
            <city>Mountain View</city> <region>CA</region>
            <code>94043</code>
            <country>US</country>
        </postal>
        <email>weihaw@google.com</email>
    </address>
</author>
<date year="2017" />
<area>Security</area>
<workgroup>LAMPS</workgroup>
<keyword>EAI</keyword>
<keyword>PKIX</keyword>
<keyword>email address</keyword>

<abstract>

<t>
This document defines a new name form for inclusion in the otherName
field of an X.509 Subject Alternative Name and Issuer Alternative Name
extension that allows a certificate subject to be associated with an
Internationalized Email Address.
</t>

</abstract>
</front>
<middle>

<section title="Introduction">

<t><xref target="RFC5280"/> defines the rfc822Name subjectAltName name type for representing <xref
target="RFC5321"/> email addresses. The syntax of rfc822Name is restricted to a subset of US-ASCII
characters and thus can't be used to represent Internationalized Email addresses <xref
target='RFC6531'/>.  This document defines a new otherName variant to represent Internationalized
Email addresses.  In addition this document requires all email address domains in X.509
certificates to conform to IDNA2008 <xref target='RFC5890'/>.</t>

</section>

<section title="Conventions Used in This Document">
<t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in
this document are to be interpreted as described in
<xref target="RFC2119"/>.</t>

<t>The formal syntax uses the <xref target="RFC5234">Augmented
Backus-Naur Form (ABNF)</xref> notation.</t>
</section>

<section title="Name Definitions" anchor="sec_name_def">

<t> The GeneralName structure is defined in <xref target="RFC5280"/>, and supports many different
name forms including otherName for extensibility.  This section specifies the SmtpUTF8Mailbox name
form of otherName, so that Internationalized Email addresses can appear in the subjectAltName of a
certificate, the issuerAltName of a certificate, or anywhere else that GeneralName is used. </t>

<t>id-on-SmtpUTF8Mailbox OBJECT IDENTIFIER ::= { id-on 9 }</t>

<t>SmtpUTF8Mailbox ::= UTF8String (SIZE (1..MAX))<vspace/>
  -- SmtpUTF8Mailbox conforms to Mailbox as specified<vspace/>
  -- in Section 3.3 of RFC 6531.
</t>

<t> When the subjectAltName (or issuerAltName) extension contains an Internationalized Email address
with a non-ASCII local-part, the address MUST be stored in the SmtpUTF8Mailbox name form of otherName.
The format of SmtpUTF8Mailbox is defined as the ABNF rule SmtpUTF8Mailbox. SmtpUTF8Mailbox is a
modified version of the Internationalized Mailbox which was defined in Section 3.3 of <xref
target='RFC6531'/> which was itself derived from SMTP Mailbox from Section 4.1.2 of <xref
target='RFC5321'/>. <xref target='RFC6531'/> defines the following ABNF rules for Mailbox whose
parts are modified for internationalization: &lt;Local-part&gt;, &lt;Dot-string&gt;, &lt;Quoted-string&gt;,
&lt;QcontentSMTP&gt;, &lt;Domain&gt;, and &lt;Atom&gt;.  In particular, &lt;Local-part&gt;
was updated to also support UTF8-non-ascii.  UTF8-non-ascii was described by Section 3.1 of
<xref target='RFC6532'/>.  Also, domain was extended to support U-labels, as defined in <xref
target='RFC5890'/>. </t>

<t> This document further refines Internationalized <xref target='RFC6531'/> Mailbox ABNF rules and
calls this SmtpUTF8Mailbox.  In SmtpUTF8Mailbox, labels that include non-ASCII characters MUST be
stored in U-label (rather than A-label) <xref target='RFC5890'/> form.  This restriction removes the
need to determine which label encoding A- or U-label is present in the Domain.  As per Section
2.3.2.1 of <xref target='RFC5890'/>, U-label are encoded as UTF-8 <xref target='RFC3629'/> in
Normalization Form C and other properties specified there.  In SmtpUTF8Mailbox, domain labels that
solely use ASCII characters (meaning not A- nor U-labels) SHALL use NR-LDH restrictions as specified
by Section 2.3.1 of <xref target='RFC5890'/> and SHALL be restricted to lower case letters.  NR-LDH
stands for "Non-Reserved Letters Digits Hyphen" and is the set of LDH labels that do not have "--"
characters in the third and forth character position, which excludes "tagged domain names" such as
A-labels.  Consistent with the treatment of rfc822Name in <xref target='RFC5280'/>, SmtpUTF8Mailbox is
an envelope &lt;Mailbox&gt; and has no phrase (such as a common name) before it, has no comment
(text surrounded in parentheses) after it, and is not surrounded by "&lt;" and "&gt;". </t>

<t> Due to operational reasons to be described shortly and name constraint compatibility reasons
described in <xref target="sec_constraint" />, SmtpUTF8Mailbox subjectAltName MUST only be used when
the local-part of the email address contains non-ASCII characters.  When the local-part is
ASCII, rfc822Name subjectAltName MUST be used instead of SmtpUTF8Mailbox.  This is compatible with
legacy software that supports only rfc822Name (and not SmtpUTF8Mailbox).  The appropriate usage
of rfc822Name and SmtpUTF8Mailbox is summarized in <xref target="table_email_format" /> below.</t>

<t> SmtpUTF8Mailbox is encoded as UTF8String.  The UTF8String encoding MUST NOT contain a Byte-Order-
Mark (BOM) <xref target='RFC3629'/> to aid consistency across implementations particularly for
comparison. </t>

<texttable anchor="table_email_format" title="Email address formatting">
    <ttcol align='center'>local-part char</ttcol>
    <ttcol align='center'>domain char</ttcol>
    <ttcol align='center'>domain label</ttcol>
    <ttcol align='center'>subjectAltName</ttcol>

    <c>ASCII-only</c>
    <c>ASCII-only</c>
    <c>NR-LDH label</c>
    <c>rfc822Name</c>

    <c>non-ASCII</c>
    <c>ASCII-only</c>
    <c>NR-LDH label</c>
    <c>SmtpUTF8Mailbox</c>

    <c>ASCII-only</c>
    <c>non-ASCII</c>
    <c>A-label</c>
    <c>rfc822Name</c>

    <c>non-ASCII</c>
    <c>non-ASCII</c>
    <c>U-label</c>
    <c>SmtpUTF8Mailbox</c>

    <postamble>non-ASCII may additionally include ASCII characters.</postamble>
</texttable>

</section>

<section title="IDNA2008" anchor="sec_idna"> <t> To facilitate comparison between email addresses,
all email address domains in X.509 certificates MUST conform to IDNA2008 <xref target='RFC5890'/>
(and avoids any "mappings" mentioned in that document).  Use of non-conforming email address
domains introduces the possibility of conversion errors between alternate forms.  This applies to
SmtpUTF8Mailbox and rfc822Name in subjectAltName, issuerAltName and anywhere else that these
are used. </t> </section>

<section title='Matching of Internationalized Email Addresses in X.509 certificates'
anchor="sec_match">

<t>In equivalence comparison with SmtpUTF8Mailbox, there may be some setup work on one or both inputs
depending of whether the input is already in comparison form.  Comparing SmtpUTF8Mailboxs consists of a
domain part step and a local-part step.  The comparison form for local-parts is always UTF-8. The
comparison form for domain parts depends on context.  While some contexts such as certificate path
validation in <xref target='RFC5280'/> specify transforming domain to A-label (Section 7.5 and 7.2
in <xref target='RFC5280'/> as updated by <xref target='ID-lamps-rfc5280-i18n-update'/>),
this document recommends transforming to UTF-8 U-label instead.  This
reduces the likelihood of errors by reducing conversions as more implementations natively support
U-label domains. </t>

<t> Comparison of two SmtpUTF8Mailbox is straightforward with no setup work needed.  They are
considered equivalent if there is an exact octet-for-octet match.  Comparison with email addresses
such as Internationalized email address or rfc822Name requires additional setup steps for domain
part and local-part.  The initial preparation for the email addresses is to remove any phrases or
comments, as well as "&lt;" and "&gt;" present.  This document calls for comparison of domain labels
that include non-ASCII characters be transformed to U-label if not already in that form.  The first
step is to detect use of the A-label by using Section 5.1 of <xref target='RFC5891'/>.  Next if
necessary, transform any A-labels to U-labels Unicode as specified in Section 5.2 of <xref
target='RFC5891'/>.  Finally if necessary convert the Unicode to UTF-8 as specified in Section 3 of
<xref target='RFC3629'/>.  For ASCII NR-LDH labels, upper case letters are converted to lower case
letters.  In setup for SmtpUTF8Mailbox, the email address local-part MUST conform to the
requirements of <xref target='RFC6530'/> and <xref target='RFC6531'/>, including being a string in
UTF-8 form.  In particular, the local-part MUST NOT be transformed in any way, such as by doing case
folding or normalization of any kind.  The &lt;Local-part&gt; part of an Internationalized email
address is already in UTF-8.  For rfc822Name the local-part, which is IA5String (ASCII), trivially
maps to UTF-8 without change.  Once setup is complete, they are again compared octet-for-octet. </t>

<t> To summarize non-normatively, the comparison steps including setup are:
  <list style="numbers">
    <t>If the domain contains A-labels, transform them to U-labels.</t>
    <t>If the domain contains ASCII NR-LDH labels, lowercase them.</t>
    <t>Compare strings octet-for-octet for equivalence.</t>
  </list>
</t>

<t> This specification expressly does not define any wildcard characters and SmtpUTF8Mailbox
comparison implementations MUST NOT interpret any character as wildcards.  Instead, to specify
multiple email addresses through SmtpUTF8Mailbox, the certificate MUST use multiple subjectAltNames
or issuerAltNames to explicitly carry any additional email addresses. </t>

</section>

<section title='Name constraints in path validation' anchor="sec_constraint">

<t> This section updates Section 4.2.1.10 of <xref target='RFC5280'/> to extend rfc822Name
name constraints to SmtpUTF8Mailbox subjectAltNames.  A SmtpUTF8Mailbox aware path validators will
apply name constraint comparison to the subject distinguished name and both forms of subject
alternative name rfc822Name and SmtpUTF8Mailbox.  </t>

<t> Both rfc822Name and SmtpUTF8Mailbox subject alternative names represent the same underlying email
address namespace.  Since legacy CAs constrained to issue certificates for a specific set of domains
would lack corresponding UTF-8 constraints, <xref target='ID-lamps-rfc5280-i18n-update'/>
updates modifies and extends rfc822Name name constraints defined in <xref target='RFC5280'/> to
cover SmtpUTF8Mailbox subject alternative names.  This ensures that the introduction of SmtpUTF8Mailbox
does not violate existing name constraints.  Since it is not valid to include non-ASCII UTF-8
characters in the local-part of rfc822Name name constraints, and since name constraints that include
a local-part are rarely, if at all, used in practice, name constraints updated in <xref
target='ID-lamps-rfc5280-i18n-update'/> admit the forms that represent all addresses at a host
or all mailboxes in a domain, and deprecates rfc822Name name constraints that represent a particular
mailbox.  That is, rfc822Name constraints with a local-part SHOULD NOT be used. </t>

<t> Constraint comparison with SmtpUTF8Mailbox subjectAltName starts with the setup steps defined by
<xref target="sec_match"/>.  Setup converts the inputs of the comparison which is one of a subject
distinguished name or a rfc822Name or SmtpUTF8Mailbox subjectAltName, and one of a rfc822Name name
constraint, to constraint comparison form.  For rfc822Name name constraint, this will convert any
domain A-labels to U-labels.  For both the name constraint and the subject, this will lower case any
domain NR-LDH labels.  Strip the local-part and "@" separator from each rfc822Name and SmtpUTF8Mailbox,
leaving just the domain-part.  After setup, this follows the comparison steps defined in 4.2.1.10 of
<xref target='RFC5280'/> as follows.  If the resulting name constraint domain starts with a "."
character, then for the name constraint to match, a suffix of the resulting subject alternative name
domain MUST match the name constraint (including the leading ".") octet for octet.  If the resulting
name constraint domain does not start with a "." character, then for the name constraint to match,
the entire resulting subject alternative name domain MUST match the name constraint octet for octet.
</t>

<t> Certificate Authorities that wish to issue CA certificates with email address name constraint
MUST use rfc822Name subject alternative names only.  These MUST be IDNA2008 conformant names with no
mappings, and with non-ASCII domains encoded in A-labels only. </t>

<t> The name constraint requirement with SmtpUTF8Mailbox subject alternative name is illustrated in the
non-normative diagram <xref target="example_permitted_matched_constraint" />.   The first example
(1) illustrates a permitted rfc822Name ASCII only hostname name constraint, and the corresponding
valid rfc822Name subjectAltName and SmtpUTF8Mailbox subjectAltName email addresses.  The second
example (2) illustrates a permitted rfc822Name hostname name constraint with A-label, and the
corresponding valid rfc822Name subjectAltName and SmtpUTF8Mailbox subjectAltName email addresses.
Note that an email address with ASCII only local-part is encoded as rfc822Name despite also
having unicode present in the domain.


<!-- u+8001u+5E2B is 老師 teacher; u+4E0Du+5C0D is 不對 wrong;  u+5B66u+751F 学生 student; -->
<!-- u+533Bu+751F 医生 doctor; U+5C0F U+5B66 (xn\-\-48s3o) 小学 is elemenary school -->
<!-- U+5927 U+5B66 (xn\-\-pss25c) is 大学 university; U+4E2D U+5B66 (xn\-\-fiq353a) is 中学 high school-->

<figure anchor="example_permitted_matched_constraint">
<artwork>
  +-------------------------------------------------------------------+
  |  Root CA Cert                                                     |
  +-------------------------------------------------------------------+
                                    |
                                    v
  +-------------------------------------------------------------------+
  |  Intermediate CA Cert                                             |
  |      Permitted                                                    |
  |        rfc822Name: elementary.school.example.com (1)              |
  |                                                                   |
  |        rfc822Name: xn--pss25c.example.com (2)                     |
  |                                                                   |
  +-------------------------------------------------------------------+
                                    |
                                    v
  +-------------------------------------------------------------------+
  |  Entity Cert (w/explicitly permitted subjects)                    |
  |    SubjectAltName Extension                                       |
  |      rfc822Name: student@elemenary.school.example.com (1)         |
  |      SmtpUTF8Mailbox: u+5B66u+751F@elementary.school.example.com  |
  |        (1)                                                        |
  |                                                                   |
  |      rfc822Name: student@xn--pss25c.example.com (2)               |
  |      SmtpUTF8Mailbox: u+533Bu+751F@u+5927u+5B66.example.com (2)   |
  |                                                                   |
  +-------------------------------------------------------------------+
</artwork>
<postamble>Name constraints with SmtpUTF8Name and rfc822Name</postamble>
</figure>
</t>


</section>


<section title="Security Considerations" anchor="seccons">

<t> Use of SmtpUTF8Mailbox for certificate subjectAltName (and issuerAltName) will incur many of the
same security considerations as in Section 8 in <xref target='RFC5280'/>, but introduces a new
issue by permitting non-ASCII characters in the email address local-part. This issue,
as mentioned in Section 4.4 of <xref target='RFC5890'/> and in Section 4 of <xref
target='RFC6532'/>, is that use of Unicode introduces the risk of visually similar and identical
characters which can be exploited to deceive the recipient. The former document references some
means to mitigate against these attacks. </t>

</section>

<section title="IANA Considerations" anchor="sec_iana">

<t>In <xref target='sec_name_def'/> and the ASN.1 module identifier defined in
<xref target='appndix_asn1'/>. IANA is kindly requested to make the following assignments for:
  <list style="symbol">
  <t>The LAMPS-EaiAddresses-2016 ASN.1 module in the "SMI Security for PKIX Module Identifier"
     registry (1.3.6.1.5.5.7.0).</t>
  <t>The SmtpUTF8Mailbox otherName in the "PKIX Other Name Forms" registry (1.3.6.1.5.5.7.8).</t>
</list>
</t>

</section>

</middle>
<back>
<references title="Normative References">
<?rfc include="reference.RFC.2119"?> <!-- Keywords -->
<?rfc include="reference.RFC.3629"?> <!-- UTF-8 -->
<?rfc include="reference.RFC.5234"?> <!-- ABNF -->
<?rfc include="reference.RFC.5280"?> <!-- X.509 Certificates -->
<?rfc include="reference.RFC.5321"?> <!-- Simple Mail Transfer Protocol -->
<?rfc include="reference.RFC.5890"?> <!-- Internationalized Domain Names for Applications (IDNA):
                                          Definitions and Document Framework -->
<?rfc include="reference.RFC.5891"?> <!-- Internationalized Domain Names in Applications (IDNA): Protocol -->
<?rfc include="reference.RFC.6530"?> <!-- Overview and Framework for Internationalized Email -->
<?rfc include="reference.RFC.6531"?> <!-- SMTP Extension for Internationalized Email -->
<?rfc include="reference.RFC.6532"?> <!-- Internationalized Email Headers-->
<reference anchor="ID-lamps-rfc5280-i18n-update"
           target="https://datatracker.ietf.org/doc/draft-housley-rfc5280-i18n-update/">
    <front>
        <title>Internationalization Updates to RFC 5280</title>
        <author initials="R." surname="Housley" fullname="Russ Housley">
            <organization/>
        </author>
        <date month="June" year="2017" />
    </front>
</reference>
</references>
<references title="Informative References">

<?rfc include="reference.RFC.5912"?> <!-- New ASN.1 for PKIX -->
</references>

<section title="ASN.1 Module" anchor="appndix_asn1">

<t>The following ASN.1 module normatively specifies the SmtpUTF8Mailbox structure.
This specification uses the ASN.1 definitions from
<xref target='RFC5912'/> with the 2002 ASN.1 notation used in that document.
<xref target='RFC5912'/> updates normative documents using older ASN.1 notation.</t>

<figure>
<artwork>
  LAMPS-EaiAddresses-2016
    { iso(1) identified-organization(3) dod(6)
      internet(1) security(5) mechanisms(5) pkix(7) id-mod(0)
      id-mod-lamps-eai-addresses-2016(TBD) }

  DEFINITIONS IMPLICIT TAGS ::=
  BEGIN

  IMPORTS
    OTHER-NAME
    FROM PKIX1Implicit-2009
      { iso(1) identified-organization(3) dod(6) internet(1) security(5)
      mechanisms(5) pkix(7) id-mod(0) id-mod-pkix1-implicit-02(59) }

    id-pkix
    FROM PKIX1Explicit-2009
      { iso(1) identified-organization(3) dod(6) internet(1) security(5)
      mechanisms(5) pkix(7) id-mod(0) id-mod-pkix1-explicit-02(51) } &#59;

  --
  -- otherName carries additional name types for subjectAltName,
  -- issuerAltName, and other uses of GeneralNames.
  --

    id-on OBJECT IDENTIFIER ::= { id-pkix 8 }

    SmtpUtf8OtherNames OTHER-NAME ::= { on-SmtpUTF8Mailbox, ... }

    on-SmtpUTF8Mailbox OTHER-NAME ::= {
        SmtpUTF8Mailbox IDENTIFIED BY id-on-SmtpUTF8Mailbox
    }

    id-on-SmtpUTF8Mailbox OBJECT IDENTIFIER ::= { id-on 9 }

    SmtpUTF8Mailbox ::= UTF8String (SIZE (1..MAX))
     -- SmtpUTF8Mailbox conforms to Mailbox as specified
     -- in Section 3.3 of RFC 6531.

  END
</artwork>
</figure>

</section>

<section title="Example of SmtpUTF8Mailbox" anchor="appndix_example">
<t>This non-normative example demonstrates using SmtpUTF8Mailbox as an otherName in
GeneralName to encode the email address "u+8001u+5E2B@example.com".</t>

<figure anchor="asn1_example">
<artwork>
   The hexadecimal DER encoding of the email address is:
   A022060A 2B060105 05070012 0809A014 0C12E880 81E5B8AB 40657861
   6D706C65 2E636F6D

   The text decoding is:
     0  34: [0] {
     2  10:   OBJECT IDENTIFIER '1 3 6 1 5 5 7 0 18 8 9'
    14  20:   [0] {
    16  18:     UTF8String '..@example.com'
          :     }
          :   }
</artwork>
</figure>
<t>The example was encoded on the OSS Nokalva ASN.1 Playground and the above text decoding
is an output of Peter Gutmann's "dumpasn1" program.</t>
</section>

<section title="Acknowledgements">

<t>Thank you to Magnus Nystrom for motivating this document.  Thanks to Russ Housley, Nicolas
Lidzborski, Laetitia Baudoin, Ryan Sleevi, Sean Leonard, Sean Turner, John Levine, and Patrik
Falstrom for their feedback. Also special thanks to John Klensin for his valuable input on
internationalization, Unicode and ABNF formatting, to Jim Schaad for his help with the ASN.1 example
and his helpful feedback, and especially to Viktor Dukhovni for helping us with name constraints
and his many detailed document reviews.</t>

</section>
</back>
</rfc>

