<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" category="bcp" consensus="true" docName="draft-ietf-oauth-jwt-bcp-07" indexInclude="true" ipr="trust200902" number="8725" prepTime="2020-02-19T14:38:29" scripts="Common,Latin" sortRefs="true" submissionType="IETF" symRefs="true" tocDepth="3" tocInclude="true" updates="7519" xml:lang="en">
  <link href="https://datatracker.ietf.org/doc/draft-ietf-oauth-jwt-bcp-07" rel="prev"/>
  <link href="https://dx.doi.org/10.17487/rfc8725" rel="alternate"/>
  <link href="urn:issn:2070-1721" rel="alternate"/>
  <front>
    <title abbrev="JWT BCP">JSON Web Token Best Current Practices</title>
    <seriesInfo name="RFC" value="8725" stream="IETF"/>
    <seriesInfo name="BCP" value="225" stream="IETF"/>
    <author initials="Y." surname="Sheffer" fullname="Yaron Sheffer">
      <organization showOnFrontPage="true">Intuit</organization>
      <address>
        <email>yaronf.ietf@gmail.com</email>
      </address>
    </author>
    <author initials="D." surname="Hardt" fullname="Dick Hardt">
      <organization showOnFrontPage="true"/>
      <address>
        <email>dick.hardt@gmail.com</email>
      </address>
    </author>
    <author initials="M." surname="Jones" fullname="Michael B. Jones">
      <organization showOnFrontPage="true">Microsoft</organization>
      <address>
        <email>mbj@microsoft.com</email>
        <uri>https://self-issued.info/</uri>
      </address>
    </author>
    <date month="02" year="2020"/>
    <area>Security</area>
    <workgroup>OAuth Working Group</workgroup>
    <keyword>JSON Web Token</keyword>
    <keyword>JWT</keyword>
    <keyword>JSON Object Signing and Encryption</keyword>
    <keyword>JOSE</keyword>
    <keyword>JSON Web Signature</keyword>
    <keyword>JWS</keyword>
    <keyword>JSON Web Encryption</keyword>
    <keyword>JWE</keyword>
    <keyword>attacks</keyword>
    <keyword>Claims</keyword>
    <keyword>Security</keyword>
    <keyword>Cryptography</keyword>
    <abstract pn="section-abstract">
      <t pn="section-abstract-1">JSON Web Tokens, also known as JWTs, are URL-safe JSON-based security
      tokens that contain a set of claims that can be signed and/or encrypted.
      JWTs are being widely used and deployed as a simple security token
      format in numerous protocols and applications, both in the area of
      digital identity and in other application areas.  This Best Current
      Practices document updates RFC 7519 to provide actionable guidance
      leading to secure implementation and deployment of JWTs.</t>
    </abstract>
    <boilerplate>
      <section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
        <name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
        <t pn="section-boilerplate.1-1">
            This memo documents an Internet Best Current Practice.
        </t>
        <t pn="section-boilerplate.1-2">
            This document is a product of the Internet Engineering Task Force
            (IETF).  It represents the consensus of the IETF community.  It has
            received public review and has been approved for publication by
            the Internet Engineering Steering Group (IESG).  Further information
            on BCPs is available in Section 2 of RFC 7841.
        </t>
        <t pn="section-boilerplate.1-3">
            Information about the current status of this document, any
            errata, and how to provide feedback on it may be obtained at
            <eref target="https://www.rfc-editor.org/info/rfc8725" brackets="none"/>.
        </t>
      </section>
      <section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
        <name slugifiedName="name-copyright-notice">Copyright Notice</name>
        <t pn="section-boilerplate.2-1">
            Copyright (c) 2020 IETF Trust and the persons identified as the
            document authors. All rights reserved.
        </t>
        <t pn="section-boilerplate.2-2">
            This document is subject to BCP 78 and the IETF Trust's Legal
            Provisions Relating to IETF Documents
            (<eref target="https://trustee.ietf.org/license-info" brackets="none"/>) in effect on the date of
            publication of this document. Please review these documents
            carefully, as they describe your rights and restrictions with
            respect to this document. Code Components extracted from this
            document must include Simplified BSD License text as described in
            Section 4.e of the Trust Legal Provisions and are provided without
            warranty as described in the Simplified BSD License.
        </t>
      </section>
    </boilerplate>
    <toc>
      <section anchor="toc" numbered="false" removeInRFC="false" toc="exclude" pn="section-toc.1">
        <name slugifiedName="name-table-of-contents">Table of Contents</name>
        <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1">
          <li pn="section-toc.1-1.1">
            <t keepWithNext="true" pn="section-toc.1-1.1.1"><xref derivedContent="1" format="counter" sectionFormat="of" target="section-1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-introduction">Introduction</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.1.2">
              <li pn="section-toc.1-1.1.2.1">
                <t keepWithNext="true" pn="section-toc.1-1.1.2.1.1"><xref derivedContent="1.1" format="counter" sectionFormat="of" target="section-1.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-target-audience">Target Audience</xref></t>
              </li>
              <li pn="section-toc.1-1.1.2.2">
                <t keepWithNext="true" pn="section-toc.1-1.1.2.2.1"><xref derivedContent="1.2" format="counter" sectionFormat="of" target="section-1.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-conventions-used-in-this-do">Conventions Used in this Document</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.2">
            <t keepWithNext="true" pn="section-toc.1-1.2.1"><xref derivedContent="2" format="counter" sectionFormat="of" target="section-2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-threats-and-vulnerabilities">Threats and Vulnerabilities</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.2.2">
              <li pn="section-toc.1-1.2.2.1">
                <t keepWithNext="true" pn="section-toc.1-1.2.2.1.1"><xref derivedContent="2.1" format="counter" sectionFormat="of" target="section-2.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-weak-signatures-and-insuffi">Weak Signatures and Insufficient Signature Validation</xref></t>
              </li>
              <li pn="section-toc.1-1.2.2.2">
                <t keepWithNext="true" pn="section-toc.1-1.2.2.2.1"><xref derivedContent="2.2" format="counter" sectionFormat="of" target="section-2.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-weak-symmetric-keys">Weak Symmetric Keys</xref></t>
              </li>
              <li pn="section-toc.1-1.2.2.3">
                <t keepWithNext="true" pn="section-toc.1-1.2.2.3.1"><xref derivedContent="2.3" format="counter" sectionFormat="of" target="section-2.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-incorrect-composition-of-en">Incorrect Composition of Encryption and Signature</xref></t>
              </li>
              <li pn="section-toc.1-1.2.2.4">
                <t keepWithNext="true" pn="section-toc.1-1.2.2.4.1"><xref derivedContent="2.4" format="counter" sectionFormat="of" target="section-2.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-plaintext-leakage-through-a">Plaintext Leakage through Analysis of Ciphertext Length</xref></t>
              </li>
              <li pn="section-toc.1-1.2.2.5">
                <t keepWithNext="true" pn="section-toc.1-1.2.2.5.1"><xref derivedContent="2.5" format="counter" sectionFormat="of" target="section-2.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-insecure-use-of-elliptic-cu">Insecure Use of Elliptic Curve Encryption</xref></t>
              </li>
              <li pn="section-toc.1-1.2.2.6">
                <t keepWithNext="true" pn="section-toc.1-1.2.2.6.1"><xref derivedContent="2.6" format="counter" sectionFormat="of" target="section-2.6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-multiplicity-of-json-encodi">Multiplicity of JSON Encodings</xref></t>
              </li>
              <li pn="section-toc.1-1.2.2.7">
                <t keepWithNext="true" pn="section-toc.1-1.2.2.7.1"><xref derivedContent="2.7" format="counter" sectionFormat="of" target="section-2.7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-substitution-attacks">Substitution Attacks</xref></t>
              </li>
              <li pn="section-toc.1-1.2.2.8">
                <t keepWithNext="true" pn="section-toc.1-1.2.2.8.1"><xref derivedContent="2.8" format="counter" sectionFormat="of" target="section-2.8"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-cross-jwt-confusion">Cross-JWT Confusion</xref></t>
              </li>
              <li pn="section-toc.1-1.2.2.9">
                <t keepWithNext="true" pn="section-toc.1-1.2.2.9.1"><xref derivedContent="2.9" format="counter" sectionFormat="of" target="section-2.9"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-indirect-attacks-on-the-ser">Indirect Attacks on the Server</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.3">
            <t keepWithNext="true" pn="section-toc.1-1.3.1"><xref derivedContent="3" format="counter" sectionFormat="of" target="section-3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-best-practices">Best Practices</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.3.2">
              <li pn="section-toc.1-1.3.2.1">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.1.1"><xref derivedContent="3.1" format="counter" sectionFormat="of" target="section-3.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-perform-algorithm-verificat">Perform Algorithm Verification</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.2">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.2.1"><xref derivedContent="3.2" format="counter" sectionFormat="of" target="section-3.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-use-appropriate-algorithms">Use Appropriate Algorithms</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.3">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.3.1"><xref derivedContent="3.3" format="counter" sectionFormat="of" target="section-3.3"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-validate-all-cryptographic-">Validate All Cryptographic Operations</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.4">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.4.1"><xref derivedContent="3.4" format="counter" sectionFormat="of" target="section-3.4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-validate-cryptographic-inpu">Validate Cryptographic Inputs</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.5">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.5.1"><xref derivedContent="3.5" format="counter" sectionFormat="of" target="section-3.5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-ensure-cryptographic-keys-h">Ensure Cryptographic Keys Have Sufficient Entropy</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.6">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.6.1"><xref derivedContent="3.6" format="counter" sectionFormat="of" target="section-3.6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-avoid-compression-of-encryp">Avoid Compression of Encryption Inputs</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.7">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.7.1"><xref derivedContent="3.7" format="counter" sectionFormat="of" target="section-3.7"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-use-utf-8">Use UTF-8</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.8">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.8.1"><xref derivedContent="3.8" format="counter" sectionFormat="of" target="section-3.8"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-validate-issuer-and-subject">Validate Issuer and Subject</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.9">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.9.1"><xref derivedContent="3.9" format="counter" sectionFormat="of" target="section-3.9"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-use-and-validate-audience">Use and Validate Audience</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.10">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.10.1"><xref derivedContent="3.10" format="counter" sectionFormat="of" target="section-3.10"/>. <xref derivedContent="" format="title" sectionFormat="of" target="name-do-not-trust-received-claim">Do Not Trust Received Claims</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.11">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.11.1"><xref derivedContent="3.11" format="counter" sectionFormat="of" target="section-3.11"/>. <xref derivedContent="" format="title" sectionFormat="of" target="name-use-explicit-typing">Use Explicit Typing</xref></t>
              </li>
              <li pn="section-toc.1-1.3.2.12">
                <t keepWithNext="true" pn="section-toc.1-1.3.2.12.1"><xref derivedContent="3.12" format="counter" sectionFormat="of" target="section-3.12"/>. <xref derivedContent="" format="title" sectionFormat="of" target="name-use-mutually-exclusive-vali">Use Mutually Exclusive Validation Rules for Different Kinds of JWTs</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.4">
            <t keepWithNext="true" pn="section-toc.1-1.4.1"><xref derivedContent="4" format="counter" sectionFormat="of" target="section-4"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-security-considerations">Security Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.5">
            <t keepWithNext="true" pn="section-toc.1-1.5.1"><xref derivedContent="5" format="counter" sectionFormat="of" target="section-5"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-iana-considerations">IANA Considerations</xref></t>
          </li>
          <li pn="section-toc.1-1.6">
            <t keepWithNext="true" pn="section-toc.1-1.6.1"><xref derivedContent="6" format="counter" sectionFormat="of" target="section-6"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-references">References</xref></t>
            <ul bare="true" empty="true" indent="2" spacing="compact" pn="section-toc.1-1.6.2">
              <li pn="section-toc.1-1.6.2.1">
                <t keepWithNext="true" pn="section-toc.1-1.6.2.1.1"><xref derivedContent="6.1" format="counter" sectionFormat="of" target="section-6.1"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-normative-references">Normative References</xref></t>
              </li>
              <li pn="section-toc.1-1.6.2.2">
                <t keepWithNext="true" pn="section-toc.1-1.6.2.2.1"><xref derivedContent="6.2" format="counter" sectionFormat="of" target="section-6.2"/>.  <xref derivedContent="" format="title" sectionFormat="of" target="name-informative-references">Informative References</xref></t>
              </li>
            </ul>
          </li>
          <li pn="section-toc.1-1.7">
            <t keepWithNext="true" pn="section-toc.1-1.7.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.a"/><xref derivedContent="" format="title" sectionFormat="of" target="name-acknowledgements">Acknowledgements</xref></t>
          </li>
          <li pn="section-toc.1-1.8">
            <t keepWithNext="true" pn="section-toc.1-1.8.1"><xref derivedContent="" format="none" sectionFormat="of" target="section-appendix.b"/><xref derivedContent="" format="title" sectionFormat="of" target="name-authors-addresses">Authors' Addresses</xref></t>
          </li>
        </ul>
      </section>
    </toc>
  </front>
  <middle>
    <section anchor="introduction" numbered="true" toc="include" removeInRFC="false" pn="section-1">
      <name slugifiedName="name-introduction">Introduction</name>
      <t pn="section-1-1">JSON Web Tokens, also known as JWTs <xref target="RFC7519" format="default" sectionFormat="of" derivedContent="RFC7519"/>, are URL-safe JSON-based security tokens 
