Tech-invite3GPPspaceIETFspace
959493929190898887868584838281807978777675747372717069686766656463626160595857565554535251504948474645444342414039383736353433323130292827262524232221201918171615141312111009080706050403020100
in Index   Prev   Next

RFC 7516

JSON Web Encryption (JWE)

Pages: 51
Proposed Standard
Errata
Part 1 of 3 – Pages 1 to 15
None   None   Next

Top   ToC   RFC7516 - Page 1
Internet Engineering Task Force (IETF)                          M. Jones
Request for Comments: 7516                                     Microsoft
Category: Standards Track                                  J. Hildebrand
ISSN: 2070-1721                                                    Cisco
                                                                May 2015


                       JSON Web Encryption (JWE)

Abstract

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. Status of This Memo This is an Internet Standards Track document. 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 Internet Standards is available in Section 2 of RFC 5741. Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc7516. Copyright Notice Copyright (c) 2015 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) 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.
Top   ToC   RFC7516 - Page 2

Table of Contents

1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 1.1. Notational Conventions . . . . . . . . . . . . . . . . . 4 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 3. JSON Web Encryption (JWE) Overview . . . . . . . . . . . . . 8 3.1. JWE Compact Serialization Overview . . . . . . . . . . . 8 3.2. JWE JSON Serialization Overview . . . . . . . . . . . . . 9 3.3. Example JWE . . . . . . . . . . . . . . . . . . . . . . . 10 4. JOSE Header . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1. Registered Header Parameter Names . . . . . . . . . . . . 11 4.1.1. "alg" (Algorithm) Header Parameter . . . . . . . . . 12 4.1.2. "enc" (Encryption Algorithm) Header Parameter . . . . 12 4.1.3. "zip" (Compression Algorithm) Header Parameter . . . 12 4.1.4. "jku" (JWK Set URL) Header Parameter . . . . . . . . 13 4.1.5. "jwk" (JSON Web Key) Header Parameter . . . . . . . . 13 4.1.6. "kid" (Key ID) Header Parameter . . . . . . . . . . . 13 4.1.7. "x5u" (X.509 URL) Header Parameter . . . . . . . . . 13 4.1.8. "x5c" (X.509 Certificate Chain) Header Parameter . . 13 4.1.9. "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter . . . . . . . . . . . . . . . . . . . . . . 14 4.1.10. "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header Parameter . . . . . . . . . . . . . . . . . . 14 4.1.11. "typ" (Type) Header Parameter . . . . . . . . . . . . 14 4.1.12. "cty" (Content Type) Header Parameter . . . . . . . . 14 4.1.13. "crit" (Critical) Header Parameter . . . . . . . . . 14 4.2. Public Header Parameter Names . . . . . . . . . . . . . . 14 4.3. Private Header Parameter Names . . . . . . . . . . . . . 15 5. Producing and Consuming JWEs . . . . . . . . . . . . . . . . 15 5.1. Message Encryption . . . . . . . . . . . . . . . . . . . 15 5.2. Message Decryption . . . . . . . . . . . . . . . . . . . 17 5.3. String Comparison Rules . . . . . . . . . . . . . . . . . 20 6. Key Identification . . . . . . . . . . . . . . . . . . . . . 20 7. Serializations . . . . . . . . . . . . . . . . . . . . . . . 20 7.1. JWE Compact Serialization . . . . . . . . . . . . . . . . 20 7.2. JWE JSON Serialization . . . . . . . . . . . . . . . . . 20 7.2.1. General JWE JSON Serialization Syntax . . . . . . . . 21 7.2.2. Flattened JWE JSON Serialization Syntax . . . . . . . 23 8. TLS Requirements . . . . . . . . . . . . . . . . . . . . . . 24 9. Distinguishing between JWS and JWE Objects . . . . . . . . . 24 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 25 10.1. JSON Web Signature and Encryption Header Parameters Registration . . . . . . . . . . . . . . . . . . . . . . 25 10.1.1. Registry Contents . . . . . . . . . . . . . . . . . 25 11. Security Considerations . . . . . . . . . . . . . . . . . . . 27 11.1. Key Entropy and Random Values . . . . . . . . . . . . . 27 11.2. Key Protection . . . . . . . . . . . . . . . . . . . . . 27 11.3. Using Matching Algorithm Strengths . . . . . . . . . . . 28
Top   ToC   RFC7516 - Page 3
     11.4.  Adaptive Chosen-Ciphertext Attacks . . . . . . . . . . .  28
     11.5.  Timing Attacks . . . . . . . . . . . . . . . . . . . . .  28
   12. References  . . . . . . . . . . . . . . . . . . . . . . . . .  29
     12.1.  Normative References . . . . . . . . . . . . . . . . . .  29
     12.2.  Informative References . . . . . . . . . . . . . . . . .  30
   Appendix A.  JWE Examples . . . . . . . . . . . . . . . . . . . .  32
     A.1.  Example JWE using RSAES-OAEP and AES GCM  . . . . . . . .  32
       A.1.1.  JOSE Header . . . . . . . . . . . . . . . . . . . . .  32
       A.1.2.  Content Encryption Key (CEK)  . . . . . . . . . . . .  32
       A.1.3.  Key Encryption  . . . . . . . . . . . . . . . . . . .  33
       A.1.4.  Initialization Vector . . . . . . . . . . . . . . . .  34
       A.1.5.  Additional Authenticated Data . . . . . . . . . . . .  35
       A.1.6.  Content Encryption  . . . . . . . . . . . . . . . . .  35
       A.1.7.  Complete Representation . . . . . . . . . . . . . . .  36
       A.1.8.  Validation  . . . . . . . . . . . . . . . . . . . . .  36
     A.2.  Example JWE using RSAES-PKCS1-v1_5 and
           AES_128_CBC_HMAC_SHA_256  . . . . . . . . . . . . . . . .  36
       A.2.1.  JOSE Header . . . . . . . . . . . . . . . . . . . . .  37
       A.2.2.  Content Encryption Key (CEK)  . . . . . . . . . . . .  37
       A.2.3.  Key Encryption  . . . . . . . . . . . . . . . . . . .  38
       A.2.4.  Initialization Vector . . . . . . . . . . . . . . . .  39
       A.2.5.  Additional Authenticated Data . . . . . . . . . . . .  40
       A.2.6.  Content Encryption  . . . . . . . . . . . . . . . . .  40
       A.2.7.  Complete Representation . . . . . . . . . . . . . . .  40
       A.2.8.  Validation  . . . . . . . . . . . . . . . . . . . . .  41
     A.3.  Example JWE Using AES Key Wrap and
           AES_128_CBC_HMAC_SHA_256  . . . . . . . . . . . . . . . .  41
       A.3.1.  JOSE Header . . . . . . . . . . . . . . . . . . . . .  41
       A.3.2.  Content Encryption Key (CEK)  . . . . . . . . . . . .  42
       A.3.3.  Key Encryption  . . . . . . . . . . . . . . . . . . .  42
       A.3.4.  Initialization Vector . . . . . . . . . . . . . . . .  42
       A.3.5.  Additional Authenticated Data . . . . . . . . . . . .  43
       A.3.6.  Content Encryption  . . . . . . . . . . . . . . . . .  43
       A.3.7.  Complete Representation . . . . . . . . . . . . . . .  43
       A.3.8.  Validation  . . . . . . . . . . . . . . . . . . . . .  44
     A.4.  Example JWE Using General JWE JSON Serialization  . . . .  44
       A.4.1.  JWE Per-Recipient Unprotected Headers . . . . . . . .  45
       A.4.2.  JWE Protected Header  . . . . . . . . . . . . . . . .  45
       A.4.3.  JWE Shared Unprotected Header . . . . . . . . . . . .  45
       A.4.4.  Complete JOSE Header Values . . . . . . . . . . . . .  45
       A.4.5.  Additional Authenticated Data . . . . . . . . . . . .  46
       A.4.6.  Content Encryption  . . . . . . . . . . . . . . . . .  46
       A.4.7.  Complete JWE JSON Serialization Representation  . . .  47
     A.5.  Example JWE Using Flattened JWE JSON Serialization  . . .  47
   Appendix B.  Example AES_128_CBC_HMAC_SHA_256 Computation . . . .  48
     B.1.  Extract MAC_KEY and ENC_KEY from Key  . . . . . . . . . .  48
     B.2.  Encrypt Plaintext to Create Ciphertext  . . . . . . . . .  49
     B.3.  64-Bit Big-Endian Representation of AAD Length  . . . . .  49
