<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="rfc7991bis.rnc"?>
<!DOCTYPE rfc [
    <!ENTITY nbsp    "&#160;">
    <!ENTITY zwsp   "&#8203;">
    <!ENTITY nbhy   "&#8209;">
    <!ENTITY wj     "&#8288;">
    ]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude"
     ipr="trust200902" submissionType="IETF" category="std" version="3" docName="draft-blahaj-sidrops-rsm-01"
     consensus="true">
  <front>
    <title abbrev="RPKI Signed Messages">Resource Public Key Infrastructure (RPKI) Signed Messages (RSMs)</title>
    <seriesInfo name="Internet-Draft" status="standard" value="draft-blahaj-sidrops-rsm-01"/>
    <author fullname="Q Misell" initials="Q" surname="Misell" role="editor">
      <organization abbrev="AS207960">AS207960 Cyfyngedig</organization>
      <address>
        <postal>
          <street>13 Pen-y-lan Terrace</street>
          <city>Caerdydd</city>
          <code>CF23 9EU</code>
          <country>United Kingdom</country>
        </postal>
        <email>q@as207960.net</email>
        <email>q@magicalcodewit.ch</email>
        <uri>magicalcodewit.ch</uri>
      </address>
    </author>
    <author fullname="Job Snijders" initials="J." surname="Snijders">
      <organization/>
      <address>
        <postal>
          <street/>
          <city>Amsterdam</city>
          <code/>
          <country>NL</country>
        </postal>
        <email>job@sobornost.net</email>
      </address>
    </author>
    <area>ops</area>
    <workgroup>SIDR Operations</workgroup>

    <abstract>
      <t>This document defines a Cryptographic Message Syntax (CMS) protected content type for use with the
        Resource Public Key Infrastructure (RPKI) to carry a signature over a detached message.
        This document is an iteration on RPKI Signed Checklists (RSCs)
        <xref target="RFC9323"/>
        to include an
        explicit purpose and audience, to allow for more secure automated processing.
      </t>
    </abstract>

    <note removeInRFC="true">
      <name>Discussion</name>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/AS207960/draft-blahaj-sidrops-rsm"/>.
      </t>
    </note>
  </front>

  <middle>
    <section>
      <name>Introduction</name>
      <t>RPKI Signed Checklists (RSC)
        <xref target="RFC9323"/>
        do not signal a purpose, nor its intended audience.
        In the context of processing by humans this is of little concern as the context in which e.g. a signed PDF was
        sent makes its purpose evident. However, in automated machine-to-machine protocols these ambiguities can lead
        to security vulnerabilities.
      </t>

      <t>To allow for better use of the RPKI in machine-to-machine communications, this document defines the RPKI
        Signed Message (RSM) content type, including an explicit audience and purpose field.
      </t>

      <section>
        <name>Requirements Language</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
          <xref target="BCP14"/>
          (<xref target="RFC2119"/>,<xref target="RFC8174"/>) when,
          and only when, they appear in all capitals, as shown here.
        </t>
      </section>
    </section>

    <section>
      <name>Motivation for a new content type</name>
      <t>Protocols can assign the different meanings to the same data. In the context of human-to-human communication
        the worst outcome of this is often a mere opportunity for a pun; however in the context of automated
        machine-to-machine processing this can lead to serious security vulnerabilities.
      </t>
      <t>An RSC with ambiguous content could, for example, be used in a cross-protocol replay attack.
        One might argue that a protocol which is vulnerable to such a replay attack is a poorly designed one;
        a counter-argument to this is that it should not be possible to design such a vulnerability into a
        protocol built on top of RSCs in the first place.
      </t>
      <t>Further motivation for avoiding such ambiguity in protocols can be found in
        <xref target="ascii-or-protobuf" format="title"/>.
      </t>
    </section>

    <section>
      <name>Profile and Distribution</name>
      <t>RSMs follows the Signed Object Template for the RPKI
        <xref target="RFC6488"/>
        with one exception:
        because RSMs <bcp14>MUST NOT</bcp14> be distributed through the global RPKI repository system,
        the Subject Information Access (SIA) extension <bcp14>MUST</bcp14> be omitted from the RSM's
        X.509 End-Entity (EE) certificate.
      </t>

      <t>What constitutes suitable transport for RSM files is deliberately unspecified. In the context of
        machine-to-machine communication it is expected that they are attached to an API request,
        in a way compatible with said API.
      </t>

      <section>
        <name>End Entity Certificates</name>

        <t>The Certification Authority (CA) <bcp14>MUST</bcp14> only sign one RSM with each EE certificate and
          <bcp14>MUST</bcp14>
          generate a new key pair for each new RSM. This type of EE certificate is termed a
          "one-time-use" EE certificate (see<xref target="RFC6487" section="3"/>).
        </t>
      </section>
    </section>

    <section>
      <name>Content Type</name>
      <t>The eContentType for an RSM is defined as id-ct-rpkiSignedMessage, with Object Identifier (OID)
        1.2.840.113549.1.9.16.1.TDB.
      </t>

      <t>This OID MUST appear within both the eContentType in the encapContentInfo object and the ContentType
        signed attribute in the signerInfo object (see<xref target="RFC6488"/>).
      </t>
    </section>

    <section>
      <name>Content</name>

      <t>The content of an RSM indicates that as arbitrary binary message has been signed with a specific set of
        Internet Number Resources. An RSM is formally defined as follows:
      </t>

