<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-ietf-lamps-nf-eku-03" ipr="trust200902">
  <front>
    <title abbrev="EKUs for NFs">X.509 Certificate Extended Key Usage (EKU)
    for 5G Network Functions</title>

    <author fullname="Tirumaleswar Reddy" initials="T." surname="Reddy">
      <organization>Nokia</organization>

      <address>
        <postal>
          <street></street>

          <country>India</country>
        </postal>

        <email>kondtir@gmail.com</email>
      </address>
    </author>

    <author fullname="Jani Ekman" initials="J." surname="Ekman">
      <organization>Nokia</organization>

      <address>
        <postal>
          <street></street>

          <country>Finland</country>
        </postal>

        <email>jani.ekman@nokia.com</email>
      </address>
    </author>

    <author fullname="Daniel Migault" initials="D." surname="Migault">
      <organization>Ericsson</organization>

      <address>
        <postal>
          <street></street>

          <country>Canada</country>
        </postal>

        <email>daniel.migault@ericsson.com</email>
      </address>
    </author>

    <date />

    <workgroup>LAMPS WG</workgroup>

    <abstract>
      <t>RFC 5280 specifies several extended key purpose identifiers
      (KeyPurposeIds) for X.509 certificates. This document defines encrypting
      JSON objects in HTTP messages, JSON Web Token (JWT) and signing the
      OAuth 2.0 access tokens KeyPurposeIds for inclusion in the Extended Key
      Usage (EKU) extension of X.509 v3 public key certificates used by
      Network Functions (NFs) for the 5G System.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <t>The Operators of 5G systems make use of an internal PKI to generate
      X.509 PKI certificates for the Network Functions (NFs) (Section 6 of
      <xref target="TS23.501"></xref>) in a 5G system. The certificates are
      used for the following purposes:</t>

      <t><list style="symbols">
          <t>Client and Server certificates for NFs in 5GC Service Based
          Architecture (see Section 6.1.3c of <xref
          target="TS33.310"></xref>)</t>

          <t>Client Credentials Assertion (CCA) uses JSON Web Tokens (JWT)
          <xref target="RFC7519"></xref> and is secured with digital
          signatures based on JSON Web Signature (JWS) <xref
          target="RFC7515"></xref> (see Section 13.3.8.2 of <xref
          target="TS33.501"></xref>).</t>

          <t>Certificates for encrypting JSON objects in HTTP messages between
          Security Edge Protection Proxies (SEPPs) using JSON Web Encryption
          (JWE) <xref target="RFC7516"></xref> (Section 13.2.4.4 of <xref
          target="TS33.501"></xref>) and Section 6.3.2 of <xref
          target="TS33.210"></xref>).</t>

          <t>Certificates for signing the OAuth 2.0 access tokens for service
          authorization to grant temporary access to resources provided by NF
          producers using JWS (see Section 13.4.1 of <xref
          target="TS33.501"></xref>).</t>
        </list></t>

      <t><xref target="RFC5280"></xref> specifies several key usage
      extensions, defined via KeyPurposeIds, for X.509 certificates. Key usage
      extensions added to a certificate are meant to express intent as to the
      purpose of the named usage, for humans and for complying libraries. In
      addition, the IANA repository "SMI Security for PKIX Extended Key
      Purpose" <xref target="RFC7299"></xref> contains additional
      KeyPurposeIds. It's important to note that using the anyExtendedKeyUsage
      KeyPurposeId, as defined in Section 4.2.1.12 of <xref
      target="RFC5280"></xref>, is generally considered a poor practice. This
      is especially true for publicly trusted certificates, whether they are
      multi-purpose or single-purpose, within the context of 5G systems and
      the 5G Core Service Based Architecture.</t>

      <t>If the purpose of the issued certificates is not restricted, i.e.,
      the type of operations for which a public key contained in the
      certificate can be used are not specified, those certificates could be
      used for another purpose than intended, violating the CA policies, and
      increasing the risk of cross-protocol attacks. Failure to ensure proper
      segregation of duties means that a NF which generates the public/private
      keys and applies for a certificate to the operator CA, could obtain a
      certificate which can be misused for tasks that this NF is not entitled
      to perform. For example, a NF service consumer could impersonate NF
      service producers using its certificate. Another example, if the purpose
      of the certificate is for the NF service consumer is to use it as a
      client certificate, the NF with this client certificate and
      corresponding private key must not be allowed to sign the CCA. When a NF
      service producer receives the signed CCA from the NF service consumer,
      the NF would accept the token even if CCA is signed with a certificate
      not issued for this purpose.</t>

      <t>The KeyPurposeId id-kp-serverAuth (Section 4.2.1.12 of <xref
      target="RFC5280"></xref>) can be used to identify that the certificate
      is for a server (e.g., NF service producer), and the KeyPurposeId
      id-kp-clientAuth (Section 4.2.1.12 of <xref target="RFC5280"></xref>)
      can be used to identify that the certificate is for a client (e.g., NF
      service consumer). However, there are currently no KeyPurposeIds for the
      other usages of certificates in 5G System. This document defines the
      Extended Key Usage (EKU) extension of X.509 public key certificates for
      signing the JWT Claims set using JWS, encrypting JSON objects in HTTP
      messages using JWE, and signing the OAuth 2.0 access tokens using
      JWS.</t>

      <t>Vendor-defined KeyPurposeIds used within a PKI governed by the vendor
      or a group of vendors typically do not pose interoperability concerns,
      as non-critical extensions can be safely ignored if unrecognized.
      However, using or misusing KeyPurposeIds outside of their intended
      vendor-controlled environment can lead to interoperability issues.
      Therefore, it is advisable not to rely on vendor-defined KeyPurposeIds.
      Instead, the specification defines standard KeyPurposeIds to ensure
      interoperability across various implementations.</t>
    </section>

    <section anchor="notation" title="Terminology">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
      "OPTIONAL" in this document are to be interpreted as described in BCP 14
      <xref target="RFC2119"></xref><xref target="RFC8174"></xref> when, and
      only when, they appear in all capitals, as shown here.</t>
    </section>

    <section title="Extended Key Purpose for Network Functions">
      <t>This specification defines the KeyPurposeIds id-kp-jwt,
      id-kp-httpContentEncrypt, id-kp-oauthAccessTokenSigning for respectively
      signing the JWT Claims set of CCA using JWS, encrypting JSON objects in
      HTTP messages between Security Edge Protection Proxies (SEPPs) using JWE
      and signing the OAuth 2.0 access tokens for service authorization to
      grant temporary access to resources provided by NF producers using JWS.
      As described in <xref target="RFC5280"></xref>, "[i]f the [Extended Key
      Usage] extension is present, then the certificate MUST only be used for
      one of the purposes indicated." <xref target="RFC5280"></xref> also
      notes that "[i]f multiple [key] purposes are indicated the application
      need not recognize all purposes indicated, as long as the intended
      purpose is present."</t>

      <t>Applications verifying the signature of a Client Credentials
      Assertion (CCA) represented as JWT, decrypting JSON objects in HTTP
      messages between Security Edge Protection Proxies (SEPPs) using JWE or
      verifying the signature of an OAuth 2.0 access tokens for service
      authorization to grant temporary access to resources provided by NF
      producers using JWS MAY require corresponding KeyPurposeIds be specified
      by the EKU extension. In addition, such application MUST require the
      KeyUsage extension be set to digitalSignature or nonRepudiation (also
      designated as contentCommitment) for the signature calculation and/or to
      keyEncipherment for encryption of the secret key.</t>
    </section>

    <section title="Including the Extended Key Purpose in Certificates">
      <t><xref target="RFC5280"></xref> specifies the Extended Key Usage (EKU)
      X.509 certificate extension for use on end entity certificates. The
      extension indicates one or more purposes for which the certified public
      key is valid. The EKU extension can be used in conjunction with the key
      usage extension, which indicates the set of basic cryptographic
      operations for which the certified key may be used. The EKU extension
      syntax is repeated here for convenience:</t>

      <figure>
        <artwork><![CDATA[ExtKeyUsageSyntax ::= SEQUENCE SIZE (1..MAX) OF KeyPurposeId 

KeyPurposeId ::= OBJECT IDENTIFIER 
]]></artwork>
      </figure>

      <t></t>

      <t>As described in <xref target="RFC5280"></xref>, the EKU extension
      may, at the option of the certificate issuer, be either critical or
      non-critical. The inclusion of KeyPurposeId id-kp-jwt,
      id-kp-httpContentEncrypt, and id-kp-oauthAccessTokenSigning in a
      certificate indicates that the public key encoded in the certificate has
      been certified for use in the following: <list style="numbers">
          <t>Validating the JWS Signature in JWT. The distinction between JWS
          and JWE is determined by the KU that is set to digitalSignature or
          nonRepudiation for JWS and keyEncipherment for JWE.</t>

          <t>Encrypting JSON objects in HTTP messages (for example, encrypting
          the CEK with the recipient's public key using the RSAES-OAEP
          algorithm to produce the JWE Encrypted Key). KU is set to
          keyEncipherment.</t>

          <t>Signing OAuth 2.0 access tokens. In this case, Ku is set to
          digitalSignature or nonRepudiation.</t>
        </list></t>

      <t><figure>
          <artwork><![CDATA[     id-kp  OBJECT IDENTIFIER  ::= {
       iso(1) identified-organization(3) dod(6) internet(1)
       security(5) mechanisms(5) pkix(7) kp(3) }

id-kp-jwt OBJECT IDENTIFIER ::= { id-kp TBD1 }
id-kp-httpContentEncrypt OBJECT IDENTIFIER ::= { id-kp TBD2 }
id-kp-oauthAccessTokenSigning OBJECT IDENTIFIER ::= { id-kp TBD3 }
]]></artwork>
        </figure></t>
    </section>

    <section anchor="solution"
             title="Implications for a Certification Authority">
      <t>The procedures and practices employed by a certification authority
      MUST ensure that the correct values for the EKU extension as well as the
      KU extension are inserted in each certificate that is issued. The
      inclusion of the id-kp-jwt, id-kp-httpContentEncrypt and
      id-kp-oauthAccessTokenSigning KeyPurposeIds does not preclude the
      inclusion of other KeyPurposeIds.</t>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The Security Considerations of <xref target="RFC5280"></xref> are
      applicable to this document. This extended key purpose does not
      introduce new security risks but instead reduces existing security risks
      by providing means to identify if the certificate is generated to sign
      the JWT Claims Set, signing the OAuth 2.0 access tokens using JWS or to
      encrypt the CEK in JWE for encrypting JSON objects in HTTP messages.</t>

      <t>To reduce the risk of specific cross-protocol attacks, the relying
      party or the relying party software may additionally prohibit use of
      specific combinations of KeyPurposeIds. The procedure of using Excluded
      KeyPurposeId and Permitted KeyPurposeId by an relying party to permit or
      prohibit combinations of KeyPurposeIds is defined in Section 4 of <xref
      target="RFC9336"></xref>. Examples of Excluded KeyPurposeId include the
      presence of the anyExtendedKeyUsage KeyPurposeId or the complete absence
      of the EKU extension in a certificate. Examples of Permitted
      KeyPurposeId include the presence of id-kp-jwt, id-kp-httpContentEncrypt
      or id-kp-oauthAccessTokenSigning KeyPurposeId.</t>
    </section>

    <section anchor="Privacy" title="Privacy Considerations">
      <t>In some security protocols, such as TLS 1.2 <xref
      target="RFC5246"></xref>, certificates are exchanged in the clear. In
      other security protocols, such as TLS 1.3 <xref
      target="RFC8446"></xref>, the certificates are encrypted. The inclusion
      of the EKU extension can help an observer determine the purpose of the
      certificate. In addition, If the certificate is issued by a public
      certification authority, the inclusion of EKU extension can help an
      attacker to monitor the Certificate Transparency logs <xref
      target="RFC9162"></xref> to identify the purpose of the certificate.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>IANA is requested to register the following OIDs in the "SMI Security
      for PKIX Extended Key Purpose" registry (1.3.6.1.5.5.7.3). These OIDs
      are defined in Section 4.</t>

      <figure anchor="fig-a">
        <name>Table 1</name>

        <artwork><![CDATA[
+=========+===============================+============+
| Decimal | Description                   | References |
+=========+===============================+============+
| TBD1    | id-kp-jwt                     | This-RFC   |
+---------+-------------------------------+------------+
| TBD2    | id-kp-httpContentEncrypt      | This-RFC   |
+---------+-------------------------------+------------+
| TBD3    | id-kp-oauthAccessTokenSigning | This-RFC   |
+---------+-------------------------------+------------+
]]></artwork>
      </figure>

      <t></t>

      <t>IANA is also requested to register the following ASN.1<xref
      target="X.680"></xref> module OID in the "SMI Security for PKIX Module
      Identifier" registry (1.3.6.1.5.5.7.0). This OID is defined in <xref
      target="Appendix"></xref>.</t>

      <t><figure anchor="fig-b">
          <name>Table 2</name>

          <artwork><![CDATA[
+=========+==========================+============+
| Decimal |     Description          | References |
+=========+==========================+============+
| TBD4    | id-mod-nf-eku            | This-RFC   |
+---------+--------------------------+------------+
]]></artwork>
        </figure></t>
    </section>

    <section anchor="contrib" title="Contributors">
      <t>The following individuals have contributed to this document:</t>

      <t><figure>
          <artwork><![CDATA[      German Peinado
      Nokia

      Email: german.peinado@nokia.com]]></artwork>
        </figure></t>
    </section>

    <section anchor="acknowledgments" title="Acknowledgments">
      <t>We would like to thank Corey Bonnell, Ilari Liusvaara, Carl Wallace
      and Russ Housley for their useful feedback. Thanks to Yoav Nir for the
      secdir review, Elwyn Davies for the genart review and Benson Muite for
      the intdir review.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      <?rfc include="reference.RFC.8174"?>

      <?rfc include="reference.RFC.5280"?>

      <?rfc include="reference.RFC.7515"?>

      <?rfc include="reference.RFC.7519"?>

      <?rfc include="reference.RFC.7516"?>

      <!-- <?rfc include="reference.RFC.7159"?> -->

      <!-- <?rfc include="reference.RFC.9052"?> -->

      <!-- <?rfc include="reference.RFC.8949"?> -->

      <reference anchor="X.680" target="https://www.itu.int/rec/T-REC-X.680">
        <front>
          <title>ITU-T, "Information technology - Abstract Syntax Notation One
          (ASN.1): Specification of basic notation", ITU-T Recommendation
          X.680, February 2021.</title>

          <author>
            <organization></organization>
          </author>

          <date day="" month="" year="" />
        </front>
      </reference>

      <reference anchor="X.690" target="https://www.itu.int/rec/T-REC-X.690">
        <front>
          <title>ITU-T, "Information technology - ASN.1 encoding rules:
          Specification of Basic Encoding Rules (BER), Canonical Encoding
          Rules (CER) and Distinguished Encoding Rules (DER)", ITU-T
          Recommendation X.690, February 2021,</title>

          <author>
            <organization></organization>
          </author>

          <date day="" month="" year="" />
        </front>
      </reference>
    </references>

    <references title="Informative References">
      <?rfc include='reference.RFC.5246'?>

      <?rfc include='reference.RFC.8446'