that contain a set of claims that can be signed and/or encrypted.
The JWT specification has seen rapid adoption because it encapsulates
security-relevant information in one easy-to-protect location, and because
it is easy to implement using widely available tools.
One application area in which JWTs are commonly used is representing digital identity information,
such as OpenID Connect ID Tokens <xref target="OpenID.Core" format="default" sectionFormat="of" derivedContent="OpenID.Core"/>
and OAuth 2.0 <xref target="RFC6749" format="default" sectionFormat="of" derivedContent="RFC6749"/> access tokens and
      refresh tokens, the details of which are deployment-specific.</t>
      <t pn="section-1-2">Since the JWT specification was published, there have been several widely published
attacks on implementations and deployments.
Such attacks are the result of under-specified security mechanisms, as well as incomplete
implementations and incorrect usage by applications.</t>
      <t pn="section-1-3">The goal of this document is to facilitate secure implementation and deployment of JWTs.
Many of the recommendations in this document are about
implementation and use of the cryptographic mechanisms underlying JWTs that are defined by
JSON Web Signature (JWS) <xref target="RFC7515" format="default" sectionFormat="of" derivedContent="RFC7515"/>,
JSON Web Encryption (JWE) <xref target="RFC7516" format="default" sectionFormat="of" derivedContent="RFC7516"/>, and
JSON Web Algorithms (JWA) <xref target="RFC7518" format="default" sectionFormat="of" derivedContent="RFC7518"/>.
Others are about use of the JWT claims themselves.</t>
      <t pn="section-1-4">These are intended to be minimum recommendations for the use of JWTs
in the vast majority of implementation
and deployment scenarios. Other specifications that reference this document can have
stricter requirements related to one or more aspects of the format, based on their
particular circumstances; when that is the case, implementers are advised to adhere
to those stricter requirements. Furthermore, this document provides a floor, not a ceiling,
so stronger options are always allowed (e.g., depending on differing evaluations of the
importance of cryptographic strength vs. computational load).</t>
      <t pn="section-1-5">Community knowledge about the strength of various algorithms and feasible attacks can