Top   ToC   RFC7516 - Page 4
     B.4.  Initialization Vector Value . . . . . . . . . . . . . . .  49
     B.5.  Create Input to HMAC Computation  . . . . . . . . . . . .  50
     B.6.  Compute HMAC Value  . . . . . . . . . . . . . . . . . . .  50
     B.7.  Truncate HMAC Value to Create Authentication Tag  . . . .  50
   Acknowledgements  . . . . . . . . . . . . . . . . . . . . . . . .  50
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  51

1. Introduction

JSON Web Encryption (JWE) represents encrypted content using JSON- based data structures [RFC7159]. The JWE cryptographic mechanisms encrypt and provide integrity protection for an arbitrary sequence of octets. Two closely related serializations for JWEs are defined. The JWE Compact Serialization is a compact, URL-safe representation intended for space constrained environments such as HTTP Authorization headers and URI query parameters. The JWE JSON Serialization represents JWEs as JSON objects and enables the same content to be encrypted to multiple parties. Both share the same cryptographic underpinnings. Cryptographic algorithms and identifiers for use with this specification are described in the separate JSON Web Algorithms (JWA) [JWA] specification and IANA registries defined by that specification. Related digital signature and MAC capabilities are described in the separate JSON Web Signature (JWS) [JWS] specification. Names defined by this specification are short because a core goal is for the resulting representations to be compact.

