< draft-ietf-jose-json-web-encryption-05.txt   draft-ietf-jose-json-web-encryption-06.txt >
JOSE Working Group M. Jones JOSE Working Group M. Jones
Internet-Draft Microsoft Internet-Draft Microsoft
Intended status: Standards Track E. Rescorla Intended status: Standards Track E. Rescorla
Expires: January 31, 2013 RTFM Expires: April 18, 2013 RTFM
J. Hildebrand J. Hildebrand
Cisco Cisco
July 30, 2012 October 15, 2012
JSON Web Encryption (JWE) JSON Web Encryption (JWE)
draft-ietf-jose-json-web-encryption-05 draft-ietf-jose-json-web-encryption-06
Abstract Abstract
JSON Web Encryption (JWE) is a means of representing encrypted JSON Web Encryption (JWE) is a means of representing encrypted
content using JavaScript Object Notation (JSON) data structures. content using JavaScript Object Notation (JSON) data structures.
Cryptographic algorithms and identifiers for use with this Cryptographic algorithms and identifiers for use with this
specification are described in the separate JSON Web Algorithms (JWA) specification are described in the separate JSON Web Algorithms (JWA)
specification. Related digital signature and MAC capabilities are specification. Related digital signature and MAC capabilities are
described in the separate JSON Web Signature (JWS) specification. described in the separate JSON Web Signature (JWS) specification.
skipping to change at page 1, line 38 skipping to change at page 1, line 38
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on January 31, 2013. This Internet-Draft will expire on April 18, 2013.
Copyright Notice Copyright Notice
Copyright (c) 2012 IETF Trust and the persons identified as the Copyright (c) 2012 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 4 1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 5
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5
3. JSON Web Encryption (JWE) Overview . . . . . . . . . . . . . . 6 3. JSON Web Encryption (JWE) Overview . . . . . . . . . . . . . . 7
3.1. Example JWE with an Integrated Integrity Check . . . . . . 6 3.1. Example JWE with an Integrated Integrity Check . . . . . . 8
3.2. Example JWE with a Separate Integrity Check . . . . . . . 8 3.2. Example JWE with a Separate Integrity Check . . . . . . . 9
4. JWE Header . . . . . . . . . . . . . . . . . . . . . . . . . . 10 4. JWE Header . . . . . . . . . . . . . . . . . . . . . . . . . . 11
4.1. Reserved Header Parameter Names . . . . . . . . . . . . . 10 4.1. Reserved Header Parameter Names . . . . . . . . . . . . . 12
4.1.1. "alg" (Algorithm) Header Parameter . . . . . . . . . . 11 4.1.1. "alg" (Algorithm) Header Parameter . . . . . . . . . . 12
4.1.2. "enc" (Encryption Method) Header Parameter . . . . . . 11 4.1.2. "enc" (Encryption Method) Header Parameter . . . . . . 12
4.1.3. "int" (Integrity Algorithm) Header Parameter . . . . . 11 4.1.3. "epk" (Ephemeral Public Key) Header Parameter . . . . 13
4.1.4. "kdf" (Key Derivation Function) Header Parameter . . . 12 4.1.4. "zip" (Compression Algorithm) Header Parameter . . . . 13
4.1.5. "iv" (Initialization Vector) Header Parameter . . . . 12 4.1.5. "jku" (JWK Set URL) Header Parameter . . . . . . . . . 13
4.1.6. "epk" (Ephemeral Public Key) Header Parameter . . . . 12 4.1.6. "jwk" (JSON Web Key) Header Parameter . . . . . . . . 13
4.1.7. "zip" (Compression Algorithm) Header Parameter . . . . 12 4.1.7. "x5u" (X.509 URL) Header Parameter . . . . . . . . . . 13
4.1.8. "jku" (JWK Set URL) Header Parameter . . . . . . . . . 13 4.1.8. "x5t" (X.509 Certificate Thumbprint) Header
4.1.9. "jwk" (JSON Web Key) Header Parameter . . . . . . . . 13 Parameter . . . . . . . . . . . . . . . . . . . . . . 14
4.1.10. "x5u" (X.509 URL) Header Parameter . . . . . . . . . . 13 4.1.9. "x5c" (X.509 Certificate Chain) Header Parameter . . . 14
4.1.11. "x5t" (X.509 Certificate Thumbprint) Header 4.1.10. "kid" (Key ID) Header Parameter . . . . . . . . . . . 14
Parameter . . . . . . . . . . . . . . . . . . . . . . 13 4.1.11. "typ" (Type) Header Parameter . . . . . . . . . . . . 15
4.1.12. "x5c" (X.509 Certificate Chain) Header Parameter . . . 14 4.1.12. "cty" (Content Type) Header Parameter . . . . . . . . 15
4.1.13. "kid" (Key ID) Header Parameter . . . . . . . . . . . 14 4.1.13. "apu" (Agreement PartyUInfo) Header Parameter . . . . 15
4.1.14. "typ" (Type) Header Parameter . . . . . . . . . . . . 14 4.1.14. "apv" (Agreement PartyVInfo) Header Parameter . . . . 15
4.1.15. "cty" (Content Type) Header Parameter . . . . . . . . 15 4.1.15. "epu" (Encryption PartyUInfo) Header Parameter . . . . 15
4.2. Public Header Parameter Names . . . . . . . . . . . . . . 15 4.1.16. "epv" (Encryption PartyVInfo) Header Parameter . . . . 16
4.3. Private Header Parameter Names . . . . . . . . . . . . . . 15 4.2. Public Header Parameter Names . . . . . . . . . . . . . . 16
5. Message Encryption . . . . . . . . . . . . . . . . . . . . . . 15 4.3. Private Header Parameter Names . . . . . . . . . . . . . . 16
6. Message Decryption . . . . . . . . . . . . . . . . . . . . . . 17 5. Message Encryption . . . . . . . . . . . . . . . . . . . . . . 16
7. CMK Encryption . . . . . . . . . . . . . . . . . . . . . . . . 18 6. Message Decryption . . . . . . . . . . . . . . . . . . . . . . 18
8. Integrity Value Calculation . . . . . . . . . . . . . . . . . 19 7. CMK Encryption . . . . . . . . . . . . . . . . . . . . . . . . 19
9. Encrypting JWEs with Cryptographic Algorithms . . . . . . . . 19 8. Encrypting JWEs with Cryptographic Algorithms . . . . . . . . 19
10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20
10.1. Registration of JWE Header Parameter Names . . . . . . . . 20 9.1. Registration of JWE Header Parameter Names . . . . . . . . 20
10.1.1. Registry Contents . . . . . . . . . . . . . . . . . . 20 9.1.1. Registry Contents . . . . . . . . . . . . . . . . . . 20
10.2. JSON Web Signature and Encryption Type Values 9.2. JSON Web Signature and Encryption Type Values
Registration . . . . . . . . . . . . . . . . . . . . . . . 22 Registration . . . . . . . . . . . . . . . . . . . . . . . 21
10.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 22 9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 21
10.3. Media Type Registration . . . . . . . . . . . . . . . . . 22 9.3. Media Type Registration . . . . . . . . . . . . . . . . . 21
10.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 22 9.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 21
11. Security Considerations . . . . . . . . . . . . . . . . . . . 23 10. Security Considerations . . . . . . . . . . . . . . . . . . . 22
12. Open Issues . . . . . . . . . . . . . . . . . . . . . . . . . 23 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 22
13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 24 11.1. Normative References . . . . . . . . . . . . . . . . . . . 22
13.1. Normative References . . . . . . . . . . . . . . . . . . . 24 11.2. Informative References . . . . . . . . . . . . . . . . . . 24
13.2. Informative References . . . . . . . . . . . . . . . . . . 26 Appendix A. JWE Examples . . . . . . . . . . . . . . . . . . . . 24
Appendix A. JWE Examples . . . . . . . . . . . . . . . . . . . . 26 A.1. Example JWE using RSAES OAEP and AES GCM . . . . . . . . . 24
A.1. Example JWE using RSAES OAEP and AES GCM . . . . . . . . . 26 A.1.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 25
A.1.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 26 A.1.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 25
A.1.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 27 A.1.3. Content Master Key (CMK) . . . . . . . . . . . . . . . 25
A.1.3. Content Master Key (CMK) . . . . . . . . . . . . . . . 27 A.1.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 25
A.1.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 27 A.1.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 28
A.1.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 30 A.1.6. Initialization Vector . . . . . . . . . . . . . . . . 28
A.1.6. "Additional Authenticated Data" Parameter . . . . . . 30 A.1.7. "Additional Authenticated Data" Parameter . . . . . . 28
A.1.7. Plaintext Encryption . . . . . . . . . . . . . . . . . 31 A.1.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 29
A.1.8. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 31 A.1.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 29
A.1.9. Encoded JWE Integrity Value . . . . . . . . . . . . . 31 A.1.10. Encoded JWE Integrity Value . . . . . . . . . . . . . 30
A.1.10. Complete Representation . . . . . . . . . . . . . . . 31 A.1.11. Complete Representation . . . . . . . . . . . . . . . 30
A.1.11. Validation . . . . . . . . . . . . . . . . . . . . . . 32 A.1.12. Validation . . . . . . . . . . . . . . . . . . . . . . 30
A.2. Example JWE using RSAES-PKCS1-V1_5 and AES CBC . . . . . . 32 A.2. Example JWE using RSAES-PKCS1-V1_5 and AES CBC . . . . . . 30
A.2.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 32 A.2.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 31
A.2.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 33 A.2.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 31
A.2.3. Content Master Key (CMK) . . . . . . . . . . . . . . . 33 A.2.3. Content Master Key (CMK) . . . . . . . . . . . . . . . 31
A.2.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 33 A.2.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 31
A.2.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 36 A.2.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 34
A.2.6. Key Derivation . . . . . . . . . . . . . . . . . . . . 36 A.2.6. Key Derivation . . . . . . . . . . . . . . . . . . . . 34
A.2.7. Plaintext Encryption . . . . . . . . . . . . . . . . . 36 A.2.7. Initialization Vector . . . . . . . . . . . . . . . . 34
A.2.8. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 36 A.2.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 34
A.2.9. Secured Input Value . . . . . . . . . . . . . . . . . 37 A.2.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 35
A.2.10. JWE Integrity Value . . . . . . . . . . . . . . . . . 38 A.2.10. Secured Input Value . . . . . . . . . . . . . . . . . 35
A.2.11. Encoded JWE Integrity Value . . . . . . . . . . . . . 38 A.2.11. JWE Integrity Value . . . . . . . . . . . . . . . . . 36
A.2.12. Complete Representation . . . . . . . . . . . . . . . 38 A.2.12. Encoded JWE Integrity Value . . . . . . . . . . . . . 36
A.2.13. Validation . . . . . . . . . . . . . . . . . . . . . . 39 A.2.13. Complete Representation . . . . . . . . . . . . . . . 36
A.3. Example Key Derivation with Outputs <= Hash Size . . . . . 39 A.2.14. Validation . . . . . . . . . . . . . . . . . . . . . . 37
A.3.1. CEK Generation . . . . . . . . . . . . . . . . . . . . 39 A.3. Example JWE using AES Key Wrap and AES GCM . . . . . . . . 37
A.3.2. CIK Generation . . . . . . . . . . . . . . . . . . . . 40 A.3.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 37
A.4. Example Key Derivation with Outputs >= Hash Size . . . . . 40 A.3.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 38
A.4.1. CEK Generation . . . . . . . . . . . . . . . . . . . . 40 A.3.3. Content Master Key (CMK) . . . . . . . . . . . . . . . 38
A.4.2. CIK Generation . . . . . . . . . . . . . . . . . . . . 41 A.3.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 38
Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 42 A.3.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 38
Appendix C. Document History . . . . . . . . . . . . . . . . . . 42 A.3.6. Initialization Vector . . . . . . . . . . . . . . . . 38
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 45 A.3.7. "Additional Authenticated Data" Parameter . . . . . . 39
A.3.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 39
A.3.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 39
A.3.10. Encoded JWE Integrity Value . . . . . . . . . . . . . 40
A.3.11. Complete Representation . . . . . . . . . . . . . . . 40
A.3.12. Validation . . . . . . . . . . . . . . . . . . . . . . 40
A.4. Example Key Derivation for "enc" value "A128CBC+HS256" . . 40
A.4.1. CEK Generation . . . . . . . . . . . . . . . . . . . . 41
A.4.2. CIK Generation . . . . . . . . . . . . . . . . . . . . 42
A.5. Example Key Derivation for "enc" value "A256CBC+HS512" . . 42
A.5.1. CEK Generation . . . . . . . . . . . . . . . . . . . . 43
A.5.2. CIK Generation . . . . . . . . . . . . . . . . . . . . 44
Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 45
Appendix C. Open Issues . . . . . . . . . . . . . . . . . . . . . 45
Appendix D. Document History . . . . . . . . . . . . . . . . . . 46
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 49
1. Introduction 1. Introduction
JSON Web Encryption (JWE) is a compact encryption format intended for JSON Web Encryption (JWE) is a compact encryption format intended for
space constrained environments such as HTTP Authorization headers and space constrained environments such as HTTP Authorization headers and
URI query parameters. It represents this content using JavaScript URI query parameters. It represents this content using JavaScript
Object Notation (JSON) [RFC4627] based data structures. The JWE Object Notation (JSON) [RFC4627] based data structures. The JWE
cryptographic mechanisms encrypt and provide integrity protection for cryptographic mechanisms encrypt and provide integrity protection for
arbitrary sequences of bytes. arbitrary sequences of bytes.
skipping to change at page 4, line 30 skipping to change at page 5, line 30
1.1. Notational Conventions 1.1. Notational Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in Key words for use in document are to be interpreted as described in Key words for use in
RFCs to Indicate Requirement Levels [RFC2119]. RFCs to Indicate Requirement Levels [RFC2119].
2. Terminology 2. Terminology
JSON Web Encryption (JWE) A data structure representing an encrypted JSON Web Encryption (JWE) A data structure representing an encrypted
message. The structure consists of four parts: the JWE Header, message. The structure consists of five parts: the JWE Header,
the JWE Encrypted Key, the JWE Ciphertext, and the JWE Integrity the JWE Encrypted Key, the JWE Initialization Vector, the JWE
Value. Ciphertext, and the JWE Integrity Value.
Plaintext The bytes to be encrypted - a.k.a., the message. The Plaintext The bytes to be encrypted -- a.k.a., the message. The
plaintext can contain an arbitrary sequence of bytes. plaintext can contain an arbitrary sequence of bytes.
Ciphertext An encrypted representation of the Plaintext. Ciphertext An encrypted representation of the Plaintext.
Content Encryption Key (CEK) A symmetric key used to encrypt the Content Encryption Key (CEK) A symmetric key used to encrypt the
Plaintext for the recipient to produce the Ciphertext. Plaintext for the recipient to produce the Ciphertext.
Content Integrity Key (CIK) A key used with a MAC function to ensure Content Integrity Key (CIK) A key used with a MAC function to ensure
the integrity of the Ciphertext and the parameters used to create the integrity of the Ciphertext and the parameters used to create
it. it.
skipping to change at page 5, line 18 skipping to change at page 6, line 18
JWE Ciphertext, and the JWE Integrity Value. JWE Ciphertext, and the JWE Integrity Value.
JWE Encrypted Key When key wrapping or key encryption are employed, JWE Encrypted Key When key wrapping or key encryption are employed,
the Content Master Key (CMK) is encrypted with the intended the Content Master Key (CMK) is encrypted with the intended
recipient's key and the resulting encrypted content is recorded as recipient's key and the resulting encrypted content is recorded as
a byte array, which is referred to as the JWE Encrypted Key. a byte array, which is referred to as the JWE Encrypted Key.
Otherwise, when direct encryption with a shared or agreed upon Otherwise, when direct encryption with a shared or agreed upon
symmetric key is employed, the JWE Encrypted Key is the empty byte symmetric key is employed, the JWE Encrypted Key is the empty byte
array. array.
JWE Initialization Vector A byte array containing the Initialization
Vector used when encrypting the Plaintext.
JWE Ciphertext A byte array containing the Ciphertext. JWE Ciphertext A byte array containing the Ciphertext.
JWE Integrity Value A byte array containing a MAC value that ensures JWE Integrity Value A byte array containing a MAC value that ensures
the integrity of the Ciphertext and the parameters used to create the integrity of the Ciphertext and the parameters used to create
it. it.
Base64url Encoding The URL- and filename-safe Base64 encoding Base64url Encoding The URL- and filename-safe Base64 encoding
described in RFC 4648 [RFC4648], Section 5, with the (non URL- described in RFC 4648 [RFC4648], Section 5, with the (non URL-
safe) '=' padding characters omitted, as permitted by Section 3.2. safe) '=' padding characters omitted, as permitted by Section 3.2.
(See Appendix C of [JWS] for notes on implementing base64url (See Appendix C of [JWS] for notes on implementing base64url
encoding without padding.) encoding without padding.)
Encoded JWE Header Base64url encoding of the bytes of the UTF-8 Encoded JWE Header Base64url encoding of the bytes of the UTF-8
[RFC3629] representation of the JWE Header. [RFC3629] representation of the JWE Header.
Encoded JWE Encrypted Key Base64url encoding of the JWE Encrypted Encoded JWE Encrypted Key Base64url encoding of the JWE Encrypted
Key. Key.
Encoded JWE Initialization Vector Base64url encoding of the JWE
Initialization Vector.
Encoded JWE Ciphertext Base64url encoding of the JWE Ciphertext. Encoded JWE Ciphertext Base64url encoding of the JWE Ciphertext.
Encoded JWE Integrity Value Base64url encoding of the JWE Integrity Encoded JWE Integrity Value Base64url encoding of the JWE Integrity
Value. Value.
Header Parameter Name The name of a member of the JSON object Header Parameter Name The name of a member of the JSON object
representing a JWE Header. representing a JWE Header.
Header Parameter Value The value of a member of the JSON object Header Parameter Value The value of a member of the JSON object
representing a JWE Header. representing a JWE Header.
JWE Compact Serialization A representation of the JWE as the JWE Compact Serialization A representation of the JWE as the
concatenation of the Encoded JWE Header, the Encoded JWE Encrypted concatenation of the Encoded JWE Header, the Encoded JWE Encrypted
Key, the Encoded JWE Ciphertext, and the Encoded JWE Integrity Key, the Encoded JWE Initialization Vector, the Encoded JWE
Value in that order, with the four strings being separated by Ciphertext, and the Encoded JWE Integrity Value in that order,
period ('.') characters. with the five strings being separated by four period ('.')
characters.
AEAD Algorithm An Authenticated Encryption with Associated Data AEAD Algorithm An Authenticated Encryption with Associated Data
(AEAD) [RFC5116] encryption algorithm is one that provides an (AEAD) [RFC5116] encryption algorithm is one that provides an
integrated content integrity check. AES Galois/Counter Mode (GCM) integrated content integrity check. AES Galois/Counter Mode (GCM)
is one such algorithm. is one such algorithm.
Collision Resistant Namespace A namespace that allows names to be Collision Resistant Namespace A namespace that allows names to be
allocated in a manner such that they are highly unlikely to allocated in a manner such that they are highly unlikely to
collide with other names. For instance, collision resistance can collide with other names. For instance, collision resistance can
be achieved through administrative delegation of portions of the be achieved through administrative delegation of portions of the
skipping to change at page 6, line 32 skipping to change at page 7, line 42
StringOrURI A JSON string value, with the additional requirement StringOrURI A JSON string value, with the additional requirement
that while arbitrary string values MAY be used, any value that while arbitrary string values MAY be used, any value
containing a ":" character MUST be a URI [RFC3986]. StringOrURI containing a ":" character MUST be a URI [RFC3986]. StringOrURI
values are compared as case-sensitive strings with no values are compared as case-sensitive strings with no
transformations or canonicalizations applied. transformations or canonicalizations applied.
3. JSON Web Encryption (JWE) Overview 3. JSON Web Encryption (JWE) Overview
JWE represents encrypted content using JSON data structures and JWE represents encrypted content using JSON data structures and
base64url encoding. The representation consists of four parts: the base64url encoding. The representation consists of five parts: the
JWE Header, the JWE Encrypted Key, the JWE Ciphertext, and the JWE JWE Header, the JWE Encrypted Key, the JWE Initialization Vector, the
Integrity Value. In the Compact Serialization, the four parts are JWE Ciphertext, and the JWE Integrity Value. In the Compact
base64url-encoded for transmission, and represented as the Serialization, the five parts are base64url-encoded for transmission,
concatenation of the encoded strings in that order, with the four and represented as the concatenation of the encoded strings in that
strings being separated by period ('.') characters. (A JSON order, with the five strings being separated by four period ('.')
Serialization for this information is defined in the separate JSON characters. (A JSON Serialization for this information is defined in
Web Encryption JSON Serialization (JWE-JS) [JWE-JS] specification.) the separate JSON Web Encryption JSON Serialization (JWE-JS) [JWE-JS]
specification.)
JWE utilizes encryption to ensure the confidentiality of the JWE utilizes encryption to ensure the confidentiality of the
Plaintext. JWE adds a content integrity check if not provided by the Plaintext. JWE adds a content integrity check if not provided by the
underlying encryption algorithm. underlying encryption algorithm.
3.1. Example JWE with an Integrated Integrity Check 3.1. Example JWE with an Integrated Integrity Check
This example encrypts the plaintext "Live long and prosper." to the This example encrypts the plaintext "Live long and prosper." to the
recipient using RSAES OAEP and AES GCM. The AES GCM algorithm has an recipient using RSAES OAEP and AES GCM. The AES GCM algorithm has an
integrated integrity check. integrated integrity check.
The following example JWE Header declares that: The following example JWE Header declares that:
o the Content Master Key is encrypted to the recipient using the o the Content Master Key is encrypted to the recipient using the
RSAES OAEP algorithm to produce the JWE Encrypted Key, RSAES OAEP algorithm to produce the JWE Encrypted Key and
o the Plaintext is encrypted using the AES GCM algorithm with a 256 o the Plaintext is encrypted using the AES GCM algorithm with a 256
bit key to produce the Ciphertext, and bit key to produce the Ciphertext.
o the 96 bit Initialization Vector (IV) with the base64url encoding
"48V1_ALb6US04U3b" was used.
{"alg":"RSA-OAEP","enc":"A256GCM","iv":"48V1_ALb6US04U3b"} {"alg":"RSA-OAEP","enc":"A256GCM"}
Base64url encoding the bytes of the UTF-8 representation of the JWE Base64url encoding the bytes of the UTF-8 representation of the JWE
Header yields this Encoded JWE Header value (with line breaks for Header yields this Encoded JWE Header value:
display purposes only):
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00iLCJpdiI6IjQ4VjFfQUxi eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ
NlVTMDRVM2IifQ
The remaining steps to finish creating this JWE are: The remaining steps to finish creating this JWE are:
o Generate a random Content Master Key (CMK) o Generate a random Content Master Key (CMK)
o Encrypt the CMK with the recipient's public key using the RSAES o Encrypt the CMK with the recipient's public key using the RSAES
OAEP algorithm to produce the JWE Encrypted Key OAEP algorithm to produce the JWE Encrypted Key
o Base64url encode the JWE Encrypted Key to produce the Encoded JWE o Base64url encode the JWE Encrypted Key to produce the Encoded JWE
Encrypted Key Encrypted Key
o Generate a random JWE Initialization Vector
o Base64url encode the JWE Initialization Vector to produce the
Encoded JWE Initialization Vector
o Concatenate the Encoded JWE Header value, a period character o Concatenate the Encoded JWE Header value, a period character
('.'), and the Encoded JWE Encrypted Key to create the "additional ('.'), the Encoded JWE Encrypted Key, a second period character
authenticated data" parameter for the AES GCM algorithm. ('.'), and the Encoded JWE Initialization Vector to create the
"additional authenticated data" parameter for the AES GCM
algorithm
o Encrypt the Plaintext with AES GCM, using the IV, the CMK as the o Encrypt the Plaintext with AES GCM, using the CMK as the
encryption key, and the "additional authenticated data" value encryption key, the JWE Initialization Vector, and the "additional
above, requesting a 128 bit "authentication tag" output authenticated data" value above, requesting a 128 bit
"authentication tag" output
o Base64url encode the resulting Ciphertext to create the Encoded o Base64url encode the resulting Ciphertext to create the Encoded
JWE Ciphertext JWE Ciphertext
o Base64url encode the resulting "authentication tag" to create the o Base64url encode the resulting "authentication tag" to create the
Encoded JWE Integrity Value Encoded JWE Integrity Value
o Assemble the final representation: The Compact Serialization of o Assemble the final representation: The Compact Serialization of
this result is the concatenation of the Encoded JWE Header, the this result is the concatenation of the Encoded JWE Header, the
Encoded JWE Encrypted Key, the Encoded JWE Ciphertext, and the Encoded JWE Encrypted Key, the Encoded JWE Initialization Vector,
Encoded JWE Integrity Value in that order, with the four strings the Encoded JWE Ciphertext, and the Encoded JWE Integrity Value in
being separated by three period ('.') characters. that order, with the five strings being separated by four period
('.') characters.
The final result in this example (with line breaks for display The final result in this example (with line breaks for display
purposes only) is: purposes only) is:
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00iLCJpdiI6IjQ4VjFfQUxi eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.
NlVTMDRVM2IifQ. M2XxpbORKezKSzzQL_95-GjiudRBTqn_omS8z9xgoRb7L0Jw5UsEbxmtyHn2T71m
jvwoyhWxOMboB5cxX6ncAi7Wp3Q5FKRtlmIx35pfR9HpEa6Oy-iEpxEqM30W3YcR rZLkjg4Mp8gbhYoltPkEOHvAopz25-vZ8C2e1cOaAo5WPcbSIuFcB4DjBOM3t0UA
Q8WU9ouRoO5jd6tfdcpX-2X-OteHw4dnMXdMLjHGGx86LMDeFRAN2KGz7EGPJiva O6JHkWLuAEYoe58lcxIQneyKdaYSLbV9cKqoUoFQpvKWYRHZbfszIyfsa18rmgTj
w0yM80fzT3zY0PKrIvU5ml1M5szqUnX4Jw0-PNcIM_j-L5YkLhv3Yk04XCwTJwxN zrtLDTPnc09DSJE24aQ8w3i8RXEDthW9T1J6LsTH_vwHdwUgkI-tC2PNeGrnM-dN
NmXCflYAQO9f00Aa213TJJr6dbHV6I642FwU-EWvtEfN3evgX3EFIVYSnT3HCHkA SfzF3Y7-lwcGy0FsdXkPXytvDV7y4pZeeUiQ-0VdibIN2AjjfW60nfrPuOjepMFG
AIdBQ9ykD-abRzVA_dGp_yJAZQcrZuNTqzThd_22YMPhIpzTygfC_4k7qqxI6t7L 6BBBbR37pHcyzext9epOAQ.
e_l5_o-taUG7vaNAl5FjEQ. 48V1_ALb6US04U3b.
_e21tGGhac_peEFkLXr2dMPUZiUkrw. _e21tGGhac_peEFkLXr2dMPUZiUkrw.
YbZSeHCNDZBqAdzpROlyiw 7V5ZDko0v_mf2PAc4JMiUg
See Appendix A.1 for the complete details of computing this JWE. See Appendix A.1 for the complete details of computing this JWE.
3.2. Example JWE with a Separate Integrity Check 3.2. Example JWE with a Separate Integrity Check
This example encrypts the plaintext "Now is the time for all good men This example encrypts the plaintext "No matter where you go, there
to come to the aid of their country." to the recipient using RSAES- you are." to the recipient using RSAES-PKCS1-V1_5 and AES CBC. AES
PKCS1-V1_5 and AES CBC. AES CBC does not have an integrated CBC does not have an integrated integrity check, so a separate
integrity check, so a separate integrity check calculation is integrity check calculation is performed using HMAC SHA-256, with
performed using HMAC SHA-256, with separate encryption and integrity separate encryption and integrity keys being derived from a master
keys being derived from a master key using the Concat KDF with the key using the Concat KDF with the SHA-256 digest function.
SHA-256 digest function.
The following example JWE Header (with line breaks for display The following example JWE Header (with line breaks for display
purposes only) declares that: purposes only) declares that:
o the Content Master Key is encrypted to the recipient using the o the Content Master Key is encrypted to the recipient using the
RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key, RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and
o the Plaintext is encrypted using the AES CBC algorithm with a 128 o the Plaintext is encrypted using the AES CBC algorithm with a 128
bit key to produce the Ciphertext, bit key to produce the Ciphertext, with the integrity of the
Ciphertext and the parameters used to create it being secured
o the JWE Integrity Value safeguarding the integrity of the using the HMAC SHA-256 algorithm.
Ciphertext and the parameters used to create it was computed with
the HMAC SHA-256 algorithm, and
o the 128 bit Initialization Vector (IV) with the base64url encoding
"AxY8DCtDaGlsbGljb3RoZQ" was used.
{"alg":"RSA1_5","enc":"A128CBC","int":"HS256","iv":"AxY8DCtDaGls {"alg":"RSA1_5","enc":"A128CBC+HS256"}
bGljb3RoZQ"}
Base64url encoding the bytes of the UTF-8 representation of the JWE Base64url encoding the bytes of the UTF-8 representation of the JWE
Header yields this Encoded JWE Header value (with line breaks for Header yields this Encoded JWE Header value:
display purposes only):
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDIiwiaW50IjoiSFMyNTYiLCJp eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0
diI6IkF4WThEQ3REYUdsc2JHbGpiM1JvWlEifQ
The remaining steps to finish creating this JWE are like the previous The remaining steps to finish creating this JWE are like the previous
example, but with an additional step to compute the separate example, but with an additional step to compute the separate
integrity value: integrity value:
o Generate a random Content Master Key (CMK) o Generate a random Content Master Key (CMK)
o Encrypt the CMK with the recipient's public key using the RSAES- o Encrypt the CMK with the recipient's public key using the RSAES-
PKCS1-V1_5 algorithm to produce the JWE Encrypted Key PKCS1-V1_5 algorithm to produce the JWE Encrypted Key
o Base64url encode the JWE Encrypted Key to produce the Encoded JWE o Base64url encode the JWE Encrypted Key to produce the Encoded JWE
Encrypted Key Encrypted Key
o Generate a random JWE Initialization Vector
o Base64url encode the JWE Initialization Vector to produce the
Encoded JWE Initialization Vector
o Use the Concat key derivation function to derive Content o Use the Concat key derivation function to derive Content
Encryption Key (CEK) and Content Integrity Key (CIK) values from Encryption Key (CEK) and Content Integrity Key (CIK) values from
the CMK the CMK
o Encrypt the Plaintext with AES CBC using the CEK and IV to produce o Encrypt the Plaintext with AES CBC using the CEK and JWE
the Ciphertext Initialization Vector to produce the Ciphertext
o Base64url encode the resulting Ciphertext to create the Encoded o Base64url encode the resulting Ciphertext to create the Encoded
JWE Ciphertext JWE Ciphertext
o Concatenate the Encoded JWE Header value, a period character o Concatenate the Encoded JWE Header value, a period character
('.'), the Encoded JWE Encrypted Key, a second period character, ('.'), the Encoded JWE Encrypted Key, a second period character
and the Encoded JWE Ciphertext to create the value to integrity ('.'), the Encoded JWE Initialization Vector, a third period ('.')
protect character, and the Encoded JWE Ciphertext to create the value to
integrity protect
o Compute the HMAC SHA-256 of this value using the CIK to create the o Compute the HMAC SHA-256 of this value using the CIK to create the
JWE Integrity Value JWE Integrity Value
o Base64url encode the resulting JWE Integrity Value to create the o Base64url encode the resulting JWE Integrity Value to create the
Encoded JWE Integrity Value Encoded JWE Integrity Value
o Assemble the final representation: The Compact Serialization of o Assemble the final representation: The Compact Serialization of
this result is the concatenation of the Encoded JWE Header, the this result is the concatenation of the Encoded JWE Header, the
Encoded JWE Encrypted Key, the Encoded JWE Ciphertext, and the Encoded JWE Encrypted Key, the Encoded JWE Initialization Vector,
Encoded JWE Integrity Value in that order, with the four strings the Encoded JWE Ciphertext, and the Encoded JWE Integrity Value in
being separated by three period ('.') characters. that order, with the five strings being separated by four period
('.') characters.
The final result in this example (with line breaks for display The final result in this example (with line breaks for display
purposes only) is: purposes only) is:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDIiwiaW50IjoiSFMyNTYiLCJp eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0.
diI6IkF4WThEQ3REYUdsc2JHbGpiM1JvWlEifQ. O6AqXqgVlJJ4c4lp5sXZd7bpGHAw6ARkHUeXQxD1cAW4-X1x0qtj_AN0mukqEOl4
IPI_z172hSWHMFgED8EG9DM6hIXU_6NaO1DImCn0vNeuoBq847Sl6qw_GHSYHJUQ Y6UOwJXIJY9-G1ELK-RQWrKH_StR-AM9H7GpKmSEji8QYOcMOjr-u9H1Lt_pBEie
XtXJq7S_CxWVrI82wjrOyaQca5tLZRZc45BfKHeqByThKI261QevEK56SyAwwXfK G802SxWz0rbFTXRcj4BWLxcpCtjUZ31AP-sc-L_eCZ5UNl0aSRNqFskuPkzRsFZR
KZjSvkQ5dwTFSgfy76rMSUvVynHYEhdCatBF9HWTAiXPx7hgZixG1FeP_QCmOylz DJqSSJeVOyJ7pZCQ83fli19Vgi_3R7XMUqluQuuc7ZHOWixi47jXlBTlWRZ5iFxa
2VClVyYFCbjKREOwBFf-puNYfO75S3LNlJUtTsGGQL2oTKpMsEiUTdefkje91VX9 S8G6J8wUrd4BKggAw3qX5XoIfXQVlQZE0Vmkq_zQSIo5LnFKyowooRcdsEuNh9B9
h8g7908lFsggbjV7NicJsufuXxnTj1fcWIrRDeNIOmakiPEODi0gTSz0ou-W-LWK Mkyt0ZQElG-jGdtHWjZSOA.
-3T1zYlOIiIKBjsExQKZ-w. AxY8DCtDaGlsbGljb3RoZQ.
_Z_djlIoC4MDSCKireWS2beti4Q6iSG2UjFujQvdz-_PQdUcFNkOulegD6BgjgdF 1eBWFgcrz40wC88cgv8rPgu3EfmC1p4zT0kIxxfSF2zDJcQ-iEHk1jQM95xAdr5Z.
LjeB4HHOO7UHvP8PEDu0a0sA2a_-CI0w2YQQ2QQe35M. RBGhYzE8_cZLHjJqqHuLhzbgWgL_wV3LDSUrcbkOiIA
c41k4T4eAgCCt63m8ZNmiOinMciFFypOFpvid7i6D0k
See Appendix A.2 for the complete details of computing this JWE. See Appendix A.2 for the complete details of computing this JWE.
4. JWE Header 4. JWE Header
The members of the JSON object represented by the JWE Header describe The members of the JSON object represented by the JWE Header describe
the encryption applied to the Plaintext and optionally additional the encryption applied to the Plaintext and optionally additional
properties of the JWE. The Header Parameter Names within this object properties of the JWE. The Header Parameter Names within this object
MUST be unique; JWEs with duplicate Header Parameter Names MUST be MUST be unique; JWEs with duplicate Header Parameter Names MUST be
rejected. Implementations MUST understand the entire contents of the rejected. Implementations MUST understand the entire contents of the
skipping to change at page 11, line 22 skipping to change at page 12, line 34
supported by the implementation and there MUST be a key for use with supported by the implementation and there MUST be a key for use with
that algorithm associated with the intended recipient or the JWE MUST that algorithm associated with the intended recipient or the JWE MUST
be rejected. "alg" values SHOULD either be registered in the IANA be rejected. "alg" values SHOULD either be registered in the IANA
JSON Web Signature and Encryption Algorithms registry [JWA] or be a JSON Web Signature and Encryption Algorithms registry [JWA] or be a
URI that contains a Collision Resistant Namespace. The "alg" value URI that contains a Collision Resistant Namespace. The "alg" value
is a case sensitive string containing a StringOrURI value. This is a case sensitive string containing a StringOrURI value. This
header parameter is REQUIRED. header parameter is REQUIRED.
A list of defined "alg" values can be found in the IANA JSON Web A list of defined "alg" values can be found in the IANA JSON Web
Signature and Encryption Algorithms registry [JWA]; the initial Signature and Encryption Algorithms registry [JWA]; the initial
contents of this registry is the values defined in Section 4.1 of the contents of this registry are the values defined in Section 4.1 of
JSON Web Algorithms (JWA) [JWA] specification. the JSON Web Algorithms (JWA) [JWA] specification.
4.1.2. "enc" (Encryption Method) Header Parameter 4.1.2. "enc" (Encryption Method) Header Parameter
The "enc" (encryption method) header parameter identifies the The "enc" (encryption method) header parameter identifies the
symmetric encryption algorithm used to encrypt the Plaintext to symmetric encryption algorithm used to encrypt the Plaintext to
produce the Ciphertext. The algorithm specified by the "enc" value produce the Ciphertext. The algorithm specified by the "enc" value
MUST be supported by the implementation or the JWE MUST be rejected. MUST be supported by the implementation or the JWE MUST be rejected.
"enc" values SHOULD either be registered in the IANA JSON Web "enc" values SHOULD either be registered in the IANA JSON Web
Signature and Encryption Algorithms registry [JWA] or be a URI that Signature and Encryption Algorithms registry [JWA] or be a URI that
contains a Collision Resistant Namespace. The "enc" value is a case contains a Collision Resistant Namespace. The "enc" value is a case
sensitive string containing a StringOrURI value. This header sensitive string containing a StringOrURI value. This header
parameter is REQUIRED. parameter is REQUIRED.
A list of defined "enc" values can be found in the IANA JSON Web A list of defined "enc" values can be found in the IANA JSON Web
Signature and Encryption Algorithms registry [JWA]; the initial Signature and Encryption Algorithms registry [JWA]; the initial
contents of this registry is the values defined in Section 4.2 of the contents of this registry are the values defined in Section 4.2 of
JSON Web Algorithms (JWA) [JWA] specification. the JSON Web Algorithms (JWA) [JWA] specification.
4.1.3. "int" (Integrity Algorithm) Header Parameter
The "int" (integrity algorithm) header parameter identifies the
cryptographic algorithm used to safeguard the integrity of the
Ciphertext and the parameters used to create it. The "int" parameter
uses the MAC subset of the algorithm values used by the JWS "alg"
parameter. "int" values SHOULD either be registered in the IANA JSON
Web Signature and Encryption Algorithms registry [JWA] or be a URI
that contains a Collision Resistant Namespace. The "int" value is a
case sensitive string containing a StringOrURI value. This header
parameter is REQUIRED when an AEAD algorithm is not used to encrypt
the Plaintext and MUST NOT be present when an AEAD algorithm is used.
A list of defined "int" values can be found in the IANA JSON Web
Signature and Encryption Algorithms registry [JWA]; the initial
contents of this registry is the values defined in Section 4.3 of the
JSON Web Algorithms (JWA) [JWA] specification.
4.1.4. "kdf" (Key Derivation Function) Header Parameter
The "kdf" (key derivation function) header parameter identifies the
cryptographic algorithm used to derive the CEK and CIK from the CMK.
"kdf" values SHOULD either be registered in the IANA JSON Web
Signature and Encryption Algorithms registry [JWA] or be a URI that
contains a Collision Resistant Namespace. The "kdf" value is a case
sensitive string containing a StringOrURI value. This header
parameter is OPTIONAL when an AEAD algorithm is not used to encrypt
the Plaintext and MUST NOT be present when an AEAD algorithm is used.
When an AEAD algorithm is not used and no "kdf" header parameter is
present, the "CS256" KDF [JWA] SHALL be used.
A list of defined "kdf" values can be found in the IANA JSON Web
Signature and Encryption Algorithms registry [JWA]; the initial
contents of this registry is the values defined in Section 4.4 of the
JSON Web Algorithms (JWA) [JWA] specification.
4.1.5. "iv" (Initialization Vector) Header Parameter
The "iv" (initialization vector) value for algorithms requiring it,
represented as a base64url encoded string. This header parameter is
OPTIONAL, although its use is REQUIRED with some "enc" algorithms.
4.1.6. "epk" (Ephemeral Public Key) Header Parameter 4.1.3. "epk" (Ephemeral Public Key) Header Parameter
The "epk" (ephemeral public key) value created by the originator for The "epk" (ephemeral public key) value created by the originator for
the use in key agreement algorithms. This key is represented as a the use in key agreement algorithms. This key is represented as a
JSON Web Key [JWK] value. This header parameter is OPTIONAL, JSON Web Key [JWK] value. This header parameter is OPTIONAL,
although its use is REQUIRED with some "alg" algorithms. although its use is REQUIRED with some "alg" algorithms.
4.1.7. "zip" (Compression Algorithm) Header Parameter 4.1.4. "zip" (Compression Algorithm) Header Parameter
The "zip" (compression algorithm) applied to the Plaintext before The "zip" (compression algorithm) applied to the Plaintext before
encryption, if any. If present, the value of the "zip" header encryption, if any. If present, the value of the "zip" header
parameter MUST be the case sensitive string "DEF". Compression is parameter MUST be the case sensitive string "DEF". Compression is
performed with the DEFLATE [RFC1951] algorithm. If no "zip" performed with the DEFLATE [RFC1951] algorithm. If no "zip"
parameter is present, no compression is applied to the Plaintext parameter is present, no compression is applied to the Plaintext
before encryption. This header parameter is OPTIONAL. before encryption. This header parameter is OPTIONAL.
4.1.8. "jku" (JWK Set URL) Header Parameter 4.1.5. "jku" (JWK Set URL) Header Parameter
The "jku" (JWK Set URL) header parameter is a URI [RFC3986] that The "jku" (JWK Set URL) header parameter is a URI [RFC3986] that
refers to a resource for a set of JSON-encoded public keys, one of refers to a resource for a set of JSON-encoded public keys, one of
which corresponds to the key used to encrypt the JWE; this can be which corresponds to the key used to encrypt the JWE; this can be
used to determine the private key needed to decrypt the JWE. The used to determine the private key needed to decrypt the JWE. The
keys MUST be encoded as a JSON Web Key Set (JWK Set) [JWK]. The keys MUST be encoded as a JSON Web Key Set (JWK Set) [JWK]. The
protocol used to acquire the resource MUST provide integrity protocol used to acquire the resource MUST provide integrity
protection; an HTTP GET request to retrieve the certificate MUST use protection; an HTTP GET request to retrieve the certificate MUST use
TLS [RFC2818] [RFC5246]; the identity of the server MUST be TLS [RFC2818] [RFC5246]; the identity of the server MUST be
validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. This validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. This
header parameter is OPTIONAL. header parameter is OPTIONAL.
4.1.9. "jwk" (JSON Web Key) Header Parameter 4.1.6. "jwk" (JSON Web Key) Header Parameter
The "jwk" (JSON Web Key) header parameter is a public key that The "jwk" (JSON Web Key) header parameter is a public key that
corresponds to the key used to encrypt the JWE; this can be used to corresponds to the key used to encrypt the JWE; this can be used to
determine the private key needed to decrypt the JWE. This key is determine the private key needed to decrypt the JWE. This key is
represented as a JSON Web Key [JWK]. This header parameter is represented as a JSON Web Key [JWK]. This header parameter is
OPTIONAL. OPTIONAL.
4.1.10. "x5u" (X.509 URL) Header Parameter 4.1.7. "x5u" (X.509 URL) Header Parameter
The "x5u" (X.509 URL) header parameter is a URI [RFC3986] that refers The "x5u" (X.509 URL) header parameter is a URI [RFC3986] that refers
to a resource for the X.509 public key certificate or certificate to a resource for the X.509 public key certificate or certificate
chain [RFC5280] corresponding to the key used to encrypt the JWE; chain [RFC5280] corresponding to the key used to encrypt the JWE;
this can be used to determine the private key needed to decrypt the this can be used to determine the private key needed to decrypt the
JWE. The identified resource MUST provide a representation of the JWE. The identified resource MUST provide a representation of the
certificate or certificate chain that conforms to RFC 5280 [RFC5280] certificate or certificate chain that conforms to RFC 5280 [RFC5280]
in PEM encoded form [RFC1421]. The certificate containing the public in PEM encoded form [RFC1421]. The certificate containing the public
key of the entity that encrypted the JWE MUST be the first key of the entity that encrypted the JWE MUST be the first
certificate. This MAY be followed by additional certificates, with certificate. This MAY be followed by additional certificates, with
each subsequent certificate being the one used to certify the each subsequent certificate being the one used to certify the
previous one. The protocol used to acquire the resource MUST provide previous one. The protocol used to acquire the resource MUST provide
integrity protection; an HTTP GET request to retrieve the certificate integrity protection; an HTTP GET request to retrieve the certificate
MUST use TLS [RFC2818] [RFC5246]; the identity of the server MUST be MUST use TLS [RFC2818] [RFC5246]; the identity of the server MUST be
validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. This validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. This
header parameter is OPTIONAL. header parameter is OPTIONAL.
4.1.11. "x5t" (X.509 Certificate Thumbprint) Header Parameter 4.1.8. "x5t" (X.509 Certificate Thumbprint) Header Parameter
The "x5t" (X.509 Certificate Thumbprint) header parameter provides a The "x5t" (X.509 Certificate Thumbprint) header parameter provides a
base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER
encoding of the X.509 certificate [RFC5280] corresponding to the key encoding of the X.509 certificate [RFC5280] corresponding to the key
used to encrypt the JWE; this can be used to determine the private used to encrypt the JWE; this can be used to determine the private
key needed to decrypt the JWE. This header parameter is OPTIONAL. key needed to decrypt the JWE. This header parameter is OPTIONAL.
If, in the future, certificate thumbprints need to be computed using If, in the future, certificate thumbprints need to be computed using
hash functions other than SHA-1, it is suggested that additional hash functions other than SHA-1, it is suggested that additional
related header parameters be defined for that purpose. For example, related header parameters be defined for that purpose. For example,
it is suggested that a new "x5t#S256" (X.509 Certificate Thumbprint it is suggested that a new "x5t#S256" (X.509 Certificate Thumbprint
using SHA-256) header parameter could be defined by registering it in using SHA-256) header parameter could be defined by registering it in
the IANA JSON Web Signature and Encryption Header Parameters registry the IANA JSON Web Signature and Encryption Header Parameters registry
[JWS]. [JWS].
4.1.12. "x5c" (X.509 Certificate Chain) Header Parameter 4.1.9. "x5c" (X.509 Certificate Chain) Header Parameter
The "x5c" (X.509 Certificate Chain) header parameter contains the The "x5c" (X.509 Certificate Chain) header parameter contains the
X.509 public key certificate or certificate chain [RFC5280] X.509 public key certificate or certificate chain [RFC5280]
corresponding to the key used to encrypt the JWE; this can be used to corresponding to the key used to encrypt the JWE; this can be used to
determine the private key needed to decrypt the JWE. The certificate determine the private key needed to decrypt the JWE. The certificate
or certificate chain is represented as an array of certificate or certificate chain is represented as an array of certificate value
values. Each value is a base64 encoded ([RFC4648] Section 4 - not strings. Each string is a base64 encoded ([RFC4648] Section 4 -- not
base64url encoded) DER [ITU.X690.1994] PKIX certificate value. The base64url encoded) DER [ITU.X690.1994] PKIX certificate value. The
certificate containing the public key of the entity that encrypted certificate containing the public key of the entity that encrypted
the JWE MUST be the first certificate. This MAY be followed by the JWE MUST be the first certificate. This MAY be followed by
additional certificates, with each subsequent certificate being the additional certificates, with each subsequent certificate being the
one used to certify the previous one. The recipient MUST verify the one used to certify the previous one. The recipient MUST verify the
certificate chain according to [RFC5280] and reject the JWE if any certificate chain according to [RFC5280] and reject the JWE if any
validation failure occurs. This header parameter is OPTIONAL. validation failure occurs. This header parameter is OPTIONAL.
See Appendix B of [JWS] for an example "x5c" value. See Appendix B of [JWS] for an example "x5c" value.
4.1.13. "kid" (Key ID) Header Parameter 4.1.10. "kid" (Key ID) Header Parameter
The "kid" (key ID) header parameter is a hint indicating which key The "kid" (key ID) header parameter is a hint indicating which key
was used to encrypt the JWE; this can be used to determine the was used to encrypt the JWE; this can be used to determine the
private key needed to decrypt the JWE. This parameter allows private key needed to decrypt the JWE. This parameter allows
originators to explicitly signal a change of key to recipients. originators to explicitly signal a change of key to recipients.
Should the recipient be unable to locate a key corresponding to the Should the recipient be unable to locate a key corresponding to the
"kid" value, they SHOULD treat that condition as an error. The "kid" value, they SHOULD treat that condition as an error. The
interpretation of the "kid" value is unspecified. Its value MUST be interpretation of the "kid" value is unspecified. Its value MUST be
a string. This header parameter is OPTIONAL. a string. This header parameter is OPTIONAL.
When used with a JWK, the "kid" value MAY be used to match a JWK When used with a JWK, the "kid" value MAY be used to match a JWK
"kid" parameter value. "kid" parameter value.
4.1.14. "typ" (Type) Header Parameter 4.1.11. "typ" (Type) Header Parameter
The "typ" (type) header parameter is used to declare the type of this The "typ" (type) header parameter is used to declare the type of this
object. The type value "JWE" MAY be used to indicate that this object. The type value "JWE" MAY be used to indicate that this
object is a JWE. The "typ" value is a case sensitive string. This object is a JWE. The "typ" value is a case sensitive string. This
header parameter is OPTIONAL. header parameter is OPTIONAL.
MIME Media Type [RFC2046] values MAY be used as "typ" values. MIME Media Type [RFC2046] values MAY be used as "typ" values.
"typ" values SHOULD either be registered in the IANA JSON Web "typ" values SHOULD either be registered in the IANA JSON Web
Signature and Encryption Type Values registry [JWS] or be a URI that Signature and Encryption Type Values registry [JWS] or be a URI that
contains a Collision Resistant Namespace. contains a Collision Resistant Namespace.
4.1.15. "cty" (Content Type) Header Parameter 4.1.12. "cty" (Content Type) Header Parameter
The "cty" (content type) header parameter is used to declare the type The "cty" (content type) header parameter is used to declare the type
of the encrypted content (the Plaintext). The "cty" value is a case of the encrypted content (the Plaintext). The "cty" value is a case
sensitive string. This header parameter is OPTIONAL. sensitive string. This header parameter is OPTIONAL.
The values used for the "cty" header parameter come from the same The values used for the "cty" header parameter come from the same
value space as the "typ" header parameter, with the same rules value space as the "typ" header parameter, with the same rules
applying. applying.
4.1.13. "apu" (Agreement PartyUInfo) Header Parameter
The "apu" (agreement PartyUInfo) value for key agreement algorithms
using it (such as "ECDH-ES"), represented as a base64url encoded
string. This header parameter is OPTIONAL.
4.1.14. "apv" (Agreement PartyVInfo) Header Parameter
The "apv" (agreement PartyVInfo) value for key agreement algorithms
using it (such as "ECDH-ES"), represented as a base64url encoded
string. This header parameter is OPTIONAL.
4.1.15. "epu" (Encryption PartyUInfo) Header Parameter
The "epu" (encryption PartyUInfo) value for plaintext encryption
algorithms using it (such as "A128CBC+HS256"), represented as a
base64url encoded string. This header parameter is OPTIONAL.
4.1.16. "epv" (Encryption PartyVInfo) Header Parameter
The "epv" (encryption PartyVInfo) value for plaintext encryption
algorithms using it (such as "A128CBC+HS256"), represented as a
base64url encoded string. This header parameter is OPTIONAL.
4.2. Public Header Parameter Names 4.2. Public Header Parameter Names
Additional header parameter names can be defined by those using JWEs. Additional header parameter names can be defined by those using JWEs.
However, in order to prevent collisions, any new header parameter However, in order to prevent collisions, any new header parameter
name SHOULD either be registered in the IANA JSON Web Signature and name SHOULD either be registered in the IANA JSON Web Signature and
Encryption Header Parameters registry [JWS] or be a URI that contains Encryption Header Parameters registry [JWS] or be a URI that contains
a Collision Resistant Namespace. In each case, the definer of the a Collision Resistant Namespace. In each case, the definer of the
name or value needs to take reasonable precautions to make sure they name or value needs to take reasonable precautions to make sure they
are in control of the part of the namespace they use to define the are in control of the part of the namespace they use to define the
header parameter name. header parameter name.
skipping to change at page 15, line 46 skipping to change at page 16, line 39
name that is not a Reserved Name Section 4.1 or a Public Name name that is not a Reserved Name Section 4.1 or a Public Name
Section 4.2. Unlike Public Names, these private names are subject to Section 4.2. Unlike Public Names, these private names are subject to
collision and should be used with caution. collision and should be used with caution.
5. Message Encryption 5. Message Encryption
The message encryption process is as follows. The order of the steps The message encryption process is as follows. The order of the steps
is not significant in cases where there are no dependencies between is not significant in cases where there are no dependencies between
the inputs and outputs of the steps. the inputs and outputs of the steps.
1. When key agreement is employed, use the key agreement algorithm 1. When key wrapping, key encryption, or key agreement with key
wrapping are employed, generate a random Content Master Key
(CMK). See RFC 4086 [RFC4086] for considerations on generating
random values. The CMK MUST have a length equal to that
required for the block encryption algorithm.
2. When key agreement is employed, use the key agreement algorithm
to compute the value of the agreed upon key. When key agreement to compute the value of the agreed upon key. When key agreement
without key wrapping is employed, let the Content Master Key without key wrapping is employed, let the Content Master Key
(CMK) be the agreed upon key. When key agreement with key (CMK) be the agreed upon key. When key agreement with key
wrapping is employed, the agreed upon key will be used to wrap wrapping is employed, the agreed upon key will be used to wrap
the CMK. the CMK.
2. When key wrapping, key encryption, or key agreement with key
wrapping are employed, generate a random Content Master Key
(CMK). See RFC 4086 [RFC4086] for considerations on generating
random values. The CMK MUST have a length equal to that of the
larger of the required encryption and integrity keys.
3. When key wrapping, key encryption, or key agreement with key 3. When key wrapping, key encryption, or key agreement with key
wrapping are employed, encrypt the CMK for the recipient (see wrapping are employed, encrypt the CMK for the recipient (see
Section 7) and let the result be the JWE Encrypted Key. Section 7) and let the result be the JWE Encrypted Key.
Otherwise, when direct encryption with a shared or agreed upon Otherwise, when direct encryption with a shared or agreed upon
symmetric key is employed, let the JWE Encrypted Key be the symmetric key is employed, let the JWE Encrypted Key be the
empty byte array. empty byte array.
4. When direct encryption with a shared symmetric key is employed, 4. When direct encryption with a shared symmetric key is employed,
let the Content Master Key (CMK) be the shared key. let the Content Master Key (CMK) be the shared key.
5. Base64url encode the JWE Encrypted Key to create the Encoded JWE 5. Base64url encode the JWE Encrypted Key to create the Encoded JWE
Encrypted Key. Encrypted Key.
6. Generate a random Initialization Vector (IV) of the correct size 6. Generate a random JWE Initialization Vector of the correct size
for the algorithm (if required for the algorithm). for the block encryption algorithm (if required for the
algorithm); otherwise, let the JWE Initialization Vector be the
empty byte string.
7. If not using an AEAD algorithm, run the key derivation algorithm 7. Base64url encode the JWE Initialization Vector to create the
specified by the "kdf" header parameter to generate the Content Encoded JWE Initialization Vector.
Encryption Key (CEK) and the Content Integrity Key (CIK);
otherwise (when using an AEAD algorithm), set the CEK to be the
CMK.
8. Compress the Plaintext if a "zip" parameter was included. 8. Compress the Plaintext if a "zip" parameter was included.
9. Serialize the (compressed) Plaintext into a byte sequence M. 9. Serialize the (compressed) Plaintext into a byte sequence M.
10. Create a JWE Header containing the encryption parameters used. 10. Create a JWE Header containing the encryption parameters used.
Note that white space is explicitly allowed in the Note that white space is explicitly allowed in the
representation and no canonicalization need be performed before representation and no canonicalization need be performed before
encoding. encoding.
11. Base64url encode the bytes of the UTF-8 representation of the 11. Base64url encode the bytes of the UTF-8 representation of the
JWE Header to create the Encoded JWE Header. JWE Header to create the Encoded JWE Header.
12. Encrypt M using the CEK and IV to form the byte sequence C. If 12. Encrypt M using the CMK, the JWE Initialization Vector, and the
an AEAD algorithm is used, use the bytes of the ASCII other parameters required for the specified block encryption
representation of the concatenation of the Encoded JWE Header, a algorithm to create the JWE Ciphertext value and the JWE
period ('.') character, and the Encoded JWE Encrypted Key as the Integrity Value.
"additional authenticated data" parameter value for the
encryption.
13. Base64url encode C to create the Encoded JWE Ciphertext.
14. If not using an AEAD algorithm, run the integrity algorithm (see 13. Base64url encode the JWE Ciphertext to create the Encoded JWE
Section 8) using the CIK to compute the JWE Integrity Value; Ciphertext.
otherwise (when using an AEAD algorithm), set the JWE Integrity
Value to be the "authentication tag" value produced by the AEAD
algorithm.
15. Base64url encode the JWE Integrity Value to create the Encoded 14. Base64url encode the JWE Integrity Value to create the Encoded
JWE Integrity Value. JWE Integrity Value.
16. The four encoded parts, taken together, are the result. 15. The five encoded parts, taken together, are the result.
17. The Compact Serialization of this result is the concatenation of 16. The Compact Serialization of this result is the concatenation of
the Encoded JWE Header, the Encoded JWE Encrypted Key, the the Encoded JWE Header, the Encoded JWE Encrypted Key, the
Encoded JWE Ciphertext, and the Encoded JWE Integrity Value in Encoded JWE Initialization Vector, the Encoded JWE Ciphertext,
that order, with the four strings being separated by period and the Encoded JWE Integrity Value in that order, with the five
('.') characters. strings being separated by four period ('.') characters.
6. Message Decryption 6. Message Decryption
The message decryption process is the reverse of the encryption The message decryption process is the reverse of the encryption
process. The order of the steps is not significant in cases where process. The order of the steps is not significant in cases where
there are no dependencies between the inputs and outputs of the there are no dependencies between the inputs and outputs of the
steps. If any of these steps fails, the JWE MUST be rejected. steps. If any of these steps fails, the JWE MUST be rejected.
1. Determine the Encoded JWE Header, the Encoded JWE Encrypted Key, 1. Determine the Encoded JWE Header, the Encoded JWE Encrypted Key,
the Encoded JWE Ciphertext, and the Encoded JWE Integrity Value the Encoded JWE Initialization Vector, the Encoded JWE
values contained in the JWE. When using the Compact Ciphertext, and the Encoded JWE Integrity Value values contained
Serialization, these four values are represented in that order, in the JWE. When using the Compact Serialization, these five
separated by period characters. values are represented in that order, separated by four period
('.') characters.
2. The Encoded JWE Header, the Encoded JWE Encrypted Key, the 2. The Encoded JWE Header, the Encoded JWE Encrypted Key, the
Encoded JWE Ciphertext, and the Encoded JWE Integrity Value MUST Encoded JWE Initialization Vector, the Encoded JWE Ciphertext,
be successfully base64url decoded following the restriction that and the Encoded JWE Integrity Value MUST be successfully
no padding characters have been used. base64url decoded following the restriction that no padding
characters have been used.
3. The resulting JWE Header MUST be completely valid JSON syntax 3. The resulting JWE Header MUST be completely valid JSON syntax
conforming to RFC 4627 [RFC4627]. conforming to RFC 4627 [RFC4627].
4. The resulting JWE Header MUST be validated to only include 4. The resulting JWE Header MUST be validated to only include
parameters and values whose syntax and semantics are both parameters and values whose syntax and semantics are both
understood and supported. understood and supported.
5. Verify that the JWE uses a key known to the recipient. 5. Verify that the JWE uses a key known to the recipient.
6. When key agreement is employed, use the key agreement algorithm 6. When key agreement is employed, use the key agreement algorithm
to compute the value of the agreed upon key. When key agreement to compute the value of the agreed upon key. When key agreement
without key wrapping is employed, let the Content Master Key without key wrapping is employed, let the Content Master Key
(CMK) be the agreed upon key. When key agreement with key (CMK) be the agreed upon key. When key agreement with key
wrapping is employed, the agreed upon key will be used to wrapping is employed, the agreed upon key will be used to
decrypt the JWE Encrypted Key. decrypt the JWE Encrypted Key.
7. When key wrapping, key encryption, or key agreement with key 7. When key wrapping, key encryption, or key agreement with key
wrapping are employed, decrypt the JWE Encrypted Key to produce wrapping are employed, decrypt the JWE Encrypted Key to produce
the Content Master Key (CMK). The CMK MUST have a length equal the Content Master Key (CMK). The CMK MUST have a length equal
to that of the larger of the required encryption and integrity to that required for the block encryption algorithm.
keys.
8. When direct encryption with a shared symmetric key is employed, 8. When direct encryption with a shared symmetric key is employed,
let the Content Master Key (CMK) be the shared key. let the Content Master Key (CMK) be the shared key.
9. If not using an AEAD algorithm, run the key derivation algorithm 9. Decrypt the JWE Ciphertext using the CMK, the JWE Initialization
specified by the "kdf" header parameter to generate the Content Vector, and the other parameters required for the specified
Encryption Key (CEK) and the Content Integrity Key (CIK); block encryption algorithm, returning the decrypted plaintext
otherwise (when using an AEAD algorithm), set the CEK to be the and verifying the JWE Integrity Value in the manner specified
CMK. for the algorithm.
10. Decrypt the binary representation of the JWE Ciphertext using
the CEK and IV. If an AEAD algorithm is used, use the bytes of
the ASCII representation of the concatenation of the Encoded JWE
Header, a period ('.') character, and the Encoded JWE Encrypted
Key as the "additional authenticated data" parameter value for
the decryption.
11. If not using an AEAD algorithm, run the integrity algorithm (see
Section 8) using the CIK to compute an integrity value for the
input received. This computed value MUST match the received JWE
Integrity Value; otherwise (when using an AEAD algorithm), the
received JWE Integrity Value MUST match the "authentication tag"
value produced by the AEAD algorithm.
12. Uncompress the result of the previous step, if a "zip" parameter 10. Uncompress the decrypted plaintext if a "zip" parameter was
was included. included.
13. Output the resulting Plaintext. 11. Output the resulting Plaintext.
7. CMK Encryption 7. CMK Encryption
JWE supports three forms of Content Master Key (CMK) encryption: JWE supports three forms of Content Master Key (CMK) encryption:
o Asymmetric encryption under the recipient's public key. o Asymmetric encryption under the recipient's public key.
o Symmetric encryption under a key shared between the sender and o Symmetric encryption under a key shared between the sender and
receiver. receiver.
o Symmetric encryption under a key agreed upon between the sender o Symmetric encryption under a key agreed upon between the sender
and receiver. and receiver.
See the algorithms registered for "enc" usage in the IANA JSON Web See the algorithms registered for "enc" usage in the IANA JSON Web
Signature and Encryption Algorithms registry [JWA] and Section 4.1 of Signature and Encryption Algorithms registry [JWA] and Section 4.1 of
the JSON Web Algorithms (JWA) [JWA] specification for lists of the JSON Web Algorithms (JWA) [JWA] specification for lists of
encryption algorithms that can be used for CMK encryption. encryption algorithms that can be used for CMK encryption.
8. Integrity Value Calculation 8. Encrypting JWEs with Cryptographic Algorithms
When a non-AEAD algorithm is used (an algorithm without an integrated
content check), JWE adds an explicit integrity check value to the
representation. This value is computed in the manner described in
the JSON Web Signature (JWS) [JWS] specification, with these
modifications:
o The algorithm used is taken from the "int" (integrity algorithm)
header parameter rather than the "alg" header parameter.
o The algorithm MUST be a MAC algorithm (such as HMAC SHA-256).
o The JWS Secured Input used is the bytes of the ASCII
representation of the concatenation of the Encoded JWE Header, a
period ('.') character, the Encoded JWE Encrypted Key, a period
('.') character, and the Encoded JWE Ciphertext.
o The CIK is used as the MAC key.
The computed JWS Signature value is the resulting integrity value.
9. Encrypting JWEs with Cryptographic Algorithms
JWE uses cryptographic algorithms to encrypt the Plaintext and the JWE uses cryptographic algorithms to encrypt the Plaintext and the
Content Encryption Key (CMK) and to provide integrity protection for Content Encryption Key (CMK) and to provide integrity protection for
the JWE Header, JWE Encrypted Key, and JWE Ciphertext. The JSON Web the JWE Header, JWE Encrypted Key, and JWE Ciphertext. The JSON Web
Algorithms (JWA) [JWA] specification specifies a set of cryptographic Algorithms (JWA) [JWA] specification specifies a set of cryptographic
algorithms and identifiers to be used with this specification and algorithms and identifiers to be used with this specification and
defines registries for additional such algorithms. Specifically, defines registries for additional such algorithms. Specifically,
Section 4.1 specifies a set of "alg" (algorithm) header parameter Section 4.1 specifies a set of "alg" (algorithm) header parameter
values, Section 4.2 specifies a set of "enc" (encryption method) values and Section 4.2 specifies a set of "enc" (encryption method)
header parameter values, Section 4.3 specifies a set of "int" header parameter values intended for use this specification. It also
(integrity algorithm) header parameter values, and Section 4.4 describes the semantics and operations that are specific to these
specifies a set of "kdf" (key derivation function) header parameter algorithms and algorithm families.
values intended for use this specification. It also describes the
semantics and operations that are specific to these algorithms and
algorithm families.
Public keys employed for encryption can be identified using the Public keys employed for encryption can be identified using the
Header Parameter methods described in Section 4.1 or can be Header Parameter methods described in Section 4.1 or can be
distributed using methods that are outside the scope of this distributed using methods that are outside the scope of this
specification. specification.
10. IANA Considerations 9. IANA Considerations
10.1. Registration of JWE Header Parameter Names 9.1. Registration of JWE Header Parameter Names
This specification registers the Header Parameter Names defined in This specification registers the Header Parameter Names defined in
Section 4.1 in the IANA JSON Web Signature and Encryption Header Section 4.1 in the IANA JSON Web Signature and Encryption Header
Parameters registry [JWS]. Parameters registry [JWS].
10.1.1. Registry Contents 9.1.1. Registry Contents
o Header Parameter Name: "alg" o Header Parameter Name: "alg"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.1 of [[ this document ]] o Specification Document(s): Section 4.1.1 of [[ this document ]]
o Header Parameter Name: "enc" o Header Parameter Name: "enc"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.2 of [[ this document ]] o Specification Document(s): Section 4.1.2 of [[ this document ]]
o Header Parameter Name: "int" o Header Parameter Name: "epk"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.3 of [[ this document ]] o Specification Document(s): Section 4.1.3 of [[ this document ]]
o Header Parameter Name: "kdf" o Header Parameter Name: "zip"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.4 of [[ this document ]] o Specification Document(s): Section 4.1.4 of [[ this document ]]
o Header Parameter Name: "iv" o Header Parameter Name: "jku"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.5 of [[ this document ]] o Specification Document(s): Section 4.1.5 of [[ this document ]]
o Header Parameter Name: "epk" o Header Parameter Name: "jwk"
o Change Controller: IETF o Change Controller: IETF
o Specification document(s): Section 4.1.6 of [[ this document ]]
o Specification Document(s): Section 4.1.6 of [[ this document ]] o Header Parameter Name: "x5u"
o Header Parameter Name: "zip"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.7 of [[ this document ]] o Specification Document(s): Section 4.1.7 of [[ this document ]]
o Header Parameter Name: "jku" o Header Parameter Name: "x5t"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.8 of [[ this document ]] o Specification Document(s): Section 4.1.8 of [[ this document ]]
o Header Parameter Name: "jwk" o Header Parameter Name: "x5c"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.9 of [[ this document ]]
o Specification document(s): Section 4.1.9 of [[ this document ]] o Header Parameter Name: "kid"
o Header Parameter Name: "x5u"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.10 of [[ this document ]] o Specification Document(s): Section 4.1.10 of [[ this document ]]
o Header Parameter Name: "x5t" o Header Parameter Name: "typ"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.11 of [[ this document ]] o Specification Document(s): Section 4.1.11 of [[ this document ]]
o Header Parameter Name: "x5c" o Header Parameter Name: "cty"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.12 of [[ this document ]] o Specification Document(s): Section 4.1.12 of [[ this document ]]
o Header Parameter Name: "kid" o Header Parameter Name: "apu"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.13 of [[ this document ]] o Specification Document(s): Section 4.1.13 of [[ this document ]]
o Header Parameter Name: "typ" o Header Parameter Name: "apv"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.14 of [[ this document ]] o Specification Document(s): Section 4.1.14 of [[ this document ]]
o Header Parameter Name: "cty" o Header Parameter Name: "epu"
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.15 of [[ this document ]] o Specification Document(s): Section 4.1.15 of [[ this document ]]
10.2. JSON Web Signature and Encryption Type Values Registration o Header Parameter Name: "epv"
o Change Controller: IETF
o Specification Document(s): Section 4.1.16 of [[ this document ]]
10.2.1. Registry Contents 9.2. JSON Web Signature and Encryption Type Values Registration
9.2.1. Registry Contents
This specification registers the "JWE" type value in the IANA JSON This specification registers the "JWE" type value in the IANA JSON
Web Signature and Encryption Type Values registry [JWS]: Web Signature and Encryption Type Values registry [JWS]:
o "typ" Header Parameter Value: "JWE" o "typ" Header Parameter Value: "JWE"
o Abbreviation for MIME Type: application/jwe o Abbreviation for MIME Type: application/jwe
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.11 of [[ this document ]]
o Specification Document(s): Section 4.1.14 of [[ this document ]] 9.3. Media Type Registration
10.3. Media Type Registration
10.3.1. Registry Contents 9.3.1. Registry Contents
This specification registers the "application/jwe" Media Type This specification registers the "application/jwe" Media Type
[RFC2046] in the MIME Media Type registry [RFC4288] to indicate that [RFC2046] in the MIME Media Type registry [RFC4288] to indicate that
the content is a JWE using the Compact Serialization. the content is a JWE using the Compact Serialization.
o Type Name: application o Type Name: application
o Subtype Name: jwe o Subtype Name: jwe
o Required Parameters: n/a o Required Parameters: n/a
o Optional Parameters: n/a o Optional Parameters: n/a
o Encoding considerations: JWE values are encoded as a series of o Encoding considerations: JWE values are encoded as a series of
base64url encoded values (some of which may be the empty string) base64url encoded values (some of which may be the empty string)
separated by period ('.') characters separated by period ('.') characters
o Security Considerations: See the Security Considerations section o Security Considerations: See the Security Considerations section
of this document of this document
o Interoperability Considerations: n/a o Interoperability Considerations: n/a
o Published Specification: [[ this document ]] o Published Specification: [[ this document ]]
o Applications that use this media type: OpenID Connect and other o Applications that use this media type: OpenID Connect and other
applications using encrypted JWTs applications using encrypted JWTs
o Additional Information: Magic number(s): n/a, File extension(s): o Additional Information: Magic number(s): n/a, File extension(s):
n/a, Macintosh file type code(s): n/a n/a, Macintosh file type code(s): n/a
o Person & email address to contact for further information: Michael o Person & email address to contact for further information: Michael
B. Jones, mbj@microsoft.com B. Jones, mbj@microsoft.com
o Intended Usage: COMMON o Intended Usage: COMMON
o Restrictions on Usage: none o Restrictions on Usage: none
o Author: Michael B. Jones, mbj@microsoft.com o Author: Michael B. Jones, mbj@microsoft.com
o Change Controller: IETF o Change Controller: IETF
11. Security Considerations 10. Security Considerations
All of the security issues faced by any cryptographic application All of the security issues faced by any cryptographic application
must be faced by a JWS/JWE/JWK agent. Among these issues are must be faced by a JWS/JWE/JWK agent. Among these issues are
protecting the user's private key, preventing various attacks, and protecting the user's private key, preventing various attacks, and
helping the user avoid mistakes such as inadvertently encrypting a helping the user avoid mistakes such as inadvertently encrypting a
message for the wrong recipient. The entire list of security message for the wrong recipient. The entire list of security
considerations is beyond the scope of this document, but some considerations is beyond the scope of this document, but some
significant concerns are listed here. significant concerns are listed here.
All the security considerations in the JWS specification also apply All the security considerations in the JWS specification also apply
to this specification. Likewise, all the security considerations in to this specification. Likewise, all the security considerations in
XML Encryption 1.1 [W3C.CR-xmlenc-core1-20120313] also apply to JWE, XML Encryption 1.1 [W3C.CR-xmlenc-core1-20120313] also apply to JWE,
other than those that are XML specific. other than those that are XML specific.
12. Open Issues 11. References
[[ to be removed by the RFC editor before publication as an RFC ]]
The following items remain to be considered or done in this draft:
o Should we define an optional nonce and/or timestamp header
parameter? (Use of a nonce is an effective countermeasure to some
kinds of attacks.)
o Do we want to consolidate the combination of the "enc", "int", and
"kdf" parameters into a single new "enc" parameter defining
composite AEAD algorithms? For instance, we might define a
composite algorithm A128CBC with HS256 and CS256 and another
composite algorithm A256CBC with HS512 and CS512. A symmetry
argument for doing this is that the "int" and "kdf" parameters are
not used with AEAD algorithms. An argument against it is that in
some cases, integrity is not needed because it's provided by other
means, and so having the flexibility to not use an "int" algorithm
or key derivation with a non-AEAD "enc" algorithm could be useful.
o Do we want to represent the JWE IV as a separate dot-separated
element or continue to have it be in the header? An IV is always
required in practice for the block encryption algorithms we've
specified. This would save 15 and 17 characters, respectively,
for the current AES GCM and AES CBC examples.
13. References
13.1. Normative References 11.1. Normative References
[ITU.X690.1994] [ITU.X690.1994]
International Telecommunications Union, "Information International Telecommunications Union, "Information
Technology - ASN.1 encoding rules: Specification of Basic Technology - ASN.1 encoding rules: Specification of Basic
Encoding Rules (BER), Canonical Encoding Rules (CER) and Encoding Rules (BER), Canonical Encoding Rules (CER) and
Distinguished Encoding Rules (DER)", ITU-T Recommendation Distinguished Encoding Rules (DER)", ITU-T Recommendation
X.690, 1994. X.690, 1994.
[JWA] Jones, M., "JSON Web Algorithms (JWA)", July 2012. [JWA] Jones, M., "JSON Web Algorithms (JWA)", October 2012.
[JWK] Jones, M., "JSON Web Key (JWK)", July 2012. [JWK] Jones, M., "JSON Web Key (JWK)", October 2012.
[JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web
Signature (JWS)", July 2012. Signature (JWS)", October 2012.
[RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic [RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic
Mail: Part I: Message Encryption and Authentication Mail: Part I: Message Encryption and Authentication
Procedures", RFC 1421, February 1993. Procedures", RFC 1421, February 1993.
[RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification [RFC1951] Deutsch, P., "DEFLATE Compressed Data Format Specification
version 1.3", RFC 1951, May 1996. version 1.3", RFC 1951, May 1996.
[RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
Extensions (MIME) Part Two: Media Types", RFC 2046, Extensions (MIME) Part Two: Media Types", RFC 2046,
skipping to change at page 26, line 5 skipping to change at page 24, line 18
Infrastructure Certificate and Certificate Revocation List Infrastructure Certificate and Certificate Revocation List
(CRL) Profile", RFC 5280, May 2008. (CRL) Profile", RFC 5280, May 2008.
[W3C.CR-xmlenc-core1-20120313] [W3C.CR-xmlenc-core1-20120313]
Eastlake, D., Reagle, J., Hirsch, F., and T. Roessler, Eastlake, D., Reagle, J., Hirsch, F., and T. Roessler,
"XML Encryption Syntax and Processing Version 1.1", World "XML Encryption Syntax and Processing Version 1.1", World
Wide Web Consortium CR CR-xmlenc-core1-20120313, Wide Web Consortium CR CR-xmlenc-core1-20120313,
March 2012, March 2012,
<http://www.w3.org/TR/2012/CR-xmlenc-core1-20120313>. <http://www.w3.org/TR/2012/CR-xmlenc-core1-20120313>.
13.2. Informative References 11.2. Informative References
[I-D.rescorla-jsms] [I-D.rescorla-jsms]
Rescorla, E. and J. Hildebrand, "JavaScript Message Rescorla, E. and J. Hildebrand, "JavaScript Message
Security Format", draft-rescorla-jsms-00 (work in Security Format", draft-rescorla-jsms-00 (work in
progress), March 2011. progress), March 2011.
[JSE] Bradley, J. and N. Sakimura (editor), "JSON Simple [JSE] Bradley, J. and N. Sakimura (editor), "JSON Simple
Encryption", September 2010. Encryption", September 2010.
[JWE-JS] Jones, M., "JSON Web Encryption JSON Serialization [JWE-JS] Jones, M., "JSON Web Encryption JSON Serialization
(JWE-JS)", July 2012. (JWE-JS)", October 2012.
[RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally [RFC4122] Leach, P., Mealling, M., and R. Salz, "A Universally
Unique IDentifier (UUID) URN Namespace", RFC 4122, Unique IDentifier (UUID) URN Namespace", RFC 4122,
July 2005. July 2005.
[RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70, [RFC5652] Housley, R., "Cryptographic Message Syntax (CMS)", STD 70,
RFC 5652, September 2009. RFC 5652, September 2009.
Appendix A. JWE Examples Appendix A. JWE Examples
skipping to change at page 26, line 43 skipping to change at page 25, line 10
integrated integrity check. The representation of this plaintext is: integrated integrity check. The representation of this plaintext is:
[76, 105, 118, 101, 32, 108, 111, 110, 103, 32, 97, 110, 100, 32, [76, 105, 118, 101, 32, 108, 111, 110, 103, 32, 97, 110, 100, 32,
112, 114, 111, 115, 112, 101, 114, 46] 112, 114, 111, 115, 112, 101, 114, 46]
A.1.1. JWE Header A.1.1. JWE Header
The following example JWE Header declares that: The following example JWE Header declares that:
o the Content Master Key is encrypted to the recipient using the o the Content Master Key is encrypted to the recipient using the
RSAES OAEP algorithm to produce the JWE Encrypted Key, RSAES OAEP algorithm to produce the JWE Encrypted Key and
o the Plaintext is encrypted using the AES GCM algorithm with a 256 o the Plaintext is encrypted using the AES GCM algorithm with a 256
bit key to produce the Ciphertext, and bit key to produce the Ciphertext.
o the 96 bit Initialization Vector (IV) [227, 197, 117, 252, 2, 219,
233, 68, 180, 225, 77, 219] with the base64url encoding
"48V1_ALb6US04U3b" was used.
{"alg":"RSA-OAEP","enc":"A256GCM","iv":"48V1_ALb6US04U3b"} {"alg":"RSA-OAEP","enc":"A256GCM"}
A.1.2. Encoded JWE Header A.1.2. Encoded JWE Header
Base64url encoding the bytes of the UTF-8 representation of the JWE Base64url encoding the bytes of the UTF-8 representation of the JWE
Header yields this Encoded JWE Header value (with line breaks for Header yields this Encoded JWE Header value:
display purposes only):
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00iLCJpdiI6IjQ4VjFfQUxi eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ
NlVTMDRVM2IifQ
A.1.3. Content Master Key (CMK) A.1.3. Content Master Key (CMK)
Generate a random Content Master Key (CMK). In this example, the key Generate a 256 bit random Content Master Key (CMK). In this example,
value is: the value is:
[177, 161, 244, 128, 84, 143, 225, 115, 63, 180, 3, 255, 107, 154, [177, 161, 244, 128, 84, 143, 225, 115, 63, 180, 3, 255, 107, 154,
212, 246, 138, 7, 110, 91, 112, 46, 34, 105, 47, 130, 203, 46, 122, 212, 246, 138, 7, 110, 91, 112, 46, 34, 105, 47, 130, 203, 46, 122,
234, 64, 252] 234, 64, 252]
A.1.4. Key Encryption A.1.4. Key Encryption
Encrypt the CMK with the recipient's public key using the RSAES OAEP Encrypt the CMK with the recipient's public key using the RSAES OAEP
algorithm to produce the JWE Encrypted Key. In this example, the RSA algorithm to produce the JWE Encrypted Key. In this example, the RSA
key parameters are: key parameters are:
skipping to change at page 29, line 31 skipping to change at page 27, line 31
| | 38, 249, 208, 17, 197, 49, 45, 19, 232, 157, 251, | | | 38, 249, 208, 17, 197, 49, 45, 19, 232, 157, 251, |
| | 131, 137, 175, 72, 126, 43, 229, 69, 179, 117, 82, | | | 131, 137, 175, 72, 126, 43, 229, 69, 179, 117, 82, |
| | 157, 213, 83, 35, 57, 210, 197, 252, 171, 143, 194, | | | 157, 213, 83, 35, 57, 210, 197, 252, 171, 143, 194, |
| | 11, 47, 163, 6, 253, 75, 252, 96, 11, 187, 84, 130, | | | 11, 47, 163, 6, 253, 75, 252, 96, 11, 187, 84, 130, |
| | 210, 7, 121, 78, 91, 79, 57, 251, 138, 132, 220, 60, | | | 210, 7, 121, 78, 91, 79, 57, 251, 138, 132, 220, 60, |
| | 224, 173, 56, 224, 201] | | | 224, 173, 56, 224, 201] |
+-----------+-------------------------------------------------------+ +-----------+-------------------------------------------------------+
The resulting JWE Encrypted Key value is: The resulting JWE Encrypted Key value is:
[142, 252, 40, 202, 21, 177, 56, 198, 232, 7, 151, 49, 95, 169, 220, [51, 101, 241, 165, 179, 145, 41, 236, 202, 75, 60, 208, 47, 255,
2, 46, 214, 167, 116, 57, 20, 164, 109, 150, 98, 49, 223, 154, 95, 121, 248, 104, 226, 185, 212, 65, 78, 169, 255, 162, 100, 188, 207,
71, 209, 233, 17, 174, 142, 203, 232, 132, 167, 17, 42, 51, 125, 22, 220, 96, 161, 22, 251, 47, 66, 112, 229, 75, 4, 111, 25, 173, 200,
221, 135, 17, 67, 197, 148, 246, 139, 145, 160, 238, 99, 119, 171, 121, 246, 79, 189, 102, 173, 146, 228, 142, 14, 12, 167, 200, 27,
95, 117, 202, 87, 251, 101, 254, 58, 215, 135, 195, 135, 103, 49, 133, 138, 37, 180, 249, 4, 56, 123, 192, 162, 156, 246, 231, 235,
119, 76, 46, 49, 198, 27, 31, 58, 44, 192, 222, 21, 16, 13, 216, 161, 217, 240, 45, 158, 213, 195, 154, 2, 142, 86, 61, 198, 210, 34, 225,
179, 236, 65, 143, 38, 43, 218, 195, 76, 140, 243, 71, 243, 79, 124, 92, 7, 128, 227, 4, 227, 55, 183, 69, 0, 59, 162, 71, 145, 98, 238,
216, 208, 242, 171, 34, 245, 57, 154, 93, 76, 230, 204, 234, 82, 117, 0, 70, 40, 123, 159, 37, 115, 18, 16, 157, 236, 138, 117, 166, 18,
248, 39, 13, 62, 60, 215, 8, 51, 248, 254, 47, 150, 36, 46, 27, 247, 45, 181, 125, 112, 170, 168, 82, 129, 80, 166, 242, 150, 97, 17, 217,
98, 77, 56, 92, 44, 19, 39, 12, 77, 54, 101, 194, 126, 86, 0, 64, 109, 251, 51, 35, 39, 236, 107, 95, 43, 154, 4, 227, 206, 187, 75,
239, 95, 211, 64, 26, 219, 93, 211, 36, 154, 250, 117, 177, 213, 232, 13, 51, 231, 115, 79, 67, 72, 145, 54, 225, 164, 60, 195, 120, 188,
142, 184, 216, 92, 20, 248, 69, 175, 180, 71, 205, 221, 235, 224, 95, 69, 113, 3, 182, 21, 189, 79, 82, 122, 46, 196, 199, 254, 252, 7,
113, 5, 33, 86, 18, 157, 61, 199, 8, 121, 0, 0, 135, 65, 67, 220, 119, 5, 32, 144, 143, 173, 11, 99, 205, 120, 106, 231, 51, 231, 77,
164, 15, 230, 155, 71, 53, 64, 253, 209, 169, 255, 34, 64, 101, 7, 73, 252, 197, 221, 142, 254, 151, 7, 6, 203, 65, 108, 117, 121, 15,
43, 102, 227, 83, 171, 52, 225, 119, 253, 182, 96, 195, 225, 34, 156, 95, 43, 111, 13, 94, 242, 226, 150, 94, 121, 72, 144, 251, 69, 93,
211, 202, 7, 194, 255, 137, 59, 170, 172, 72, 234, 222, 203, 123, 137, 178, 13, 216, 8, 227, 125, 110, 180, 157, 250, 207, 184, 232,
249, 121, 254, 143, 173, 105, 65, 187, 189, 163, 64, 151, 145, 99, 222, 164, 193, 70, 232, 16, 65, 109, 29, 251, 164, 119, 50, 205, 236,
17] 109, 245, 234, 78, 1]
A.1.5. Encoded JWE Encrypted Key A.1.5. Encoded JWE Encrypted Key
Base64url encode the JWE Encrypted Key to produce the Encoded JWE Base64url encode the JWE Encrypted Key to produce the Encoded JWE
Encrypted Key. This result (with line breaks for display purposes Encrypted Key. This result (with line breaks for display purposes
only) is: only) is:
jvwoyhWxOMboB5cxX6ncAi7Wp3Q5FKRtlmIx35pfR9HpEa6Oy-iEpxEqM30W3YcR M2XxpbORKezKSzzQL_95-GjiudRBTqn_omS8z9xgoRb7L0Jw5UsEbxmtyHn2T71m
Q8WU9ouRoO5jd6tfdcpX-2X-OteHw4dnMXdMLjHGGx86LMDeFRAN2KGz7EGPJiva rZLkjg4Mp8gbhYoltPkEOHvAopz25-vZ8C2e1cOaAo5WPcbSIuFcB4DjBOM3t0UA
w0yM80fzT3zY0PKrIvU5ml1M5szqUnX4Jw0-PNcIM_j-L5YkLhv3Yk04XCwTJwxN O6JHkWLuAEYoe58lcxIQneyKdaYSLbV9cKqoUoFQpvKWYRHZbfszIyfsa18rmgTj
NmXCflYAQO9f00Aa213TJJr6dbHV6I642FwU-EWvtEfN3evgX3EFIVYSnT3HCHkA zrtLDTPnc09DSJE24aQ8w3i8RXEDthW9T1J6LsTH_vwHdwUgkI-tC2PNeGrnM-dN
AIdBQ9ykD-abRzVA_dGp_yJAZQcrZuNTqzThd_22YMPhIpzTygfC_4k7qqxI6t7L SfzF3Y7-lwcGy0FsdXkPXytvDV7y4pZeeUiQ-0VdibIN2AjjfW60nfrPuOjepMFG
e_l5_o-taUG7vaNAl5FjEQ 6BBBbR37pHcyzext9epOAQ
A.1.6. "Additional Authenticated Data" Parameter A.1.6. Initialization Vector
Generate a random 96 bit JWE Initialization Vector. In this example,
the value is:
[227, 197, 117, 252, 2, 219, 233, 68, 180, 225, 77, 219]
Base64url encoding this value yields the Encoded JWE Initialization
Vector value:
48V1_ALb6US04U3b
A.1.7. "Additional Authenticated Data" Parameter
Concatenate the Encoded JWE Header value, a period character ('.'), Concatenate the Encoded JWE Header value, a period character ('.'),
and the Encoded JWE Encrypted Key to create the "additional the Encoded JWE Encrypted Key, a second period character ('.'), and
the Encoded JWE Initialization Vector to create the "additional
authenticated data" parameter for the AES GCM algorithm. This result authenticated data" parameter for the AES GCM algorithm. This result
(with line breaks for display purposes only) is: (with line breaks for display purposes only) is:
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00iLCJpdiI6IjQ4VjFfQUxi eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.
NlVTMDRVM2IifQ. M2XxpbORKezKSzzQL_95-GjiudRBTqn_omS8z9xgoRb7L0Jw5UsEbxmtyHn2T71m
jvwoyhWxOMboB5cxX6ncAi7Wp3Q5FKRtlmIx35pfR9HpEa6Oy-iEpxEqM30W3YcR rZLkjg4Mp8gbhYoltPkEOHvAopz25-vZ8C2e1cOaAo5WPcbSIuFcB4DjBOM3t0UA
Q8WU9ouRoO5jd6tfdcpX-2X-OteHw4dnMXdMLjHGGx86LMDeFRAN2KGz7EGPJiva O6JHkWLuAEYoe58lcxIQneyKdaYSLbV9cKqoUoFQpvKWYRHZbfszIyfsa18rmgTj
w0yM80fzT3zY0PKrIvU5ml1M5szqUnX4Jw0-PNcIM_j-L5YkLhv3Yk04XCwTJwxN zrtLDTPnc09DSJE24aQ8w3i8RXEDthW9T1J6LsTH_vwHdwUgkI-tC2PNeGrnM-dN
NmXCflYAQO9f00Aa213TJJr6dbHV6I642FwU-EWvtEfN3evgX3EFIVYSnT3HCHkA SfzF3Y7-lwcGy0FsdXkPXytvDV7y4pZeeUiQ-0VdibIN2AjjfW60nfrPuOjepMFG
AIdBQ9ykD-abRzVA_dGp_yJAZQcrZuNTqzThd_22YMPhIpzTygfC_4k7qqxI6t7L 6BBBbR37pHcyzext9epOAQ.
e_l5_o-taUG7vaNAl5FjEQ 48V1_ALb6US04U3b
The representation of this value is: The representation of this value is:
[101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 48, 69, [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 48, 69,
116, 84, 48, 70, 70, 85, 67, 73, 115, 73, 109, 86, 117, 89, 121, 73, 116, 84, 48, 70, 70, 85, 67, 73, 115, 73, 109, 86, 117, 89, 121, 73,
54, 73, 107, 69, 121, 78, 84, 90, 72, 81, 48, 48, 105, 76, 67, 74, 54, 73, 107, 69, 121, 78, 84, 90, 72, 81, 48, 48, 105, 102, 81, 46,
112, 100, 105, 73, 54, 73, 106, 81, 52, 86, 106, 70, 102, 81, 85, 77, 50, 88, 120, 112, 98, 79, 82, 75, 101, 122, 75, 83, 122, 122, 81,
120, 105, 78, 108, 86, 84, 77, 68, 82, 86, 77, 50, 73, 105, 102, 81, 76, 95, 57, 53, 45, 71, 106, 105, 117, 100, 82, 66, 84, 113, 110, 95,
46, 106, 118, 119, 111, 121, 104, 87, 120, 79, 77, 98, 111, 66, 53, 111, 109, 83, 56, 122, 57, 120, 103, 111, 82, 98, 55, 76, 48, 74,
99, 120, 88, 54, 110, 99, 65, 105, 55, 87, 112, 51, 81, 53, 70, 75, 119, 53, 85, 115, 69, 98, 120, 109, 116, 121, 72, 110, 50, 84, 55,
82, 116, 108, 109, 73, 120, 51, 53, 112, 102, 82, 57, 72, 112, 69, 49, 109, 114, 90, 76, 107, 106, 103, 52, 77, 112, 56, 103, 98, 104,
97, 54, 79, 121, 45, 105, 69, 112, 120, 69, 113, 77, 51, 48, 87, 51, 89, 111, 108, 116, 80, 107, 69, 79, 72, 118, 65, 111, 112, 122, 50,
89, 99, 82, 81, 56, 87, 85, 57, 111, 117, 82, 111, 79, 53, 106, 100, 53, 45, 118, 90, 56, 67, 50, 101, 49, 99, 79, 97, 65, 111, 53, 87,
54, 116, 102, 100, 99, 112, 88, 45, 50, 88, 45, 79, 116, 101, 72, 80, 99, 98, 83, 73, 117, 70, 99, 66, 52, 68, 106, 66, 79, 77, 51,
119, 52, 100, 110, 77, 88, 100, 77, 76, 106, 72, 71, 71, 120, 56, 54, 116, 48, 85, 65, 79, 54, 74, 72, 107, 87, 76, 117, 65, 69, 89, 111,
76, 77, 68, 101, 70, 82, 65, 78, 50, 75, 71, 122, 55, 69, 71, 80, 74, 101, 53, 56, 108, 99, 120, 73, 81, 110, 101, 121, 75, 100, 97, 89,
105, 118, 97, 119, 48, 121, 77, 56, 48, 102, 122, 84, 51, 122, 89, 83, 76, 98, 86, 57, 99, 75, 113, 111, 85, 111, 70, 81, 112, 118, 75,
48, 80, 75, 114, 73, 118, 85, 53, 109, 108, 49, 77, 53, 115, 122, 87, 89, 82, 72, 90, 98, 102, 115, 122, 73, 121, 102, 115, 97, 49, 56,
113, 85, 110, 88, 52, 74, 119, 48, 45, 80, 78, 99, 73, 77, 95, 106, 114, 109, 103, 84, 106, 122, 114, 116, 76, 68, 84, 80, 110, 99, 48,
45, 76, 53, 89, 107, 76, 104, 118, 51, 89, 107, 48, 52, 88, 67, 119, 57, 68, 83, 74, 69, 50, 52, 97, 81, 56, 119, 51, 105, 56, 82, 88, 69,
84, 74, 119, 120, 78, 78, 109, 88, 67, 102, 108, 89, 65, 81, 79, 57, 68, 116, 104, 87, 57, 84, 49, 74, 54, 76, 115, 84, 72, 95, 118, 119,
102, 48, 48, 65, 97, 50, 49, 51, 84, 74, 74, 114, 54, 100, 98, 72, 72, 100, 119, 85, 103, 107, 73, 45, 116, 67, 50, 80, 78, 101, 71,
86, 54, 73, 54, 52, 50, 70, 119, 85, 45, 69, 87, 118, 116, 69, 102, 114, 110, 77, 45, 100, 78, 83, 102, 122, 70, 51, 89, 55, 45, 108,
78, 51, 101, 118, 103, 88, 51, 69, 70, 73, 86, 89, 83, 110, 84, 51, 119, 99, 71, 121, 48, 70, 115, 100, 88, 107, 80, 88, 121, 116, 118,
72, 67, 72, 107, 65, 65, 73, 100, 66, 81, 57, 121, 107, 68, 45, 97, 68, 86, 55, 121, 52, 112, 90, 101, 101, 85, 105, 81, 45, 48, 86, 100,
98, 82, 122, 86, 65, 95, 100, 71, 112, 95, 121, 74, 65, 90, 81, 99, 105, 98, 73, 78, 50, 65, 106, 106, 102, 87, 54, 48, 110, 102, 114,
114, 90, 117, 78, 84, 113, 122, 84, 104, 100, 95, 50, 50, 89, 77, 80, 80, 117, 79, 106, 101, 112, 77, 70, 71, 54, 66, 66, 66, 98, 82, 51,
104, 73, 112, 122, 84, 121, 103, 102, 67, 95, 52, 107, 55, 113, 113, 55, 112, 72, 99, 121, 122, 101, 120, 116, 57, 101, 112, 79, 65, 81,
120, 73, 54, 116, 55, 76, 101, 95, 108, 53, 95, 111, 45, 116, 97, 85, 46, 52, 56, 86, 49, 95, 65, 76, 98, 54, 85, 83, 48, 52, 85, 51, 98]
71, 55, 118, 97, 78, 65, 108, 53, 70, 106, 69, 81]
A.1.7. Plaintext Encryption A.1.8. Plaintext Encryption
Encrypt the Plaintext with AES GCM, using the IV, the CMK as the Encrypt the Plaintext with AES GCM using the CMK as the encryption
encryption key, and the "additional authenticated data" value above, key, the JWE Initialization Vector, and the "additional authenticated
requesting a 128 bit "authentication tag" output. The resulting data" value above, requesting a 128 bit "authentication tag" output.
Ciphertext is: The resulting Ciphertext is:
[253, 237, 181, 180, 97, 161, 105, 207, 233, 120, 65, 100, 45, 122, [253, 237, 181, 180, 97, 161, 105, 207, 233, 120, 65, 100, 45, 122,
246, 116, 195, 212, 102, 37, 36, 175] 246, 116, 195, 212, 102, 37, 36, 175]
The resulting "authentication tag" value is: The resulting "authentication tag" value is:
[97, 182, 82, 120, 112, 141, 13, 144, 106, 1, 220, 233, 68, 233, 114, [237, 94, 89, 14, 74, 52, 191, 249, 159, 216, 240, 28, 224, 147, 34,
139] 82]
A.1.8. Encoded JWE Ciphertext A.1.9. Encoded JWE Ciphertext
Base64url encode the resulting Ciphertext to create the Encoded JWE Base64url encode the resulting Ciphertext to create the Encoded JWE
Ciphertext. This result is: Ciphertext. This result is:
_e21tGGhac_peEFkLXr2dMPUZiUkrw _e21tGGhac_peEFkLXr2dMPUZiUkrw
A.1.9. Encoded JWE Integrity Value A.1.10. Encoded JWE Integrity Value
Base64url encode the resulting "authentication tag" to create the Base64url encode the resulting "authentication tag" to create the
Encoded JWE Integrity Value. This result is: Encoded JWE Integrity Value. This result is:
YbZSeHCNDZBqAdzpROlyiw 7V5ZDko0v_mf2PAc4JMiUg
A.1.10. Complete Representation A.1.11. Complete Representation
Assemble the final representation: The Compact Serialization of this Assemble the final representation: The Compact Serialization of this
result is the concatenation of the Encoded JWE Header, the Encoded result is the concatenation of the Encoded JWE Header, the Encoded
JWE Encrypted Key, the Encoded JWE Ciphertext, and the Encoded JWE JWE Encrypted Key, the Encoded JWE Initialization Vector, the Encoded
Integrity Value in that order, with the four strings being separated JWE Ciphertext, and the Encoded JWE Integrity Value in that order,
by three period ('.') characters. with the five strings being separated by four period ('.')
characters.
The final result in this example (with line breaks for display The final result in this example (with line breaks for display
purposes only) is: purposes only) is:
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00iLCJpdiI6IjQ4VjFfQUxi eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.
NlVTMDRVM2IifQ. M2XxpbORKezKSzzQL_95-GjiudRBTqn_omS8z9xgoRb7L0Jw5UsEbxmtyHn2T71m
jvwoyhWxOMboB5cxX6ncAi7Wp3Q5FKRtlmIx35pfR9HpEa6Oy-iEpxEqM30W3YcR rZLkjg4Mp8gbhYoltPkEOHvAopz25-vZ8C2e1cOaAo5WPcbSIuFcB4DjBOM3t0UA
Q8WU9ouRoO5jd6tfdcpX-2X-OteHw4dnMXdMLjHGGx86LMDeFRAN2KGz7EGPJiva O6JHkWLuAEYoe58lcxIQneyKdaYSLbV9cKqoUoFQpvKWYRHZbfszIyfsa18rmgTj
w0yM80fzT3zY0PKrIvU5ml1M5szqUnX4Jw0-PNcIM_j-L5YkLhv3Yk04XCwTJwxN zrtLDTPnc09DSJE24aQ8w3i8RXEDthW9T1J6LsTH_vwHdwUgkI-tC2PNeGrnM-dN
NmXCflYAQO9f00Aa213TJJr6dbHV6I642FwU-EWvtEfN3evgX3EFIVYSnT3HCHkA SfzF3Y7-lwcGy0FsdXkPXytvDV7y4pZeeUiQ-0VdibIN2AjjfW60nfrPuOjepMFG
AIdBQ9ykD-abRzVA_dGp_yJAZQcrZuNTqzThd_22YMPhIpzTygfC_4k7qqxI6t7L 6BBBbR37pHcyzext9epOAQ.
e_l5_o-taUG7vaNAl5FjEQ. 48V1_ALb6US04U3b.
_e21tGGhac_peEFkLXr2dMPUZiUkrw. _e21tGGhac_peEFkLXr2dMPUZiUkrw.
YbZSeHCNDZBqAdzpROlyiw 7V5ZDko0v_mf2PAc4JMiUg
A.1.11. Validation A.1.12. Validation
This example illustrates the process of creating a JWE with an AEAD This example illustrates the process of creating a JWE with an AEAD
algorithm. These results can be used to validate JWE decryption algorithm. These results can be used to validate JWE decryption
implementations for these algorithms. However, note that since the implementations for these algorithms. Note that since the RSAES OAEP
RSAES OAEP computation includes random values, the results above will computation includes random values, the encryption results above will
not be repeatable. not be completely reproducible. However, since the AES GCM
computation is deterministic, the JWE Encrypted Ciphertext values
will be the same for all encryptions performed using these inputs.
A.2. Example JWE using RSAES-PKCS1-V1_5 and AES CBC A.2. Example JWE using RSAES-PKCS1-V1_5 and AES CBC
This example encrypts the plaintext "Now is the time for all good men This example encrypts the plaintext "No matter where you go, there
to come to the aid of their country." to the recipient using RSAES- you are." to the recipient using RSAES-PKCS1-V1_5 and AES CBC. AES
PKCS1-V1_5 and AES CBC. AES CBC does not have an integrated CBC does not have an integrated integrity check, so a separate
integrity check, so a separate integrity check calculation is integrity check calculation is performed using HMAC SHA-256, with
performed using HMAC SHA-256, with separate encryption and integrity separate encryption and integrity keys being derived from a master
keys being derived from a master key using the Concat KDF with the key using the Concat KDF with the SHA-256 digest function. The
SHA-256 digest function. The representation of this plaintext is: representation of this plaintext is:
[78, 111, 119, 32, 105, 115, 32, 116, 104, 101, 32, 116, 105, 109, [78, 111, 32, 109, 97, 116, 116, 101, 114, 32, 119, 104, 101, 114,
101, 32, 102, 111, 114, 32, 97, 108, 108, 32, 103, 111, 111, 100, 32, 101, 32, 121, 111, 117, 32, 103, 111, 44, 32, 116, 104, 101, 114,
109, 101, 110, 32, 116, 111, 32, 99, 111, 109, 101, 32, 116, 111, 32, 101, 32, 121, 111, 117, 32, 97, 114, 101, 46]
116, 104, 101, 32, 97, 105, 100, 32, 111, 102, 32, 116, 104, 101,
105, 114, 32, 99, 111, 117, 110, 116, 114, 121, 46]
A.2.1. JWE Header A.2.1. JWE Header
The following example JWE Header (with line breaks for display The following example JWE Header (with line breaks for display
purposes only) declares that: purposes only) declares that:
o the Content Master Key is encrypted to the recipient using the o the Content Master Key is encrypted to the recipient using the
RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key, RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and
o the Plaintext is encrypted using the AES CBC algorithm with a 128 o the Plaintext is encrypted using the AES CBC algorithm with a 128
bit key to produce the Ciphertext, bit key to produce the Ciphertext, with the integrity of the
Ciphertext and the parameters used to create it being secured with
o the JWE Integrity Value safeguarding the integrity of the the HMAC SHA-256 algorithm.
Ciphertext and the parameters used to create it was computed with
the HMAC SHA-256 algorithm, and
o the 128 bit Initialization Vector (IV) [3, 22, 60, 12, 43, 67,
104, 105, 108, 108, 105, 99, 111, 116, 104, 101] with the
base64url encoding "AxY8DCtDaGlsbGljb3RoZQ" was used.
{"alg":"RSA1_5","enc":"A128CBC","int":"HS256","iv":"AxY8DCtDaGls {"alg":"RSA1_5","enc":"A128CBC+HS256"}
bGljb3RoZQ"}
A.2.2. Encoded JWE Header A.2.2. Encoded JWE Header
Base64url encoding the bytes of the UTF-8 representation of the JWE Base64url encoding the bytes of the UTF-8 representation of the JWE
Header yields this Encoded JWE Header value (with line breaks for Header yields this Encoded JWE Header value:
display purposes only):
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDIiwiaW50IjoiSFMyNTYiLCJp eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0
diI6IkF4WThEQ3REYUdsc2JHbGpiM1JvWlEifQ
A.2.3. Content Master Key (CMK) A.2.3. Content Master Key (CMK)
Generate a random Content Master Key (CMK). In this example, the key Generate a 256 bit random Content Master Key (CMK). In this example,
value is: the key value is:
[4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106, [4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106,
206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156, 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156,
44, 207] 44, 207]
A.2.4. Key Encryption A.2.4. Key Encryption
Encrypt the CMK with the recipient's public key using the RSAES- Encrypt the CMK with the recipient's public key using the RSAES-
PKCS1-V1_5 algorithm to produce the JWE Encrypted Key. In this PKCS1-V1_5 algorithm to produce the JWE Encrypted Key. In this
example, the RSA key parameters are: example, the RSA key parameters are:
skipping to change at page 35, line 31 skipping to change at page 33, line 31
| | 46, 196, 90, 173, 38, 245, 219, 186, 222, 27, 240, | | | 46, 196, 90, 173, 38, 245, 219, 186, 222, 27, 240, |
| | 212, 194, 15, 66, 135, 226, 178, 190, 52, 245, 74, | | | 212, 194, 15, 66, 135, 226, 178, 190, 52, 245, 74, |
| | 65, 224, 81, 100, 85, 25, 204, 165, 203, 187, 175, | | | 65, 224, 81, 100, 85, 25, 204, 165, 203, 187, 175, |
| | 84, 100, 82, 15, 11, 23, 202, 151, 107, 54, 41, 207, | | | 84, 100, 82, 15, 11, 23, 202, 151, 107, 54, 41, 207, |
| | 3, 136, 229, 134, 131, 93, 139, 50, 182, 204, 93, | | | 3, 136, 229, 134, 131, 93, 139, 50, 182, 204, 93, |
| | 130, 89] | | | 130, 89] |
+-----------+-------------------------------------------------------+ +-----------+-------------------------------------------------------+
The resulting JWE Encrypted Key value is: The resulting JWE Encrypted Key value is:
[32, 242, 63, 207, 94, 246, 133, 37, 135, 48, 88, 4, 15, 193, 6, 244, [59, 160, 42, 94, 168, 21, 148, 146, 120, 115, 137, 105, 230, 197,
51, 58, 132, 133, 212, 255, 163, 90, 59, 80, 200, 152, 41, 244, 188, 217, 119, 182, 233, 24, 112, 48, 232, 4, 100, 29, 71, 151, 67, 16,
215, 174, 160, 26, 188, 227, 180, 165, 234, 172, 63, 24, 116, 152, 245, 112, 5, 184, 249, 125, 113, 210, 171, 99, 252, 3, 116, 154, 233,
28, 149, 16, 94, 213, 201, 171, 180, 191, 11, 21, 149, 172, 143, 54, 42, 16, 233, 120, 99, 165, 14, 192, 149, 200, 37, 143, 126, 27, 81,
194, 58, 206, 201, 164, 28, 107, 155, 75, 101, 22, 92, 227, 144, 95, 11, 43, 228, 80, 90, 178, 135, 253, 43, 81, 248, 3, 61, 31, 177, 169,
40, 119, 170, 7, 36, 225, 40, 141, 186, 213, 7, 175, 16, 174, 122, 42, 100, 132, 142, 47, 16, 96, 231, 12, 58, 58, 254, 187, 209, 245,
75, 32, 48, 193, 119, 202, 41, 152, 210, 190, 68, 57, 119, 4, 197, 46, 223, 233, 4, 72, 158, 27, 205, 54, 75, 21, 179, 210, 182, 197,
74, 7, 242, 239, 170, 204, 73, 75, 213, 202, 113, 216, 18, 23, 66, 77, 116, 92, 143, 128, 86, 47, 23, 41, 10, 216, 212, 103, 125, 64,
106, 208, 69, 244, 117, 147, 2, 37, 207, 199, 184, 96, 102, 44, 70, 63, 235, 28, 248, 191, 222, 9, 158, 84, 54, 93, 26, 73, 19, 106, 22,
212, 87, 143, 253, 0, 166, 59, 41, 115, 217, 80, 165, 87, 38, 5, 9, 201, 46, 62, 76, 209, 176, 86, 81, 12, 154, 146, 72, 151, 149, 59,
184, 202, 68, 67, 176, 4, 87, 254, 166, 227, 88, 124, 238, 249, 75, 34, 123, 165, 144, 144, 243, 119, 229, 139, 95, 85, 130, 47, 247, 71,
114, 205, 148, 149, 45, 78, 193, 134, 64, 189, 168, 76, 170, 76, 176, 181, 204, 82, 169, 110, 66, 235, 156, 237, 145, 206, 90, 44, 98, 227,
72, 148, 77, 215, 159, 146, 55, 189, 213, 85, 253, 135, 200, 59, 247, 184, 215, 148, 20, 229, 89, 22, 121, 136, 92, 90, 75, 193, 186, 39,
79, 37, 22, 200, 32, 110, 53, 123, 54, 39, 9, 178, 231, 238, 95, 25, 204, 20, 173, 222, 1, 42, 8, 0, 195, 122, 151, 229, 122, 8, 125, 116,
211, 143, 87, 220, 88, 138, 209, 13, 227, 72, 58, 102, 164, 136, 241, 21, 149, 6, 68, 209, 89, 164, 171, 252, 208, 72, 138, 57, 46, 113,
14, 14, 45, 32, 77, 44, 244, 162, 239, 150, 248, 181, 138, 251, 116, 74, 202, 140, 40, 161, 23, 29, 176, 75, 141, 135, 208, 125, 50, 76,
245, 205, 137, 78, 34, 34, 10, 6, 59, 4, 197, 2, 153, 251] 173, 209, 148, 4, 148, 111, 163, 25, 219, 71, 90, 54, 82, 56]
A.2.5. Encoded JWE Encrypted Key A.2.5. Encoded JWE Encrypted Key
Base64url encode the JWE Encrypted Key to produce the Encoded JWE Base64url encode the JWE Encrypted Key to produce the Encoded JWE
Encrypted Key. This result (with line breaks for display purposes Encrypted Key. This result (with line breaks for display purposes
only) is: only) is:
IPI_z172hSWHMFgED8EG9DM6hIXU_6NaO1DImCn0vNeuoBq847Sl6qw_GHSYHJUQ O6AqXqgVlJJ4c4lp5sXZd7bpGHAw6ARkHUeXQxD1cAW4-X1x0qtj_AN0mukqEOl4
XtXJq7S_CxWVrI82wjrOyaQca5tLZRZc45BfKHeqByThKI261QevEK56SyAwwXfK Y6UOwJXIJY9-G1ELK-RQWrKH_StR-AM9H7GpKmSEji8QYOcMOjr-u9H1Lt_pBEie
KZjSvkQ5dwTFSgfy76rMSUvVynHYEhdCatBF9HWTAiXPx7hgZixG1FeP_QCmOylz G802SxWz0rbFTXRcj4BWLxcpCtjUZ31AP-sc-L_eCZ5UNl0aSRNqFskuPkzRsFZR
2VClVyYFCbjKREOwBFf-puNYfO75S3LNlJUtTsGGQL2oTKpMsEiUTdefkje91VX9 DJqSSJeVOyJ7pZCQ83fli19Vgi_3R7XMUqluQuuc7ZHOWixi47jXlBTlWRZ5iFxa
h8g7908lFsggbjV7NicJsufuXxnTj1fcWIrRDeNIOmakiPEODi0gTSz0ou-W-LWK S8G6J8wUrd4BKggAw3qX5XoIfXQVlQZE0Vmkq_zQSIo5LnFKyowooRcdsEuNh9B9
-3T1zYlOIiIKBjsExQKZ-w Mkyt0ZQElG-jGdtHWjZSOA
A.2.6. Key Derivation A.2.6. Key Derivation
Use the Concat key derivation function to derive Content Encryption Use the Concat key derivation function to derive Content Encryption
Key (CEK) and Content Integrity Key (CIK) values from the CMK. The Key (CEK) and Content Integrity Key (CIK) values from the CMK. The
details of this derivation are shown in Appendix A.3. The resulting details of this derivation are shown in Appendix A.4. The resulting
CEK value is: CEK value is:
[249, 255, 87, 218, 224, 223, 221, 53, 204, 121, 166, 130, 195, 184, [37, 245, 125, 247, 113, 155, 238, 98, 228, 206, 62, 65, 81, 153, 79,
50, 69] 91]
The resulting CIK value is: The resulting CIK value is:
[218, 209, 130, 50, 169, 45, 70, 214, 29, 187, 123, 20, 3, 158, 111, [203, 194, 197, 180, 120, 46, 123, 202, 78, 12, 33, 116, 214, 247,
122, 182, 94, 57, 133, 245, 76, 97, 44, 193, 80, 81, 246, 115, 177, 128, 41, 175, 53, 181, 164, 224, 223, 56, 146, 179, 193, 18, 223,
225, 159] 146, 85, 244, 127]
A.2.7. Plaintext Encryption A.2.7. Initialization Vector
Encrypt the Plaintext with AES CBC using the CEK and IV to produce Generate a random 128 bit JWE Initialization Vector. In this
the Ciphertext. The resulting Ciphertext is: example, the value is:
[253, 159, 221, 142, 82, 40, 11, 131, 3, 72, 34, 162, 173, 229, 146, [3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111, 116, 104,
217, 183, 173, 139, 132, 58, 137, 33, 182, 82, 49, 110, 141, 11, 221, 101]
207, 239, 207, 65, 213, 28, 20, 217, 14, 186, 87, 160, 15, 160, 96,
142, 7, 69, 46, 55, 129, 224, 113, 206, 59, 181, 7, 188, 255, 15, 16,
59, 180, 107, 75, 0, 217, 175, 254, 8, 141, 48, 217, 132, 16, 217, 4,
30, 223, 147]
A.2.8. Encoded JWE Ciphertext Base64url encoding this value yields the Encoded JWE Initialization
Vector value:
AxY8DCtDaGlsbGljb3RoZQ
A.2.8. Plaintext Encryption
Encrypt the Plaintext with AES CBC using the CEK and the JWE
Initialization Vector to produce the Ciphertext. The resulting
Ciphertext is:
[213, 224, 86, 22, 7, 43, 207, 141, 48, 11, 207, 28, 130, 255, 43,
62, 11, 183, 17, 249, 130, 214, 158, 51, 79, 73, 8, 199, 23, 210, 23,
108, 195, 37, 196, 62, 136, 65, 228, 214, 52, 12, 247, 156, 64, 118,
190, 89]
A.2.9. Encoded JWE Ciphertext
Base64url encode the resulting Ciphertext to create the Encoded JWE Base64url encode the resulting Ciphertext to create the Encoded JWE
Ciphertext. This result (with line breaks for display purposes only) Ciphertext. This result is:
is:
_Z_djlIoC4MDSCKireWS2beti4Q6iSG2UjFujQvdz-_PQdUcFNkOulegD6BgjgdF 1eBWFgcrz40wC88cgv8rPgu3EfmC1p4zT0kIxxfSF2zDJcQ-iEHk1jQM95xAdr5Z
LjeB4HHOO7UHvP8PEDu0a0sA2a_-CI0w2YQQ2QQe35M
A.2.9. Secured Input Value A.2.10. Secured Input Value
Concatenate the Encoded JWE Header value, a period character ('.'), Concatenate the Encoded JWE Header value, a period character ('.'),
the Encoded JWE Encrypted Key, a second period character, and the the Encoded JWE Encrypted Key, a second period character, the Encoded
JWE Initialization Vector, a third period ('.') character, and the
Encoded JWE Ciphertext to create the value to integrity protect. Encoded JWE Ciphertext to create the value to integrity protect.
This result (with line breaks for display purposes only) is: This result (with line breaks for display purposes only) is:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDIiwiaW50IjoiSFMyNTYiLCJp eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0.
diI6IkF4WThEQ3REYUdsc2JHbGpiM1JvWlEifQ. O6AqXqgVlJJ4c4lp5sXZd7bpGHAw6ARkHUeXQxD1cAW4-X1x0qtj_AN0mukqEOl4
IPI_z172hSWHMFgED8EG9DM6hIXU_6NaO1DImCn0vNeuoBq847Sl6qw_GHSYHJUQ Y6UOwJXIJY9-G1ELK-RQWrKH_StR-AM9H7GpKmSEji8QYOcMOjr-u9H1Lt_pBEie
XtXJq7S_CxWVrI82wjrOyaQca5tLZRZc45BfKHeqByThKI261QevEK56SyAwwXfK G802SxWz0rbFTXRcj4BWLxcpCtjUZ31AP-sc-L_eCZ5UNl0aSRNqFskuPkzRsFZR
KZjSvkQ5dwTFSgfy76rMSUvVynHYEhdCatBF9HWTAiXPx7hgZixG1FeP_QCmOylz DJqSSJeVOyJ7pZCQ83fli19Vgi_3R7XMUqluQuuc7ZHOWixi47jXlBTlWRZ5iFxa
2VClVyYFCbjKREOwBFf-puNYfO75S3LNlJUtTsGGQL2oTKpMsEiUTdefkje91VX9 S8G6J8wUrd4BKggAw3qX5XoIfXQVlQZE0Vmkq_zQSIo5LnFKyowooRcdsEuNh9B9
h8g7908lFsggbjV7NicJsufuXxnTj1fcWIrRDeNIOmakiPEODi0gTSz0ou-W-LWK Mkyt0ZQElG-jGdtHWjZSOA.
-3T1zYlOIiIKBjsExQKZ-w. AxY8DCtDaGlsbGljb3RoZQ.
_Z_djlIoC4MDSCKireWS2beti4Q6iSG2UjFujQvdz-_PQdUcFNkOulegD6BgjgdF 1eBWFgcrz40wC88cgv8rPgu3EfmC1p4zT0kIxxfSF2zDJcQ-iEHk1jQM95xAdr5Z
LjeB4HHOO7UHvP8PEDu0a0sA2a_-CI0w2YQQ2QQe35M
The representation of this value is: The representation of this value is:
[101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 48, 69, [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 48, 69,
120, 88, 122, 85, 105, 76, 67, 74, 108, 98, 109, 77, 105, 79, 105, 120, 88, 122, 85, 105, 76, 67, 74, 108, 98, 109, 77, 105, 79, 105,
74, 66, 77, 84, 73, 52, 81, 48, 74, 68, 73, 105, 119, 105, 97, 87, 74, 66, 77, 84, 73, 52, 81, 48, 74, 68, 75, 48, 104, 84, 77, 106, 85,
53, 48, 73, 106, 111, 105, 83, 70, 77, 121, 78, 84, 89, 105, 76, 67, 50, 73, 110, 48, 46, 79, 54, 65, 113, 88, 113, 103, 86, 108, 74, 74,
74, 112, 100, 105, 73, 54, 73, 107, 70, 52, 87, 84, 104, 69, 81, 51, 52, 99, 52, 108, 112, 53, 115, 88, 90, 100, 55, 98, 112, 71, 72, 65,
82, 69, 89, 85, 100, 115, 99, 50, 74, 72, 98, 71, 112, 105, 77, 49, 119, 54, 65, 82, 107, 72, 85, 101, 88, 81, 120, 68, 49, 99, 65, 87,
74, 118, 87, 108, 69, 105, 102, 81, 46, 73, 80, 73, 95, 122, 49, 55, 52, 45, 88, 49, 120, 48, 113, 116, 106, 95, 65, 78, 48, 109, 117,
50, 104, 83, 87, 72, 77, 70, 103, 69, 68, 56, 69, 71, 57, 68, 77, 54, 107, 113, 69, 79, 108, 52, 89, 54, 85, 79, 119, 74, 88, 73, 74, 89,
104, 73, 88, 85, 95, 54, 78, 97, 79, 49, 68, 73, 109, 67, 110, 48, 57, 45, 71, 49, 69, 76, 75, 45, 82, 81, 87, 114, 75, 72, 95, 83, 116,
118, 78, 101, 117, 111, 66, 113, 56, 52, 55, 83, 108, 54, 113, 119, 82, 45, 65, 77, 57, 72, 55, 71, 112, 75, 109, 83, 69, 106, 105, 56,
95, 71, 72, 83, 89, 72, 74, 85, 81, 88, 116, 88, 74, 113, 55, 83, 95, 81, 89, 79, 99, 77, 79, 106, 114, 45, 117, 57, 72, 49, 76, 116, 95,
67, 120, 87, 86, 114, 73, 56, 50, 119, 106, 114, 79, 121, 97, 81, 99, 112, 66, 69, 105, 101, 71, 56, 48, 50, 83, 120, 87, 122, 48, 114, 98,
97, 53, 116, 76, 90, 82, 90, 99, 52, 53, 66, 102, 75, 72, 101, 113, 70, 84, 88, 82, 99, 106, 52, 66, 87, 76, 120, 99, 112, 67, 116, 106,
66, 121, 84, 104, 75, 73, 50, 54, 49, 81, 101, 118, 69, 75, 53, 54, 85, 90, 51, 49, 65, 80, 45, 115, 99, 45, 76, 95, 101, 67, 90, 53, 85,
83, 121, 65, 119, 119, 88, 102, 75, 75, 90, 106, 83, 118, 107, 81, 78, 108, 48, 97, 83, 82, 78, 113, 70, 115, 107, 117, 80, 107, 122,
53, 100, 119, 84, 70, 83, 103, 102, 121, 55, 54, 114, 77, 83, 85, 82, 115, 70, 90, 82, 68, 74, 113, 83, 83, 74, 101, 86, 79, 121, 74,
118, 86, 121, 110, 72, 89, 69, 104, 100, 67, 97, 116, 66, 70, 57, 72, 55, 112, 90, 67, 81, 56, 51, 102, 108, 105, 49, 57, 86, 103, 105, 95,
87, 84, 65, 105, 88, 80, 120, 55, 104, 103, 90, 105, 120, 71, 49, 70, 51, 82, 55, 88, 77, 85, 113, 108, 117, 81, 117, 117, 99, 55, 90, 72,
101, 80, 95, 81, 67, 109, 79, 121, 108, 122, 50, 86, 67, 108, 86, 79, 87, 105, 120, 105, 52, 55, 106, 88, 108, 66, 84, 108, 87, 82, 90,
121, 89, 70, 67, 98, 106, 75, 82, 69, 79, 119, 66, 70, 102, 45, 112, 53, 105, 70, 120, 97, 83, 56, 71, 54, 74, 56, 119, 85, 114, 100, 52,
117, 78, 89, 102, 79, 55, 53, 83, 51, 76, 78, 108, 74, 85, 116, 84, 66, 75, 103, 103, 65, 119, 51, 113, 88, 53, 88, 111, 73, 102, 88, 81,
115, 71, 71, 81, 76, 50, 111, 84, 75, 112, 77, 115, 69, 105, 85, 84, 86, 108, 81, 90, 69, 48, 86, 109, 107, 113, 95, 122, 81, 83, 73, 111,
100, 101, 102, 107, 106, 101, 57, 49, 86, 88, 57, 104, 56, 103, 55, 53, 76, 110, 70, 75, 121, 111, 119, 111, 111, 82, 99, 100, 115, 69,
57, 48, 56, 108, 70, 115, 103, 103, 98, 106, 86, 55, 78, 105, 99, 74, 117, 78, 104, 57, 66, 57, 77, 107, 121, 116, 48, 90, 81, 69, 108, 71,
115, 117, 102, 117, 88, 120, 110, 84, 106, 49, 102, 99, 87, 73, 114, 45, 106, 71, 100, 116, 72, 87, 106, 90, 83, 79, 65, 46, 65, 120, 89,
82, 68, 101, 78, 73, 79, 109, 97, 107, 105, 80, 69, 79, 68, 105, 48, 56, 68, 67, 116, 68, 97, 71, 108, 115, 98, 71, 108, 106, 98, 51, 82,
103, 84, 83, 122, 48, 111, 117, 45, 87, 45, 76, 87, 75, 45, 51, 84, 111, 90, 81, 46, 49, 101, 66, 87, 70, 103, 99, 114, 122, 52, 48, 119,
49, 122, 89, 108, 79, 73, 105, 73, 75, 66, 106, 115, 69, 120, 81, 75, 67, 56, 56, 99, 103, 118, 56, 114, 80, 103, 117, 51, 69, 102, 109,
90, 45, 119, 46, 95, 90, 95, 100, 106, 108, 73, 111, 67, 52, 77, 68, 67, 49, 112, 52, 122, 84, 48, 107, 73, 120, 120, 102, 83, 70, 50,
83, 67, 75, 105, 114, 101, 87, 83, 50, 98, 101, 116, 105, 52, 81, 54, 122, 68, 74, 99, 81, 45, 105, 69, 72, 107, 49, 106, 81, 77, 57, 53,
105, 83, 71, 50, 85, 106, 70, 117, 106, 81, 118, 100, 122, 45, 95, 120, 65, 100, 114, 53, 90]
80, 81, 100, 85, 99, 70, 78, 107, 79, 117, 108, 101, 103, 68, 54, 66,
103, 106, 103, 100, 70, 76, 106, 101, 66, 52, 72, 72, 79, 79, 55, 85,
72, 118, 80, 56, 80, 69, 68, 117, 48, 97, 48, 115, 65, 50, 97, 95,
45, 67, 73, 48, 119, 50, 89, 81, 81, 50, 81, 81, 101, 51, 53, 77]
A.2.10. JWE Integrity Value A.2.11. JWE Integrity Value
Compute the HMAC SHA-256 of this value using the CIK to create the Compute the HMAC SHA-256 of this value using the CIK to create the
JWE Integrity Value. This result is: JWE Integrity Value. This result is:
[115, 141, 100, 225, 62, 30, 2, 0, 130, 183, 173, 230, 241, 147, 102, [68, 17, 161, 99, 49, 60, 253, 198, 75, 30, 50, 106, 168, 123, 139,
136, 232, 167, 49, 200, 133, 23, 42, 78, 22, 155, 226, 119, 184, 186, 135, 54, 224, 90, 2, 255, 193, 93, 203, 13, 37, 43, 113, 185, 14,
15, 73] 136, 128]
A.2.11. Encoded JWE Integrity Value A.2.12. Encoded JWE Integrity Value
Base64url encode the resulting JWE Integrity Value to create the Base64url encode the resulting JWE Integrity Value to create the
Encoded JWE Integrity Value. This result is: Encoded JWE Integrity Value. This result is:
c41k4T4eAgCCt63m8ZNmiOinMciFFypOFpvid7i6D0k RBGhYzE8_cZLHjJqqHuLhzbgWgL_wV3LDSUrcbkOiIA
A.2.12. Complete Representation A.2.13. Complete Representation
Assemble the final representation: The Compact Serialization of this Assemble the final representation: The Compact Serialization of this
result is the concatenation of the Encoded JWE Header, the Encoded result is the concatenation of the Encoded JWE Header, the Encoded
JWE Encrypted Key, the Encoded JWE Ciphertext, and the Encoded JWE JWE Encrypted Key, the Encoded JWE Initialization Vector, the Encoded
Integrity Value in that order, with the four strings being separated JWE Ciphertext, and the Encoded JWE Integrity Value in that order,
by three period ('.') characters. with the five strings being separated by four period ('.')
characters.
The final result in this example (with line breaks for display The final result in this example (with line breaks for display
purposes only) is: purposes only) is:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDIiwiaW50IjoiSFMyNTYiLCJp eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0.
diI6IkF4WThEQ3REYUdsc2JHbGpiM1JvWlEifQ. O6AqXqgVlJJ4c4lp5sXZd7bpGHAw6ARkHUeXQxD1cAW4-X1x0qtj_AN0mukqEOl4
IPI_z172hSWHMFgED8EG9DM6hIXU_6NaO1DImCn0vNeuoBq847Sl6qw_GHSYHJUQ Y6UOwJXIJY9-G1ELK-RQWrKH_StR-AM9H7GpKmSEji8QYOcMOjr-u9H1Lt_pBEie
XtXJq7S_CxWVrI82wjrOyaQca5tLZRZc45BfKHeqByThKI261QevEK56SyAwwXfK G802SxWz0rbFTXRcj4BWLxcpCtjUZ31AP-sc-L_eCZ5UNl0aSRNqFskuPkzRsFZR
KZjSvkQ5dwTFSgfy76rMSUvVynHYEhdCatBF9HWTAiXPx7hgZixG1FeP_QCmOylz DJqSSJeVOyJ7pZCQ83fli19Vgi_3R7XMUqluQuuc7ZHOWixi47jXlBTlWRZ5iFxa
2VClVyYFCbjKREOwBFf-puNYfO75S3LNlJUtTsGGQL2oTKpMsEiUTdefkje91VX9 S8G6J8wUrd4BKggAw3qX5XoIfXQVlQZE0Vmkq_zQSIo5LnFKyowooRcdsEuNh9B9
h8g7908lFsggbjV7NicJsufuXxnTj1fcWIrRDeNIOmakiPEODi0gTSz0ou-W-LWK Mkyt0ZQElG-jGdtHWjZSOA.
-3T1zYlOIiIKBjsExQKZ-w. AxY8DCtDaGlsbGljb3RoZQ.
_Z_djlIoC4MDSCKireWS2beti4Q6iSG2UjFujQvdz-_PQdUcFNkOulegD6BgjgdF 1eBWFgcrz40wC88cgv8rPgu3EfmC1p4zT0kIxxfSF2zDJcQ-iEHk1jQM95xAdr5Z.
LjeB4HHOO7UHvP8PEDu0a0sA2a_-CI0w2YQQ2QQe35M. RBGhYzE8_cZLHjJqqHuLhzbgWgL_wV3LDSUrcbkOiIA
c41k4T4eAgCCt63m8ZNmiOinMciFFypOFpvid7i6D0k
A.2.13. Validation A.2.14. Validation
This example illustrates the process of creating a JWE with a non- This example illustrates the process of creating a JWE with a
AEAD algorithm. These results can be used to validate JWE decryption composite AEAD algorithm created from a non-AEAD algorithm by adding
implementations for these algorithms. Since all the algorithms used a separate integrity check calculation. These results can be used to
in this example produce deterministic results, the results above validate JWE decryption implementations for these algorithms. Note
should be repeatable. that since the RSAES-PKCS1-V1_5 computation includes random values,
the encryption results above will not be completely reproducible.
However, since the AES CBC computation is deterministic, the JWE
Encrypted Ciphertext values will be the same for all encryptions
performed using these inputs.
A.3. Example Key Derivation with Outputs <= Hash Size A.3. Example JWE using AES Key Wrap and AES GCM
This example encrypts the plaintext "The true sign of intelligence is
not knowledge but imagination." to the recipient using AES Key Wrap
and AES GCM. The representation of this plaintext is:
[84, 104, 101, 32, 116, 114, 117, 101, 32, 115, 105, 103, 110, 32,
111, 102, 32, 105, 110, 116, 101, 108, 108, 105, 103, 101, 110, 99,
101, 32, 105, 115, 32, 110, 111, 116, 32, 107, 110, 111, 119, 108,
101, 100, 103, 101, 32, 98, 117, 116, 32, 105, 109, 97, 103, 105,
110, 97, 116, 105, 111, 110, 46]
A.3.1. JWE Header
The following example JWE Header declares that:
o the Content Master Key is encrypted to the recipient using the AES
Key Wrap algorithm with a 128 bit key to produce the JWE Encrypted
Key and
o the Plaintext is encrypted using the AES GCM algorithm with a 128
bit key to produce the Ciphertext.
{"alg":"A128KW","enc":"A128GCM"}
A.3.2. Encoded JWE Header
Base64url encoding the bytes of the UTF-8 representation of the JWE
Header yields this Encoded JWE Header value:
eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4R0NNIn0
A.3.3. Content Master Key (CMK)
Generate a 128 bit random Content Master Key (CMK). In this example,
the value is:
[64, 154, 239, 170, 64, 40, 195, 99, 19, 84, 192, 142, 192, 238, 207,
217]
A.3.4. Key Encryption
Encrypt the CMK with the shared symmetric key using the AES Key Wrap
algorithm to produce the JWE Encrypted Key. In this example, the
shared symmetric key value is:
[25, 172, 32, 130, 225, 114, 26, 181, 138, 106, 254, 192, 95, 133,
74, 82]
The resulting JWE Encrypted Key value is:
[164, 255, 251, 1, 64, 200, 65, 200, 34, 197, 81, 143, 43, 211, 240,
38, 191, 161, 181, 117, 119, 68, 44, 80]
A.3.5. Encoded JWE Encrypted Key
Base64url encode the JWE Encrypted Key to produce the Encoded JWE
Encrypted Key. This result is:
pP_7AUDIQcgixVGPK9PwJr-htXV3RCxQ
A.3.6. Initialization Vector
Generate a random 96 bit JWE Initialization Vector. In this example,
the value is:
[253, 220, 80, 25, 166, 152, 178, 168, 97, 99, 67, 89]
Base64url encoding this value yields the Encoded JWE Initialization
Vector value:
_dxQGaaYsqhhY0NZ
A.3.7. "Additional Authenticated Data" Parameter
Concatenate the Encoded JWE Header value, a period character ('.'),
the Encoded JWE Encrypted Key, a second period character ('.'), and
the Encoded JWE Initialization Vector to create the "additional
authenticated data" parameter for the AES GCM algorithm. This result
(with line breaks for display purposes only) is:
eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4R0NNIn0.
pP_7AUDIQcgixVGPK9PwJr-htXV3RCxQ.
_dxQGaaYsqhhY0NZ
The representation of this value is:
[101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 66, 77, 84, 73, 52,
83, 49, 99, 105, 76, 67, 74, 108, 98, 109, 77, 105, 79, 105, 74, 66,
77, 84, 73, 52, 82, 48, 78, 78, 73, 110, 48, 46, 112, 80, 95, 55, 65,
85, 68, 73, 81, 99, 103, 105, 120, 86, 71, 80, 75, 57, 80, 119, 74,
114, 45, 104, 116, 88, 86, 51, 82, 67, 120, 81, 46, 95, 100, 120, 81,
71, 97, 97, 89, 115, 113, 104, 104, 89, 48, 78, 90]
A.3.8. Plaintext Encryption
Encrypt the Plaintext with AES GCM using the CMK as the encryption
key, the JWE Initialization Vector, and the "additional authenticated
data" value above, requesting a 128 bit "authentication tag" output.
The resulting Ciphertext is:
[227, 12, 89, 132, 185, 16, 248, 93, 145, 87, 53, 130, 95, 115, 62,
104, 138, 96, 109, 71, 124, 211, 165, 103, 202, 99, 21, 193, 4, 226,
84, 229, 254, 106, 144, 241, 39, 86, 148, 132, 160, 104, 88, 232,
228, 109, 85, 7, 86, 80, 134, 106, 166, 24, 92, 199, 210, 188, 153,
187, 218, 69, 227]
The resulting "authentication tag" value is:
[154, 35, 80, 107, 37, 148, 81, 6, 103, 4, 60, 206, 171, 165, 113,
67]
A.3.9. Encoded JWE Ciphertext
Base64url encode the resulting Ciphertext to create the Encoded JWE
Ciphertext. This result (with line breaks for display purposes only)
is:
4wxZhLkQ-F2RVzWCX3M-aIpgbUd806VnymMVwQTiVOX-apDxJ1aUhKBoWOjkbVUH
VlCGaqYYXMfSvJm72kXj
A.3.10. Encoded JWE Integrity Value
Base64url encode the resulting "authentication tag" to create the
Encoded JWE Integrity Value. This result is:
miNQayWUUQZnBDzOq6VxQw
A.3.11. Complete Representation
Assemble the final representation: The Compact Serialization of this
result is the concatenation of the Encoded JWE Header, the Encoded
JWE Encrypted Key, the Encoded JWE Initialization Vector, the Encoded
JWE Ciphertext, and the Encoded JWE Integrity Value in that order,
with the five strings being separated by four period ('.')
characters.
The final result in this example (with line breaks for display
purposes only) is:
eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4R0NNIn0.
pP_7AUDIQcgixVGPK9PwJr-htXV3RCxQ.
_dxQGaaYsqhhY0NZ.
4wxZhLkQ-F2RVzWCX3M-aIpgbUd806VnymMVwQTiVOX-apDxJ1aUhKBoWOjkbVUH
VlCGaqYYXMfSvJm72kXj.
miNQayWUUQZnBDzOq6VxQw
A.3.12. Validation
This example illustrates the process of creating a JWE with symmetric
key wrap and an AEAD algorithm. These results can be used to
validate JWE decryption implementations for these algorithms. Also,
since both the AES Key Wrap and AES GCM computations are
deterministic, the resulting JWE value will be the same for all
encryptions performed using these inputs. Since the computation is
reproducible, these results can also be used to validate JWE
encryption implementations for these algorithms.
A.4. Example Key Derivation for "enc" value "A128CBC+HS256"
This example uses the Concat KDF to derive the Content Encryption Key This example uses the Concat KDF to derive the Content Encryption Key
(CEK) and Content Integrity Key (CIK) from the Content Master Key (CEK) and Content Integrity Key (CIK) from the Content Master Key
(CMK) in the manner described in Section 4.12 of [JWA]. In this (CMK) in the manner described in Section 4.8.1 of [JWA]. In this
example, a 256 bit CMK is used to derive a 128 bit CEK and a 256 bit example, a 256 bit CMK is used to derive a 128 bit CEK and a 256 bit
CIK. CIK.
The CMK value is: The CMK value used is:
[4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106, [4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106,
206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156, 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156,
44, 207] 44, 207]
A.3.1. CEK Generation A.4.1. CEK Generation
When deriving the CEK from the CMK, the ASCII label "Encryption" These values are concatenated to produce the round 1 hash input:
([69, 110, 99, 114, 121, 112, 116, 105, 111, 110]) is used. The
input to the first hash round is the concatenation of the big endian o the round number 1 as a 32 bit big endian integer ([0, 0, 0, 1]),
number 1 ([0, 0, 0, 1]), the CMK, and the label. Thus the round 1
hash input is: o the CMK value (as above),
o the output bit size 128 as a 32 bit big endian number ([0, 0, 0,
128]),
o the bytes of the UTF-8 representation of the "enc" value
"A128CBC+HS256" -- [65, 49, 50, 56, 67, 66, 67, 43, 72, 83, 50,
53, 54],
o (no bytes are included for the "epu" (encryption PartyUInfo) and
"epv" (encryption PartyVInfo) parameters because they are absent,
but if present, the base64url decoded values of them would have
been included here),
o the bytes of the ASCII representation of the label "Encryption" --
[69, 110, 99, 114, 121, 112, 116, 105, 111, 110].
Thus the round 1 hash input is:
[0, 0, 0, 1, 4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, [0, 0, 0, 1, 4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250,
63, 170, 106, 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 63, 170, 106, 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0,
240, 143, 156, 44, 207, 69, 110, 99, 114, 121, 112, 116, 105, 111, 240, 143, 156, 44, 207, 0, 0, 0, 128, 65, 49, 50, 56, 67, 66, 67, 43,
110] 72, 83, 50, 53, 54, 69, 110, 99, 114, 121, 112, 116, 105, 111, 110]
The SHA-256 hash of this value, which is the round 1 hash output, is: The SHA-256 hash of this value, which is the round 1 hash output, is:
[249, 255, 87, 218, 224, 223, 221, 53, 204, 121, 166, 130, 195, 184, [37, 245, 125, 247, 113, 155, 238, 98, 228, 206, 62, 65, 81, 153, 79,
50, 69, 11, 237, 202, 71, 10, 96, 59, 199, 140, 88, 126, 147, 146, 91, 225, 37, 250, 101, 198, 63, 51, 182, 5, 242, 241, 169, 162, 232,
113, 222, 41] 103, 155]
Given that 128 bits are needed for the CEK and the hash has produced Given that 128 bits are needed for the CEK and the hash has produced
256 bits, the CEK value is the first 128 bits of that value: 256 bits, the CEK value is the first 128 bits of that value:
[249, 255, 87, 218, 224, 223, 221, 53, 204, 121, 166, 130, 195, 184, [37, 245, 125, 247, 113, 155, 238, 98, 228, 206, 62, 65, 81, 153, 79,
50, 69] 91]
A.3.2. CIK Generation A.4.2. CIK Generation
When deriving the CIK from the CMK, the ASCII label "Integrity" ([73, These values are concatenated to produce the round 1 hash input:
110, 116, 101, 103, 114, 105, 116, 121]) is used. The input to the
first hash round is the concatenation of the big endian number 1 ([0, o the round number 1 as a 32 bit big endian integer ([0, 0, 0, 1]),
0, 0, 1]), the CMK, and the label. Thus the round 1 hash input is:
o the CMK value (as above),
o the output bit size 256 as a 32 bit big endian number ([0, 0, 1,
0]),
o the bytes of the UTF-8 representation of the "enc" value
"A128CBC+HS256" -- [65, 49, 50, 56, 67, 66, 67, 43, 72, 83, 50,
53, 54],
o (no bytes are included for the "epu" (encryption PartyUInfo) and
"epv" (encryption PartyVInfo) parameters because they are absent,
but if present, the base64url decoded values of them would have
been included here),
o the bytes of the ASCII representation of the label "Integrity" --
[73, 110, 116, 101, 103, 114, 105, 116, 121].
Thus the round 1 hash input is:
[0, 0, 0, 1, 4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, [0, 0, 0, 1, 4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250,
63, 170, 106, 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 63, 170, 106, 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0,
240, 143, 156, 44, 207, 73, 110, 116, 101, 103, 114, 105, 116, 121] 240, 143, 156, 44, 207, 0, 0, 1, 0, 65, 49, 50, 56, 67, 66, 67, 43,
72, 83, 50, 53, 54, 73, 110, 116, 101, 103, 114, 105, 116, 121]
The SHA-256 hash of this value, which is the round 1 hash output, is: The SHA-256 hash of this value, which is the round 1 hash output, is:
[218, 209, 130, 50, 169, 45, 70, 214, 29, 187, 123, 20, 3, 158, 111, [203, 194, 197, 180, 120, 46, 123, 202, 78, 12, 33, 116, 214, 247,
122, 182, 94, 57, 133, 245, 76, 97, 44, 193, 80, 81, 246, 115, 177, 128, 41, 175, 53, 181, 164, 224, 223, 56, 146, 179, 193, 18, 223,
225, 159] 146, 85, 244, 127]
Given that 256 bits are needed for the CIK and the hash has produced Given that 256 bits are needed for the CIK and the hash has produced
256 bits, the CIK value is that same value: 256 bits, the CIK value is that same value:
[218, 209, 130, 50, 169, 45, 70, 214, 29, 187, 123, 20, 3, 158, 111, [203, 194, 197, 180, 120, 46, 123, 202, 78, 12, 33, 116, 214, 247,
122, 182, 94, 57, 133, 245, 76, 97, 44, 193, 80, 81, 246, 115, 177, 128, 41, 175, 53, 181, 164, 224, 223, 56, 146, 179, 193, 18, 223,
225, 159] 146, 85, 244, 127]
A.4. Example Key Derivation with Outputs >= Hash Size A.5. Example Key Derivation for "enc" value "A256CBC+HS512"
This example uses the Concat KDF to derive the Content Encryption Key This example uses the Concat KDF to derive the Content Encryption Key
(CEK) and Content Integrity Key (CIK) from the Content Master Key (CEK) and Content Integrity Key (CIK) from the Content Master Key
(CMK) in the manner described in Section 4.12 of [JWA]. In this (CMK) in the manner described in Section 4.8.1 of [JWA]. In this
example, a 512 bit CMK is used to derive a 256 bit CEK and a 512 bit example, a 512 bit CMK is used to derive a 256 bit CEK and a 512 bit
CIK. CIK.
The CMK value is: The CMK value used is:
[148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193, 61, 34, 239, [148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193, 61, 34, 239,
226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49, 176, 68, 226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49, 176, 68,
119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137, 138, 67, 119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137, 138, 67,
23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124, 45, 156, 23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124, 45, 156,
249, 7, 225, 168] 249, 7, 225, 168]
A.4.1. CEK Generation A.5.1. CEK Generation
When deriving the CEK from the CMK, the ASCII label "Encryption" These values are concatenated to produce the round 1 hash input:
([69, 110, 99, 114, 121, 112, 116, 105, 111, 110]) is used. The
input to the first hash round is the concatenation of the big endian o the round number 1 as a 32 bit big endian integer ([0, 0, 0, 1]),
number 1 ([0, 0, 0, 1]), the CMK, and the label. Thus the round 1
hash input is: o the CMK value (as above),
o the output bit size 256 as a 32 bit big endian number ([0, 0, 1,
0]),
o the bytes of the UTF-8 representation of the "enc" value
"A256CBC+HS512" -- [65, 50, 53, 54, 67, 66, 67, 43, 72, 83, 53,
49, 50],
o (no bytes are included for the "epu" (encryption PartyUInfo) and
"epv" (encryption PartyVInfo) parameters because they are absent,
but if present, the base64url decoded values of them would have
been included here),
o the bytes of the ASCII representation of the label "Encryption" --
[69, 110, 99, 114, 121, 112, 116, 105, 111, 110].
Thus the round 1 hash input is:
[0, 0, 0, 1, 148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193, [0, 0, 0, 1, 148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193,
61, 34, 239, 226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49, 61, 34, 239, 226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49,
176, 68, 119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137, 176, 68, 119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137,
138, 67, 23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124, 138, 67, 23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124,
45, 156, 249, 7, 225, 168, 69, 110, 99, 114, 121, 112, 116, 105, 111, 45, 156, 249, 7, 225, 168, 0, 0, 1, 0, 65, 50, 53, 54, 67, 66, 67,
43, 72, 83, 53, 49, 50, 69, 110, 99, 114, 121, 112, 116, 105, 111,
110] 110]
The SHA-256 hash of this value, which is the round 1 hash output, is: The SHA-512 hash of this value, which is the round 1 hash output, is:
[137, 5, 92, 9, 17, 47, 17, 86, 253, 235, 34, 247, 121, 78, 11, 144, [95, 112, 19, 252, 0, 97, 200, 188, 108, 84, 27, 116, 192, 169, 42,
10, 172, 38, 247, 108, 243, 201, 237, 95, 80, 49, 150, 116, 240, 159, 165, 25, 246, 115, 235, 226, 198, 148, 211, 94, 143, 240, 226, 89,
64] 226, 79, 13, 178, 80, 124, 251, 55, 114, 30, 115, 179, 64, 107, 213,
222, 225, 12, 169, 245, 116, 231, 83, 227, 233, 20, 164, 249, 148,
62, 92, 43, 5, 1, 97]
Given that 256 bits are needed for the CEK and the hash has produced Given that 256 bits are needed for the CEK and the hash has produced
256 bits, the CEK value is that same value: 512 bits, the CEK value is the first 256 bits of that value:
[137, 5, 92, 9, 17, 47, 17, 86, 253, 235, 34, 247, 121, 78, 11, 144, [95, 112, 19, 252, 0, 97, 200, 188, 108, 84, 27, 116, 192, 169, 42,
10, 172, 38, 247, 108, 243, 201, 237, 95, 80, 49, 150, 116, 240, 159, 165, 25, 246, 115, 235, 226, 198, 148, 211, 94, 143, 240, 226, 89,
64] 226, 79, 13]
A.4.2. CIK Generation A.5.2. CIK Generation
When deriving the CIK from the CMK, the ASCII label "Integrity" ([73, These values are concatenated to produce the round 1 hash input:
110, 116, 101, 103, 114, 105, 116, 121]) is used. The input to the
first hash round is the concatenation of the big endian number 1 ([0,
0, 0, 1]), the CMK, and the label. Thus the round 1 hash input is:
[0, 0, 0, 1, 148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193, o the round number 1 as a 32 bit big endian integer ([0, 0, 0, 1]),
61, 34, 239, 226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49,
176, 68, 119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137,
138, 67, 23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124,
45, 156, 249, 7, 225, 168, 73, 110, 116, 101, 103, 114, 105, 116,
121]
The SHA-256 hash of this value, which is the round 1 hash output, is: o the CMK value (as above),
[11, 179, 132, 177, 171, 24, 126, 19, 113, 1, 200, 102, 100, 74, 88, o the output bit size 512 as a 32 bit big endian number ([0, 0, 2,
149, 31, 41, 71, 57, 51, 179, 106, 242, 113, 211, 56, 56, 37, 198, 0]),
57, 17]
Given that 512 bits are needed for the CIK and the hash has produced o the bytes of the UTF-8 representation of the "enc" value
only 256 bits, another round is needed. The input to the second hash "A256CBC+HS512" -- [65, 50, 53, 54, 67, 66, 67, 43, 72, 83, 53,
round is the concatenation of the big endian number 2 ([0, 0, 0, 2]), 49, 50],
the CMK, and the label. Thus the round 2 hash input is:
[0, 0, 0, 2, 148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193, o (no bytes are included for the "epu" (encryption PartyUInfo) and
"epv" (encryption PartyVInfo) parameters because they are absent,
but if present, the base64url decoded values of them would have
been included here),
o the bytes of the ASCII representation of the label "Integrity" --
[73, 110, 116, 101, 103, 114, 105, 116, 121].
Thus the round 1 hash input is:
[0, 0, 0, 1, 148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193,
61, 34, 239, 226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49, 61, 34, 239, 226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49,
176, 68, 119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137, 176, 68, 119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137,
138, 67, 23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124, 138, 67, 23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124,
45, 156, 249, 7, 225, 168, 73, 110, 116, 101, 103, 114, 105, 116, 45, 156, 249, 7, 225, 168, 0, 0, 2, 0, 65, 50, 53, 54, 67, 66, 67,
121] 43, 72, 83, 53, 49, 50, 73, 110, 116, 101, 103, 114, 105, 116, 121]
The SHA-256 hash of this value, which is the round 2 hash output, is: The SHA-512 hash of this value, which is the round 1 hash output, is:
[149, 209, 221, 113, 40, 191, 95, 252, 142, 254, 141, 230, 39, 113, [203, 188, 104, 71, 177, 60, 21, 10, 255, 157, 56, 214, 254, 87, 32,
139, 84, 44, 156, 247, 47, 223, 101, 229, 180, 82, 231, 38, 96, 170, 115, 194, 36, 117, 162, 226, 93, 50, 220, 191, 219, 41, 56, 80, 197,
119, 236, 81] 18, 173, 250, 145, 215, 178, 235, 51, 251, 122, 212, 193, 48, 227,
126, 89, 253, 101, 143, 252, 124, 157, 147, 200, 175, 164, 253, 92,
204, 122, 218, 77, 105, 146]
Given that 512 bits are needed for the CIK and the two rounds have Given that 512 bits are needed for the CIK and the hash has produced
collectively produced 512 bits of output, the CIK is the 512 bits, the CIK value is that same value:
concatenation of the round 1 and round 2 hash outputs, which is:
[11, 179, 132, 177, 171, 24, 126, 19, 113, 1, 200, 102, 100, 74, 88, [203, 188, 104, 71, 177, 60, 21, 10, 255, 157, 56, 214, 254, 87, 32,
149, 31, 41, 71, 57, 51, 179, 106, 242, 113, 211, 56, 56, 37, 198, 115, 194, 36, 117, 162, 226, 93, 50, 220, 191, 219, 41, 56, 80, 197,
57, 17, 149, 209, 221, 113, 40, 191, 95, 252, 142, 254, 141, 230, 39, 18, 173, 250, 145, 215, 178, 235, 51, 251, 122, 212, 193, 48, 227,
113, 139, 84, 44, 156, 247, 47, 223, 101, 229, 180, 82, 231, 38, 96, 126, 89, 253, 101, 143, 252, 124, 157, 147, 200, 175, 164, 253, 92,
170, 119, 236, 81] 204, 122, 218, 77, 105, 146]
Appendix B. Acknowledgements Appendix B. Acknowledgements
Solutions for encrypting JSON content were also explored by JSON Solutions for encrypting JSON content were also explored by JSON
Simple Encryption [JSE] and JavaScript Message Security Format Simple Encryption [JSE] and JavaScript Message Security Format
[I-D.rescorla-jsms], both of which significantly influenced this [I-D.rescorla-jsms], both of which significantly influenced this
draft. This draft attempts to explicitly reuse as many of the draft. This draft attempts to explicitly reuse as many of the
relevant concepts from XML Encryption 1.1 relevant concepts from XML Encryption 1.1
[W3C.CR-xmlenc-core1-20120313] and RFC 5652 [RFC5652] as possible, [W3C.CR-xmlenc-core1-20120313] and RFC 5652 [RFC5652] as possible,
while utilizing simple compact JSON-based data structures. while utilizing simple compact JSON-based data structures.
Special thanks are due to John Bradley and Nat Sakimura for the Special thanks are due to John Bradley and Nat Sakimura for the
discussions that helped inform the content of this specification and discussions that helped inform the content of this specification and
to Eric Rescorla and Joe Hildebrand for allowing the reuse of text to Eric Rescorla and Joe Hildebrand for allowing the reuse of text
from [I-D.rescorla-jsms] in this document. from [I-D.rescorla-jsms] in this document.
Thanks to Axel Nennker, Emmanuel Raviart, Brian Campbell, and Edmund Thanks to Axel Nennker, Emmanuel Raviart, Brian Campbell, and Edmund
Jay for validating the examples in this specification. Jay for validating the examples in this specification.
Appendix C. Document History Jim Schaad and Karen O'Donoghue chaired the JOSE working group and
Sean Turner and Stephen Farrell served as Security area directors
during the creation of this specification.
Appendix C. Open Issues
[[ to be removed by the RFC editor before publication as an RFC ]]
The following items remain to be considered or done in this draft:
o Should we define optional nonce, timestamp, and/or uninterpreted
string header parameter(s)?
Appendix D. Document History
[[ to be removed by the RFC editor before publication as an RFC ]] [[ to be removed by the RFC editor before publication as an RFC ]]
-06
o Removed the "int" and "kdf" parameters and defined the new
composite AEAD algorithms "A128CBC+HS256" and "A256CBC+HS512" to
replace the former uses of AES CBC, which required the use of
separate integrity and key derivation functions.
o Included additional values in the Concat KDF calculation -- the
desired output size and the algorithm value, and optionally
PartyUInfo and PartyVInfo values. Added the optional header
parameters "apu" (agreement PartyUInfo), "apv" (agreement
PartyVInfo), "epu" (encryption PartyUInfo), and "epv" (encryption
PartyVInfo). Updated the KDF examples accordingly.
o Promoted Initialization Vector from being a header parameter to
being a top-level JWE element. This saves approximately 16 bytes
in the compact serialization, which is a significant savings for
some use cases. Promoting the Initialization Vector out of the
header also avoids repeating this shared value in the JSON
serialization.
o Changed "x5c" (X.509 Certificate Chain) representation from being
a single string to being an array of strings, each containing a
single base64 encoded DER certificate value, representing elements
of the certificate chain.
o Added an AES Key Wrap example.
o Reordered the encryption steps so CMK creation is first, when
required.
o Correct statements in examples about which algorithms produce
reproducible results.
-05 -05
o Support both direct encryption using a shared or agreed upon o Support both direct encryption using a shared or agreed upon
symmetric key, and the use of a shared or agreed upon symmetric symmetric key, and the use of a shared or agreed upon symmetric
key to key wrap the CMK. key to key wrap the CMK.
o Added statement that "StringOrURI values are compared as case- o Added statement that "StringOrURI values are compared as case-
sensitive strings with no transformations or canonicalizations sensitive strings with no transformations or canonicalizations
applied". applied".
 End of changes. 217 change blocks. 
750 lines changed or deleted 910 lines changed or added

This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/