?>

      <?rfc include="reference.RFC.7299"?>

      <?rfc include="reference.RFC.9336"?>

      <?rfc include="reference.RFC.9162"?>

      <!-- <?rfc include="reference.RFC.7518"?> -->

      <reference anchor="TS33.501"
                 target="https://www.3gpp.org/ftp/Specs/archive/33_series/33.501/33501-h70.zip">
        <front>
          <title>3rd Generation Partnership Project; Technical Specification
          Group Services and System Aspects; Security architecture and
          procedures for 5G system (Release 17), , 3GPP TS:33.501 V17.7.0,
          Sept 2022,</title>

          <author>
            <organization></organization>
          </author>

          <date day="" month="" year="" />
        </front>
      </reference>

      <reference anchor="TS33.310"
                 target="https://www.3gpp.org/ftp/Specs/archive/33_series/33.310/33310-h40.zip">
        <front>
          <title>3rd Generation Partnership Project; Technical Specification
          Group Services and System Aspects; Network Domain Security (NDS);
          Authentication Framework (AF) (Release 17), 3GPP 33.310 V17.4.0,
          Sept 2022,</title>

          <author>
            <organization></organization>
          </author>

          <date day="" month="" year="" />
        </front>
      </reference>

      <reference anchor="TS33.210"
                 target="https://www.3gpp.org/ftp/Specs/archive/33_series/33.210/33210-h10.zip">
        <front>
          <title>3rd Generation Partnership Project; Technical Specification
          Group Services and System Aspects;Network Domain Security (NDS); IP
          network layer security (Release 17), 3GPP TS 33.210 V17.1.0 Sept
          2022,</title>

          <author>
            <organization></organization>
          </author>

          <date day="" month="" year="" />
        </front>
      </reference>

      <reference anchor="TS23.501"
                 target="https://www.3gpp.org/ftp/Specs/archive/23_series/23.501/23501-i00.zip">
        <front>
          <title>3rd Generation Partnership Project; Technical Specification
          Group Services and System Aspects; System architecture for the 5G
          System (5GS); Stage 2 (Release 18), 3GPP TS 23.501 V18.0.0 Dec
          2022,</title>

          <author>
            <organization></organization>
          </author>

          <date day="" month="" year="" />
        </front>
      </reference>
    </references>

    <section anchor="Appendix" title="ASN.1 Module">
      <t>The following module adheres to ASN.1 specifications <xref
      target="X.680"></xref> and <xref target="X.690"></xref>.</t>

      <figure>
        <artwork><![CDATA[<CODE BEGINS>

NF-EKU
  { iso(1) identified-organization(3) dod(6) internet(1)
  security(5) mechanisms(5) pkix(7) id-mod(0)
  id-mod-nf-eku (TBD4) }

DEFINITIONS IMPLICIT TAGS ::=
BEGIN

-- OID Arc

id-kp OBJECT IDENTIFIER ::=
  { iso(1) identified-organization(3) dod(6) internet(1)
    security(5) mechanisms(5) pkix(7) kp(3) }

-- Extended Key Usage Values

id-kp-jwt OBJECT IDENTIFIER ::= { id-kp TBD1 }
id-kp-httpContentEncrypt OBJECT IDENTIFIER ::= { id-kp TBD2 }
id-kp-oauthAccessTokenSigning OBJECT IDENTIFIER ::= { id-kp TBD3 }

END

<CODE ENDS>]]></artwork>
      </figure>
    </section>
  </back>
</rfc>