change quickly, and experience shows that a Best Current Practice (BCP) document about
security is a point-in-time statement. Readers are advised to seek out any errata or
updates that apply to this document.</t>
      <section anchor="target-audience" numbered="true" toc="include" removeInRFC="false" pn="section-1.1">
        <name slugifiedName="name-target-audience">Target Audience</name>
        <t pn="section-1.1-1">The intended audiences of this document are:</t>
        <ul spacing="normal" bare="false" empty="false" pn="section-1.1-2">
          <li pn="section-1.1-2.1">Implementers of JWT libraries (and the JWS and JWE libraries
	  used by those libraries),</li>
          <li pn="section-1.1-2.2">Implementers of code that uses such libraries (to the extent that some mechanisms may
not be provided by libraries, or until they are), and</li>
          <li pn="section-1.1-2.3">Developers of specifications that rely on JWTs, both inside and
	  outside the IETF.</li>
        </ul>
      </section>
      <section anchor="conventions-used-in-this-document" numbered="true" toc="include" removeInRFC="false" pn="section-1.2">
        <name slugifiedName="name-conventions-used-in-this-do">Conventions Used in this Document</name>
        <t pn="section-1.2-1">                                                                     
    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" format="default" sectionFormat="of" derivedContent="RFC2119"/> <xref target="RFC8174" format="default" sectionFormat="of" derivedContent="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.            
        </t>
      </section>
    </section>
    <section anchor="threats-and-vulnerabilities" numbered="true" toc="include" removeInRFC="false" pn="section-2">
      <name slugifiedName="name-threats-and-vulnerabilities">Threats and Vulnerabilities</name>
      <t pn="section-2-1">This section lists some known and possible problems with JWT
      implementations and deployments. 
Each problem description is followed by references to one or more mitigations to those problems.</t>
      <section anchor="weak-signatures-and-insufficient-signature-validation" numbered="true" toc="include" removeInRFC="false" pn="section-2.1">
        <name slugifiedName="name-weak-signatures-and-insuffi">Weak Signatures and Insufficient Signature Validation</name>
        <t pn="section-2.1-1">Signed JSON Web Tokens carry an explicit indication of the signing algorithm,
in the form of the "alg" Header Parameter, to facilitate cryptographic agility.
This, in conjunction with design flaws in some libraries and applications,
	has led to several attacks:</t>
        <ul spacing="normal" bare="false" empty="false" pn="section-2.1-2">
          <li pn="section-2.1-2.1">The algorithm can be changed to "none" by an attacker, and some libraries would trust
this value and "validate" the JWT without checking any signature.</li>
          <li pn="section-2.1-2.2">An "RS256" (RSA, 2048 bit) parameter value can be changed into
"HS256" (HMAC, SHA-256), and some libraries
would try to validate the signature using HMAC-SHA256 and using the RSA public key as the
HMAC shared secret (see <xref target="McLean" format="default" sectionFormat="of" derivedContent="McLean"/> and
	  <xref target="CVE-2015-9235" format="default" sectionFormat="of" derivedContent="CVE-2015-9235"/>).</li>
        </ul>
        <t pn="section-2.1-3">For mitigations, see Sections <xref target="algorithm-verification" format="counter" sectionFormat="of" derivedContent="3.1"/> and <xref target="appropriate-algorithms" format="counter" sectionFormat="of" derivedContent="3.2"/>.</t>
      </section>
      <section anchor="weak-symmetric-keys" numbered="true" toc="include" removeInRFC="false" pn="section-2.2">
        <name slugifiedName="name-weak-symmetric-keys">Weak Symmetric Keys</name>
        <t pn="section-2.2-1">In addition, some applications use a keyed Message Authentication
	Code (MAC) algorithm, such as
"HS256", to sign tokens but supply a weak symmetric key with
insufficient entropy (such as a human-memorable password). Such keys
are vulnerable to offline brute-force or dictionary attacks once an
attacker gets hold of such a token <xref target="Langkemper" format="default" sectionFormat="of" derivedContent="Langkemper"/>.</t>
        <t pn="section-2.2-2">For mitigations, see <xref target="key-entropy" format="default" sectionFormat="of" derivedContent="Section 3.5"/>.</t>
      </section>
      <section anchor="incorrect-composition-of-encryption-and-signature" numbered="true" toc="include" removeInRFC="false" pn="section-2.3">
        <name slugifiedName="name-incorrect-composition-of-en">Incorrect Composition of Encryption and Signature</name>
        <t pn="section-2.3-1">Some libraries that decrypt a JWE-encrypted JWT to obtain a JWS-signed object
do not always validate the internal signature.</t>
        <t pn="section-2.3-2">For mitigations, see <xref target="validate-crypto" format="default" sectionFormat="of" derivedContent="Section 3.3"/>.</t>
      </section>
      <section anchor="plaintext-leakage-through-analysis-of-ciphertext-length" numbered="true" toc="include" removeInRFC="false" pn="section-2.4">
        <name slugifiedName="name-plaintext-leakage-through-a">Plaintext Leakage through Analysis of Ciphertext Length</name>
        <t pn="section-2.4-1">Many encryption algorithms leak information about the length of the
	plaintext, with a varying amount of 
leakage depending on the algorithm and mode of operation. This problem is exacerbated
when the plaintext is initially compressed, because the length of the
compressed plaintext and, thus, 
the ciphertext 
depends not only on the length of the original plaintext but also
on its content.
Compression attacks are particularly
powerful when there is attacker-controlled data in the same compression
space as secret data, which is the case for some attacks on HTTPS.</t>
        <t pn="section-2.4-2">See <xref target="Kelsey" format="default" sectionFormat="of" derivedContent="Kelsey"/> for general background
on compression and encryption and <xref target="Alawatugoda" format="default" sectionFormat="of" derivedContent="Alawatugoda"/> for a specific example of attacks on HTTP cookies.</t>
        <t pn="section-2.4-3">For mitigations, see <xref target="no-compression" format="default" sectionFormat="of" derivedContent="Section 3.6"/>.</t>
      </section>
      <section anchor="insecure-use-of-elliptic-curve-encryption" numbered="true" toc="include" removeInRFC="false" pn="section-2.5">
        <name slugifiedName="name-insecure-use-of-elliptic-cu">Insecure Use of Elliptic Curve Encryption</name>
        <t pn="section-2.5-1">Per <xref target="Sanso" format="default" sectionFormat="of" derivedContent="Sanso"/>, several Javascript
	Object Signing and Encryption (JOSE) libraries
	fail to validate their inputs correctly 
when performing elliptic curve key agreement (the "ECDH-ES" algorithm).
An attacker that is able to send JWEs of its choosing that use invalid curve points and
observe the cleartext outputs resulting from decryption with the invalid curve points
can use this vulnerability to recover the recipient's private key.</t>
        <t pn="section-2.5-2">For mitigations, see <xref target="validate-inputs" format="default" sectionFormat="of" derivedContent="Section 3.4"/>.</t>
      </section>
      <section anchor="multiplicity-of-json-encodings" numbered="true" toc="include" removeInRFC="false" pn="section-2.6">
        <name slugifiedName="name-multiplicity-of-json-encodi">Multiplicity of JSON Encodings</name>
        <t pn="section-2.6-1">Previous versions of the JSON format, such as the obsoleted <xref target="RFC7159" format="default" sectionFormat="of" derivedContent="RFC7159"/>, 
allowed several different character
encodings: UTF-8, UTF-16, and UTF-32. This is not the case anymore, with the latest
standard <xref target="RFC8259" format="default" sectionFormat="of" derivedContent="RFC8259"/> only allowing UTF-8 except
for internal use within a "closed ecosystem". 
This ambiguity, where older implementations and those used within closed environments may generate
non-standard encodings, may result in the JWT being
misinterpreted by its recipient. This, in turn, could be used by a malicious sender to bypass
the recipient's validation checks.</t>
        <t pn="section-2.6-2">For mitigations, see <xref target="use-utf8" format="default" sectionFormat="of" derivedContent="Section 3.7"/>.</t>
      </section>
      <section anchor="substitution" numbered="true" toc="include" removeInRFC="false" pn="section-2.7">
        <name slugifiedName="name-substitution-attacks">Substitution Attacks</name>
        <t pn="section-2.7-1">There are attacks in which one recipient will be given a JWT that was intended for it