1.1. Notational Conventions

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 "Key words for use in RFCs to Indicate Requirement Levels" [RFC2119]. The interpretation should only be applied when the terms appear in all capital letters. BASE64URL(OCTETS) denotes the base64url encoding of OCTETS, per Section 2 of [JWS]. UTF8(STRING) denotes the octets of the UTF-8 [RFC3629] representation of STRING, where STRING is a sequence of zero or more Unicode [UNICODE] characters.
Top   ToC   RFC7516 - Page 5
   ASCII(STRING) denotes the octets of the ASCII [RFC20] representation
   of STRING, where STRING is a sequence of zero or more ASCII
   characters.

   The concatenation of two values A and B is denoted as A || B.

2. Terminology

The terms "JSON Web Signature (JWS)", "Base64url Encoding", "Collision-Resistant Name", "Header Parameter", "JOSE Header", and "StringOrURI" are defined by the JWS specification [JWS]. The terms "Ciphertext", "Digital Signature", "Initialization Vector (IV)", "Message Authentication Code (MAC)", and "Plaintext" are defined by the "Internet Security Glossary, Version 2" [RFC4949]. These terms are defined by this specification: JSON Web Encryption (JWE) A data structure representing an encrypted and integrity-protected message. Authenticated Encryption with Associated Data (AEAD) An AEAD algorithm is one that encrypts the plaintext, allows Additional Authenticated Data to be specified, and provides an integrated content integrity check over the ciphertext and Additional Authenticated Data. AEAD algorithms accept two inputs, the plaintext and the Additional Authenticated Data value, and produce two outputs, the ciphertext and the Authentication Tag value. AES Galois/Counter Mode (GCM) is one such algorithm. Additional Authenticated Data (AAD) An input to an AEAD operation that is integrity protected but not encrypted. Authentication Tag An output of an AEAD operation that ensures the integrity of the ciphertext and the Additional Authenticated Data. Note that some algorithms may not use an Authentication Tag, in which case this value is the empty octet sequence. Content Encryption Key (CEK) A symmetric key for the AEAD algorithm used to encrypt the plaintext to produce the ciphertext and the Authentication Tag.
Top   ToC   RFC7516 - Page 6
   JWE Encrypted Key
      Encrypted Content Encryption Key value.  Note that for some
      algorithms, the JWE Encrypted Key value is specified as being the
      empty octet sequence.

   JWE Initialization Vector
      Initialization Vector value used when encrypting the plaintext.
      Note that some algorithms may not use an Initialization Vector, in
      which case this value is the empty octet sequence.

   JWE AAD
      Additional value to be integrity protected by the authenticated
      encryption operation.  This can only be present when using the JWE
      JSON Serialization.  (Note that this can also be achieved when
      using either the JWE Compact Serialization or the JWE JSON
      Serialization by including the AAD value as an integrity-protected
      Header Parameter value, but at the cost of the value being double
      base64url encoded.)

   JWE Ciphertext
      Ciphertext value resulting from authenticated encryption of the
      plaintext with Additional Authenticated Data.

   JWE Authentication Tag
      Authentication Tag value resulting from authenticated encryption
      of the plaintext with Additional Authenticated Data.

   JWE Protected Header
      JSON object that contains the Header Parameters that are integrity
      protected by the authenticated encryption operation.  These
      parameters apply to all recipients of the JWE.  For the JWE
      Compact Serialization, this comprises the entire JOSE Header.  For
      the JWE JSON Serialization, this is one component of the JOSE
      Header.

   JWE Shared Unprotected Header
      JSON object that contains the Header Parameters that apply to all
      recipients of the JWE that are not integrity protected.  This can
      only be present when using the JWE JSON Serialization.

   JWE Per-Recipient Unprotected Header
      JSON object that contains Header Parameters that apply to a single
      recipient of the JWE.  These Header Parameter values are not
      integrity protected.  This can only be present when using the JWE
      JSON Serialization.

   JWE Compact Serialization
      A representation of the JWE as a compact, URL-safe string.