<sourcecode type="asn.1" markers="false">
<![CDATA[
RpkiSignedMessage-2025
  { iso(1) member-body(2) us(840) rsadsi(113549)
    pkcs(1) pkcs9(9) smime(16) mod(0)
    id-mod-rpkiSignedMessage-2025(TBD) }

DEFINITIONS EXPLICIT TAGS ::=
BEGIN

IMPORTS
  CONTENT-TYPE, Digest, DigestAlgorithmIdentifier
  FROM CryptographicMessageSyntax-2010 -- in [RFC6268]
    { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
      pkcs-9(9) smime(16) modules(0) id-mod-cms-2009(58) }

  IPAddressOrRange, ASIdOrRange
  FROM IPAddrAndASCertExtn -- in [RFC3779]
    { iso(1) identified-organization(3) dod(6) internet(1)
      security(5) mechanisms(5) pkix(7) mod(0)
      id-mod-ip-addr-and-as-ident(30) }

  ResourceBlock
  FROM id-mod-rpkiSignedChecklist-2022 -- in [RFC9323]
    { iso(1) member-body(2) us(840) rsadsi(113549)
      pkcs(1) pkcs9(9) smime(16) mod(0)
      id-mod-rpkiSignedChecklist-2022(73) };

ct-rpkiSignedMessage CONTENT-TYPE ::=
  { TYPE RpkiSignedMessage
    IDENTIFIED BY id-ct-signedMessage }

id-ct-signedMessage OBJECT IDENTIFIER ::=
  { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
    pkcs-9(9) id-smime(16) id-ct(1) signedMessage(TBD) }

RpkiSignedMessage ::= SEQUENCE {
    version [0]       INTEGER DEFAULT 0,
    purpose           OBJECT IDENTIFIER
    audience          OBJECT IDENTIFIER
    resources         ResourceBlock,
    digestAlgorithm   DigestAlgorithmIdentifier,
    hash              Digest }
END]]>
</sourcecode>

      <section>
        <name>Version</name>

        <t>The version number of the RpkiSignedMessage <bcp14>MUST</bcp14> be 0.</t>
      </section>

      <section>
        <name>Purpose</name>

        <t>The purpose field includes an OID identifying for which purpose the RSM was created.</t>
      </section>

      <section>
        <name>Audience</name>

        <t>The audience fields includes an OID identifying for which audience the RSM was created, or that it was
          created for the general audience.
        </t>
      </section>

      <section>
        <name>Resources</name>

        <t>The resources in an RSM <bcp14>MUST</bcp14> be constructed as per <xref target="RFC9323" section="4.2"/>.</t>
      </section>

      <section>
        <name>Digest algorithm</name>

        <t>The digest algorithm is used to create the message digest of the attested message.
          This algorithm <bcp14>MUST</bcp14> be a hash algorithm defined in <xref target="RFC7935"/>.</t>
      </section>

      <section>
        <name>Hash</name>

        <t>The value of the hash field is the calculated message digest of the attested message. This message is
          carried externally to the RSM. That is, an RSM is a detached signature.</t>
      </section>

    </section>

    <section>
      <name>Well-known audiences and purposes</name>
      <t>It would be advantages for implementations to have certain well-known purposes and audiences for uses of RSMs
        that are intended to be globally interoperable. To that end this document establishes an OID tree for
        well-known audiences and purposes, under 1.3.6.1.5.5.TBD.0 and 1.3.6.1.5.5.TBD.1 respectively.</t>

      <section>
        <name>Anyone Audience</name>
        <t>When an RSM is intended anyone and everyone <bcp14>SHOULD</bcp14> use
          the 1.3.6.1.5.5.TBD.0.0 audience. This should be used sparingly, as its use can introduce the possibility
          for cross-protocol attacks.</t>
      </section>

      <section>
        <name>Autonomous System Audience</name>
        <t>When an RSM is intended for the operator of a specific AS implementors <bcp14>SHOULD</bcp14> use
          the 1.3.6.1.5.5.TBD.0.1.X audience, where X is the intended ASN. That is, an RSM intended for AS64496 will
          have the audience 1.3.6.1.5.5.TBD.0.1.64496.</t>
      </section>
    </section>

    <section>
      <name>Validation</name>

      <t>The considerations of
        <xref target="RFC9323" section="5"/>
        also apply to validating RSMs.
      </t>

      <t>Additionally, a Relying Party <bcp14>MUST</bcp14> verify:
      </t>

      <ul>
        <li>That the RSM is intended for the purpose that it is being used for.</li>
        <li>That it is in the intended audience of the RSM.</li>
      </ul>
    </section>

    <section>
      <name>Security Considerations</name>

      <t>The considerations of
        <xref target="RFC9323" section="8"/>
        also apply to RSMs.
      </t>

      <t>Additionally, RPs <bcp14>MUST</bcp14> verify the purpose and audience fields, and protocols
        <bcp14>SHOULD</bcp14>
        ensure that the values used in these fields are specific enough to avoid
        cross-protocol attacks.
      </t>
    </section>

    <section anchor="iana">
      <name>IANA Considerations</name>
      <section>
        <name>SMI Security for Mechanism Codes</name>
        <t>The IANA is requested to allocate a new security mechanism under the
          "SMI Security for Mechanism Codes" registry:
        </t>
        <table>
          <thead>
            <tr>
              <th>OID Value</th>
              <th>Name</th>
              <th>Description</th>
              <th>References</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>1.3.6.1.5.5.TBD</td>
              <td>rsm</td>
              <td>RPKI Signed Messages</td>
              <td>This document</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section>
        <name>SMI Security for S/MIME CMS Content Type (1.2.840.113549.1.9.16.1)</name>
        <t>The IANA is requested to allocate the following in the
          "SMI Security for S/MIME CMS Content Type (1.2.840.113549.1.9.16.1)" registry:
        </t>
        <table>
          <thead>
            <tr>
              <th>Decimal</th>
              <th>Description</th>
              <th>References</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>TBD</td>
              <td>id-ct-rpkiSignedMessage</td>
              <td>This document</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section>
        <name>RPKI Signed Objects</name>
        <t>The IANA is requested to register the OID for the RSM in the "RPKI Signed Objects" registry
          <xref target="RFC6488"/>
          as follows:
        </t>
        <table>
          <thead>
            <tr>
              <th>Name</th>
              <th>OID</th>
              <th>Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>Signed Message</td>
              <td>1.2.840.113549.1.9.16.1.TBD</td>
              <td>This document</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section>
        <name>RPKI Repository Name Schemes</name>
        <t>The IANA is requested to add the Signed Message file extension to the "RPKI Repository Name Schemes" registry
          <xref target="RFC6481"/>
          as follows:
        </t>
        <table>
          <thead>
            <tr>
              <th>Filename Extension</th>
              <th>RPKI Object</th>
              <th>Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left" colspan="1" rowspan="1">.sme</td>
              <td align="left" colspan="1" rowspan="1">Signed Message</td>
              <td align="left" colspan="1" rowspan="1">This document</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section>
        <name>SMI Security for S/MIME Module Identifier (1.2.840.113549.1.9.16.0)</name>
        <t>The IANA is requested to allocate the following in the "SMI Security for S/MIME Module Identifier
          (1.2.840.113549.1.9.16.0)" registry:
        </t>
        <table>
          <thead>
            <tr>
              <th>Decimal</th>
              <th>Description</th>
              <th>References</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>TBD</td>
              <td>id-mod-rpkiSignedMessage-2025</td>
              <td>This document</td>
            </tr>
          </tbody>
        </table>
      </section>
      <section>
        <name>Media Types</name>
        <t>The IANA is requested to register the media type "application/rpki-signed-message" in the "Media Types"
          registry as follows:
        </t>
        <dl>
          <dt>Type name:</dt>
          <dd>application</dd>
          <dt>Subtype name:</dt>
          <dd>rpki-signed-message</dd>
          <dt>Required parameters:</dt>
          <dd>N/A</dd>
          <dt>Optional parameters:</dt>
          <dd>N/A</dd>
          <dt>Encoding considerations:</dt>
          <dd>binary</dd>
          <dt>Security considerations:</dt>
          <dd>Carries an RPKI Signed Message. This media type contains no active content.</dd>
          <dt>Interoperability considerations:</dt>
          <dd>N/A</dd>
          <dt>Published specification:</dt>
          <dd>This document</dd>
          <dt>Applications that use this media type:</dt>
          <dd>RPKI operators</dd>
          <dt>Fragment identifier considerations:</dt>
          <dd>N/A</dd>
          <dt>Additional information:</dt>
          <dd>
            <dl>
              <dt>Content:</dt>
              <dd>This media type is a signed object, as defined in [RFC6488], which contains a payload of a list of
                checksums as defined in this document.
              </dd>
              <dt>Magic number(s):</dt>
              <dd>N/A</dd>
              <dt>File extension(s):</dt>
              <dd>.rsm</dd>
              <dt>Macintosh file type code(s):</dt>
              <dd>N/A</dd>
            </dl>
          </dd>
          <dt>Person &amp; email address to contact for further information:</dt>
          <dd>Q Misell (q@as207960.net)</dd>
          <dt>Intended usage:</dt>
          <dd>COMMON</dd>
          <dt>Restrictions on usage:</dt>
          <dd>N/A</dd>
          <dt>Author:</dt>
          <dd>Q Misell (q@as207960.net)</dd>
          <dt>Change controller:</dt>
          <dd>IETF</dd>
        </dl>
      </section>
      <section>
        <name>New registries</name>
        <t>The IANA is requested to create the following new registries:</t>
        <ul>
          <li>RPKI Signed Message well-known audiences (1.3.6.1.5.5.TBD.0)</li>
          <li>RPKI Signed Message well-known purposes (1.3.6.1.5.5.TBD.1)</li>
        </ul>

        <section>
          <name>RPKI Signed Message well-known audiences</name>
          <t>This registry contains the audience OIDs which are to be understood globally. All values are in the
            1.3.6.1.5.5.TBD.0 tree.
          </t>
          <t>Template:</t>
          <dl>
            <dt>Decimal</dt>
            <dd>integer value of the OID tree node</dd>
            <dt>Description</dt>
            <dd>a textual description of the audience</dd>
            <dt>Reference</dt>
            <dd>where this audience is defined</dd>
          </dl>
          <t>Initial contents:</t>
          <table>
            <thead>
              <tr>
                <th>Decimal</th>
                <th>Description</th>
                <th>References</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>0</td>
                <td>Global Audience</td>
                <td>This document</td>
              </tr>
              <tr>
                <td>1</td>
                <td>Autonomous System</td>
                <td>This document</td>
              </tr>
            </tbody>
          </table>
          <t>Values are to be allocated under the Specifications Required procedure.</t>
        </section>

        <section>
          <name>RPKI Signed Message well-known purposes</name>
          <t>This registry contains the purpose OIDs which are to be understood globally. All values are in the
            1.3.6.1.5.5.TBD.1 tree.
          </t>
          <t>Template:</t>
          <dl>
            <dt>Decimal</dt>
            <dd>integer value of the OID tree node</dd>
            <dt>Description</dt>
            <dd>a textual description of the purpose</dd>
            <dt>Reference</dt>
            <dd>where this purpose is defined</dd>
          </dl>
          <t>Initial contents:</t>
          <table>
            <thead>
              <tr>
                <th>Decimal</th>
                <th>Description</th>
                <th>References</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td colspan="3">No entries</td>
              </tr>
            </tbody>
          </table>
          <t>Values are to be allocated under the Specifications Required procedure.</t>
        </section>
      </section>
    </section>
  </middle>

  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>

        <referencegroup anchor="BCP14" target="https://www.rfc-editor.org/info/bcp14">
          <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.2119.xml"/>
          <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8174.xml"/>
        </referencegroup>

        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.6481.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.6487.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.6488.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.7935.xml"/>
        <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.9323.xml"/>
      </references>
      <references>
        <name>Informative References</name>

        <reference anchor="ascii-or-protobuf" target="https://sandstorm.io/news/2015-05-01-is-that-ascii-or-protobuf">
          <front>
            <title>Is that ASCII or is it Protobuf? The importance of types in cryptographic signatures</title>
            <author initials="K" surname="Varda" fullname="Kenton Varda"/>
            <date month="May" year="2015"/>
          </front>
        </reference>
      </references>
    </references>
  </back>
</rfc>