and will attempt to use it at a different recipient for which that JWT was not intended.
For instance, if an OAuth 2.0 <xref target="RFC6749" format="default" sectionFormat="of" derivedContent="RFC6749"/> access
token is legitimately presented to an 
OAuth 2.0 protected resource for which it is intended, that protected resource might then present
that same access token to a different protected resource for which the access token is not intended,
in an attempt to gain access. If such situations are not caught, this can result in
the attacker gaining access to resources that it is not entitled to access.</t>
        <t pn="section-2.7-2">For mitigations, see Sections <xref target="validate-iss-sub" format="counter" sectionFormat="of" derivedContent="3.8"/> and <xref target="use-aud" format="counter" sectionFormat="of" derivedContent="3.9"/>.</t>
      </section>
      <section anchor="cross-jwt-confusion" numbered="true" toc="include" removeInRFC="false" pn="section-2.8">
        <name slugifiedName="name-cross-jwt-confusion">Cross-JWT Confusion</name>
        <t pn="section-2.8-1">As JWTs are being used by more different protocols in diverse
	application areas, it becomes increasingly 
important to prevent cases of JWT tokens that have been issued for one purpose
being subverted and used for another.
Note that this is a specific type of substitution attack.
If the JWT could be used in an application context in which it could be
confused with other kinds of JWTs, 
then mitigations <bcp14>MUST</bcp14> be employed to prevent these substitution attacks.</t>
        <t pn="section-2.8-2">For mitigations, see Sections <xref target="validate-iss-sub" format="counter" sectionFormat="of" derivedContent="3.8"/>, <xref target="use-aud" format="counter" sectionFormat="of" derivedContent="3.9"/>, 
<xref target="use-typ" format="counter" sectionFormat="of" derivedContent="3.11"/>, and <xref target="preventing-confusion" format="counter" sectionFormat="of" derivedContent="3.12"/>.</t>
      </section>
      <section anchor="indirect-attacks-on-the-server" numbered="true" toc="include" removeInRFC="false" pn="section-2.9">
        <name slugifiedName="name-indirect-attacks-on-the-ser">Indirect Attacks on the Server</name>
        <t pn="section-2.9-1">Various JWT claims are used by the recipient to perform lookup operations,
such as database and Lightweight Directory Access Protocol (LDAP) searches.
Others include URLs that are similarly looked up by the server. Any of these claims can be used by
an attacker as vectors for injection attacks or server-side request forgery (SSRF) attacks.</t>
        <t pn="section-2.9-2">For mitigations, see <xref target="do-not-trust-claims" format="default" sectionFormat="of" derivedContent="Section 3.10"/>.</t>
      </section>
    </section>
    <section anchor="BP" numbered="true" toc="include" removeInRFC="false" pn="section-3">
      <name slugifiedName="name-best-practices">Best Practices</name>
      <t pn="section-3-1">The best practices listed below should be applied by practitioners
to mitigate the threats listed in the preceding section.</t>
      <section anchor="algorithm-verification" numbered="true" toc="include" removeInRFC="false" pn="section-3.1">
        <name slugifiedName="name-perform-algorithm-verificat">Perform Algorithm Verification</name>
        <t pn="section-3.1-1">Libraries <bcp14>MUST</bcp14> enable the caller to specify a
	supported set of algorithms and 
<bcp14>MUST NOT</bcp14> use any other algorithms when performing cryptographic operations.
The library <bcp14>MUST</bcp14> ensure that the "alg" or "enc" header specifies the same algorithm
that is used for the cryptographic operation.
Moreover, each key <bcp14>MUST</bcp14> be used with exactly one algorithm,
and this <bcp14>MUST</bcp14> be checked when the cryptographic operation is performed.</t>
      </section>
      <section anchor="appropriate-algorithms" numbered="true" toc="include" removeInRFC="false" pn="section-3.2">
        <name slugifiedName="name-use-appropriate-algorithms">Use Appropriate Algorithms</name>
        <t pn="section-3.2-1">As <xref target="RFC7515" sectionFormat="of" section="5.2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc7515#section-5.2" derivedContent="RFC7515"/> says,
"it is an application decision which algorithms may 
be used in a given context. Even if a JWS can be successfully
validated, unless the algorithm(s) used in the JWS are acceptable to
the application, it <bcp14>SHOULD</bcp14> consider the JWS to be invalid."</t>
        <t pn="section-3.2-2">Therefore, applications <bcp14>MUST</bcp14> only allow the use of
	cryptographically current algorithms 
that meet the security requirements of the application.
This set will vary over time as new algorithms are introduced
and existing algorithms are deprecated due to discovered cryptographic weaknesses.
Applications <bcp14>MUST</bcp14> therefore be designed to enable cryptographic agility.</t>
        <t pn="section-3.2-3">That said, if a JWT is cryptographically protected end-to-end by a
	transport layer, such as TLS 