Top   ToC   RFC7516 - Page 7
   JWE JSON Serialization
      A representation of the JWE as a JSON object.  The JWE JSON
      Serialization enables the same content to be encrypted to multiple
      parties.  This representation is neither optimized for compactness
      nor URL safe.

   Key Management Mode
      A method of determining the Content Encryption Key value to use.
      Each algorithm used for determining the CEK value uses a specific
      Key Management Mode.  Key Management Modes employed by this
      specification are Key Encryption, Key Wrapping, Direct Key
      Agreement, Key Agreement with Key Wrapping, and Direct Encryption.

   Key Encryption
      A Key Management Mode in which the CEK value is encrypted to the
      intended recipient using an asymmetric encryption algorithm.

   Key Wrapping
      A Key Management Mode in which the CEK value is encrypted to the
      intended recipient using a symmetric key wrapping algorithm.

   Direct Key Agreement
      A Key Management Mode in which a key agreement algorithm is used
      to agree upon the CEK value.

   Key Agreement with Key Wrapping
      A Key Management Mode in which a key agreement algorithm is used
      to agree upon a symmetric key used to encrypt the CEK value to the
      intended recipient using a symmetric key wrapping algorithm.

   Direct Encryption
      A Key Management Mode in which the CEK value used is the secret
      symmetric key value shared between the parties.
Top   ToC   RFC7516 - Page 8

3. JSON Web Encryption (JWE) Overview

JWE represents encrypted content using JSON data structures and base64url encoding. These JSON data structures MAY contain whitespace and/or line breaks before or after any JSON values or structural characters, in accordance with Section 2 of RFC 7159 [RFC7159]. A JWE represents these logical values (each of which is defined in Section 2): o JOSE Header o JWE Encrypted Key o JWE Initialization Vector o JWE AAD o JWE Ciphertext o JWE Authentication Tag For a JWE, the JOSE Header members are the union of the members of these values (each of which is defined in Section 2): o JWE Protected Header o JWE Shared Unprotected Header o JWE Per-Recipient Unprotected Header JWE utilizes authenticated encryption to ensure the confidentiality and integrity of the plaintext and the integrity of the JWE Protected Header and the JWE AAD. This document defines two serializations for JWEs: a compact, URL- safe serialization called the JWE Compact Serialization and a JSON serialization called the JWE JSON Serialization. In both serializations, the JWE Protected Header, JWE Encrypted Key, JWE Initialization Vector, JWE Ciphertext, and JWE Authentication Tag are base64url encoded, since JSON lacks a way to directly represent arbitrary octet sequences. When present, the JWE AAD is also base64url encoded.

