< draft-ietf-jose-json-web-encryption-10.txt   draft-ietf-jose-json-web-encryption-11.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: October 27, 2013 RTFM Expires: November 29, 2013 RTFM
J. Hildebrand J. Hildebrand
Cisco Cisco
April 25, 2013 May 28, 2013
JSON Web Encryption (JWE) JSON Web Encryption (JWE)
draft-ietf-jose-json-web-encryption-10 draft-ietf-jose-json-web-encryption-11
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) based data
Cryptographic algorithms and identifiers for use with this structures. Cryptographic algorithms and identifiers for use with
specification are described in the separate JSON Web Algorithms (JWA) this specification are described in the separate JSON Web Algorithms
specification. Related digital signature and MAC capabilities are (JWA) specification. Related digital signature and MAC capabilities
described in the separate JSON Web Signature (JWS) specification. are described in the separate JSON Web Signature (JWS) specification.
Status of this Memo Status of this Memo
This Internet-Draft is submitted in full conformance with the This Internet-Draft is submitted in full conformance with the
provisions of BCP 78 and BCP 79. provisions of BCP 78 and BCP 79.
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 October 27, 2013. This Internet-Draft will expire on November 29, 2013.
Copyright Notice Copyright Notice
Copyright (c) 2013 IETF Trust and the persons identified as the Copyright (c) 2013 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
skipping to change at page 2, line 15 skipping to change at page 2, line 15
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 . . . . . . . . . . . . . . . . . . . . . . . . . 5 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 5 1.1. Notational Conventions . . . . . . . . . . . . . . . . . . 5
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 5
3. JSON Web Encryption (JWE) Overview . . . . . . . . . . . . . . 8 3. JSON Web Encryption (JWE) Overview . . . . . . . . . . . . . . 8
3.1. Example JWE using RSAES OAEP and AES GCM . . . . . . . . . 8 3.1. Example JWE . . . . . . . . . . . . . . . . . . . . . . . 9
3.2. Example JWE using RSAES-PKCS1-V1_5 and 4. JWE Header . . . . . . . . . . . . . . . . . . . . . . . . . . 10
AES_128_CBC_HMAC_SHA_256 . . . . . . . . . . . . . . . . . 10 4.1. Reserved Header Parameter Names . . . . . . . . . . . . . 11
4. JWE Header . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1.1. "alg" (Algorithm) Header Parameter . . . . . . . . . . 11
4.1. Reserved Header Parameter Names . . . . . . . . . . . . . 12
4.1.1. "alg" (Algorithm) Header Parameter . . . . . . . . . . 12
4.1.2. "enc" (Encryption Method) Header Parameter . . . . . . 12 4.1.2. "enc" (Encryption Method) Header Parameter . . . . . . 12
4.1.3. "epk" (Ephemeral Public Key) Header Parameter . . . . 13 4.1.3. "epk" (Ephemeral Public Key) Header Parameter . . . . 12
4.1.4. "zip" (Compression Algorithm) Header Parameter . . . . 13 4.1.4. "zip" (Compression Algorithm) Header Parameter . . . . 12
4.1.5. "jku" (JWK Set URL) Header Parameter . . . . . . . . . 13 4.1.5. "jku" (JWK Set URL) Header Parameter . . . . . . . . . 13
4.1.6. "jwk" (JSON Web Key) Header Parameter . . . . . . . . 13 4.1.6. "jwk" (JSON Web Key) Header Parameter . . . . . . . . 13
4.1.7. "x5u" (X.509 URL) Header Parameter . . . . . . . . . . 13 4.1.7. "x5u" (X.509 URL) Header Parameter . . . . . . . . . . 13
4.1.8. "x5t" (X.509 Certificate Thumbprint) Header 4.1.8. "x5t" (X.509 Certificate Thumbprint) Header
Parameter . . . . . . . . . . . . . . . . . . . . . . 14 Parameter . . . . . . . . . . . . . . . . . . . . . . 13
4.1.9. "x5c" (X.509 Certificate Chain) Header Parameter . . . 14 4.1.9. "x5c" (X.509 Certificate Chain) Header Parameter . . . 14
4.1.10. "kid" (Key ID) Header Parameter . . . . . . . . . . . 15 4.1.10. "kid" (Key ID) Header Parameter . . . . . . . . . . . 14
4.1.11. "typ" (Type) Header Parameter . . . . . . . . . . . . 15 4.1.11. "typ" (Type) Header Parameter . . . . . . . . . . . . 14
4.1.12. "cty" (Content Type) Header Parameter . . . . . . . . 15 4.1.12. "cty" (Content Type) Header Parameter . . . . . . . . 15
4.1.13. "apu" (Agreement PartyUInfo) Header Parameter . . . . 15 4.1.13. "apu" (Agreement PartyUInfo) Header Parameter . . . . 15
4.1.14. "apv" (Agreement PartyVInfo) Header Parameter . . . . 16 4.1.14. "crit" (Critical) Header Parameter . . . . . . . . . . 15
4.1.15. "crit" (Critical) Header Parameter . . . . . . . . . . 16
4.2. Public Header Parameter Names . . . . . . . . . . . . . . 16 4.2. Public Header Parameter Names . . . . . . . . . . . . . . 16
4.3. Private Header Parameter Names . . . . . . . . . . . . . . 16 4.3. Private Header Parameter Names . . . . . . . . . . . . . . 16
5. Producing and Consuming JWEs . . . . . . . . . . . . . . . . . 17 5. Producing and Consuming JWEs . . . . . . . . . . . . . . . . . 16
5.1. Message Encryption . . . . . . . . . . . . . . . . . . . . 17 5.1. Message Encryption . . . . . . . . . . . . . . . . . . . . 16
5.2. Message Decryption . . . . . . . . . . . . . . . . . . . . 19 5.2. Message Decryption . . . . . . . . . . . . . . . . . . . . 18
5.3. String Comparison Rules . . . . . . . . . . . . . . . . . 21 5.3. String Comparison Rules . . . . . . . . . . . . . . . . . 20
6. Encrypting JWEs with Cryptographic Algorithms . . . . . . . . 21 6. Cryptographic Algorithms . . . . . . . . . . . . . . . . . . . 21
6.1. CEK Encryption . . . . . . . . . . . . . . . . . . . . . . 22 6.1. CEK Encryption . . . . . . . . . . . . . . . . . . . . . . 21
7. JSON Serialization . . . . . . . . . . . . . . . . . . . . . . 22 7. Key Identification . . . . . . . . . . . . . . . . . . . . . . 21
7.1. Example JWE-JS . . . . . . . . . . . . . . . . . . . . . . 23 8. JWE JSON Serialization . . . . . . . . . . . . . . . . . . . . 22
8. Implementation Considerations . . . . . . . . . . . . . . . . 25 9. Implementation Considerations . . . . . . . . . . . . . . . . 24
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 25 10. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 24
9.1. Registration of JWE Header Parameter Names . . . . . . . . 25 10.1. Registration of JWE Header Parameter Names . . . . . . . . 24
9.1.1. Registry Contents . . . . . . . . . . . . . . . . . . 25 10.1.1. Registry Contents . . . . . . . . . . . . . . . . . . 25
9.2. JSON Web Signature and Encryption Type Values 10.2. JSON Web Signature and Encryption Type Values
Registration . . . . . . . . . . . . . . . . . . . . . . . 27 Registration . . . . . . . . . . . . . . . . . . . . . . . 26
9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 27 10.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 26
9.3. Media Type Registration . . . . . . . . . . . . . . . . . 27 10.3. Media Type Registration . . . . . . . . . . . . . . . . . 26
9.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 27 10.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 27
10. Security Considerations . . . . . . . . . . . . . . . . . . . 29 11. Security Considerations . . . . . . . . . . . . . . . . . . . 28
11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 29 12. References . . . . . . . . . . . . . . . . . . . . . . . . . . 28
11.1. Normative References . . . . . . . . . . . . . . . . . . . 29 12.1. Normative References . . . . . . . . . . . . . . . . . . . 28
11.2. Informative References . . . . . . . . . . . . . . . . . . 31 12.2. Informative References . . . . . . . . . . . . . . . . . . 30
Appendix A. JWE Examples . . . . . . . . . . . . . . . . . . . . 31 Appendix A. JWE Examples . . . . . . . . . . . . . . . . . . . . 30
A.1. Example JWE using RSAES OAEP and AES GCM . . . . . . . . . 31 A.1. Example JWE using RSAES OAEP and AES GCM . . . . . . . . . 30
A.1.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 32 A.1.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 31
A.1.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 32 A.1.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 31
A.1.3. Content Encryption Key (CEK) . . . . . . . . . . . . . 32 A.1.3. Content Encryption Key (CEK) . . . . . . . . . . . . . 31
A.1.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 32 A.1.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 31
A.1.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 35 A.1.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 34
A.1.6. Initialization Vector . . . . . . . . . . . . . . . . 35 A.1.6. Initialization Vector . . . . . . . . . . . . . . . . 34
A.1.7. Additional Authenticated Data Parameter . . . . . . . 35 A.1.7. Additional Authenticated Data . . . . . . . . . . . . 34
A.1.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 36 A.1.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 34
A.1.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 36 A.1.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 35
A.1.10. Encoded JWE Authentication Tag . . . . . . . . . . . . 37 A.1.10. Encoded JWE Authentication Tag . . . . . . . . . . . . 35
A.1.11. Complete Representation . . . . . . . . . . . . . . . 37 A.1.11. Complete Representation . . . . . . . . . . . . . . . 35
A.1.12. Validation . . . . . . . . . . . . . . . . . . . . . . 37 A.1.12. Validation . . . . . . . . . . . . . . . . . . . . . . 36
A.2. Example JWE using RSAES-PKCS1-V1_5 and A.2. Example JWE using RSAES-PKCS1-V1_5 and
AES_128_CBC_HMAC_SHA_256 . . . . . . . . . . . . . . . . . 37 AES_128_CBC_HMAC_SHA_256 . . . . . . . . . . . . . . . . . 36
A.2.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 38 A.2.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 36
A.2.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 38 A.2.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 36
A.2.3. Content Encryption Key (CEK) . . . . . . . . . . . . . 38 A.2.3. Content Encryption Key (CEK) . . . . . . . . . . . . . 36
A.2.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 38 A.2.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 37
A.2.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 41 A.2.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 39
A.2.6. Initialization Vector . . . . . . . . . . . . . . . . 41 A.2.6. Initialization Vector . . . . . . . . . . . . . . . . 39
A.2.7. Additional Authenticated Data Parameter . . . . . . . 41 A.2.7. Additional Authenticated Data . . . . . . . . . . . . 39
A.2.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 42 A.2.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 39
A.2.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 42 A.2.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 40
A.2.10. Encoded JWE Authentication Tag . . . . . . . . . . . . 43 A.2.10. Encoded JWE Authentication Tag . . . . . . . . . . . . 40
A.2.11. Complete Representation . . . . . . . . . . . . . . . 43 A.2.11. Complete Representation . . . . . . . . . . . . . . . 40
A.2.12. Validation . . . . . . . . . . . . . . . . . . . . . . 43 A.2.12. Validation . . . . . . . . . . . . . . . . . . . . . . 40
A.3. Example JWE using AES Key Wrap and AES GCM . . . . . . . . 43 A.3. Example JWE using AES Key Wrap and AES GCM . . . . . . . . 41
A.3.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 44 A.3.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 41
A.3.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 44 A.3.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 41
A.3.3. Content Encryption Key (CEK) . . . . . . . . . . . . . 44 A.3.3. Content Encryption Key (CEK) . . . . . . . . . . . . . 41
A.3.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 44 A.3.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 41
A.3.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 45 A.3.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 42
A.3.6. Initialization Vector . . . . . . . . . . . . . . . . 45 A.3.6. Initialization Vector . . . . . . . . . . . . . . . . 42
A.3.7. Additional Authenticated Data Parameter . . . . . . . 45 A.3.7. Additional Authenticated Data . . . . . . . . . . . . 42
A.3.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 45 A.3.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 42
A.3.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 46 A.3.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 43
A.3.10. Encoded JWE Authentication Tag . . . . . . . . . . . . 46 A.3.10. Encoded JWE Authentication Tag . . . . . . . . . . . . 43
A.3.11. Complete Representation . . . . . . . . . . . . . . . 46 A.3.11. Complete Representation . . . . . . . . . . . . . . . 43
A.3.12. Validation . . . . . . . . . . . . . . . . . . . . . . 46 A.3.12. Validation . . . . . . . . . . . . . . . . . . . . . . 43
A.4. Example JWE Using JWE JSON Serialization . . . . . . . . . 44
A.4.1. JWE Per-Recipient Unprotected Headers . . . . . . . . 44
A.4.2. JWE Protected Header . . . . . . . . . . . . . . . . . 44
A.4.3. JWE Unprotected Header . . . . . . . . . . . . . . . . 45
A.4.4. Complete JWE Header Values . . . . . . . . . . . . . . 45
A.4.5. Additional Authenticated Data . . . . . . . . . . . . 45
A.4.6. Plaintext Encryption . . . . . . . . . . . . . . . . . 45
A.4.7. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 46
A.4.8. Encoded JWE Authentication Tag . . . . . . . . . . . . 46
A.4.9. Complete JWE JSON Serialization Representation . . . . 46
Appendix B. Example AES_128_CBC_HMAC_SHA_256 Computation . . . . 47 Appendix B. Example AES_128_CBC_HMAC_SHA_256 Computation . . . . 47
B.1. Extract MAC_KEY and ENC_KEY from Key . . . . . . . . . . . 47 B.1. Extract MAC_KEY and ENC_KEY from Key . . . . . . . . . . . 47
B.2. Encrypt Plaintext to Create Ciphertext . . . . . . . . . . 47 B.2. Encrypt Plaintext to Create Ciphertext . . . . . . . . . . 47
B.3. Create 64 Bit Big Endian Representation of AAD Length . . 48 B.3. 64 Bit Big Endian Representation of AAD Length . . . . . . 48
B.4. Initialization Vector Value . . . . . . . . . . . . . . . 48 B.4. Initialization Vector Value . . . . . . . . . . . . . . . 48
B.5. Create Input to HMAC Computation . . . . . . . . . . . . . 48 B.5. Create Input to HMAC Computation . . . . . . . . . . . . . 48
B.6. Compute HMAC Value . . . . . . . . . . . . . . . . . . . . 49 B.6. Compute HMAC Value . . . . . . . . . . . . . . . . . . . . 48
B.7. Truncate HMAC Value to Create Authentication Tag . . . . . 49 B.7. Truncate HMAC Value to Create Authentication Tag . . . . . 49
Appendix C. Possible Compact Serialization for Multiple Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 49
Recipients . . . . . . . . . . . . . . . . . . . . . 49 Appendix D. Document History . . . . . . . . . . . . . . . . . . 49
Appendix D. Acknowledgements . . . . . . . . . . . . . . . . . . 50
Appendix E. Document History . . . . . . . . . . . . . . . . . . 51
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 56 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 56
1. Introduction 1. Introduction
JSON Web Encryption (JWE) is a compact encryption format intended for JSON Web Encryption (JWE) is a means of representing encrypted
space constrained environments such as HTTP Authorization headers and content using JavaScript Object Notation (JSON) [RFC4627] based data
URI query parameters. It represents this content using JavaScript structures. The JWE cryptographic mechanisms encrypt and provide
Object Notation (JSON) [RFC4627] based data structures. The JWE integrity protection for arbitrary sequences of octets.
cryptographic mechanisms encrypt and provide integrity protection for
arbitrary sequences of octets. Two closely related representations for JWE objects are defined. The
JWE Compact Serialization is a compact, URL-safe representation
intended for space constrained environments such as HTTP
Authorization headers and URI query parameters. The JWE JSON
Serialization represents JWE objects as JSON objects and enables the
same content to be encrypted to multiple parties. Both share the
same cryptographic underpinnings.
Cryptographic algorithms and identifiers for use with this 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)
[JWA] specification. Related digital signature and MAC capabilities [JWA] specification. Related digital signature and MAC capabilities
are described in the separate JSON Web Signature (JWS) [JWS] are described in the separate JSON Web Signature (JWS) [JWS]
specification. specification.
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",
skipping to change at page 5, line 47 skipping to change at page 6, line 7
Plaintext and the Additional Authenticated Data value, and produce Plaintext and the Additional Authenticated Data value, and produce
two outputs, the Ciphertext and the Authentication Tag value. AES two outputs, the Ciphertext and the Authentication Tag value. AES
Galois/Counter Mode (GCM) is one such algorithm. Galois/Counter Mode (GCM) is one such algorithm.
Plaintext The sequence of octets to be encrypted -- a.k.a., the Plaintext The sequence of octets to be encrypted -- a.k.a., the
message. The plaintext can contain an arbitrary sequence of message. The plaintext can contain an arbitrary sequence of
octets. octets.
Ciphertext An encrypted representation of the Plaintext. Ciphertext An encrypted representation of the Plaintext.
Additional Associated Data (AAD) An input to an Authenticated Additional Authenticated Data (AAD) An input to an Authenticated
Encryption operation that is integrity protected but not Encryption operation that is integrity protected but not
encrypted. encrypted.
Authentication Tag An output of an Authenticated Encryption Authentication Tag An output of an Authenticated Encryption
operation that ensures the integrity of the Ciphertext and the operation that ensures the integrity of the Ciphertext and the
Additional Associated Data. Additional Authenticated Data. Note that some algorithms may not
use an Authentication Tag, in which case this value is the empty
octet sequence.
Content Encryption Key (CEK) A symmetric key for the Authenticated Content Encryption Key (CEK) A symmetric key for the Authenticated
Encryption algorithm used to encrypt the Plaintext for the Encryption algorithm used to encrypt the Plaintext for the
recipient to produce the Ciphertext and the Authentication Tag. recipient to produce the Ciphertext and the Authentication Tag.
JSON Text Object A UTF-8 [RFC3629] encoded text string representing JSON Text Object A UTF-8 [RFC3629] encoded text string representing
a JSON object; the syntax of JSON objects is defined in Section a JSON object; the syntax of JSON objects is defined in Section
2.2 of [RFC4627]. 2.2 of [RFC4627].
JWE Header A JSON Text Object that describes the encryption JWE Header A JSON Text Object (or JSON Text Objects, when using the
operations applied to create the JWE Encrypted Key, the JWE JWE JSON Serialization) that describes the encryption operations
Ciphertext, and the JWE Authentication Tag. applied to create the JWE Encrypted Key, the JWE Ciphertext, and
the JWE Authentication Tag. The members of the JWE Header
object(s) are Header Parameters.
JWE Encrypted Key The result of encrypting the Content Encryption JWE Encrypted Key The result of encrypting the Content Encryption
Key (CEK) with the intended recipient's key using the specified Key (CEK) with the intended recipient's key using the specified
algorithm. Note that for some algorithms, the JWE Encrypted Key algorithm. Note that for some algorithms, the JWE Encrypted Key
value is specified as being the empty octet sequence. value is specified as being the empty octet sequence.
JWE Initialization Vector A sequence of octets containing the JWE Initialization Vector A sequence of octets containing the
Initialization Vector used when encrypting the Plaintext. Note Initialization Vector used when encrypting the Plaintext. Note
that some algorithms may not use an Initialization Vector, in that some algorithms may not use an Initialization Vector, in
which case this value is the empty octet sequence. which case this value is the empty octet sequence.
JWE Ciphertext A sequence of octets containing the Ciphertext for a JWE Ciphertext A sequence of octets containing the Ciphertext for a
JWE. JWE.
JWE Authentication Tag A sequence of octets containing the JWE Authentication Tag A sequence of octets containing the
Authentication Tag for a JWE. Authentication Tag for a JWE.
JWE Protected Header A JSON Text Object that contains the portion of
the JWE Header that is integrity protected. For the JWE Compact
Serialization, this comprises the entire JWE Header. For the JWE
JSON Serialization, this is one component of the JWE Header.
Header Parameter A name/value pair that is member of the JWE Header.
Header Parameter Name The name of a member of the JWE Header.
Header Parameter Value The value of a member of the JWE Header.
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 JWE Header. Encoded JWE Header Base64url encoding of the JWE Protected 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 Encoded JWE Initialization Vector Base64url encoding of the JWE
Initialization Vector. Initialization Vector.
Encoded JWE Ciphertext Base64url encoding of the JWE Ciphertext. Encoded JWE Ciphertext Base64url encoding of the JWE Ciphertext.
Encoded JWE Authentication Tag Base64url encoding of the JWE Encoded JWE Authentication Tag Base64url encoding of the JWE
Authentication Tag. Authentication Tag.
Header Parameter Name The name of a member of the JWE Header.
Header Parameter Value The value of a member of the 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 Initialization Vector, the Encoded JWE Key, the Encoded JWE Initialization Vector, the Encoded JWE
Ciphertext, and the Encoded JWE Authentication Tag in that order, Ciphertext, and the Encoded JWE Authentication Tag in that order,
with the five strings being separated by four period ('.') with the five strings being separated by four period ('.')
characters. This results in a compact, URL-safe representation. characters. This representation is compact and URL-safe.
JWE JSON Serialization A representation of the JWE as a JSON JWE JSON Serialization A representation of the JWE as a JSON
structure containing Encoded JWE Header, Encoded JWE Encrypted structure containing JWE Header, Encoded JWE Encrypted Key,
Key, Encoded JWE Initialization Vector, Encoded JWE Ciphertext, Encoded JWE Initialization Vector, Encoded JWE Ciphertext, and
and Encoded JWE Authentication Tag values. Unlike the JWE Compact Encoded JWE Authentication Tag values. Unlike the JWE Compact
Serialization, the JWE JSON Serialization enables the same content Serialization, the JWE JSON Serialization enables the same content
to be encrypted to multiple parties. This representation is to be encrypted to multiple parties. This representation is
neither compact nor URL-safe. neither compact nor URL-safe.
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
namespace or through use of collision-resistant name allocation namespace or through use of collision-resistant name allocation
functions. Examples of Collision Resistant Namespaces include: functions. Examples of Collision Resistant Namespaces include:
skipping to change at page 8, line 37 skipping to change at page 9, line 6
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. Five values are represented in a JWE: the JWE base64url encoding. Five values are represented in a JWE: the JWE
Header, the JWE Encrypted Key, the JWE Initialization Vector, the JWE Header, the JWE Encrypted Key, the JWE Initialization Vector, the JWE
Ciphertext, and the JWE Authentication Tag. In the Compact Ciphertext, and the JWE Authentication Tag. In the Compact
Serialization, the five values are base64url-encoded for Serialization, the five values are base64url-encoded for
transmission, and represented as the concatenation of the encoded transmission, and represented as the concatenation of the encoded
strings in that order, with the five strings being separated by four strings in that order, with the five strings being separated by four
period ('.') characters. A JSON Serialization for this information period ('.') characters. A JSON Serialization for this information
is also defined in Section 7. is also defined in Section 8.
JWE utilizes authenticated encryption to ensure the confidentiality JWE utilizes authenticated encryption to ensure the confidentiality
and integrity of the Plaintext. and integrity of the Plaintext and the integrity of the JWE Protected
Header.
3.1. Example JWE using RSAES OAEP and AES GCM 3.1. Example JWE
This example encrypts the plaintext "The true sign of intelligence is This example encrypts the plaintext "The true sign of intelligence is
not knowledge but imagination." to the recipient using RSAES OAEP and not knowledge but imagination." to the recipient using RSAES OAEP and
AES GCM. AES GCM.
The following example JWE Header declares that: The following example JWE Header declares that:
o the Content Encryption Key is encrypted to the recipient using the o the Content Encryption Key is encrypted to the recipient using the
RSAES OAEP algorithm to produce the JWE Encrypted Key and RSAES OAEP algorithm to produce the JWE Encrypted Key and
skipping to change at page 9, line 20 skipping to change at page 9, line 35
{"alg":"RSA-OAEP","enc":"A256GCM"} {"alg":"RSA-OAEP","enc":"A256GCM"}
Base64url encoding the octets of the UTF-8 representation of the JWE Base64url encoding the octets of the UTF-8 representation of the JWE
Header yields this Encoded JWE Header value: Header yields this Encoded JWE Header value:
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ
The remaining steps to finish creating this JWE are: The remaining steps to finish creating this JWE are:
o Generate a random Content Encryption Key (CEK) o Generate a random Content Encryption Key (CEK).
o Encrypt the CEK with the recipient's public key using the RSAES o Encrypt the CEK 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 Generate a random JWE Initialization Vector.
o Base64url encode the JWE Initialization Vector to produce the o Base64url encode the JWE Initialization Vector to produce the
Encoded JWE Initialization Vector Encoded JWE Initialization Vector.
o Concatenate the Encoded JWE Header value, a period ('.') o Let the Additional Authenticated Data encryption parameter be the
character, and the Encoded JWE Encrypted Key to create the octets of the ASCII representation of the Encoded JWE Header
Additional Authenticated Data parameter value.
o Encrypt the Plaintext with AES GCM using the CEK as the encryption o Encrypt the Plaintext with AES GCM using the CEK as the encryption
key, the JWE Initialization Vector, and the Additional key, the JWE Initialization Vector, and the Additional
Authenticated Data value, requesting a 128 bit Authentication Tag Authenticated Data value, requesting a 128 bit Authentication Tag
output output.
o Base64url encode the Ciphertext to create the Encoded JWE o Base64url encode the Ciphertext to create the Encoded JWE
Ciphertext Ciphertext.
o Base64url encode the Authentication Tag to create the Encoded JWE o Base64url encode the Authentication Tag to create the Encoded JWE
Authentication Tag Authentication Tag.
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 Initialization Vector, Encoded JWE Encrypted Key, the Encoded JWE Initialization Vector,
the Encoded JWE Ciphertext, and the Encoded JWE Authentication Tag the Encoded JWE Ciphertext, and the Encoded JWE Authentication Tag
in that order, with the five strings being separated by four in that order, with the five strings being separated by four
period ('.') characters. 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:
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ. eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.
ApfOLCaDbqs_JXPYy2I937v_xmrzj-Iss1mG6NAHmeJViM6j2l0MHvfseIdHVyU2 OKOawDo13gRp2ojaHV7LFpZcgV7T6DVZKTyKOMTYUmKoTCVJRgckCL9kiMT03JGe
BIoGVu9ohvkkWiRq5DL2jYZTPA9TAdwq3FUIVyoH-Pedf6elHIVFi2KGDEspYMtQ ipsEdY3mx_etLbbWSrFr05kLzcSr4qKAq7YN7e9jwQRb23nfa6c9d-StnImGyFDb
ARMMSBcS7pslx6flh1Cfh3GBKysztVMEhZ_maFkm4PYVCsJsvq6Ct3fg2CJPOs0X Sv04uVuxIp5Zms1gNxKKK2Da14B8S4rzVRltdYwam_lDp5XnZAYpQdb76FdIKLaV
1DHuxZKoIGIqcbeK4XEO5a0h5TAuJObKdfO0dKwfNSSbpu5sFrpRFwV2FTTYoqF4 mqgfwX7XWRxv2322i-vDxRfqNzo_tETKzpVLzfiwQyeyPGLBIO56YJ7eObdv0je8
zI46N9-_hMIznlEpftRXhScEJuZ9HG8C8CHB1WRZ_J48PleqdhF4o7fB5J1wFqUX 1860ppamavo35UgoRdbYaBcoh9QcfylQr66oc6vFWXRcZ_ZT2LawVCWTIy3brGPi
BtbtuGJ_A2Xe6AEhrlzCOw. 6UklfCpIMfIjf7iGdXKHzg.
48V1_ALb6US04U3b. 48V1_ALb6US04U3b.
5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji 5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji
SdiwkIr3ajwQzaBtQD_A. SdiwkIr3ajwQzaBtQD_A.
ghEgxninkHEAMp4xZtB2mA XFBoMYUZodetZdvTiFvSkQ
See Appendix A.1 for the complete details of computing this JWE.
3.2. Example JWE using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256
This example encrypts the plaintext "Live long and prosper." to the
recipient using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256.
The following example JWE Header (with line breaks for display
purposes only) declares that:
o the Content Encryption Key is encrypted to the recipient using the
RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and
o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256
algorithm to produce the Ciphertext.
{"alg":"RSA1_5","enc":"A128CBC-HS256"}
Base64url encoding the octets of the UTF-8 representation of the JWE
Header yields this Encoded JWE Header value:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0
The remaining steps to finish creating this JWE are the same as for
the previous example, but using RSAES-PKCS1-v1_5 instead of RSAES
OAEP and using the AES_128_CBC_HMAC_SHA_256 algorithm (which is
specified in Sections 4.8 and 4.8.3 of JWA) instead of AES GCM.
The final result in this example (with line breaks for display
purposes only) is:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.
nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMkmOm
kkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZjDYENR
WiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfEJmNmfsx5f
cB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWyEHW6WzQ4iH9S
IcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_NSsx24LxtK6fIkej
RlMBmCfxv0Tg8CtxpURigg.
AxY8DCtDaGlsbGljb3RoZQ.
KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY.
fY2U_Hx5VcfXmipEldHhMA
See Appendix A.2 for the complete details of computing this JWE. See Appendix A.1 for the complete details of computing this JWE. See
Appendix A for additional examples.
4. JWE Header 4. JWE Header
The members of the JSON object represented by the JWE Header describe The members of the JSON object(s) represented by the JWE Header
the encryption applied to the Plaintext and optionally additional describe the encryption applied to the Plaintext and optionally
properties of the JWE. The Header Parameter Names within this object additional properties of the JWE. The Header Parameter Names within
MUST be unique; JWEs with duplicate Header Parameter Names MUST be the JWE Header MUST be unique; JWEs with duplicate Header Parameter
rejected. Names MUST be rejected.
Implementations are required to understand the specific header Implementations are required to understand the specific header
parameters defined by this specification that are designated as "MUST parameters defined by this specification that are designated as "MUST
be understood" and process them in the manner defined in this be understood" and process them in the manner defined in this
specification. All other header parameters defined by this specification. All other header parameters defined by this
specification that are not so designated MUST be ignored when not specification that are not so designated MUST be ignored when not
understood. Unless listed as a critical header parameter, per understood. Unless listed as a critical header parameter, per
Section 4.1.15, all other header parameters MUST be ignored when not Section 4.1.14, all other header parameters MUST be ignored when not
understood. understood.
There are two ways of distinguishing whether a header is a JWS Header There are two ways of distinguishing whether a header is a JWS Header
or a JWE Header. The first is by examining the "alg" (algorithm) or a JWE Header. The first is by examining the "alg" (algorithm)
header parameter value. If the value represents a digital signature header parameter value. If the value represents a digital signature
or MAC algorithm, or is the value "none", it is for a JWS; if it or MAC algorithm, or is the value "none", it is for a JWS; if it
represents a Key Encryption, Key Wrapping, Direct Key Agreement, Key represents a Key Encryption, Key Wrapping, Direct Key Agreement, Key
Agreement with Key Wrapping, or Direct Encryption algorithm, it is Agreement with Key Wrapping, or Direct Encryption algorithm, it is
for a JWE. A second method is determining whether an "enc" for a JWE. A second method is determining whether an "enc"
(encryption method) member exists. If the "enc" member exists, it is (encryption method) member exists. If the "enc" member exists, it is
skipping to change at page 12, line 12 skipping to change at page 11, line 32
Parameter Names, Public Header Parameter Names, and Private Header Parameter Names, Public Header Parameter Names, and Private Header
Parameter Names. Parameter Names.
4.1. Reserved Header Parameter Names 4.1. Reserved Header Parameter Names
The following Header Parameter Names are reserved with meanings as The following Header Parameter Names are reserved with meanings as
defined below. All the names are short because a core goal of this defined below. All the names are short because a core goal of this
specification is for the resulting representations using the JWE specification is for the resulting representations using the JWE
Compact Serialization to be compact. Compact Serialization to be compact.
Additional reserved Header Parameter Names MAY be defined via the Additional reserved Header Parameter Names can be defined via the
IANA JSON Web Signature and Encryption Header Parameters registry IANA JSON Web Signature and Encryption Header Parameters registry
[JWS]. As indicated by the common registry, JWSs and JWEs share a [JWS]. As indicated by the common registry, JWSs and JWEs share a
common header parameter space; when a parameter is used by both common header parameter space; when a parameter is used by both
specifications, its usage must be compatible between the specifications, its usage must be compatible between the
specifications. specifications.
4.1.1. "alg" (Algorithm) Header Parameter 4.1.1. "alg" (Algorithm) Header Parameter
The "alg" (algorithm) header parameter identifies the cryptographic The "alg" (algorithm) header parameter identifies the cryptographic
algorithm used to encrypt or determine the value of the Content algorithm used to encrypt or determine the value of the Content
skipping to change at page 13, line 12 skipping to change at page 12, line 33
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 are the values defined in Section 4.2 of contents of this registry are the values defined in Section 4.2 of
the JSON Web Algorithms (JWA) [JWA] specification. the JSON Web Algorithms (JWA) [JWA] specification.
4.1.3. "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. Use of this header parameter is OPTIONAL, JSON Web Key [JWK] value. When the "alg" value used identifies an
although its use is REQUIRED with some "alg" algorithms. When its algorithm for which "epk" is a parameter, this parameter MUST be
use is REQUIRED, this header parameter MUST be understood by present if REQUIRED by the algorithm and this header parameter MUST
implementations. be understood by implementations; otherwise, this parameter MUST be
omitted.
4.1.4. "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. Use of this header parameter is OPTIONAL. This before encryption. This header parameter MUST be integrity
protected, and therefore MUST occur only with the JWE Protected
Header, when used. Use of this header parameter is OPTIONAL. This
header parameter MUST be understood by implementations. header parameter MUST be understood by implementations.
4.1.5. "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 is the key to which the JWE was encrypted; this can be used to which is the key to which the JWE was encrypted; this can be used to
determine the private key needed to decrypt the JWE. The keys MUST determine the private key needed to decrypt the JWE. The keys MUST
be encoded as a JSON Web Key Set (JWK Set) [JWK]. The protocol used be encoded as a JSON Web Key Set (JWK Set) [JWK]. The protocol used
to acquire the resource MUST provide integrity protection; an HTTP to acquire the resource MUST provide integrity protection; an HTTP
skipping to change at page 14, line 19 skipping to change at page 13, line 45
This MAY be followed by additional certificates, with each subsequent This MAY be followed by additional certificates, with each subsequent
certificate being the one used to certify the previous one. The certificate being the one used to certify the previous one. 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]. Use of validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. Use of
this header parameter is OPTIONAL. this header parameter is OPTIONAL.
4.1.8. "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 is 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] containing the key to encoding of the X.509 certificate [RFC5280] containing the key to
which the JWE was encrypted; this can be used to determine the which the JWE was encrypted; this can be used to determine the
private key needed to decrypt the JWE. Use of this header parameter private key needed to decrypt the JWE. Use of this header parameter
is OPTIONAL. 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.9. "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]
containing the key to which the JWE was encrypted; this can be used containing the key to which the JWE was encrypted; this can be used
to determine the private key needed to decrypt the JWE. The to 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 a JSON array of
certificate value strings. Each string is a base64 encoded certificate value strings. Each string in the array is a base64
([RFC4648] Section 4 -- not base64url encoded) DER [ITU.X690.1994] encoded ([RFC4648] Section 4 -- not base64url encoded) DER
PKIX certificate value. The certificate containing the public key to [ITU.X690.1994] PKIX certificate value. The certificate containing
which the JWE was encrypted MUST be the first certificate. This MAY the public key to which the JWE was encrypted MUST be the first
be followed by additional certificates, with each subsequent certificate. This MAY be followed by additional certificates, with
certificate being the one used to certify the previous one. Use of each subsequent certificate being the one used to certify the
this header parameter is OPTIONAL. previous one. Use of 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.10. "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 to The "kid" (key ID) header parameter is a hint indicating which key to
which the JWE was encrypted; this can be used to determine the which the JWE was encrypted; 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
skipping to change at page 15, line 23 skipping to change at page 14, line 46
interpretation of the "kid" value is unspecified. Its value MUST be interpretation of the "kid" value is unspecified. Its value MUST be
a string. Use of this header parameter is OPTIONAL. a string. Use of this header parameter is OPTIONAL.
When used with a JWK, the "kid" value can be used to match a JWK When used with a JWK, the "kid" value can be used to match a JWK
"kid" parameter value. "kid" parameter value.
4.1.11. "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" is used to indicate that this object is object. The type value "JWE" is used to indicate that this object is
a JWE using the JWE Compact Serialization. The type value "JWE-JS" a JWE using the JWE Compact Serialization. The type value "JWE+JSON"
is used to indicate that this object is a JWE using the JWE JSON is used to indicate that this object is a JWE using the JWE JSON
Serialization. The "typ" value is a case sensitive string. Use of Serialization. Other type values MAY be used, and if not understood,
this header parameter is OPTIONAL. SHOULD be ignored. The "typ" value is a case sensitive string. Use
of this 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 value Signature and Encryption Type Values registry [JWS] or be a value
that contains a Collision Resistant Namespace. that contains a Collision Resistant Namespace.
4.1.12. "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). For example, the JSON Web of the encrypted content (the Plaintext). For example, the JSON Web
Token (JWT) [JWT] specification uses the "cty" value "JWT" to Token (JWT) [JWT] specification uses the "cty" value "JWT" to
indicate that the Plaintext is a JSON Web Token (JWT). The "cty" indicate that the Plaintext is a JSON Web Token (JWT). Content type
value is a case sensitive string. Use of this header parameter is values that are not understood SHOULD be ignored. The "cty" value is
OPTIONAL. a case sensitive string. Use of 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 4.1.13. "apu" (Agreement PartyUInfo) Header Parameter
The "apu" (agreement PartyUInfo) value for key agreement algorithms The "apu" (agreement PartyUInfo) value for key agreement algorithms
using it (such as "ECDH-ES"), represented as a base64url encoded using it (such as "ECDH-ES"), represented as a base64url encoded
string. Use of this header parameter is OPTIONAL. When the "alg" string. Use of this header parameter is OPTIONAL. When the "alg"
value used identifies an algorithm for which "apu" is a parameter, value used identifies an algorithm for which "apu" is a parameter,
this header parameter MUST be understood by implementations. this header parameter MUST be understood by implementations;
otherwise, this parameter MUST be omitted.
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. Use of this header parameter is OPTIONAL. When the "alg"
value used identifies an algorithm for which "apv" is a parameter,
this header parameter MUST be understood by implementations.
4.1.15. "crit" (Critical) Header Parameter 4.1.14. "crit" (Critical) Header Parameter
The "crit" (critical) header parameter is array listing the names of The "crit" (critical) header parameter indicates that extensions to
header parameters that are present in the JWE Header that MUST be [[ this specification ]] are being used that MUST be understood and
understood and processed by the implementation or if not understood, processed. Its value is an array listing the header parameter names
MUST cause the JWE to be rejected. This list MUST NOT include header defined by those extensions that are used in the JWE Header. If any
parameters defined by this specification, duplicate names, or names of the listed extension header parameters are not understood and
that do not occur as header parameters within the JWE. Use of this supported by the receiver, it MUST reject the JWE. Senders MUST NOT
header parameter is OPTIONAL. This header parameter MUST be include header parameter names defined by [[ this specification ]],
understood by implementations. duplicate names, or names that do not occur as header parameter names
within the JWE Header in the "crit" list. Senders MUST not use the
empty list "[]" as the "crit" value. Recipients MAY reject the JWE
if the critical list contains any header parameter names defined by
[[ this specification ]] or any other constraints on its use are
violated. This header parameter MUST be integrity protected, and
therefore MUST occur only with the JWE Protected Header, when used.
Use of this header parameter is OPTIONAL. This header parameter MUST
be understood by implementations.
An example use, along with a hypothetical "exp" (expiration-time) An example use, along with a hypothetical "exp" (expiration-time)
field is: field is:
{"alg":"RSA-OAEP", {"alg":"RSA-OAEP",
"enc":"A256GCM", "enc":"A256GCM",
"crit":["exp"], "crit":["exp"],
"exp":1363284000 "exp":1363284000
} }
skipping to change at page 17, line 47 skipping to change at page 17, line 27
5. Otherwise, when Direct Key Agreement or Direct Encryption are 5. Otherwise, when Direct Key Agreement or Direct Encryption are
employed, let the JWE Encrypted Key be the empty octet sequence. employed, let the JWE Encrypted Key be the empty octet sequence.
6. When Direct Encryption is employed, let the Content Encryption 6. When Direct Encryption is employed, let the Content Encryption
Key (CEK) be the shared symmetric key. Key (CEK) be the shared symmetric key.
7. Base64url encode the JWE Encrypted Key to create the Encoded JWE 7. Base64url encode the JWE Encrypted Key to create the Encoded JWE
Encrypted Key. Encrypted Key.
8. Generate a random JWE Initialization Vector of the correct size 8. If the JWE JSON Serialization is being used, repeat this process
for each recipient.
9. Generate a random JWE Initialization Vector of the correct size
for the block encryption algorithm (if required for the for the block encryption algorithm (if required for the
algorithm); otherwise, let the JWE Initialization Vector be the algorithm); otherwise, let the JWE Initialization Vector be the
empty octet sequence. empty octet sequence.
9. Base64url encode the JWE Initialization Vector to create the 10. Base64url encode the JWE Initialization Vector to create the
Encoded JWE Initialization Vector. Encoded JWE Initialization Vector.
10. Compress the Plaintext if a "zip" parameter was included. 11. Compress the Plaintext if a "zip" parameter was included.
11. Serialize the (compressed) Plaintext into an octet sequence M. 12. Serialize the (compressed) Plaintext into an octet sequence M.
12. Create a JWE Header containing the encryption parameters used. 13. 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.
13. Base64url encode the octets of the UTF-8 representation of the 14. Base64url encode the octets of the UTF-8 representation of the
JWE Header to create the Encoded JWE Header. JWE Protected Header to create the Encoded JWE Header. If the
JWE Protected Header is not present (which can only happen when
14. If the JWE JSON Serialization is being used, repeat this process using the JWE JSON Serialization), let the Encoded JWE Header be
for each recipient. the empty string.
15. Let the value X be the concatenation of the Encoded JWE Header
values computed above, with a tilde ('~') character between each
Encoded JWE Header value. (In the single recipient case, X is
simply the single Encoded JWE Header value.)
16. Let the value Y be the concatenation of the Encoded JWE
Encrypted Key values computed above, with a tilde ('~')
character between each Encoded JWE Encrypted Key value. The
order of the Encoded JWE Encrypted Key values MUST be the same
as the order of the corresponding Encoded JWE Header values in
the previous step. (In the single recipient case, Y is simply
the single Encoded JWE Encrypted Key value.)
17. Let the Additional Authenticated Data value be the octets of the 15. Let the Additional Authenticated Data encryption parameter be
ASCII representation of the concatenation of X, a period ('.') the octets of the ASCII representation of the Encoded JWE Header
character, and Y. value.
18. Encrypt M using the CEK, the JWE Initialization Vector, and the 16. Encrypt M using the CEK, the JWE Initialization Vector, and the
Additional Authenticated Data value using the specified block Additional Authenticated Data value using the specified block
encryption algorithm to create the JWE Ciphertext value and the encryption algorithm to create the JWE Ciphertext value and the
JWE Authentication Tag (which is the Authentication Tag output JWE Authentication Tag (which is the Authentication Tag output
from the encryption operation). from the encryption operation).
19. Base64url encode the JWE Ciphertext to create the Encoded JWE 17. Base64url encode the JWE Ciphertext to create the Encoded JWE
Ciphertext. Ciphertext.
20. Base64url encode the JWE Authentication Tag to create the 18. Base64url encode the JWE Authentication Tag to create the
Encoded JWE Authentication Tag. Encoded JWE Authentication Tag.
21. The five encoded parts are the result values used in both the 19. The five encoded parts are result values used in both the JWE
JWE Compact Serialization and the JWE JSON Serialization Compact Serialization and the JWE JSON Serialization
representations. representations.
22. Create the desired serialized output. The JWE Compact 20. Create the desired serialized output. The JWE Compact
Serialization of this result is the concatenation of the Encoded Serialization of this result is the concatenation of the Encoded
JWE Header, the Encoded JWE Encrypted Key, the Encoded JWE JWE Header, the Encoded JWE Encrypted Key, the Encoded JWE
Initialization Vector, the Encoded JWE Ciphertext, and the Initialization Vector, the Encoded JWE Ciphertext, and the
Encoded JWE Authentication Tag in that order, with the five Encoded JWE Authentication Tag in that order, with the five
strings being separated by four period ('.') characters. The strings being separated by four period ('.') characters. The
JWE JSON Serialization is described in Section 7. JWE JSON Serialization is described in Section 8.
5.2. Message Decryption 5.2. 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. Parse the serialized input to determine the values of the 1. Parse the serialized input to determine the values of the JWE
Encoded JWE Header, the Encoded JWE Encrypted Key, the Encoded Header, the Encoded JWE Encrypted Key, the Encoded JWE
JWE Initialization Vector, the Encoded JWE Ciphertext, and the Initialization Vector, the Encoded JWE Ciphertext, and the
Encoded JWE Authentication Tag. When using the JWE Compact Encoded JWE Authentication Tag. When using the JWE Compact
Serialization, these five values are represented as text strings Serialization, the Encoded JWE Header, the Encoded JWE Encrypted
in that order, separated by four period ('.') characters. The Key, the Encoded JWE Initialization Vector, the Encoded JWE
JWE JSON Serialization is described in Section 7. Ciphertext, and the Encoded JWE Authentication Tag are
represented as text strings in that order, separated by four
period ('.') characters. The JWE JSON Serialization is
described in Section 8.
2. The Encoded JWE Header, the Encoded JWE Encrypted Key, the 2. The Encoded JWE Header, the Encoded JWE Encrypted Key, the
Encoded JWE Initialization Vector, the Encoded JWE Ciphertext, Encoded JWE Initialization Vector, the Encoded JWE Ciphertext,
and the Encoded JWE Authentication Tag MUST be successfully and the Encoded JWE Authentication Tag MUST be successfully
base64url decoded following the restriction that no padding base64url decoded following the restriction that no padding
characters have been used. characters have been used.
3. The resulting JWE Header MUST be completely valid JSON syntax 3. The resulting JWE Protected Header MUST be a completely valid
conforming to RFC 4627 [RFC4627]. JSON object conforming to RFC 4627 [RFC4627].
4. The resulting JWE Header MUST be validated to only include 4. If using the JWE Compact Serialization, let the JWE Header be
the JWE Protected Header; otherwise, when using the JWE JSON
Serialization, let the JWE Header be the union of the members of
the JWE Protected Header, the members of the "unprotected"
value, and the members of the corresponding "header" value, all
of which must be completely valid JSON objects.
5. The resulting JWE Header MUST NOT contain duplicate Header
Parameter Names. When using the JWE JSON Serialization, this
restriction includes that the same Header Parameter Name also
MUST NOT occur in distinct JSON Text Object values that together
comprise the JWE Header.
6. 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 or that are specified as being ignored understood and supported or that are specified as being ignored
when not understood. when not understood.
5. Determine the Key Management Mode employed by the algorithm 7. Determine the Key Management Mode employed by the algorithm
specified by the "alg" (algorithm) header parameter. specified by the "alg" (algorithm) header parameter.
6. Verify that the JWE uses a key known to the recipient. 8. Verify that the JWE uses a key known to the recipient.
7. When Direct Key Agreement or Key Agreement with Key Wrapping are 9. When Direct Key Agreement or Key Agreement with Key Wrapping are
employed, use the key agreement algorithm to compute the value employed, use the key agreement algorithm to compute the value
of the agreed upon key. When Direct Key Agreement is employed, of the agreed upon key. When Direct Key Agreement is employed,
let the Content Encryption Key (CEK) be the agreed upon key. let the Content Encryption Key (CEK) be the agreed upon key.
When Key Agreement with Key Wrapping is employed, the agreed When Key Agreement with Key Wrapping is employed, the agreed
upon key will be used to decrypt the JWE Encrypted Key. upon key will be used to decrypt the JWE Encrypted Key.
8. When Key Wrapping, Key Encryption, or Key Agreement with Key 10. 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 Encryption Key (CEK). The CEK MUST have a length the Content Encryption Key (CEK). The CEK MUST have a length
equal to that required for the block encryption algorithm. Note equal to that required for the block encryption algorithm. Note
that when there are multiple recipients, each recipient will that when there are multiple recipients, each recipient will
only be able decrypt any JWE Encrypted Key values that were only be able decrypt any JWE Encrypted Key values that were
encrypted to a key in that recipient's possession. It is encrypted to a key in that recipient's possession. It is
therefore normal to only be able to decrypt one of the per- therefore normal to only be able to decrypt one of the per-
recipient JWE Encrypted Key values to obtain the CEK value. To recipient JWE Encrypted Key values to obtain the CEK value. To
mitigate against attacks described in RFC 3218 [RFC3218], the mitigate against attacks described in RFC 3218 [RFC3218], the
recipient MUST NOT distinguish between format, padding, and recipient MUST NOT distinguish between format, padding, and
length errors of encrypted keys. It is strongly recommended, in length errors of encrypted keys. It is strongly recommended, in
the event of receiving an improperly formatted key, that the the event of receiving an improperly formatted key, that the
receiver substitute a randomly generated CEK and proceed to the receiver substitute a randomly generated CEK and proceed to the
next step, to mitigate timing attacks. next step, to mitigate timing attacks.
9. Otherwise, when Direct Key Agreement or Direct Encryption are 11. Otherwise, when Direct Key Agreement or Direct Encryption are
employed, verify that the JWE Encrypted Key value is empty octet employed, verify that the JWE Encrypted Key value is empty octet
sequence. sequence.
10. When Direct Encryption is employed, let the Content Encryption 12. When Direct Encryption is employed, let the Content Encryption
Key (CEK) be the shared symmetric key. Key (CEK) be the shared symmetric key.
11. If the JWE JSON Serialization is being used, repeat this process 13. If the JWE JSON Serialization is being used, repeat this process
for each recipient contained in the representation. for each recipient contained in the representation until the CEK
value has been determined.
12. Let the value X be the concatenation of the Encoded JWE Header
values identified above, with a tilde ('~') character between
each Encoded JWE Header value. (In the single recipient case, X
is simply the single Encoded JWE Header value.)
13. Let the value Y be the concatenation of the Encoded JWE
Encrypted Key values identified above, with a tilde ('~')
character between each Encoded JWE Encrypted Key value. The
order of the Encoded JWE Encrypted Key values MUST be the same
as the order of the corresponding Encoded JWE Header values in
the previous step. (In the single recipient case, Y is simply
the single Encoded JWE Encrypted Key value.)
14. Let the Additional Authenticated Data value be the octets of the 14. Let the Additional Authenticated Data encryption parameter be
ASCII representation of the concatenation of X, a period ('.') the octets of the ASCII representation of the Encoded JWE Header
character, and Y. value.
15. Decrypt the JWE Ciphertext using the CEK, the JWE Initialization 15. Decrypt the JWE Ciphertext using the CEK, the JWE Initialization
Vector, the Additional Authenticated Data value, and the JWE Vector, the Additional Authenticated Data value, and the JWE
Authentication Tag (which is the Authentication Tag input to the Authentication Tag (which is the Authentication Tag input to the
calculation) using the specified block encryption algorithm, calculation) using the specified block encryption algorithm,
returning the decrypted plaintext and verifying the JWE returning the decrypted plaintext and verifying the JWE
Authentication Tag in the manner specified for the algorithm, Authentication Tag in the manner specified for the algorithm,
rejecting the input without emitting any decrypted output if the rejecting the input without emitting any decrypted output if the
JWE Authentication Tag is incorrect. JWE Authentication Tag is incorrect.
skipping to change at page 21, line 31 skipping to change at page 21, line 5
Processing a JWE inevitably requires comparing known strings to Processing a JWE inevitably requires comparing known strings to
values in JSON objects. For example, in checking what the encryption values in JSON objects. For example, in checking what the encryption
method is, the Unicode string encoding "enc" will be checked against method is, the Unicode string encoding "enc" will be checked against
the member names in the JWE Header to see if there is a matching the member names in the JWE Header to see if there is a matching
Header Parameter Name. Header Parameter Name.
Comparisons between JSON strings and other Unicode strings MUST be Comparisons between JSON strings and other Unicode strings MUST be
performed by comparing Unicode code points without normalization as performed by comparing Unicode code points without normalization as
specified in the String Comparison Rules in Section 5.3 of [JWS]. specified in the String Comparison Rules in Section 5.3 of [JWS].
6. Encrypting JWEs with Cryptographic Algorithms 6. 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 (CEK) and to provide integrity protection for Content Encryption Key (CEK) and to provide integrity protection for
the JWE Header, JWE Encrypted Key, and JWE Ciphertext. The JSON Web the JWE Protected Header and JWE Ciphertext. The JSON Web Algorithms
Algorithms (JWA) [JWA] specification specifies a set of cryptographic (JWA) [JWA] specification specifies a set of cryptographic algorithms
algorithms and identifiers to be used with this specification and and identifiers to be used with this specification and defines
defines registries for additional such algorithms. Specifically, registries for additional such algorithms. Specifically, Section 4.1
Section 4.1 specifies a set of "alg" (algorithm) header parameter specifies a set of "alg" (algorithm) header parameter values and
values and Section 4.2 specifies a set of "enc" (encryption method) Section 4.2 specifies a set of "enc" (encryption method) header
header parameter values intended for use this specification. It also parameter values intended for use this specification. It also
describes the semantics and operations that are specific to these describes the semantics and operations that are specific to these
algorithms. algorithms.
Public keys employed for encryption can be identified using the
Header Parameter methods described in Section 4.1 or can be
distributed using methods that are outside the scope of this
specification.
6.1. CEK Encryption 6.1. CEK Encryption
JWE supports three forms of Content Encryption Key (CEK) encryption: JWE supports three forms of Content Encryption Key (CEK) 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 CEK encryption. encryption algorithms that can be used for CEK encryption.
7. JSON Serialization 7. Key Identification
The JWE JSON Serialization represents encrypted content as a JSON
object with a "recipients" member containing an array of per-
recipient information, an "initialization_vector" member containing a
shared Encoded JWE Initialization Vector value, a "ciphertext" member
containing a shared Encoded JWE Ciphertext value, and an
"authentication_tag" member containing a shared Encoded JWE
Authentication Tag value. Each member of the "recipients" array is a
JSON object with a "header" member containing an Encoded JWE Header
value and an "encrypted_key" member containing an Encoded JWE
Encrypted Key value.
Unlike the JWE Compact Serialization, content using the JWE JSON It is necessary for the recipient of a JWE to be able to determine
Serialization MAY be encrypted to more than one recipient. Each the key that was employed for the encryption operation. The key
recipient requires: employed can be identified using the Header Parameter methods
described in Section 4.1 or can be identified using methods that are
outside the scope of this specification. Specifically, the Header
Parameters "jku", "jwk", "x5u", "x5t", "x5c", and "kid" can be used
to identify the key used. The sender SHOULD include sufficient
information in the Header Parameters to identify the key used, unless
the application uses another means or convention to determine the key
used. Recipients MUST reject the input when the key used cannot be
determined.
o a JWE Header value specifying the cryptographic parameters used to 8. JWE JSON Serialization
encrypt the JWE Encrypted Key to that recipient and the parameters
used to encrypt the plaintext to produce the JWE Ciphertext; this
is represented as an Encoded JWE Header value in the "header"
member of an object in the "recipients" array.
o a JWE Encrypted Key value used to encrypt the ciphertext; this is The JWE JSON Serialization represents encrypted content as a JSON
represented as an Encoded JWE Encrypted Key value in the object. Unlike the JWE Compact Serialization, content using the JWE
"encrypted_key" member of the same object in the "recipients" JSON Serialization can be encrypted to more than one recipient.
array.
Therefore, the syntax is: The representation is closely related to that used in the JWE Compact
Serialization, with the following differences for the JWE JSON
Serialization:
{"recipients":[ o Values in the JWE JSON Serialization are represented as members of
{"header":"<header 1 contents>", a JSON object, rather than as base64url encoded strings separated
"encrypted_key":"<encrypted key 1 contents>"}, by period ('.') characters. (However binary values and values
... that are integrity protected are still base64url encoded.)
{"header":"<header N contents>",
"encrypted_key":"<encrypted key N contents>"}],
"initialization_vector":"<initialization vector contents>",
"ciphertext":"<ciphertext contents>",
"authentication_tag":"<authentication tag contents>"
}
The contents of the Encoded JWE Header, Encoded JWE Encrypted Key, o The Encoded JWE Header value, if non-empty, is stored in the
Encoded JWE Initialization Vector, Encoded JWE Ciphertext, and "protected" member.
Encoded JWE Authentication Tag values are exactly as specified in the
rest of this specification. They are interpreted and validated in
the same manner, with each corresponding "header" and "encrypted_key"
value being created and validated together.
All recipients use the same JWE Ciphertext, JWE Initialization o The Encoded JWE Initialization Vector value is stored in the "iv"
Vector, and JWE Authentication Tag values, resulting in potentially member.
significant space savings if the message is large. Therefore, all
header parameters that specify the treatment of the JWE Ciphertext
value MUST be the same for all recipients. This primarily means that
the "enc" (encryption method) header parameter value in the JWE
Header for each recipient MUST be the same.
7.1. Example JWE-JS o The Encoded JWE Ciphertext value is stored in the "ciphertext"
member.
This section contains an example using the JWE JSON Serialization. o The Encoded JWE Authentication Tag value is stored in the "tag"
This example demonstrates the capability for encrypting the same member.
plaintext to multiple recipients.
Two recipients are present in this example: the first using the o The JWE can be encrypted to multiple recipients, rather than just
RSAES-PKCS1-V1_5 algorithm to encrypt the Content Encryption Key one. A JSON array in the "recipients" member is used to hold
(CEK) and the second using RSAES OAEP to encrypt the CEK. The values that are specific to a particular recipient, with one array
Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 algorithm element per recipient represented. These array elements are JSON
and the same block encryption parameters to produce the common JWE objects.
Ciphertext value. The two Decoded JWE Header Segments used are:
{"alg":"RSA1_5","enc":"A128CBC-HS256"} o Each Encoded JWE Encrypted Key value is stored in the
"encrypted_key" member of a JSON object that is an element of the
"recipients" array.
and: o Some header parameter values, such as the "alg" value and
parameters used for selecting keys, can also differ for different
recipient computations. Per-recipient header parameter values are
stored in the "header" members of the same JSON objects that are
elements of the "recipients" array.
{"alg":"RSA-OAEP","enc":"A128CBC-HS256"} o Some header parameters, including the "alg" parameter, can be
shared among all recipient computations. These header parameters
are stored in either of two top-level member(s) of the JSON
object: the "protected" member and the "unprotected" member. The
values of these members are JSON Text Objects containing Header
Parameters.
The keys used for the first recipient are the same as those in o Not all header parameters are integrity protected. The shared
Appendix A.2, as is the Plaintext used. The encryption key used for header parameters in the "protected" member are integrity
the second recipient is the same as that used in Appendix A.3; the protected, and are base64url encoded. The per-recipient header
block encryption keys and parameters for the second recipient are the parameters in the "header" array element members and the shared
same as those for the first recipient (which must be the case, since header parameters in the "unprotected" member are not integrity
the Initialization Vector and Ciphertext are shared). Thus, the same protected. These JSON Text Objects containing header parameters
two Encoded JWE Header and JWE Encoded Encrypted Key values are used that are not integrity protected are not base64url encoded.
in this example as are used in those examples.
The value X used as part of the AAD value is the concatenation of the o The header parameter values used when creating or validating per-
Encoded JWE Header values, separated by a tilde ('~') character. In recipient Ciphertext and Authentication Tag values are the union
this example, the value of X (with line breaks for display purposes of the three sets of header parameter values that may be present:
only) is: (1) the per-recipient values in the "header" member of the
recipient's array element, (2) the shared integrity-protected
values in the "protected" member, and (3) the shared non-
integrity-protected values in the "unprotected" member. The union
of these sets of header parameters comprises the JWE Header. The
header parameter names in the three locations MUST be disjoint.
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0 The syntax of a JWE using the JWE JSON Serialization is as follows:
~
eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0
The value Y used as part of the AAD value is the concatenation of the {"protected":<integrity-protected shared header contents>",
Encoded JWE Encrypted Key values, separated by a tilde ('~') "unprotected":<non-integrity-protected shared header contents>",
character. In this example, the value of Y (with line breaks for "recipients":[
display purposes only) is: {"header":"<per-recipient unprotected header 1 contents>",
"encrypted_key":"<encrypted key 1 contents>"},
...
{"header":"<per-recipient unprotected header N contents>",
"encrypted_key":"<encrypted key N contents>"}],
"iv":"<initialization vector contents>",
"ciphertext":"<ciphertext contents>",
"tag":"<authentication tag contents>"
}
nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMk Of these members, only the "ciphertext" member MUST be present. The
mOmkkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZ "iv", "tag", and "encrypted_key" members MUST be present when
jDYENRWiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfE corresponding JWE Initialization Vector, JWE Authentication Tag, and
JmNmfsx5fcB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWy JWE Encrypted Key values are non-empty. The "recipients" member MUST
EHW6WzQ4iH9SIcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_N be present when any "header" or "encrypted_key" members are needed
Ssx24LxtK6fIkejRlMBmCfxv0Tg8CtxpURigg for recipients. At least one of the "header", "protected", and
~ "unprotected" members MUST be present so that "alg" and "enc" header
6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ parameter values are conveyed for each recipient computation.
The AAD value used for the block encryption is the octets of the The contents of the Encoded JWE Encrypted Key, Encoded JWE
ASCII representation of the concatenation of X, a period ('.') Initialization Vector, Encoded JWE Ciphertext, and Encoded JWE
character, and Y. This concatenation (with line breaks for display Authentication Tag values are exactly as defined in the rest of this
purposes only) is: specification. They are interpreted and validated in the same
manner, with each corresponding Encoded JWE Encrypted Key, Encoded
JWE Initialization Vector, Encoded JWE Ciphertext, Encoded JWE
Authentication Tag, and set of header parameter values being created
and validated together. The JWE Header values used are the union of
the header parameters in the "protected", "unprotected", and
corresponding "header" members, as described earlier.
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0 Each JWE Encrypted Key value is computed using the parameters of the
~ corresponding JWE Header value in the same manner as for the JWE
eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0 Compact Serialization. This has the desirable property that each
. Encoded JWE Encrypted Key value in the "recipients" array is
nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMk identical to the value that would have been computed for the same
mOmkkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZ parameter in the JWE Compact Serialization. Likewise, the JWE
jDYENRWiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfE Ciphertext and JWE Authentication Tag values match those produced for
JmNmfsx5fcB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWy the JWE Compact Serialization, provided that the Encoded JWE Header
EHW6WzQ4iH9SIcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_N value (which represents the integrity-protected header parameter
Ssx24LxtK6fIkejRlMBmCfxv0Tg8CtxpURigg values) matches that used in the JWE Compact Serialization.
~
6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ
The complete JSON Web Encryption JSON Serialization (JWE-JS) for All recipients use the same JWE Protected Header, JWE Initialization
these values is as follows (with line breaks for display purposes Vector, JWE Ciphertext, and JWE Authentication Tag values, resulting
only): in potentially significant space savings if the message is large.
Therefore, all header parameters that specify the treatment of the
Plaintext value MUST be the same for all recipients. This primarily
means that the "enc" (encryption method) header parameter value in
the JWE Header for each recipient and any parameters of that
algorithm MUST be the same.
{"recipients":[ See Appendix A.4 for an example of computing a JWE using the JWE JSON
{"header": Serialization.
"eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0",
"encrypted_key":
"nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMk
mOmkkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZ
jDYENRWiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfE
JmNmfsx5fcB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWy
EHW6WzQ4iH9SIcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_N
Ssx24LxtK6fIkejRlMBmCfxv0Tg8CtxpURigg"},
{"header":
"eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0",
"encrypted_key":
"6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ"}],
"initialization_vector":
"AxY8DCtDaGlsbGljb3RoZQ",
"ciphertext":
"KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY",
"authentication_tag":
"LlhRZFfphc2f5X3nTTJP6g"
}
8. Implementation Considerations 9. Implementation Considerations
The JWE Compact Serialization is mandatory to implement. The JWE Compact Serialization is mandatory to implement.
Implementation of the JWE JSON Serialization is OPTIONAL. Implementation of the JWE JSON Serialization is OPTIONAL.
9. IANA Considerations 10. IANA Considerations
9.1. Registration of JWE Header Parameter Names 10.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].
9.1.1. Registry Contents 10.1.1. Registry Contents
o Header Parameter Name: "alg" o Header Parameter Name: "alg"
o Header Parameter Usage Location(s): JWE o Header Parameter Usage Location(s): JWE
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 Header Parameter Usage Location(s): JWE o Header Parameter Usage Location(s): JWE
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: "epk" o Header Parameter Name: "epk"
o Header Parameter Usage Location(s): JWE o Header Parameter Usage Location(s): JWE
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 ]]
skipping to change at page 26, line 43 skipping to change at page 26, line 4
o Header Parameter Name: "x5t" o Header Parameter Name: "x5t"
o Header Parameter Usage Location(s): JWE o Header Parameter Usage Location(s): JWE
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: "x5c" o Header Parameter Name: "x5c"
o Header Parameter Usage Location(s): JWE o Header Parameter Usage Location(s): JWE
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: "kid"
o Header Parameter Usage Location(s): JWE o Header Parameter Usage Location(s): JWE
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: "typ" o Header Parameter Name: "typ"
o Header Parameter Usage Location(s): JWE o Header Parameter Usage Location(s): 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.11 of [[ this document ]]
o Header Parameter Name: "cty" o Header Parameter Name: "cty"
o Header Parameter Usage Location(s): JWE o Header Parameter Usage Location(s): JWE
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: "apu" o Header Parameter Name: "apu"
o Header Parameter Usage Location(s): JWE o Header Parameter Usage Location(s): JWE
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: "apv"
o Header Parameter Usage Location(s): JWE
o Change Controller: IETF
o Specification Document(s): Section 4.1.14 of [[ this document ]]
o Header Parameter Name: "crit" o Header Parameter Name: "crit"
o Header Parameter Usage Location(s): JWS o Header Parameter Usage Location(s): JWS
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.14 of [[ this document ]]
9.2. JSON Web Signature and Encryption Type Values Registration 10.2. JSON Web Signature and Encryption Type Values Registration
9.2.1. Registry Contents 10.2.1. Registry Contents
This specification registers the "JWE" and "JWE-JS" type values in This specification registers the "JWE" and "JWE+JSON" type values in
the IANA JSON Web Signature and Encryption Type Values registry the IANA JSON Web Signature and Encryption Type Values registry
[JWS]: [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.11 of [[ this document ]]
o "typ" Header Parameter Value: "JWE-JS" o "typ" Header Parameter Value: "JWE+JSON"
o Abbreviation for MIME Type: application/jwe-js o Abbreviation for MIME Type: application/jwe+json
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 ]]
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" and This specification registers the "application/jwe" and
"application/jwe-js" Media Types [RFC2046] in the MIME Media Type "application/jwe+json" Media Types [RFC2046] in the MIME Media Type
registry [RFC4288] to indicate, respectively, that the content is a registry [RFC4288] to indicate, respectively, that the content is a
JWE using the JWE Compact Serialization or a JWE using the JWE JSON JWE using the JWE Compact Serialization or a JWE using the JWE JSON
Serialization. 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)
skipping to change at page 28, line 31 skipping to change at page 27, line 35
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
o Type Name: application o Type Name: application
o Subtype Name: jwe-js o Subtype Name: jwe+json
o Required Parameters: n/a o Required Parameters: n/a
o Optional Parameters: n/a o Optional Parameters: n/a
o Encoding considerations: JWE-JS values are represented as a JSON o Encoding considerations: application/jwe+json values are
Object; UTF-8 encoding SHOULD be employed for the JSON object. represented as a JSON Object; UTF-8 encoding SHOULD be employed
for the JSON object.
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: TBD o Applications that use this media type: TBD
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
10. Security Considerations 11. 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 and symmetric keys, preventing various protecting the user's private and symmetric keys, preventing various
attacks, and helping the user avoid mistakes such as inadvertently attacks, and helping the user avoid mistakes such as inadvertently
encrypting a message for the wrong recipient. The entire list of encrypting a message for the wrong recipient. The entire list of
security considerations is beyond the scope of this document. security considerations is beyond the scope of this document.
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
skipping to change at page 29, line 30 skipping to change at page 28, line 35
recipient to be used as an oracle for decrypting messages. RFC 3218 recipient to be used as an oracle for decrypting messages. RFC 3218
[RFC3218] should be consulted for specific countermeasures to attacks [RFC3218] should be consulted for specific countermeasures to attacks
on RSAES-PKCS1-V1_5. An attacker might modify the contents of the on RSAES-PKCS1-V1_5. An attacker might modify the contents of the
"alg" parameter from "RSA-OAEP" to "RSA1_5" in order to generate a "alg" parameter from "RSA-OAEP" to "RSA1_5" in order to generate a
formatting error that can be detected and used to recover the CEK formatting error that can be detected and used to recover the CEK
even if RSAES OAEP was used to encrypt the CEK. It is therefore even if RSAES OAEP was used to encrypt the CEK. It is therefore
particularly important to report all formatting errors to the CEK, particularly important to report all formatting errors to the CEK,
Additional Authenticated Data, or ciphertext as a single error when Additional Authenticated Data, or ciphertext as a single error when
the JWE is rejected. the JWE is rejected.
11. References 12. References
11.1. Normative References 12.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)", [JWA] Jones, M., "JSON Web Algorithms (JWA)",
draft-ietf-jose-json-web-algorithms (work in progress), draft-ietf-jose-json-web-algorithms (work in progress),
April 2013. May 2013.
[JWK] Jones, M., "JSON Web Key (JWK)", [JWK] Jones, M., "JSON Web Key (JWK)",
draft-ietf-jose-json-web-key (work in progress), draft-ietf-jose-json-web-key (work in progress), May 2013.
April 2013.
[JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web [JWS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web
Signature (JWS)", draft-ietf-jose-json-web-signature (work Signature (JWS)", draft-ietf-jose-json-web-signature (work
in progress), April 2013. in progress), May 2013.
[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 31, line 6 skipping to change at page 30, line 12
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., Roessler, T., and F. Hirsch, Eastlake, D., Reagle, J., Roessler, T., and F. Hirsch,
"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>.
11.2. Informative References 12.2. Informative References
[I-D.mcgrew-aead-aes-cbc-hmac-sha2] [I-D.mcgrew-aead-aes-cbc-hmac-sha2]
McGrew, D. and K. Paterson, "Authenticated Encryption with McGrew, D. and K. Paterson, "Authenticated Encryption with
AES-CBC and HMAC-SHA", AES-CBC and HMAC-SHA",
draft-mcgrew-aead-aes-cbc-hmac-sha2-01 (work in progress), draft-mcgrew-aead-aes-cbc-hmac-sha2-01 (work in progress),
October 2012. October 2012.
[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.
[JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token [JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token
(JWT)", draft-ietf-oauth-json-web-token (work in (JWT)", draft-ietf-oauth-json-web-token (work in
progress), April 2013. progress), May 2013.
[RFC3218] Rescorla, E., "Preventing the Million Message Attack on [RFC3218] Rescorla, E., "Preventing the Million Message Attack on
Cryptographic Message Syntax", RFC 3218, January 2002. Cryptographic Message Syntax", RFC 3218, January 2002.
[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.
skipping to change at page 34, line 31 skipping to change at page 33, 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:
[2, 151, 206, 44, 38, 131, 110, 171, 63, 37, 115, 216, 203, 98, 61, [56, 163, 154, 192, 58, 53, 222, 4, 105, 218, 136, 218, 29, 94, 203,
223, 187, 255, 198, 106, 243, 143, 226, 44, 179, 89, 134, 232, 208, 22, 150, 92, 129, 94, 211, 232, 53, 89, 41, 60, 138, 56, 196, 216,
7, 153, 226, 85, 136, 206, 163, 218, 93, 12, 30, 247, 236, 120, 135, 82, 98, 168, 76, 37, 73, 70, 7, 36, 8, 191, 100, 136, 196, 244, 220,
71, 87, 37, 54, 4, 138, 6, 86, 239, 104, 134, 249, 36, 90, 36, 106, 145, 158, 138, 155, 4, 117, 141, 230, 199, 247, 173, 45, 182, 214,
228, 50, 246, 141, 134, 83, 60, 15, 83, 1, 220, 42, 220, 85, 8, 87, 74, 177, 107, 211, 153, 11, 205, 196, 171, 226, 162, 128, 171, 182,
42, 7, 248, 247, 157, 127, 167, 165, 28, 133, 69, 139, 98, 134, 12, 13, 237, 239, 99, 193, 4, 91, 219, 121, 223, 107, 167, 61, 119, 228,
75, 41, 96, 203, 80, 1, 19, 12, 72, 23, 18, 238, 155, 37, 199, 167, 173, 156, 137, 134, 200, 80, 219, 74, 253, 56, 185, 91, 177, 34, 158,
229, 135, 80, 159, 135, 113, 129, 43, 43, 51, 181, 83, 4, 133, 159, 89, 154, 205, 96, 55, 18, 138, 43, 96, 218, 215, 128, 124, 75, 138,
230, 104, 89, 38, 224, 246, 21, 10, 194, 108, 190, 174, 130, 183, 243, 85, 25, 109, 117, 140, 26, 155, 249, 67, 167, 149, 231, 100, 6,
119, 224, 216, 34, 79, 58, 205, 23, 212, 49, 238, 197, 146, 168, 32, 41, 65, 214, 251, 232, 87, 72, 40, 182, 149, 154, 168, 31, 193, 126,
98, 42, 113, 183, 138, 225, 113, 14, 229, 173, 33, 229, 48, 46, 36, 215, 89, 28, 111, 219, 125, 182, 139, 235, 195, 197, 23, 234, 55, 58,
230, 202, 117, 243, 180, 116, 172, 31, 53, 36, 155, 166, 238, 108, 63, 180, 68, 202, 206, 149, 75, 205, 248, 176, 67, 39, 178, 60, 98,
22, 186, 81, 23, 5, 118, 21, 52, 216, 162, 161, 120, 204, 142, 58, 193, 32, 238, 122, 96, 158, 222, 57, 183, 111, 210, 55, 188, 215,
55, 223, 191, 132, 194, 51, 158, 81, 41, 126, 212, 87, 133, 39, 4, 206, 180, 166, 150, 166, 106, 250, 55, 229, 72, 40, 69, 214, 216,
38, 230, 125, 28, 111, 2, 240, 33, 193, 213, 100, 89, 252, 158, 60, 104, 23, 40, 135, 212, 28, 127, 41, 80, 175, 174, 168, 115, 171, 197,
62, 87, 170, 118, 17, 120, 163, 183, 193, 228, 157, 112, 22, 165, 23, 89, 116, 92, 103, 246, 83, 216, 182, 176, 84, 37, 147, 35, 45, 219,
6, 214, 237, 184, 98, 127, 3, 101, 222, 232, 1, 33, 174, 92, 194, 59] 172, 99, 226, 233, 73, 37, 124, 42, 72, 49, 242, 35, 127, 184, 134,
117, 114, 135, 206]
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:
ApfOLCaDbqs_JXPYy2I937v_xmrzj-Iss1mG6NAHmeJViM6j2l0MHvfseIdHVyU2 OKOawDo13gRp2ojaHV7LFpZcgV7T6DVZKTyKOMTYUmKoTCVJRgckCL9kiMT03JGe
BIoGVu9ohvkkWiRq5DL2jYZTPA9TAdwq3FUIVyoH-Pedf6elHIVFi2KGDEspYMtQ ipsEdY3mx_etLbbWSrFr05kLzcSr4qKAq7YN7e9jwQRb23nfa6c9d-StnImGyFDb
ARMMSBcS7pslx6flh1Cfh3GBKysztVMEhZ_maFkm4PYVCsJsvq6Ct3fg2CJPOs0X Sv04uVuxIp5Zms1gNxKKK2Da14B8S4rzVRltdYwam_lDp5XnZAYpQdb76FdIKLaV
1DHuxZKoIGIqcbeK4XEO5a0h5TAuJObKdfO0dKwfNSSbpu5sFrpRFwV2FTTYoqF4 mqgfwX7XWRxv2322i-vDxRfqNzo_tETKzpVLzfiwQyeyPGLBIO56YJ7eObdv0je8
zI46N9-_hMIznlEpftRXhScEJuZ9HG8C8CHB1WRZ_J48PleqdhF4o7fB5J1wFqUX 1860ppamavo35UgoRdbYaBcoh9QcfylQr66oc6vFWXRcZ_ZT2LawVCWTIy3brGPi
BtbtuGJ_A2Xe6AEhrlzCOw 6UklfCpIMfIjf7iGdXKHzg
A.1.6. Initialization Vector A.1.6. Initialization Vector
Generate a random 96 bit JWE Initialization Vector. In this example, Generate a random 96 bit JWE Initialization Vector. In this example,
the value is: the value is:
[227, 197, 117, 252, 2, 219, 233, 68, 180, 225, 77, 219] [227, 197, 117, 252, 2, 219, 233, 68, 180, 225, 77, 219]
Base64url encoding this value yields the Encoded JWE Initialization Base64url encoding this value yields the Encoded JWE Initialization
Vector value: Vector value:
48V1_ALb6US04U3b 48V1_ALb6US04U3b
A.1.7. Additional Authenticated Data Parameter A.1.7. Additional Authenticated Data
Concatenate the Encoded JWE Header value, a period ('.') character,
and the Encoded JWE Encrypted Key to create the Additional
Authenticated Data parameter. This result (with line breaks for
display purposes only) is:
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.
ApfOLCaDbqs_JXPYy2I937v_xmrzj-Iss1mG6NAHmeJViM6j2l0MHvfseIdHVyU2
BIoGVu9ohvkkWiRq5DL2jYZTPA9TAdwq3FUIVyoH-Pedf6elHIVFi2KGDEspYMtQ
ARMMSBcS7pslx6flh1Cfh3GBKysztVMEhZ_maFkm4PYVCsJsvq6Ct3fg2CJPOs0X
1DHuxZKoIGIqcbeK4XEO5a0h5TAuJObKdfO0dKwfNSSbpu5sFrpRFwV2FTTYoqF4
zI46N9-_hMIznlEpftRXhScEJuZ9HG8C8CHB1WRZ_J48PleqdhF4o7fB5J1wFqUX
BtbtuGJ_A2Xe6AEhrlzCOw
The representation of this value is: Let the Additional Authenticated Data encryption parameter be the
octets of the ASCII representation of the Encoded JWE Header value.
This AAD 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, 102, 81, 46, 54, 73, 107, 69, 121, 78, 84, 90, 72, 81, 48, 48, 105, 102, 81]
65, 112, 102, 79, 76, 67, 97, 68, 98, 113, 115, 95, 74, 88, 80, 89,
121, 50, 73, 57, 51, 55, 118, 95, 120, 109, 114, 122, 106, 45, 73,
115, 115, 49, 109, 71, 54, 78, 65, 72, 109, 101, 74, 86, 105, 77, 54,
106, 50, 108, 48, 77, 72, 118, 102, 115, 101, 73, 100, 72, 86, 121,
85, 50, 66, 73, 111, 71, 86, 117, 57, 111, 104, 118, 107, 107, 87,
105, 82, 113, 53, 68, 76, 50, 106, 89, 90, 84, 80, 65, 57, 84, 65,
100, 119, 113, 51, 70, 85, 73, 86, 121, 111, 72, 45, 80, 101, 100,
102, 54, 101, 108, 72, 73, 86, 70, 105, 50, 75, 71, 68, 69, 115, 112,
89, 77, 116, 81, 65, 82, 77, 77, 83, 66, 99, 83, 55, 112, 115, 108,
120, 54, 102, 108, 104, 49, 67, 102, 104, 51, 71, 66, 75, 121, 115,
122, 116, 86, 77, 69, 104, 90, 95, 109, 97, 70, 107, 109, 52, 80, 89,
86, 67, 115, 74, 115, 118, 113, 54, 67, 116, 51, 102, 103, 50, 67,
74, 80, 79, 115, 48, 88, 49, 68, 72, 117, 120, 90, 75, 111, 73, 71,
73, 113, 99, 98, 101, 75, 52, 88, 69, 79, 53, 97, 48, 104, 53, 84,
65, 117, 74, 79, 98, 75, 100, 102, 79, 48, 100, 75, 119, 102, 78, 83,
83, 98, 112, 117, 53, 115, 70, 114, 112, 82, 70, 119, 86, 50, 70, 84,
84, 89, 111, 113, 70, 52, 122, 73, 52, 54, 78, 57, 45, 95, 104, 77,
73, 122, 110, 108, 69, 112, 102, 116, 82, 88, 104, 83, 99, 69, 74,
117, 90, 57, 72, 71, 56, 67, 56, 67, 72, 66, 49, 87, 82, 90, 95, 74,
52, 56, 80, 108, 101, 113, 100, 104, 70, 52, 111, 55, 102, 66, 53,
74, 49, 119, 70, 113, 85, 88, 66, 116, 98, 116, 117, 71, 74, 95, 65,
50, 88, 101, 54, 65, 69, 104, 114, 108, 122, 67, 79, 119]
A.1.8. Plaintext Encryption A.1.8. Plaintext Encryption
Encrypt the Plaintext with AES GCM using the CEK as the encryption Encrypt the Plaintext with AES GCM using the CEK as the encryption
key, the JWE Initialization Vector, and the Additional Authenticated key, the JWE Initialization Vector, and the Additional Authenticated
Data value above, requesting a 128 bit Authentication Tag output. Data value above, requesting a 128 bit Authentication Tag output.
The resulting Ciphertext is: The resulting Ciphertext is:
[229, 236, 166, 241, 53, 191, 115, 196, 174, 43, 73, 109, 39, 122, [229, 236, 166, 241, 53, 191, 115, 196, 174, 43, 73, 109, 39, 122,
233, 96, 140, 206, 120, 52, 51, 237, 48, 11, 190, 219, 186, 80, 111, 233, 96, 140, 206, 120, 52, 51, 237, 48, 11, 190, 219, 186, 80, 111,
skipping to change at page 36, line 36 skipping to change at page 35, line 4
Encrypt the Plaintext with AES GCM using the CEK as the encryption Encrypt the Plaintext with AES GCM using the CEK as the encryption
key, the JWE Initialization Vector, and the Additional Authenticated key, the JWE Initialization Vector, and the Additional Authenticated
Data value above, requesting a 128 bit Authentication Tag output. Data value above, requesting a 128 bit Authentication Tag output.
The resulting Ciphertext is: The resulting Ciphertext is:
[229, 236, 166, 241, 53, 191, 115, 196, 174, 43, 73, 109, 39, 122, [229, 236, 166, 241, 53, 191, 115, 196, 174, 43, 73, 109, 39, 122,
233, 96, 140, 206, 120, 52, 51, 237, 48, 11, 190, 219, 186, 80, 111, 233, 96, 140, 206, 120, 52, 51, 237, 48, 11, 190, 219, 186, 80, 111,
104, 50, 142, 47, 167, 59, 61, 181, 127, 196, 21, 40, 82, 242, 32, 104, 50, 142, 47, 167, 59, 61, 181, 127, 196, 21, 40, 82, 242, 32,
123, 143, 168, 226, 73, 216, 176, 144, 138, 247, 106, 60, 16, 205, 123, 143, 168, 226, 73, 216, 176, 144, 138, 247, 106, 60, 16, 205,
160, 109, 64, 63, 192] 160, 109, 64, 63, 192]
The resulting Authentication Tag value is: The resulting Authentication Tag value is:
[130, 17, 32, 198, 120, 167, 144, 113, 0, 50, 158, 49, 102, 208, 118, [92, 80, 104, 49, 133, 25, 161, 215, 173, 101, 219, 211, 136, 91,
152] 210, 145]
A.1.9. Encoded JWE Ciphertext A.1.9. Encoded JWE Ciphertext
Base64url encode the Ciphertext to create the Encoded JWE Ciphertext. Base64url encode the Ciphertext to create the Encoded JWE Ciphertext.
This result (with line breaks for display purposes only) is: This result (with line breaks for display purposes only) is:
5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji 5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji
SdiwkIr3ajwQzaBtQD_A SdiwkIr3ajwQzaBtQD_A
A.1.10. Encoded JWE Authentication Tag A.1.10. Encoded JWE Authentication Tag
Base64url encode the Authentication Tag to create the Encoded JWE Base64url encode the Authentication Tag to create the Encoded JWE
Authentication Tag. This result is: Authentication Tag. This result is:
ghEgxninkHEAMp4xZtB2mA XFBoMYUZodetZdvTiFvSkQ
A.1.11. 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 Initialization Vector, the Encoded JWE Encrypted Key, the Encoded JWE Initialization Vector, the Encoded
JWE Ciphertext, and the Encoded JWE Authentication Tag in that order, JWE Ciphertext, and the Encoded JWE Authentication Tag in that order,
with the five strings being separated by four period ('.') with the five strings being separated by four period ('.')
characters. 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:
eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ. eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.
ApfOLCaDbqs_JXPYy2I937v_xmrzj-Iss1mG6NAHmeJViM6j2l0MHvfseIdHVyU2 OKOawDo13gRp2ojaHV7LFpZcgV7T6DVZKTyKOMTYUmKoTCVJRgckCL9kiMT03JGe
BIoGVu9ohvkkWiRq5DL2jYZTPA9TAdwq3FUIVyoH-Pedf6elHIVFi2KGDEspYMtQ ipsEdY3mx_etLbbWSrFr05kLzcSr4qKAq7YN7e9jwQRb23nfa6c9d-StnImGyFDb
ARMMSBcS7pslx6flh1Cfh3GBKysztVMEhZ_maFkm4PYVCsJsvq6Ct3fg2CJPOs0X Sv04uVuxIp5Zms1gNxKKK2Da14B8S4rzVRltdYwam_lDp5XnZAYpQdb76FdIKLaV
1DHuxZKoIGIqcbeK4XEO5a0h5TAuJObKdfO0dKwfNSSbpu5sFrpRFwV2FTTYoqF4 mqgfwX7XWRxv2322i-vDxRfqNzo_tETKzpVLzfiwQyeyPGLBIO56YJ7eObdv0je8
zI46N9-_hMIznlEpftRXhScEJuZ9HG8C8CHB1WRZ_J48PleqdhF4o7fB5J1wFqUX 1860ppamavo35UgoRdbYaBcoh9QcfylQr66oc6vFWXRcZ_ZT2LawVCWTIy3brGPi
BtbtuGJ_A2Xe6AEhrlzCOw. 6UklfCpIMfIjf7iGdXKHzg.
48V1_ALb6US04U3b. 48V1_ALb6US04U3b.
5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji 5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji
SdiwkIr3ajwQzaBtQD_A. SdiwkIr3ajwQzaBtQD_A.
ghEgxninkHEAMp4xZtB2mA XFBoMYUZodetZdvTiFvSkQ
A.1.12. Validation A.1.12. Validation
This example illustrates the process of creating a JWE with RSA OAEP This example illustrates the process of creating a JWE with RSA OAEP
and AES GCM. These results can be used to validate JWE decryption and AES GCM. These results can be used to validate JWE decryption
implementations for these algorithms. Note that since the RSAES OAEP implementations for these algorithms. Note that since the RSAES OAEP
computation includes random values, the encryption results above will computation includes random values, the encryption results above will
not be completely reproducible. However, since the AES GCM not be completely reproducible. However, since the AES GCM
computation is deterministic, the JWE Encrypted Ciphertext values computation is deterministic, the JWE Encrypted Ciphertext values
will be the same for all encryptions performed using these inputs. will be the same for all encryptions performed using these inputs.
skipping to change at page 40, line 31 skipping to change at page 38, 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:
[156, 150, 191, 184, 77, 131, 211, 9, 74, 207, 227, 156, 193, 38, [80, 104, 72, 58, 11, 130, 236, 139, 132, 189, 255, 205, 61, 86, 151,
202, 23, 56, 247, 211, 108, 88, 72, 143, 145, 44, 19, 58, 133, 181, 176, 99, 40, 44, 233, 176, 189, 205, 70, 202, 169, 72, 40, 226, 181,
70, 152, 254, 26, 198, 210, 80, 60, 15, 82, 210, 154, 55, 179, 115, 156, 223, 120, 156, 115, 232, 150, 209, 145, 133, 104, 112, 237, 156,
76, 146, 99, 166, 146, 70, 176, 157, 252, 15, 54, 58, 92, 210, 103, 116, 250, 65, 102, 212, 210, 103, 240, 177, 61, 93, 40, 71, 231, 223,
55, 207, 191, 92, 185, 5, 164, 64, 241, 80, 163, 233, 131, 198, 106, 226, 240, 157, 15, 31, 150, 89, 200, 215, 198, 203, 108, 70, 117, 66,
32, 207, 199, 113, 5, 200, 94, 105, 53, 32, 221, 155, 233, 108, 96, 212, 238, 193, 205, 23, 161, 169, 218, 243, 203, 128, 214, 127, 253,
151, 197, 152, 195, 96, 67, 81, 90, 38, 121, 51, 208, 98, 47, 45, 61, 215, 139, 43, 17, 135, 103, 179, 220, 28, 2, 212, 206, 131, 158, 128,
4, 129, 121, 152, 122, 124, 229, 2, 250, 92, 64, 245, 36, 70, 76, 58, 66, 62, 240, 78, 186, 141, 125, 132, 227, 60, 137, 43, 31, 152, 199,
31, 181, 185, 61, 101, 168, 240, 220, 12, 62, 253, 169, 107, 107, 9, 54, 72, 34, 212, 115, 11, 152, 101, 70, 42, 219, 233, 142, 66, 151,
241, 9, 152, 217, 159, 179, 30, 95, 112, 29, 143, 124, 7, 21, 181, 250, 126, 146, 141, 216, 190, 73, 50, 177, 146, 5, 52, 247, 28, 197,
13, 45, 253, 137, 142, 95, 30, 127, 26, 237, 34, 183, 89, 200, 44, 21, 59, 170, 247, 181, 89, 131, 241, 169, 182, 246, 99, 15, 36, 102,
165, 203, 71, 102, 39, 127, 217, 159, 46, 17, 28, 11, 146, 222, 110, 166, 182, 172, 197, 136, 230, 120, 60, 58, 219, 243, 149, 94, 222,
149, 178, 16, 117, 186, 91, 52, 56, 136, 127, 82, 33, 194, 46, 164, 150, 154, 194, 110, 227, 225, 112, 39, 89, 233, 112, 207, 211, 241,
245, 117, 136, 160, 179, 152, 151, 15, 172, 48, 73, 228, 87, 63, 40, 124, 174, 69, 221, 179, 107, 196, 225, 127, 167, 112, 226, 12, 242,
192, 92, 92, 24, 167, 105, 47, 255, 193, 251, 77, 203, 6, 134, 129, 16, 24, 28, 120, 182, 244, 213, 244, 153, 194, 162, 69, 160, 244,
248, 191, 53, 43, 49, 219, 130, 241, 180, 174, 159, 34, 71, 163, 70, 248, 63, 165, 141, 4, 207, 249, 193, 79, 131, 0, 169, 233, 127, 167,
83, 1, 152, 39, 241, 191, 68, 224, 240, 43, 113, 165, 68, 98, 130] 101, 151, 125, 56, 112, 111, 248, 29, 232, 90, 29, 147, 110, 169,
146, 114, 165, 204, 71, 136, 41, 252]
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:
nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMkmOm UGhIOguC7IuEvf_NPVaXsGMoLOmwvc1GyqlIKOK1nN94nHPoltGRhWhw7Zx0-kFm
kkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZjDYENR 1NJn8LE9XShH59_i8J0PH5ZZyNfGy2xGdULU7sHNF6Gp2vPLgNZ__deLKxGHZ7Pc
WiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfEJmNmfsx5f HALUzoOegEI-8E66jX2E4zyJKx-YxzZIItRzC5hlRirb6Y5Cl_p-ko3YvkkysZIF
cB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWyEHW6WzQ4iH9S NPccxRU7qve1WYPxqbb2Yw8kZqa2rMWI5ng8OtvzlV7elprCbuPhcCdZ6XDP0_F8
IcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_NSsx24LxtK6fIkej rkXds2vE4X-ncOIM8hAYHHi29NX0mcKiRaD0-D-ljQTP-cFPgwCp6X-nZZd9OHBv
RlMBmCfxv0Tg8CtxpURigg -B3oWh2TbqmScqXMR4gp_A
A.2.6. Initialization Vector A.2.6. Initialization Vector
Generate a random 128 bit JWE Initialization Vector. In this Generate a random 128 bit JWE Initialization Vector. In this
example, the value is: example, the value is:
[3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111, 116, 104, [3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111, 116, 104,
101] 101]
Base64url encoding this value yields the Encoded JWE Initialization Base64url encoding this value yields the Encoded JWE Initialization
Vector value: Vector value:
AxY8DCtDaGlsbGljb3RoZQ AxY8DCtDaGlsbGljb3RoZQ
A.2.7. Additional Authenticated Data Parameter A.2.7. Additional Authenticated Data
Concatenate the Encoded JWE Header value, a period ('.') character,
and the Encoded JWE Encrypted Key to create the Additional
Authenticated Data parameter. This result (with line breaks for
display purposes only) is:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.
nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMkmOm
kkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZjDYENR
WiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfEJmNmfsx5f
cB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWyEHW6WzQ4iH9S
IcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_NSsx24LxtK6fIkej
RlMBmCfxv0Tg8CtxpURigg
The representation of this value is: Let the Additional Authenticated Data encryption parameter be the
octets of the ASCII representation of the Encoded JWE Header value.
This AAD 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, 76, 85, 104, 84, 77, 106, 85, 74, 66, 77, 84, 73, 52, 81, 48, 74, 68, 76, 85, 104, 84, 77, 106, 85,
50, 73, 110, 48, 46, 110, 74, 97, 95, 117, 69, 50, 68, 48, 119, 108, 50, 73, 110, 48]
75, 122, 45, 79, 99, 119, 83, 98, 75, 70, 122, 106, 51, 48, 50, 120,
89, 83, 73, 45, 82, 76, 66, 77, 54, 104, 98, 86, 71, 109, 80, 52, 97,
120, 116, 74, 81, 80, 65, 57, 83, 48, 112, 111, 51, 115, 51, 78, 77,
107, 109, 79, 109, 107, 107, 97, 119, 110, 102, 119, 80, 78, 106,
112, 99, 48, 109, 99, 51, 122, 55, 57, 99, 117, 81, 87, 107, 81, 80,
70, 81, 111, 45, 109, 68, 120, 109, 111, 103, 122, 56, 100, 120, 66,
99, 104, 101, 97, 84, 85, 103, 51, 90, 118, 112, 98, 71, 67, 88, 120,
90, 106, 68, 89, 69, 78, 82, 87, 105, 90, 53, 77, 57, 66, 105, 76,
121, 48, 57, 66, 73, 70, 53, 109, 72, 112, 56, 53, 81, 76, 54, 88,
69, 68, 49, 74, 69, 90, 77, 79, 104, 45, 49, 117, 84, 49, 108, 113,
80, 68, 99, 68, 68, 55, 57, 113, 87, 116, 114, 67, 102, 69, 74, 109,
78, 109, 102, 115, 120, 53, 102, 99, 66, 50, 80, 102, 65, 99, 86,
116, 81, 48, 116, 95, 89, 109, 79, 88, 120, 53, 95, 71, 117, 48, 105,
116, 49, 110, 73, 76, 75, 88, 76, 82, 50, 89, 110, 102, 57, 109, 102,
76, 104, 69, 99, 67, 53, 76, 101, 98, 112, 87, 121, 69, 72, 87, 54,
87, 122, 81, 52, 105, 72, 57, 83, 73, 99, 73, 117, 112, 80, 86, 49,
105, 75, 67, 122, 109, 74, 99, 80, 114, 68, 66, 74, 53, 70, 99, 95,
75, 77, 66, 99, 88, 66, 105, 110, 97, 83, 95, 95, 119, 102, 116, 78,
121, 119, 97, 71, 103, 102, 105, 95, 78, 83, 115, 120, 50, 52, 76,
120, 116, 75, 54, 102, 73, 107, 101, 106, 82, 108, 77, 66, 109, 67,
102, 120, 118, 48, 84, 103, 56, 67, 116, 120, 112, 85, 82, 105, 103,
103]
A.2.8. Plaintext Encryption A.2.8. Plaintext Encryption
Encrypt the Plaintext with AES_128_CBC_HMAC_SHA_256 using the CEK as Encrypt the Plaintext with AES_128_CBC_HMAC_SHA_256 using the CEK as
the encryption key, the JWE Initialization Vector, and the Additional the encryption key, the JWE Initialization Vector, and the Additional
Authenticated Data value above. The steps for doing this using the Authenticated Data value above. The steps for doing this using the
values from Appendix A.3 are detailed in Appendix B. The resulting values from Appendix A.3 are detailed in Appendix B. The resulting
Ciphertext is: Ciphertext is:
[40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6, [40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6,
skipping to change at page 42, line 37 skipping to change at page 40, line 4
Encrypt the Plaintext with AES_128_CBC_HMAC_SHA_256 using the CEK as Encrypt the Plaintext with AES_128_CBC_HMAC_SHA_256 using the CEK as
the encryption key, the JWE Initialization Vector, and the Additional the encryption key, the JWE Initialization Vector, and the Additional
Authenticated Data value above. The steps for doing this using the Authenticated Data value above. The steps for doing this using the
values from Appendix A.3 are detailed in Appendix B. The resulting values from Appendix A.3 are detailed in Appendix B. The resulting
Ciphertext is: Ciphertext is:
[40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6, [40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6,
75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143, 75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143,
112, 56, 102] 112, 56, 102]
The resulting Authentication Tag value is: The resulting Authentication Tag value is:
[125, 141, 148, 252, 124, 121, 85, 199, 215, 154, 42, 68, 149, 209, [246, 17, 244, 190, 4, 95, 98, 3, 231, 0, 115, 157, 242, 203, 100,
225, 48] 191]
A.2.9. Encoded JWE Ciphertext A.2.9. Encoded JWE Ciphertext
Base64url encode the Ciphertext to create the Encoded JWE Ciphertext. Base64url encode the Ciphertext to create the Encoded JWE Ciphertext.
This result is: This result is:
KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY
A.2.10. Encoded JWE Authentication Tag A.2.10. Encoded JWE Authentication Tag
Base64url encode the Authentication Tag to create the Encoded JWE Base64url encode the Authentication Tag to create the Encoded JWE
Authentication Tag. This result is: Authentication Tag. This result is:
fY2U_Hx5VcfXmipEldHhMA 9hH0vgRfYgPnAHOd8stkvw
A.2.11. Complete Representation A.2.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 Initialization Vector, the Encoded JWE Encrypted Key, the Encoded JWE Initialization Vector, the Encoded
JWE Ciphertext, and the Encoded JWE Authentication Tag in that order, JWE Ciphertext, and the Encoded JWE Authentication Tag in that order,
with the five strings being separated by four period ('.') with the five strings being separated by four period ('.')
characters. 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:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.
nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMkmOm UGhIOguC7IuEvf_NPVaXsGMoLOmwvc1GyqlIKOK1nN94nHPoltGRhWhw7Zx0-kFm
kkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZjDYENR 1NJn8LE9XShH59_i8J0PH5ZZyNfGy2xGdULU7sHNF6Gp2vPLgNZ__deLKxGHZ7Pc
WiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfEJmNmfsx5f HALUzoOegEI-8E66jX2E4zyJKx-YxzZIItRzC5hlRirb6Y5Cl_p-ko3YvkkysZIF
cB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWyEHW6WzQ4iH9S NPccxRU7qve1WYPxqbb2Yw8kZqa2rMWI5ng8OtvzlV7elprCbuPhcCdZ6XDP0_F8
IcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_NSsx24LxtK6fIkej rkXds2vE4X-ncOIM8hAYHHi29NX0mcKiRaD0-D-ljQTP-cFPgwCp6X-nZZd9OHBv
RlMBmCfxv0Tg8CtxpURigg. -B3oWh2TbqmScqXMR4gp_A.
AxY8DCtDaGlsbGljb3RoZQ. AxY8DCtDaGlsbGljb3RoZQ.
KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY. KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY.
fY2U_Hx5VcfXmipEldHhMA 9hH0vgRfYgPnAHOd8stkvw
A.2.12. Validation A.2.12. Validation
This example illustrates the process of creating a JWE with RSAES- This example illustrates the process of creating a JWE with RSAES-
PKCS1-V1_5 and AES_CBC_HMAC_SHA2. These results can be used to PKCS1-V1_5 and AES_CBC_HMAC_SHA2. These results can be used to
validate JWE decryption implementations for these algorithms. Note validate JWE decryption implementations for these algorithms. Note
that since the RSAES-PKCS1-V1_5 computation includes random values, that since the RSAES-PKCS1-V1_5 computation includes random values,
the encryption results above will not be completely reproducible. the encryption results above will not be completely reproducible.
However, since the AES CBC computation is deterministic, the JWE However, since the AES CBC computation is deterministic, the JWE
Encrypted Ciphertext values will be the same for all encryptions Encrypted Ciphertext values will be the same for all encryptions
skipping to change at page 45, line 25 skipping to change at page 42, line 35
example, the value is: example, the value is:
[3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111, 116, 104, [3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111, 116, 104,
101] 101]
Base64url encoding this value yields the Encoded JWE Initialization Base64url encoding this value yields the Encoded JWE Initialization
Vector value: Vector value:
AxY8DCtDaGlsbGljb3RoZQ AxY8DCtDaGlsbGljb3RoZQ
A.3.7. Additional Authenticated Data Parameter A.3.7. Additional Authenticated Data
Concatenate the Encoded JWE Header value, a period ('.') character,
and the Encoded JWE Encrypted Key to create the Additional
Authenticated Data parameter. This result (with line breaks for
display purposes only) is:
eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.
6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ
The representation of this value is: Let the Additional Authenticated Data encryption parameter be the
octets of the ASCII representation of the Encoded JWE Header value.
This AAD value is:
[101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 66, 77, 84, 73, 52, [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, 83, 49, 99, 105, 76, 67, 74, 108, 98, 109, 77, 105, 79, 105, 74, 66,
77, 84, 73, 52, 81, 48, 74, 68, 76, 85, 104, 84, 77, 106, 85, 50, 73, 77, 84, 73, 52, 81, 48, 74, 68, 76, 85, 104, 84, 77, 106, 85, 50, 73,
110, 48, 46, 54, 75, 66, 55, 48, 55, 100, 77, 57, 89, 84, 73, 103, 110, 48]
72, 116, 76, 118, 116, 103, 87, 81, 56, 109, 75, 119, 98, 111, 74,
87, 51, 111, 102, 57, 108, 111, 99, 105, 122, 107, 68, 84, 72, 122,
66, 67, 50, 73, 108, 114, 84, 49, 111, 79, 81]
A.3.8. Plaintext Encryption A.3.8. Plaintext Encryption
Encrypt the Plaintext with AES_128_CBC_HMAC_SHA_256 using the CEK as Encrypt the Plaintext with AES_128_CBC_HMAC_SHA_256 using the CEK as
the encryption key, the JWE Initialization Vector, and the Additional the encryption key, the JWE Initialization Vector, and the Additional
Authenticated Data value above. The steps for doing this using the Authenticated Data value above. The steps for doing this using the
values from this example are detailed in Appendix B. The resulting values from this example are detailed in Appendix B. The resulting
Ciphertext is: Ciphertext is:
[40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6, [40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6,
75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143, 75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143,
112, 56, 102] 112, 56, 102]
The resulting Authentication Tag value is: The resulting Authentication Tag value is:
[8, 65, 248, 101, 45, 185, 28, 218, 232, 112, 83, 79, 84, 221, 18, [83, 73, 191, 98, 104, 205, 211, 128, 201, 189, 199, 133, 32, 38,
172] 194, 85]
A.3.9. Encoded JWE Ciphertext A.3.9. Encoded JWE Ciphertext
Base64url encode the Ciphertext to create the Encoded JWE Ciphertext. Base64url encode the Ciphertext to create the Encoded JWE Ciphertext.
This result is: This result is:
KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY
A.3.10. Encoded JWE Authentication Tag A.3.10. Encoded JWE Authentication Tag
Base64url encode the Authentication Tag to create the Encoded JWE Base64url encode the Authentication Tag to create the Encoded JWE
Authentication Tag. This result is: Authentication Tag. This result is:
CEH4ZS25HNrocFNPVN0SrA U0m_YmjN04DJvceFICbCVQ
A.3.11. Complete Representation A.3.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 Initialization Vector, the Encoded JWE Encrypted Key, the Encoded JWE Initialization Vector, the Encoded
JWE Ciphertext, and the Encoded JWE Authentication Tag in that order, JWE Ciphertext, and the Encoded JWE Authentication Tag in that order,
with the five strings being separated by four period ('.') with the five strings being separated by four period ('.')
characters. 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:
eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0.
6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ. 6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ.
AxY8DCtDaGlsbGljb3RoZQ. AxY8DCtDaGlsbGljb3RoZQ.
KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY. KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY.
CEH4ZS25HNrocFNPVN0SrA U0m_YmjN04DJvceFICbCVQ
A.3.12. Validation A.3.12. Validation
This example illustrates the process of creating a JWE with symmetric This example illustrates the process of creating a JWE with symmetric
key wrap and AES_CBC_HMAC_SHA2. These results can be used to key wrap and AES_CBC_HMAC_SHA2. These results can be used to
validate JWE decryption implementations for these algorithms. Also, validate JWE decryption implementations for these algorithms. Also,
since both the AES Key Wrap and AES GCM computations are since both the AES Key Wrap and AES GCM computations are
deterministic, the resulting JWE value will be the same for all deterministic, the resulting JWE value will be the same for all
encryptions performed using these inputs. Since the computation is encryptions performed using these inputs. Since the computation is
reproducible, these results can also be used to validate JWE reproducible, these results can also be used to validate JWE
encryption implementations for these algorithms. encryption implementations for these algorithms.
A.4. Example JWE Using JWE JSON Serialization
This section contains an example using the JWE JSON Serialization.
This example demonstrates the capability for encrypting the same
plaintext to multiple recipients.
Two recipients are present in this example. The algorithm and key
used for the first recipient are the same as that used in
Appendix A.2. The algorithm and key used for the second recipient
are the same as that used in Appendix A.3. The resulting JWE
Encrypted Key values are therefore the same; those computations are
not repeated here.
The Plaintext, the Content Encryption Key (CEK), Initialization
Vector, and JWE Protected Header are shared by all recipients (which
must be the case, since the Ciphertext and Authentication Tag are
also shared).
A.4.1. JWE Per-Recipient Unprotected Headers
The first recipient uses the RSAES-PKCS1-V1_5 algorithm to encrypt
the Content Encryption Key (CEK). The second uses RSAES OAEP to
encrypt the CEK. Key ID values are supplied for both keys. The two
per-recipient header values used to represent these algorithms and
Key IDs are:
{"alg":"RSA1_5","kid":"2011-04-29"}
and:
{"alg":"A128KW","kid":"7"}
A.4.2. JWE Protected Header
The Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256
algorithm to produce the common JWE Ciphertext and JWE Authentication
Tag values. The JWE Protected Header value representing this is:
{"enc":"A128CBC-HS256"}
Base64url encoding the octets of the UTF-8 representation of the JWE
Protected Header yields this Encoded JWE Protected Header value:
eyJlbmMiOiJBMTI4Q0JDLUhTMjU2In0
A.4.3. JWE Unprotected Header
This JWE uses the "jku" header parameter to reference a JWK Set. This
is represented in the following JWE Unprotected Header value as:
{"jku":"https://server.example.com/keys.jwks"}
A.4.4. Complete JWE Header Values
Combining the per-recipient, protected, and unprotected header values
supplied, the JWE Header values used for the first and second
recipient respectively are:
{"alg":"RSA1_5",
"kid":"2011-04-29",
"enc":"A128CBC-HS256",
"jku":"https://server.example.com/keys.jwks"}
and:
{"alg":"A128KW",
"kid":"7",
"enc":"A128CBC-HS256",
"jku":"https://server.example.com/keys.jwks"}
A.4.5. Additional Authenticated Data
Let the Additional Authenticated Data encryption parameter be the
octets of the ASCII representation of the Encoded JWE Protected
Header value. This AAD value is:
[101, 121, 74, 108, 98, 109, 77, 105, 79, 105, 74, 66, 77, 84, 73,
52, 81, 48, 74, 68, 76, 85, 104, 84, 77, 106, 85, 50, 73, 110, 48]
A.4.6. Plaintext Encryption
Encrypt the Plaintext with AES_128_CBC_HMAC_SHA_256 using the CEK as
the encryption key, the JWE Initialization Vector, and the Additional
Authenticated Data value above. The steps for doing this using the
values from Appendix A.3 are detailed in Appendix B. The resulting
Ciphertext is:
[40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6,
75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143,
112, 56, 102]
The resulting Authentication Tag value is:
[51, 63, 149, 60, 252, 148, 225, 25, 92, 185, 139, 245, 35, 2, 47,
207]
A.4.7. Encoded JWE Ciphertext
Base64url encode the Ciphertext to create the Encoded JWE Ciphertext.
This result is:
KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY
A.4.8. Encoded JWE Authentication Tag
Base64url encode the Authentication Tag to create the Encoded JWE
Authentication Tag. This result is:
Mz-VPPyU4RlcuYv1IwIvzw
A.4.9. Complete JWE JSON Serialization Representation
The complete JSON Web Encryption JSON Serialization for these values
is as follows (with line breaks for display purposes only):
{"protected":
"eyJlbmMiOiJBMTI4Q0JDLUhTMjU2In0",
"unprotected":
{"jku":"https://server.example.com/keys.jwks"},
"recipients":[
{"header":
{"alg":"RSA1_5"},
"encrypted_key":
"UGhIOguC7IuEvf_NPVaXsGMoLOmwvc1GyqlIKOK1nN94nHPoltGRhWhw7Zx0-
kFm1NJn8LE9XShH59_i8J0PH5ZZyNfGy2xGdULU7sHNF6Gp2vPLgNZ__deLKx
GHZ7PcHALUzoOegEI-8E66jX2E4zyJKx-YxzZIItRzC5hlRirb6Y5Cl_p-ko3
YvkkysZIFNPccxRU7qve1WYPxqbb2Yw8kZqa2rMWI5ng8OtvzlV7elprCbuPh
cCdZ6XDP0_F8rkXds2vE4X-ncOIM8hAYHHi29NX0mcKiRaD0-D-ljQTP-cFPg
wCp6X-nZZd9OHBv-B3oWh2TbqmScqXMR4gp_A"},
{"header":
{"alg":"A128KW"},
"encrypted_key":
"6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ"}],
"iv":
"AxY8DCtDaGlsbGljb3RoZQ",
"ciphertext":
"KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY",
"tag":
"Mz-VPPyU4RlcuYv1IwIvzw"
}
Appendix B. Example AES_128_CBC_HMAC_SHA_256 Computation Appendix B. Example AES_128_CBC_HMAC_SHA_256 Computation
This example shows the steps in the AES_128_CBC_HMAC_SHA_256 This example shows the steps in the AES_128_CBC_HMAC_SHA_256
authenticated encryption computation using the values from the authenticated encryption computation using the values from the
example in Appendix A.3. As described where this algorithm is example in Appendix A.3. As described where this algorithm is
defined in Sections 4.8 and 4.8.3 of JWA, the AES_CBC_HMAC_SHA2 defined in Sections 4.8 and 4.8.3 of JWA, the AES_CBC_HMAC_SHA2
family of algorithms are implemented using Advanced Encryption family of algorithms are implemented using Advanced Encryption
Standard (AES) in Cipher Block Chaining (CBC) mode with PKCS #5 Standard (AES) in Cipher Block Chaining (CBC) mode with PKCS #5
padding to perform the encryption and an HMAC SHA-2 function to padding to perform the encryption and an HMAC SHA-2 function to
perform the integrity calculation - in this case, HMAC SHA-256. perform the integrity calculation - in this case, HMAC SHA-256.
skipping to change at page 48, line 4 skipping to change at page 47, line 50
identifiers "AES_128_CBC_HMAC_SHA_256" and "A128CBC-HS256". identifiers "AES_128_CBC_HMAC_SHA_256" and "A128CBC-HS256".
B.2. Encrypt Plaintext to Create Ciphertext B.2. Encrypt Plaintext to Create Ciphertext
Encrypt the Plaintext with AES in Cipher Block Chaining (CBC) mode Encrypt the Plaintext with AES in Cipher Block Chaining (CBC) mode
using PKCS #5 padding using the ENC_KEY above. The Plaintext in this using PKCS #5 padding using the ENC_KEY above. The Plaintext in this
example is: example 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]
The encryption result is as follows, which is the Ciphertext output: The encryption result is as follows, which is the Ciphertext output:
[40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6, [40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6,
75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143, 75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143,
112, 56, 102] 112, 56, 102]
B.3. Create 64 Bit Big Endian Representation of AAD Length B.3. 64 Bit Big Endian Representation of AAD Length
The Additional Authenticated Data (AAD) in this example is: The Additional Authenticated Data (AAD) in this example is:
[101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 66, 77, 84, 73, 52, [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, 83, 49, 99, 105, 76, 67, 74, 108, 98, 109, 77, 105, 79, 105, 74, 66,
77, 84, 73, 52, 81, 48, 74, 68, 76, 85, 104, 84, 77, 106, 85, 50, 73, 77, 84, 73, 52, 81, 48, 74, 68, 76, 85, 104, 84, 77, 106, 85, 50, 73,
110, 48, 46, 54, 75, 66, 55, 48, 55, 100, 77, 57, 89, 84, 73, 103, 110, 48]
72, 116, 76, 118, 116, 103, 87, 81, 56, 109, 75, 119, 98, 111, 74,
87, 51, 111, 102, 57, 108, 111, 99, 105, 122, 107, 68, 84, 72, 122,
66, 67, 50, 73, 108, 114, 84, 49, 111, 79, 81]
This AAD is 106 bytes long, which is 848 bits long. The octet string This AAD is 51 bytes long, which is 408 bits long. The octet string
AL, which is the number of bits in AAD expressed as a big endian 64 AL, which is the number of bits in AAD expressed as a big endian 64
bit unsigned integer is: bit unsigned integer is:
[0, 0, 0, 0, 0, 0, 3, 80] [0, 0, 0, 0, 0, 0, 1, 152]
B.4. Initialization Vector Value B.4. Initialization Vector Value
The Initialization Vector value used in this example is: The Initialization Vector value used in this example is:
[3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111, 116, 104, [3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111, 116, 104,
101] 101]
B.5. Create Input to HMAC Computation B.5. Create Input to HMAC Computation
Concatenate the AAD, the Initialization Vector, the Ciphertext, and Concatenate the AAD, the Initialization Vector, the Ciphertext, and
the AL value. The result of this concatenation is: the AL value. The result of this concatenation is:
[101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 66, 77, 84, 73, 52, [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, 83, 49, 99, 105, 76, 67, 74, 108, 98, 109, 77, 105, 79, 105, 74, 66,
77, 84, 73, 52, 81, 48, 74, 68, 76, 85, 104, 84, 77, 106, 85, 50, 73, 77, 84, 73, 52, 81, 48, 74, 68, 76, 85, 104, 84, 77, 106, 85, 50, 73,
110, 48, 46, 54, 75, 66, 55, 48, 55, 100, 77, 57, 89, 84, 73, 103, 110, 48, 3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111,
72, 116, 76, 118, 116, 103, 87, 81, 56, 109, 75, 119, 98, 111, 74, 116, 104, 101, 40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24,
87, 51, 111, 102, 57, 108, 111, 99, 105, 122, 107, 68, 84, 72, 122, 152, 230, 6, 75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215,
66, 67, 50, 73, 108, 114, 84, 49, 111, 79, 81, 3, 22, 60, 12, 43, 67, 104, 143, 112, 56, 102, 0, 0, 0, 0, 0, 0, 1, 152]
104, 105, 108, 108, 105, 99, 111, 116, 104, 101, 40, 57, 83, 181,
119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6, 75, 129, 223, 127,
19, 210, 82, 183, 230, 168, 33, 215, 104, 143, 112, 56, 102, 0, 0, 0,
0, 0, 0, 3, 80]
B.6. Compute HMAC Value B.6. Compute HMAC Value
Compute the HMAC SHA-256 of the concatenated value above. This Compute the HMAC SHA-256 of the concatenated value above. This
result M is: result M is:
[8, 65, 248, 101, 45, 185, 28, 218, 232, 112, 83, 79, 84, 221, 18, [83, 73, 191, 98, 104, 205, 211, 128, 201, 189, 199, 133, 32, 38,
172, 50, 145, 207, 8, 14, 74, 44, 220, 100, 117, 32, 57, 239, 149, 194, 85, 9, 84, 229, 201, 219, 135, 44, 252, 145, 102, 179, 140, 105,
173, 226] 86, 229, 116]
B.7. Truncate HMAC Value to Create Authentication Tag B.7. Truncate HMAC Value to Create Authentication Tag
Use the first half (128 bits) of the HMAC output M as the Use the first half (128 bits) of the HMAC output M as the
Authentication Tag output T. This truncated value is: Authentication Tag output T. This truncated value is:
[8, 65, 248, 101, 45, 185, 28, 218, 232, 112, 83, 79, 84, 221, 18, [83, 73, 191, 98, 104, 205, 211, 128, 201, 189, 199, 133, 32, 38,
172] 194, 85]
Appendix C. Possible Compact Serialization for Multiple Recipients
The JWE encryption process in Section 5.1, and in particular in steps
15 and 16, hint at a possible compact serialization when there are
multiple recipients. This possible compact serialization
concatenates instances of the per-recipient fields, separating them
with tilde ('~') characters, which are URL-safe.
The concatenation of the Encoded JWE Header values goes before the
first period ('.') character in the compact serialization. The
concatenation of the corresponding Encoded JWE Encoded Key values
goes between the first and second period ('.') characters in the
compact serialization.
A complete compact serialization of the multi-recipient JWE in
Section 7.1 (with line breaks for display purposes only) would be:
eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0
~
eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0
.
nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMk
mOmkkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZ
jDYENRWiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfE
JmNmfsx5fcB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWy
EHW6WzQ4iH9SIcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_N
Ssx24LxtK6fIkejRlMBmCfxv0Tg8CtxpURigg
~
6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ
.
AxY8DCtDaGlsbGljb3RoZQ
.
KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY
.
LlhRZFfphc2f5X3nTTJP6g
Note that the octets of the UTF-8 representation of the first two
parts of this serialization, including the period ('.') character
separating them, are used as the AAD value in step 17 of the JWE
encryption process in Section 5.1.
This representation is suggested for those who may desire or require
a compact, URL-safe serialization of JWEs with multiple recipients.
It is a suggestion to implementers for whom this functionality would
be valuable, and not a normative part of this specification.
Appendix D. Acknowledgements Appendix C. 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
skipping to change at page 51, line 11 skipping to change at page 49, line 37
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.
This specification is the work of the JOSE Working Group, which This specification is the work of the JOSE Working Group, which
includes dozens of active and dedicated participants. In particular, includes dozens of active and dedicated participants. In particular,
the following individuals contributed ideas, feedback, and wording the following individuals contributed ideas, feedback, and wording
that influenced this specification: that influenced this specification:
Richard Barnes, John Bradley, Brian Campbell, Breno de Medeiros, Dick Richard Barnes, John Bradley, Brian Campbell, Breno de Medeiros, Dick
Hardt, Jeff Hodges, Edmund Jay, James Manger, Tony Nadalin, Axel Hardt, Jeff Hodges, Edmund Jay, James Manger, Matt Miller, Tony
Nennker, Emmanuel Raviart, Nat Sakimura, Jim Schaad, Hannes Nadalin, Axel Nennker, Emmanuel Raviart, Nat Sakimura, Jim Schaad,
Tschofenig, and Sean Turner. Hannes Tschofenig, and Sean Turner.
Jim Schaad and Karen O'Donoghue chaired the JOSE working group and Jim Schaad and Karen O'Donoghue chaired the JOSE working group and
Sean Turner and Stephen Farrell served as Security area directors Sean Turner and Stephen Farrell served as Security area directors
during the creation of this specification. during the creation of this specification.
Appendix E. Document History 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 ]]
-11
o Added Key Identification section.
o Removed the Encrypted Key value from the AAD computation since it
is already effectively integrity protected by the encryption
process. The AAD value now only contains the representation of
the JWE Encrypted Header.
o For the JWE JSON Serialization, enable header parameter values to
be specified in any of three parameters: the "protected" member
that is integrity protected and shared among all recipients, the
"unprotected" member that is not integrity protected and shared
among all recipients, and the "header" member that is not
integrity protected and specific to a particular recipient. (This
does not affect the JWE Compact Serialization, in which all header
parameter values are in a single integrity protected JWE Header
value.)
o Shortened the names "authentication_tag" to "tag" and
"initialization_vector" to "iv" in the JWE JSON Serialization,
addressing issue #20.
o Removed "apv" (agreement PartyVInfo) since it is no longer used.
o Removed suggested compact serialization for multiple recipients.
o Changed the MIME type name "application/jwe-js" to
"application/jwe+json", addressing issue #22.
o Tightened the description of the "crit" (critical) header
parameter.
-10 -10
o Changed the JWE processing rules for multiple recipients so that a o Changed the JWE processing rules for multiple recipients so that a
single AAD value contains the header parameters and encrypted key single AAD value contains the header parameters and encrypted key
values for all the recipients, enabling AES GCM to be safely used values for all the recipients, enabling AES GCM to be safely used
for multiple recipients. for multiple recipients.
o Added an appendix suggesting a possible compact serialization for o Added an appendix suggesting a possible compact serialization for
JWEs with multiple recipients. JWEs with multiple recipients.
 End of changes. 167 change blocks. 
690 lines changed or deleted 696 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/