using cryptographically current algorithms, there may be no need to apply another layer of
cryptographic protections to the JWT.
In such cases, the use of the "none" algorithm can be perfectly acceptable.
The "none" algorithm should only be used when the JWT is cryptographically protected by other means.
JWTs using "none" are often used in application contexts in which the content is optionally signed;
then, the URL-safe claims representation and processing can be the same in both
the signed and unsigned cases. 
JWT libraries <bcp14>SHOULD NOT</bcp14> generate JWTs using "none" unless
explicitly requested to do so by the caller. 
Similarly, JWT libraries <bcp14>SHOULD NOT</bcp14> consume JWTs using "none"
	unless explicitly requested by the caller.</t>
        <t pn="section-3.2-4">Applications <bcp14>SHOULD</bcp14> follow these algorithm-specific recommendations:</t>
        <ul spacing="normal" bare="false" empty="false" pn="section-3.2-5">
          <li pn="section-3.2-5.1">Avoid all RSA-PKCS1 v1.5 encryption algorithms (<xref target="RFC8017" sectionFormat="comma" section="7.2" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8017#section-7.2" derivedContent="RFC8017"/>), preferring
	  RSAES-OAEP
	  (<xref target="RFC8017" sectionFormat="comma" section="7.1" format="default" derivedLink="https://rfc-editor.org/rfc/rfc8017#section-7.1" derivedContent="RFC8017"/>).</li>
          <li pn="section-3.2-5.2">Elliptic Curve Digital Signature Algorithm (ECDSA) signatures <xref target="ANSI-X962-2005" format="default" sectionFormat="of" derivedContent="ANSI-X962-2005"/> require a unique random value for every message
	  that is signed. 
If even just a few bits of the random value are predictable across multiple messages, then
the security of the signature scheme may be compromised. In the worst case,
the private key may be recoverable by an attacker. To counter these attacks,
JWT libraries <bcp14>SHOULD</bcp14> implement ECDSA using the deterministic
approach defined in <xref target="RFC6979" format="default" sectionFormat="of" derivedContent="RFC6979"/>. 
This approach is completely compatible with existing ECDSA verifiers and so can be implemented
without new algorithm identifiers being required.</li>
        </ul>
      </section>
      <section anchor="validate-crypto" numbered="true" toc="include" removeInRFC="false" pn="section-3.3">
        <name slugifiedName="name-validate-all-cryptographic-">Validate All Cryptographic Operations</name>
        <t pn="section-3.3-1">All cryptographic operations used in the JWT <bcp14>MUST</bcp14> be
	validated and the entire JWT <bcp14>MUST</bcp14> be rejected 
if any of them fail to validate.
This is true not only of JWTs with a single set of Header Parameters
but also for Nested JWTs in which both outer and inner operations <bcp14>MUST</bcp14> be validated
using the keys and algorithms supplied by the application.</t>
      </section>
      <section anchor="validate-inputs" numbered="true" toc="include" removeInRFC="false" pn="section-3.4">
        <name slugifiedName="name-validate-cryptographic-inpu">Validate Cryptographic Inputs</name>
        <t pn="section-3.4-1">Some cryptographic operations, such as Elliptic Curve Diffie-Hellman key agreement
("ECDH-ES"), take inputs that may contain invalid values. This includes points not on
the specified elliptic curve 
or other invalid points (e.g., <xref target="Valenta" format="default" sectionFormat="of" derivedContent="Valenta"/>, Section 7.1).
The JWS/JWE library itself must validate these inputs before using them,
or it must use underlying cryptographic libraries that do so (or both!).</t>
        <t pn="section-3.4-2">Elliptic Curve Diffie-Hellman Ephemeral Static (ECDH-ES) ephemeral
	public key (epk) inputs should be validated 
	according to the recipient's 
chosen elliptic curve. For the NIST prime-order curves P-256, P-384, and P-521,
validation <bcp14>MUST</bcp14> 
be performed according to Section 5.6.2.3.4 (ECC Partial Public-Key Validation
Routine) of "Recommendation for Pair-Wise Key-Establishment Schemes Using Discrete Logarithm Cryptography" <xref target="nist-sp-800-56a-r3" format="default" sectionFormat="of" derivedContent="nist-sp-800-56a-r3"/>.
If the "X25519" or "X448" <xref target="RFC8037" format="default" sectionFormat="of" derivedContent="RFC8037"/> algorithms are used,
then the security considerations in <xref target="RFC8037" format="default" sectionFormat="of" derivedContent="RFC8037"/> apply.</t>
      </section>
      <section anchor="key-entropy" numbered="true" toc="include" removeInRFC="false" pn="section-3.5">
        <name slugifiedName="name-ensure-cryptographic-keys-h">Ensure Cryptographic Keys Have Sufficient Entropy</name>
        <t pn="section-3.5-1">The Key Entropy and Random Values advice in <xref target="RFC7515" section="10.1" sectionFormat="of" format="default" derivedLink="https://rfc-editor.org/rfc/rfc7515#section-10.1" derivedContent="RFC7515"/> and the
	Password Considerations in <xref target="RFC7518" section="8.8" sectionFormat="of" format="default" derivedLink="https://rfc-editor.org/rfc/rfc7518#section-8.8" derivedContent="RFC7518"/>
          <bcp14>MUST</bcp14> be followed.
In particular, human-memorizable passwords <bcp14>MUST NOT</bcp14> be directly used
as the key to a keyed-MAC algorithm such as "HS256".
Moreover, passwords should only be used to perform key encryption, rather
than content encryption, 
as described in <xref target="RFC7518" sectionFormat="of" section="4.8" format="default" derivedLink="https://rfc-editor.org/rfc/rfc7518#section-4.8" derivedContent="RFC7518"/>.
Note that even when used for key encryption, password-based encryption is
	still subject to brute-force attacks.</t>
      </section>
      <section anchor="no-compression" numbered="true" toc="include" removeInRFC="false" pn="section-3.6">
        <name slugifiedName="name-avoid-compression-of-encryp">Avoid Compression of Encryption Inputs</name>
        <t pn="section-3.6-1">Compression of data <bcp14>SHOULD NOT</bcp14> be done before encryption, because
such compressed data often reveals information about the plaintext.</t>
      </section>
      <section anchor="use-utf8" numbered="true" toc="include" removeInRFC="false" pn="section-3.7">
        <name slugifiedName="name-use-utf-8">Use UTF-8</name>
        <t pn="section-3.7-1"><xref target="RFC7515" format="default" sectionFormat="of" derivedContent="RFC7515"/>, <xref target="RFC7516" format="default" sectionFormat="of" derivedContent="RFC7516"/>, and <xref target="RFC7519" format="default" sectionFormat="of" derivedContent="RFC7519"/> all
	specify that UTF-8 be used for encoding and decoding JSON 
used in Header Parameters and JWT Claims Sets. This is also in line with the
latest JSON specification <xref target="RFC8259" format="default" sectionFormat="of" derivedContent="RFC8259"/>. 
Implementations and applications <bcp14>MUST</bcp14> do this and not use or admit the use of
other Unicode encodings for these purposes.</t>
      </section>
      <section anchor="validate-iss-sub" numbered="true" toc="include" removeInRFC="false" pn="section-3.8">
        <name slugifiedName="name-validate-issuer-and-subject">Validate Issuer and Subject</name>
        <t pn="section-3.8-1">When a JWT contains an "iss" (issuer) claim, the application
	<bcp14>MUST</bcp14> validate that the cryptographic keys 
used for the cryptographic operations in the JWT belong to the issuer.
If they do not, the application <bcp14>MUST</bcp14> reject the JWT.</t>
        <t pn="section-3.8-2">The means of determining the keys owned by an issuer is application-specific.
As one example, OpenID Connect <xref target="OpenID.Core" format="default" sectionFormat="of" derivedContent="OpenID.Core"/>
issuer values are "https" URLs 
that reference a JSON metadata document that contains a "jwks_uri" value that is
an "https" URL from which the issuer's keys are retrieved as a JWK Set <xref target="RFC7517" format="default" sectionFormat="of" derivedContent="RFC7517"/>. 
This same mechanism is used by <xref target="RFC8414" format="default" sectionFormat="of" derivedContent="RFC8414"/>.
Other applications may use different means of binding keys to issuers.</t>
        <t pn="section-3.8-3">Similarly, when the JWT contains a "sub" (subject) claim, the
	application <bcp14>MUST</bcp14> validate that 
the subject value corresponds to a valid subject and/or issuer-subject pair at the application.
This may include confirming that the issuer is trusted by the application.
If the issuer, subject, or the pair are invalid, the application
	<bcp14>MUST</bcp14> reject the JWT.</t>
      </section>
      <section anchor="use-aud" numbered="true" toc="include" removeInRFC="false" pn="section-3.9">
        <name slugifiedName="name-use-and-validate-audience">Use and Validate Audience</name>
        <t pn="section-3.9-1">If the same issuer can issue JWTs that are intended for use by more
	than one relying party or application, 
the JWT <bcp14>MUST</bcp14> contain an "aud" (audience) claim that can be used
to determine whether the JWT 
is being used by an intended party or was substituted by an attacker at an unintended party.</t>
        <t pn="section-3.9-2">In such cases, the relying party or application <bcp14>MUST</bcp14>
	validate the audience value, 
and if the audience value is not present or not associated with the recipient,
it <bcp14>MUST</bcp14> reject the JWT.</t>
      </section>
      <section anchor="do-not-trust-claims" numbered="true" toc="include" removeInRFC="false" pn="section-3.10">
        <name slugifiedName="name-do-not-trust-received-claim">Do Not Trust Received Claims</name>
        <t pn="section-3.10-1">The "kid" (key ID) header is used by the relying application to
	perform key lookup. Applications 
should ensure that this does not create SQL or LDAP injection vulnerabilities by validating
and/or sanitizing the received value.</t>
        <t pn="section-3.10-2">Similarly, blindly following a "jku" (JWK set URL) or "x5u" (X.509 URL) header,
which may contain an arbitrary URL,
could result in server-side request forgery (SSRF) attacks. Applications
<bcp14>SHOULD</bcp14> protect against such 
attacks, e.g., by matching the URL to a whitelist of allowed locations
and ensuring no cookies are sent in the GET request.</t>
      </section>
      <section anchor="use-typ" numbered="true" toc="include" removeInRFC="false" pn="section-3.11">
        <name slugifiedName="name-use-explicit-typing">Use Explicit Typing</name>
        <t pn="section-3.11-1">Sometimes, one kind of JWT can be confused for another. If a particular
kind of JWT is subject to such confusion, that JWT can include an explicit
JWT type value, and the validation rules can specify checking the type.
This mechanism can prevent such confusion.
Explicit JWT typing is accomplished by using the "typ" Header Parameter.
For instance, the <xref target="RFC8417" format="default" sectionFormat="of" derivedContent="RFC8417"/> specification uses
the "application/secevent+jwt" media type 
to perform explicit typing of Security Event Tokens (SETs).</t>
        <t pn="section-3.11-2">Per the definition of "typ" in <xref target="RFC7515" sectionFormat="of" section="4.1.9" format="default" derivedLink="https://rfc-editor.org/rfc/rfc7515#section-4.1.9" derivedContent="RFC7515"/>,
it is <bcp14>RECOMMENDED</bcp14> that the "application/" prefix be omitted from the "typ" value.
Therefore, for example, the "typ" value used to explicitly include a type for a SET
<bcp14>SHOULD</bcp14> be "secevent+jwt".
When explicit typing is employed for a JWT, it is <bcp14>RECOMMENDED</bcp14>
that a media type name of the format 
"application/example+jwt" be used, where "example" is replaced by the
	identifier for the specific kind of JWT.</t>
        <t pn="section-3.11-3">When applying explicit typing to a Nested JWT, the "typ" Header
	Parameter containing the explicit type value 
<bcp14>MUST</bcp14> be present in the inner JWT of the Nested JWT (the JWT
whose payload is the JWT Claims Set). 
In some cases, the same "typ" Header Parameter value will be present in the outer JWT as well,
to explicitly type the entire Nested JWT.</t>
        <t pn="section-3.11-4">Note that the use of explicit typing may not achieve disambiguation
	from existing kinds of JWTs, 
as the validation rules for existing kinds of JWTs often do not use the "typ" Header Parameter value.
Explicit typing is <bcp14>RECOMMENDED</bcp14> for new uses of JWTs.</t>
      </section>
      <section anchor="preventing-confusion" numbered="true" toc="include" removeInRFC="false" pn="section-3.12">
        <name slugifiedName="name-use-mutually-exclusive-vali">Use Mutually Exclusive Validation Rules for Different Kinds of JWTs</name>
        <t pn="section-3.12-1">Each application of JWTs defines a profile specifying the required
	and optional JWT claims 
and the validation rules associated with them.
If more than one kind of JWT can be issued by the same issuer,
the validation rules for those JWTs <bcp14>MUST</bcp14> be written such that
they are mutually exclusive, 
rejecting JWTs of the wrong kind.
To prevent substitution of JWTs from one context into another,
application developers may employ a number of strategies:</t>
        <ul spacing="normal" bare="false" empty="false" pn="section-3.12-2">
          <li pn="section-3.12-2.1">Use explicit typing for different kinds of JWTs.
Then the distinct "typ" values can be used to differentiate between the
	  different kinds of JWTs.</li>
          <li pn="section-3.12-2.2">Use different sets of required claims or different required claim values.
Then the validation rules for one kind of JWT will reject those with different
	  claims or values.</li>
          <li pn="section-3.12-2.3">Use different sets of required Header Parameters or different
	  required Header Parameter values. 
Then the validation rules for one kind of JWT will reject those with different
	  Header Parameters or values.</li>
          <li pn="section-3.12-2.4">Use different keys for different kinds of JWTs.
Then the keys used to validate one kind of JWT will fail to validate other kinds of JWTs.</li>
          <li pn="section-3.12-2.5">Use different "aud" values for different uses of JWTs from the same issuer.
Then audience validation will reject JWTs substituted into inappropriate contexts.</li>
          <li pn="section-3.12-2.6">Use different issuers for different kinds of JWTs.
Then the distinct "iss" values can be used to segregate the different kinds of JWTs.</li>
        </ul>
        <t pn="section-3.12-3">Given the broad diversity of JWT usage and applications,
the best combination of types, required claims, values, Header Parameters, key usages, and issuers
to differentiate among different kinds of JWTs
will, in general, be application-specific.
As discussed in <xref target="use-typ" format="default" sectionFormat="of" derivedContent="Section 3.11"/>, for new JWT
	applications, the use of explicit typing is
	<bcp14>RECOMMENDED</bcp14>.</t>
      </section>
    </section>
    <section anchor="security-considerations" numbered="true" toc="include" removeInRFC="false" pn="section-4">
      <name slugifiedName="name-security-considerations">Security Considerations</name>
      <t pn="section-4-1">This entire document is about security considerations when
      implementing and deploying JSON Web Tokens.</t>
    </section>
    <section anchor="iana-considerations" numbered="true" toc="include" removeInRFC="false" pn="section-5">
      <name slugifiedName="name-iana-considerations">IANA Considerations</name>
      <t pn="section-5-1">This document has no IANA actions.</t>
    </section>
  </middle>
  <back>
    <references pn="section-6">
      <name slugifiedName="name-references">References</name>
      <references pn="section-6.1">
        <name slugifiedName="name-normative-references">Normative References</name>
        <reference anchor="nist-sp-800-56a-r3" target="https://doi.org/10.6028/NIST.SP.800-56Ar3" quoteTitle="true" derivedAnchor="nist-sp-800-56a-r3">
          <front>
            <title>Recommendation for Pair-Wise Key-Establishment Schemes Using Discrete Logarithm Cryptography</title>
            <author initials="E." surname="Barker" fullname="Elaine Barker">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="L." surname="Chen" fullname="Lily Chen">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="A." surname="Roginsky" fullname="Allen Roginsky">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="A." surname="Vassilev" fullname="Apostol Vassilev">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="R." surname="Davis" fullname="Richard Davis">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2018" month="April"/>
          </front>
          <seriesInfo name="NIST Special Publication" value="800-56A Revision 3"/>
          <seriesInfo name="DOI" value="10.6028/NIST.SP.800-56Ar3"/>
        </reference>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" quoteTitle="true" derivedAnchor="RFC2119">
          <front>
            <title>Key words for use in RFCs to Indicate Requirement Levels</title>
            <author initials="S." surname="Bradner" fullname="S. Bradner">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="1997" month="March"/>
            <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="RFC6979" target="https://www.rfc-editor.org/info/rfc6979" quoteTitle="true" derivedAnchor="RFC6979">
          <front>
            <title>Deterministic Usage of the Digital Signature Algorithm (DSA) and Elliptic Curve Digital Signature Algorithm (ECDSA)</title>
            <author initials="T." surname="Pornin" fullname="T. Pornin">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2013" month="August"/>
            <abstract>
              <t>This document defines a deterministic digital signature generation procedure.  Such signatures are compatible with standard Digital Signature Algorithm (DSA) and Elliptic Curve Digital Signature Algorithm (ECDSA) digital signatures and can be processed with unmodified verifiers, which need not be aware of the procedure described therein.  Deterministic signatures retain the cryptographic security features associated with digital signatures but can be more easily implemented in various environments, since they do not need access to a source of high-quality randomness.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="6979"/>
          <seriesInfo name="DOI" value="10.17487/RFC6979"/>
        </reference>
        <reference anchor="RFC7515" target="https://www.rfc-editor.org/info/rfc7515" quoteTitle="true" derivedAnchor="RFC7515">
          <front>
            <title>JSON Web Signature (JWS)</title>
            <author initials="M." surname="Jones" fullname="M. Jones">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Bradley" fullname="J. Bradley">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="N." surname="Sakimura" fullname="N. Sakimura">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2015" month="May"/>
            <abstract>
              <t>JSON Web Signature (JWS) represents content secured with digital signatures or Message Authentication Codes (MACs) using JSON-based data structures.  Cryptographic algorithms and identifiers for use with this specification are described in the separate JSON Web Algorithms (JWA) specification and an IANA registry defined by that specification.  Related encryption capabilities are described in the separate JSON Web Encryption (JWE) specification.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7515"/>
          <seriesInfo name="DOI" value="10.17487/RFC7515"/>
        </reference>
        <reference anchor="RFC7516" target="https://www.rfc-editor.org/info/rfc7516" quoteTitle="true" derivedAnchor="RFC7516">
          <front>
            <title>JSON Web Encryption (JWE)</title>
            <author initials="M." surname="Jones" fullname="M. Jones">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Hildebrand" fullname="J. Hildebrand">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2015" month="May"/>
            <abstract>
              <t>JSON Web Encryption (JWE) represents encrypted content using JSON-based data structures.  Cryptographic algorithms and identifiers for use with this specification are described in the separate JSON Web Algorithms (JWA) specification and IANA registries defined by that specification.  Related digital signature and Message Authentication Code (MAC) capabilities are described in the separate JSON Web Signature (JWS) specification.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7516"/>
          <seriesInfo name="DOI" value="10.17487/RFC7516"/>
        </reference>
        <reference anchor="RFC7518" target="https://www.rfc-editor.org/info/rfc7518" quoteTitle="true" derivedAnchor="RFC7518">
          <front>
            <title>JSON Web Algorithms (JWA)</title>
            <author initials="M." surname="Jones" fullname="M. Jones">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2015" month="May"/>
            <abstract>
              <t>This specification registers cryptographic algorithms and identifiers to be used with the JSON Web Signature (JWS), JSON Web Encryption (JWE), and JSON Web Key (JWK) specifications.  It defines several IANA registries for these identifiers.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7518"/>
          <seriesInfo name="DOI" value="10.17487/RFC7518"/>
        </reference>
        <reference anchor="RFC7519" target="https://www.rfc-editor.org/info/rfc7519" quoteTitle="true" derivedAnchor="RFC7519">
          <front>
            <title>JSON Web Token (JWT)</title>
            <author initials="M." surname="Jones" fullname="M. Jones">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Bradley" fullname="J. Bradley">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="N." surname="Sakimura" fullname="N. Sakimura">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2015" month="May"/>
            <abstract>
              <t>JSON Web Token (JWT) is a compact, URL-safe means of representing claims to be transferred between two parties.  The claims in a JWT are encoded as a JSON object that is used as the payload of a JSON Web Signature (JWS) structure or as the plaintext of a JSON Web Encryption (JWE) structure, enabling the claims to be digitally signed or integrity protected with a Message Authentication Code (MAC) and/or encrypted.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7519"/>
          <seriesInfo name="DOI" value="10.17487/RFC7519"/>
        </reference>
        <reference anchor="RFC8017" target="https://www.rfc-editor.org/info/rfc8017" quoteTitle="true" derivedAnchor="RFC8017">
          <front>
            <title>PKCS #1: RSA Cryptography Specifications Version 2.2</title>
            <author initials="K." surname="Moriarty" fullname="K. Moriarty" role="editor">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="B." surname="Kaliski" fullname="B. Kaliski">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Jonsson" fullname="J. Jonsson">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="A." surname="Rusch" fullname="A. Rusch">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2016" month="November"/>
            <abstract>
              <t>This document provides recommendations for the implementation of public-key cryptography based on the RSA algorithm, covering cryptographic primitives, encryption schemes, signature schemes with appendix, and ASN.1 syntax for representing keys and for identifying the schemes.</t>
              <t>This document represents a republication of PKCS #1 v2.2 from RSA Laboratories' Public-Key Cryptography Standards (PKCS) series.  By publishing this RFC, change control is transferred to the IETF.</t>
              <t>This document also obsoletes RFC 3447.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8017"/>
          <seriesInfo name="DOI" value="10.17487/RFC8017"/>
        </reference>
        <reference anchor="RFC8037" target="https://www.rfc-editor.org/info/rfc8037" quoteTitle="true" derivedAnchor="RFC8037">
          <front>
            <title>CFRG Elliptic Curve Diffie-Hellman (ECDH) and Signatures in JSON Object Signing and Encryption (JOSE)</title>
            <author initials="I." surname="Liusvaara" fullname="I. Liusvaara">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="January"/>
            <abstract>
              <t>This document defines how to use the Diffie-Hellman algorithms "X25519" and "X448" as well as the signature algorithms "Ed25519" and "Ed448" from the IRTF CFRG elliptic curves work in JSON Object Signing and Encryption (JOSE).</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8037"/>
          <seriesInfo name="DOI" value="10.17487/RFC8037"/>
        </reference>
        <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" quoteTitle="true" derivedAnchor="RFC8174">
          <front>
            <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
            <author initials="B." surname="Leiba" fullname="B. Leiba">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="May"/>
            <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>
        <reference anchor="RFC8259" target="https://www.rfc-editor.org/info/rfc8259" quoteTitle="true" derivedAnchor="RFC8259">
          <front>
            <title>The JavaScript Object Notation (JSON) Data Interchange Format</title>
            <author initials="T." surname="Bray" fullname="T. Bray" role="editor">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2017" month="December"/>
            <abstract>
              <t>JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format.  It was derived from the ECMAScript Programming Language Standard.  JSON defines a small set of formatting rules for the portable representation of structured data.</t>
              <t>This document removes inconsistencies with other specifications of JSON, repairs specification errors, and offers experience-based interoperability guidance.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="90"/>
          <seriesInfo name="RFC" value="8259"/>
          <seriesInfo name="DOI" value="10.17487/RFC8259"/>
        </reference>
      </references>
      <references pn="section-6.2">
        <name slugifiedName="name-informative-references">Informative References</name>
        <reference anchor="Alawatugoda" quoteTitle="true" target="https://doi.org/10.1007/978-3-662-47854-7_6" derivedAnchor="Alawatugoda">
          <front>
            <title>Protecting Encrypted Cookies from Compression Side-Channel Attacks</title>
            <author initials="J." surname="Alawatugoda" fullname="Janaka Alawatugoda">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="D." surname="Stebila" fullname="Douglas Stebila">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="C." surname="Boyd" fullname="Colin Boyd">
              <organization showOnFrontPage="true"/>
            </author>
            <date month="July" year="2015"/>
          </front>
          <refcontent>Financial Cryptography and Data Security, pp. 86-106</refcontent>
          <seriesInfo name="DOI" value="10.1007/978-3-662-47854-7_6"/>
        </reference>
        <reference anchor="ANSI-X962-2005" quoteTitle="true" derivedAnchor="ANSI-X962-2005">
          <front>
            <title>Public Key Cryptography for the Financial Services Industry: the Elliptic Curve Digital Signature Algorithm (ECDSA)</title>
            <author>
              <organization showOnFrontPage="true">American National Standards Institute</organization>
            </author>
            <date year="2005" month="November"/>
          </front>
          <seriesInfo name="ANSI" value="X9.62-2005"/>
        </reference>
        <reference anchor="CVE-2015-9235" target="https://nvd.nist.gov/vuln/detail/CVE-2015-9235" quoteTitle="true" derivedAnchor="CVE-2015-9235">
          <front>
            <title>CVE-2015-9235 Detail</title>
            <author>
              <organization showOnFrontPage="true">NIST</organization>
            </author>
            <date month="May" year="2018"/>
          </front>
          <refcontent>National Vulnerability Database</refcontent>
        </reference>
        <reference anchor="Kelsey" quoteTitle="true" target="https://doi.org/10.1007/3-540-45661-9_21" derivedAnchor="Kelsey">
          <front>
            <title>Compression and Information Leakage of Plaintext</title>
            <author initials="J." surname="Kelsey" fullname="John Kelsey">
              <organization showOnFrontPage="true"/>
            </author>
            <date month="July" year="2002"/>
          </front>
          <refcontent>Fast Software Encryption, pp. 263-276</refcontent>
          <seriesInfo name="DOI" value="10.1007/3-540-45661-9_21"/>
        </reference>
        <reference anchor="Langkemper" target="https://www.sjoerdlangkemper.nl/2016/09/28/attacking-jwt-authentication/" quoteTitle="true" derivedAnchor="Langkemper">
          <front>
            <title>Attacking JWT authentication</title>
            <author initials="S." surname="Langkemper" fullname="Sjoerd Langkemper">
              <organization showOnFrontPage="true"/>
            </author>
            <date month="September" year="2016"/>
          </front>
        </reference>
        <reference anchor="McLean" target="https://auth0.com/blog/critical-vulnerabilities-in-json-web-token-libraries/" quoteTitle="true" derivedAnchor="McLean">
          <front>
            <title>Critical vulnerabilities in JSON Web Token libraries</title>
            <author initials="T." surname="McLean" fullname="Tim McLean">
              <organization showOnFrontPage="true"/>
            </author>
            <date month="March" year="2015"/>
          </front>
        </reference>
        <reference anchor="OpenID.Core" target="https://openid.net/specs/openid-connect-core-1_0.html" quoteTitle="true" derivedAnchor="OpenID.Core">
          <front>
            <title>OpenID Connect Core 1.0 incorporating errata set 1</title>
            <author initials="N." surname="Sakimura" fullname="Nat Sakimura">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Bradley" fullname="John Bradley">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="M." surname="Jones" fullname="Michael B. Jones">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="B." surname="de Medeiros" fullname="Breno de Medeiros">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="C." surname="Mortimore" fullname="Chuck Mortimore">
              <organization showOnFrontPage="true"/>
            </author>
            <date month="November" year="2014"/>
          </front>
        </reference>
        <reference anchor="RFC6749" target="https://www.rfc-editor.org/info/rfc6749" quoteTitle="true" derivedAnchor="RFC6749">
          <front>
            <title>The OAuth 2.0 Authorization Framework</title>
            <author initials="D." surname="Hardt" fullname="D. Hardt" role="editor">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2012" month="October"/>
            <abstract>
              <t>The OAuth 2.0 authorization framework enables a third-party application to obtain limited access to an HTTP service, either on behalf of a resource owner by orchestrating an approval interaction between the resource owner and the HTTP service, or by allowing the third-party application to obtain access on its own behalf.  This specification replaces and obsoletes the OAuth 1.0 protocol described in RFC 5849.  [STANDARDS-TRACK]</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="6749"/>
          <seriesInfo name="DOI" value="10.17487/RFC6749"/>
        </reference>
        <reference anchor="RFC7159" target="https://www.rfc-editor.org/info/rfc7159" quoteTitle="true" derivedAnchor="RFC7159">
          <front>
            <title>The JavaScript Object Notation (JSON) Data Interchange Format</title>
            <author initials="T." surname="Bray" fullname="T. Bray" role="editor">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2014" month="March"/>
            <abstract>
              <t>JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format.  It was derived from the ECMAScript Programming Language Standard.  JSON defines a small set of formatting rules for the portable representation of structured data.</t>
              <t>This document removes inconsistencies with other specifications of JSON, repairs specification errors, and offers experience-based interoperability guidance.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7159"/>
          <seriesInfo name="DOI" value="10.17487/RFC7159"/>
        </reference>
        <reference anchor="RFC7517" target="https://www.rfc-editor.org/info/rfc7517" quoteTitle="true" derivedAnchor="RFC7517">
          <front>
            <title>JSON Web Key (JWK)</title>
            <author initials="M." surname="Jones" fullname="M. Jones">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2015" month="May"/>
            <abstract>
              <t>A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key.  This specification also defines a JWK Set JSON data structure that represents a set of JWKs.  Cryptographic algorithms and identifiers for use with this specification are described in the separate JSON Web Algorithms (JWA) specification and IANA registries established by that specification.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="7517"/>
          <seriesInfo name="DOI" value="10.17487/RFC7517"/>
        </reference>
        <reference anchor="RFC8414" target="https://www.rfc-editor.org/info/rfc8414" quoteTitle="true" derivedAnchor="RFC8414">
          <front>
            <title>OAuth 2.0 Authorization Server Metadata</title>
            <author initials="M." surname="Jones" fullname="M. Jones">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="N." surname="Sakimura" fullname="N. Sakimura">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Bradley" fullname="J. Bradley">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2018" month="June"/>
            <abstract>
              <t>This specification defines a metadata format that an OAuth 2.0 client can use to obtain the information needed to interact with an OAuth 2.0 authorization server, including its endpoint locations and authorization server capabilities.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8414"/>
          <seriesInfo name="DOI" value="10.17487/RFC8414"/>
        </reference>
        <reference anchor="RFC8417" target="https://www.rfc-editor.org/info/rfc8417" quoteTitle="true" derivedAnchor="RFC8417">
          <front>
            <title>Security Event Token (SET)</title>
            <author initials="P." surname="Hunt" fullname="P. Hunt" role="editor">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="M." surname="Jones" fullname="M. Jones">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="W." surname="Denniss" fullname="W. Denniss">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="M." surname="Ansari" fullname="M. Ansari">
              <organization showOnFrontPage="true"/>
            </author>
            <date year="2018" month="July"/>
            <abstract>
              <t>This specification defines the Security Event Token (SET) data structure.  A SET describes statements of fact from the perspective of an issuer about a subject.  These statements of fact represent an event that occurred directly to or about a security subject, for example, a statement about the issuance or revocation of a token on behalf of a subject.  This specification is intended to enable representing security- and identity-related events.  A SET is a JSON Web Token (JWT), which can be optionally signed and/or encrypted. SETs can be distributed via protocols such as HTTP.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8417"/>
          <seriesInfo name="DOI" value="10.17487/RFC8417"/>
        </reference>
        <reference anchor="Sanso" target="https://blogs.adobe.com/security/2017/03/critical-vulnerability-uncovered-in-json-encryption.html" quoteTitle="true" derivedAnchor="Sanso">
          <front>
            <title>Critical Vulnerability Uncovered in JSON Encryption</title>
            <author initials="A." surname="Sanso" fullname="Antonio Sanso">
              <organization showOnFrontPage="true"/>
            </author>
            <date month="March" year="2017"/>
          </front>
        </reference>
        <reference anchor="Valenta" target="https://ia.cr/2018/298" quoteTitle="true" derivedAnchor="Valenta">
          <front>
            <title>In search of CurveSwap: Measuring elliptic curve implementations in the wild</title>
            <author initials="L." surname="Valenta" fullname="Luke Valenta">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="N." surname="Sullivan" fullname="Nick Sullivan">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="A." surname="Sanso" fullname="Antonio Sanso">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="N." surname="Heninger" fullname="Nadia Heninger">
              <organization showOnFrontPage="true"/>
            </author>
            <date month="March" year="2018"/>
          </front>
        </reference>
      </references>
    </references>
    <section anchor="acknowledgements" numbered="false" toc="include" removeInRFC="false" pn="section-appendix.a">
      <name slugifiedName="name-acknowledgements">Acknowledgements</name>
      <t pn="section-appendix.a-1">Thanks to <contact fullname="Antonio Sanso"/> for bringing the
      "ECDH-ES" invalid point attack to the attention 
of JWE and JWT implementers. <contact fullname="Tim McLean"/> published the
RSA/HMAC confusion attack <xref target="McLean" format="default" sectionFormat="of" derivedContent="McLean"/>. 
Thanks to <contact fullname="Nat Sakimura"/> for advocating the use of
explicit typing. Thanks to <contact fullname="Neil Madden"/> for his 
numerous comments, and to
<contact fullname="Carsten Bormann"/>,
<contact fullname="Brian Campbell"/>,
<contact fullname="Brian Carpenter"/>,
<contact fullname="Alissa Cooper"/>,
<contact fullname="Roman Danyliw"/>,
<contact fullname="Ben Kaduk"/>,
<contact fullname="Mirja Kühlewind"/>,
<contact fullname="Barry Leiba"/>,
<contact fullname="Eric Rescorla"/>,
<contact fullname="Adam Roach"/>,
<contact fullname="Martin Vigoureux"/>,
and <contact fullname="Éric Vyncke"/> 
for their reviews.</t>
    </section>
    <section anchor="authors-addresses" numbered="false" removeInRFC="false" toc="include" pn="section-appendix.b">
      <name slugifiedName="name-authors-addresses">Authors' Addresses</name>
      <author initials="Y." surname="Sheffer" fullname="Yaron Sheffer">
        <organization showOnFrontPage="true">Intuit</organization>
        <address>
          <email>yaronf.ietf@gmail.com</email>
        </address>
      </author>
      <author initials="D." surname="Hardt" fullname="Dick Hardt">
        <organization showOnFrontPage="true"/>
        <address>
          <email>dick.hardt@gmail.com</email>
        </address>
      </author>
      <author initials="M." surname="Jones" fullname="Michael B. Jones">
        <organization showOnFrontPage="true">Microsoft</organization>
        <address>
          <email>mbj@microsoft.com</email>
          <uri>https://self-issued.info/</uri>
        </address>
      </author>
    </section>
  </back>
</rfc>