3.1. JWE Compact Serialization Overview

In the JWE Compact Serialization, no JWE Shared Unprotected Header or JWE Per-Recipient Unprotected Header are used. In this case, the JOSE Header and the JWE Protected Header are the same.
Top   ToC   RFC7516 - Page 9
   In the JWE Compact Serialization, a JWE is represented as the
   concatenation:

      BASE64URL(UTF8(JWE Protected Header)) || '.' ||
      BASE64URL(JWE Encrypted Key) || '.' ||
      BASE64URL(JWE Initialization Vector) || '.' ||
      BASE64URL(JWE Ciphertext) || '.' ||
      BASE64URL(JWE Authentication Tag)

   See Section 7.1 for more information about the JWE Compact
   Serialization.

3.2. JWE JSON Serialization Overview

In the JWE JSON Serialization, one or more of the JWE Protected Header, JWE Shared Unprotected Header, and JWE Per-Recipient Unprotected Header MUST be present. In this case, the members of the JOSE Header are the union of the members of the JWE Protected Header, JWE Shared Unprotected Header, and JWE Per-Recipient Unprotected Header values that are present. In the JWE JSON Serialization, a JWE is represented as a JSON object containing some or all of these eight members: "protected", with the value BASE64URL(UTF8(JWE Protected Header)) "unprotected", with the value JWE Shared Unprotected Header "header", with the value JWE Per-Recipient Unprotected Header "encrypted_key", with the value BASE64URL(JWE Encrypted Key) "iv", with the value BASE64URL(JWE Initialization Vector) "ciphertext", with the value BASE64URL(JWE Ciphertext) "tag", with the value BASE64URL(JWE Authentication Tag) "aad", with the value BASE64URL(JWE AAD) The six base64url-encoded result strings and the two unprotected JSON object values are represented as members within a JSON object. The inclusion of some of these values is OPTIONAL. The JWE JSON Serialization can also encrypt the plaintext to multiple recipients. See Section 7.2 for more information about the JWE JSON Serialization.
Top   ToC   RFC7516 - Page 10

3.3. Example JWE

This example encrypts the plaintext "The true sign of intelligence is not knowledge but imagination." to the recipient. The following example JWE Protected Header declares that: o The Content Encryption Key is encrypted to the recipient using the RSAES-OAEP [RFC3447] algorithm to produce the JWE Encrypted Key. o Authenticated encryption is performed on the plaintext using the AES GCM [AES] [NIST.800-38D] algorithm with a 256-bit key to produce the ciphertext and the Authentication Tag. {"alg":"RSA-OAEP","enc":"A256GCM"} Encoding this JWE Protected Header as BASE64URL(UTF8(JWE Protected Header)) gives this value: eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ The remaining steps to finish creating this JWE are: o Generate a random Content Encryption Key (CEK). o Encrypt the CEK with the recipient's public key using the RSAES- OAEP algorithm to produce the JWE Encrypted Key. o Base64url-encode the JWE Encrypted Key. o Generate a random JWE Initialization Vector. o Base64url-encode the JWE Initialization Vector. o Let the Additional Authenticated Data encryption parameter be ASCII(BASE64URL(UTF8(JWE Protected Header))). o Perform authenticated encryption on the plaintext with the AES GCM algorithm using the CEK as the encryption key, the JWE Initialization Vector, and the Additional Authenticated Data value, requesting a 128-bit Authentication Tag output. o Base64url-encode the ciphertext. o Base64url-encode the Authentication Tag.
Top   ToC   RFC7516 - Page 11
   o  Assemble the final representation: The Compact Serialization of
      this result is the string BASE64URL(UTF8(JWE Protected Header)) ||
      '.' || BASE64URL(JWE Encrypted Key) || '.' || BASE64URL(JWE
      Initialization Vector) || '.' || BASE64URL(JWE Ciphertext) || '.'
      || BASE64URL(JWE Authentication Tag).

   The final result in this example (with line breaks for display
   purposes only) is:

     eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.
     OKOawDo13gRp2ojaHV7LFpZcgV7T6DVZKTyKOMTYUmKoTCVJRgckCL9kiMT03JGe
     ipsEdY3mx_etLbbWSrFr05kLzcSr4qKAq7YN7e9jwQRb23nfa6c9d-StnImGyFDb
     Sv04uVuxIp5Zms1gNxKKK2Da14B8S4rzVRltdYwam_lDp5XnZAYpQdb76FdIKLaV
     mqgfwX7XWRxv2322i-vDxRfqNzo_tETKzpVLzfiwQyeyPGLBIO56YJ7eObdv0je8
     1860ppamavo35UgoRdbYaBcoh9QcfylQr66oc6vFWXRcZ_ZT2LawVCWTIy3brGPi
     6UklfCpIMfIjf7iGdXKHzg.
     48V1_ALb6US04U3b.
     5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji
     SdiwkIr3ajwQzaBtQD_A.
     XFBoMYUZodetZdvTiFvSkQ

   See Appendix A.1 for the complete details of computing this JWE.  See
   Appendix A for additional examples, including examples using the JWE
   JSON Serialization in Sections A.4 and A.5.

4. JOSE Header

For a JWE, the members of the JSON object(s) representing the JOSE Header describe the encryption applied to the plaintext and optionally additional properties of the JWE. The Header Parameter names within the JOSE Header MUST be unique, just as described in Section 4 of [JWS]. The rules about handling Header Parameters that are not understood by the implementation are also the same. The classes of Header Parameter names are likewise the same.

4.1. Registered Header Parameter Names

The following Header Parameter names for use in JWEs are registered in the IANA "JSON Web Signature and Encryption Header Parameters" registry established by [JWS], with meanings as defined below. As indicated by the common registry, JWSs and JWEs share a common Header Parameter space; when a parameter is used by both specifications, its usage must be compatible between the specifications.
Top   ToC   RFC7516 - Page 12

4.1.1. "alg" (Algorithm) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "alg" Header Parameter defined in Section 4.1.1 of [JWS], except that the Header Parameter identifies the cryptographic algorithm used to encrypt or determine the value of the CEK. The encrypted content is not usable if the "alg" value does not represent a supported algorithm, or if the recipient does not have a key that can be used with that algorithm. A list of defined "alg" values for this use can be found in the IANA "JSON Web Signature and Encryption Algorithms" registry established by [JWA]; the initial contents of this registry are the values defined in Section 4.1 of [JWA].

4.1.2. "enc" (Encryption Algorithm) Header Parameter

The "enc" (encryption algorithm) Header Parameter identifies the content encryption algorithm used to perform authenticated encryption on the plaintext to produce the ciphertext and the Authentication Tag. This algorithm MUST be an AEAD algorithm with a specified key length. The encrypted content is not usable if the "enc" value does not represent a supported algorithm. "enc" values should either be registered in the IANA "JSON Web Signature and Encryption Algorithms" registry established by [JWA] or be a value that contains a Collision-Resistant Name. The "enc" value is a case-sensitive ASCII string containing a StringOrURI value. This Header Parameter MUST be present and MUST be understood and processed by implementations. A list of defined "enc" values for this use can be found in the IANA "JSON Web Signature and Encryption Algorithms" registry established by [JWA]; the initial contents of this registry are the values defined in Section 5.1 of [JWA].

4.1.3. "zip" (Compression Algorithm) Header Parameter

The "zip" (compression algorithm) applied to the plaintext before encryption, if any. The "zip" value defined by this specification is: o "DEF" - Compression with the DEFLATE [RFC1951] algorithm Other values MAY be used. Compression algorithm values can be registered in the IANA "JSON Web Encryption Compression Algorithms" registry established by [JWA]. The "zip" value is a case-sensitive string. If no "zip" parameter is present, no compression is applied to the plaintext before encryption. When used, this Header Parameter MUST be integrity protected; therefore, it MUST occur only within the
Top   ToC   RFC7516 - Page 13
   JWE Protected Header.  Use of this Header Parameter is OPTIONAL.
   This Header Parameter MUST be understood and processed by
   implementations.

4.1.4. "jku" (JWK Set URL) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "jku" Header Parameter defined in Section 4.1.2 of [JWS], except that the JWK Set resource contains the public key to which the JWE was encrypted; this can be used to determine the private key needed to decrypt the JWE.

4.1.5. "jwk" (JSON Web Key) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "jwk" Header Parameter defined in Section 4.1.3 of [JWS], except that the key is the public key to which the JWE was encrypted; this can be used to determine the private key needed to decrypt the JWE.

4.1.6. "kid" (Key ID) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "kid" Header Parameter defined in Section 4.1.4 of [JWS], except that the key hint references the public key to which the JWE was encrypted; this can be used to determine the private key needed to decrypt the JWE. This parameter allows originators to explicitly signal a change of key to JWE recipients.

4.1.7. "x5u" (X.509 URL) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "x5u" Header Parameter defined in Section 4.1.5 of [JWS], except that the X.509 public key certificate or certificate chain [RFC5280] contains the public key to which the JWE was encrypted; this can be used to determine the private key needed to decrypt the JWE.

4.1.8. "x5c" (X.509 Certificate Chain) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "x5c" Header Parameter defined in Section 4.1.6 of [JWS], except that the X.509 public key certificate or certificate chain [RFC5280] contains the public key to which the JWE was encrypted; this can be used to determine the private key needed to decrypt the JWE. See Appendix B of [JWS] for an example "x5c" value.
Top   ToC   RFC7516 - Page 14

4.1.9. "x5t" (X.509 Certificate SHA-1 Thumbprint) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "x5t" Header Parameter defined in Section 4.1.7 of [JWS], except that the certificate referenced by the thumbprint contains the public key to which the JWE was encrypted; this can be used to determine the private key needed to decrypt the JWE. Note that certificate thumbprints are also sometimes known as certificate fingerprints.

4.1.10. "x5t#S256" (X.509 Certificate SHA-256 Thumbprint) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "x5t#S256" Header Parameter defined in Section 4.1.8 of [JWS], except that the certificate referenced by the thumbprint contains the public key to which the JWE was encrypted; this can be used to determine the private key needed to decrypt the JWE. Note that certificate thumbprints are also sometimes known as certificate fingerprints.

4.1.11. "typ" (Type) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "typ" Header Parameter defined in Section 4.1.9 of [JWS], except that the type is that of this complete JWE.

4.1.12. "cty" (Content Type) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "cty" Header Parameter defined in Section 4.1.10 of [JWS], except that the type is that of the secured content (the plaintext).

4.1.13. "crit" (Critical) Header Parameter

This parameter has the same meaning, syntax, and processing rules as the "crit" Header Parameter defined in Section 4.1.11 of [JWS], except that Header Parameters for a JWE are being referred to, rather than Header Parameters for a JWS.

4.2. Public Header Parameter Names

Additional Header Parameter names can be defined by those using JWEs. However, in order to prevent collisions, any new Header Parameter name should either be registered in the IANA "JSON Web Signature and Encryption Header Parameters" registry established by [JWS] or be a Public Name: a value that contains a Collision-Resistant Name. In each case, the definer of the name or value needs to take reasonable
Top   ToC   RFC7516 - Page 15
   precautions to make sure they are in control of the part of the
   namespace they use to define the Header Parameter name.

   New Header Parameters should be introduced sparingly, as they can
   result in non-interoperable JWEs.

4.3. Private Header Parameter Names

A producer and consumer of a JWE may agree to use Header Parameter names that are Private Names: names that are not Registered Header Parameter names (Section 4.1) or Public Header Parameter names (Section 4.2). Unlike Public Header Parameter names, Private Header Parameter names are subject to collision and should be used with caution.


(page 15 continued on part 2)

Next Section