| < draft-ietf-jose-json-web-encryption-08.txt | draft-ietf-jose-json-web-encryption-09.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: June 30, 2013 RTFM | Expires: October 25, 2013 RTFM | |||
| J. Hildebrand | J. Hildebrand | |||
| Cisco | Cisco | |||
| December 27, 2012 | April 23, 2013 | |||
| JSON Web Encryption (JWE) | JSON Web Encryption (JWE) | |||
| draft-ietf-jose-json-web-encryption-08 | draft-ietf-jose-json-web-encryption-09 | |||
| Abstract | Abstract | |||
| JSON Web Encryption (JWE) is a means of representing encrypted | JSON Web Encryption (JWE) is a means of representing encrypted | |||
| content using JavaScript Object Notation (JSON) data structures. | content using JavaScript Object Notation (JSON) data structures. | |||
| Cryptographic algorithms and identifiers for use with this | Cryptographic algorithms and identifiers for use with this | |||
| specification are described in the separate JSON Web Algorithms (JWA) | specification are described in the separate JSON Web Algorithms (JWA) | |||
| specification. Related digital signature and MAC capabilities are | specification. Related digital signature and MAC capabilities are | |||
| described in the separate JSON Web Signature (JWS) specification. | described in the separate JSON Web Signature (JWS) specification. | |||
| skipping to change at page 1, line 38 ¶ | skipping to change at page 1, line 38 ¶ | |||
| Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
| Task Force (IETF). Note that other groups may also distribute | Task Force (IETF). Note that other groups may also distribute | |||
| working documents as Internet-Drafts. The list of current Internet- | working documents as Internet-Drafts. The list of current Internet- | |||
| Drafts is at http://datatracker.ietf.org/drafts/current/. | Drafts is at http://datatracker.ietf.org/drafts/current/. | |||
| Internet-Drafts are draft documents valid for a maximum of six months | Internet-Drafts are draft documents valid for a maximum of six months | |||
| and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
| time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
| material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
| This Internet-Draft will expire on June 30, 2013. | This Internet-Draft will expire on October 25, 2013. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2012 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 | |||
| carefully, as they describe your rights and restrictions with respect | carefully, as they describe your rights and restrictions with respect | |||
| to this document. Code Components extracted from this document must | to this document. Code Components extracted from this document must | |||
| include Simplified BSD License text as described in Section 4.e of | include Simplified BSD License text as described in Section 4.e of | |||
| the Trust Legal Provisions and are provided without warranty as | the Trust Legal Provisions and are provided without warranty as | |||
| described in the Simplified BSD License. | described in the Simplified BSD License. | |||
| Table of Contents | Table of Contents | |||
| 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 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 . . . . . . . . . . . . . . 7 | 3. JSON Web Encryption (JWE) Overview . . . . . . . . . . . . . . 8 | |||
| 3.1. Example JWE using RSAES OAEP and AES GCM . . . . . . . . . 8 | 3.1. Example JWE using RSAES OAEP and AES GCM . . . . . . . . . 8 | |||
| 3.2. Example JWE using RSAES-PKCS1-V1_5 and AES CBC . . . . . . 9 | 3.2. Example JWE using RSAES-PKCS1-V1_5 and | |||
| AES_128_CBC_HMAC_SHA_256 . . . . . . . . . . . . . . . . . 10 | ||||
| 4. JWE Header . . . . . . . . . . . . . . . . . . . . . . . . . . 11 | 4. JWE Header . . . . . . . . . . . . . . . . . . . . . . . . . . 11 | |||
| 4.1. Reserved Header Parameter Names . . . . . . . . . . . . . 12 | 4.1. Reserved Header Parameter Names . . . . . . . . . . . . . 12 | |||
| 4.1.1. "alg" (Algorithm) Header Parameter . . . . . . . . . . 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 . . . . 13 | |||
| 4.1.4. "zip" (Compression Algorithm) Header Parameter . . . . 13 | 4.1.4. "zip" (Compression Algorithm) Header Parameter . . . . 13 | |||
| 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 . . . . . . . . . . . . . . . . . . . . . . 14 | |||
| 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 . . . . . . . . . . . 15 | |||
| 4.1.11. "typ" (Type) Header Parameter . . . . . . . . . . . . 15 | 4.1.11. "typ" (Type) Header Parameter . . . . . . . . . . . . 15 | |||
| 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 . . . . 15 | 4.1.14. "apv" (Agreement PartyVInfo) Header Parameter . . . . 16 | |||
| 4.1.15. "epu" (Encryption PartyUInfo) Header Parameter . . . . 16 | 4.1.15. "crit" (Critical) Header Parameter . . . . . . . . . . 16 | |||
| 4.1.16. "epv" (Encryption PartyVInfo) 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 . . . . . . . . . . . . . . . . . 16 | 5. Producing and Consuming JWEs . . . . . . . . . . . . . . . . . 17 | |||
| 5.1. Message Encryption . . . . . . . . . . . . . . . . . . . . 16 | 5.1. Message Encryption . . . . . . . . . . . . . . . . . . . . 17 | |||
| 5.2. Message Decryption . . . . . . . . . . . . . . . . . . . . 18 | 5.2. Message Decryption . . . . . . . . . . . . . . . . . . . . 19 | |||
| 5.3. String Comparison Rules . . . . . . . . . . . . . . . . . 19 | 5.3. String Comparison Rules . . . . . . . . . . . . . . . . . 20 | |||
| 6. Encrypting JWEs with Cryptographic Algorithms . . . . . . . . 20 | 6. Encrypting JWEs with Cryptographic Algorithms . . . . . . . . 21 | |||
| 6.1. CMK Encryption . . . . . . . . . . . . . . . . . . . . . . 20 | 6.1. CEK Encryption . . . . . . . . . . . . . . . . . . . . . . 21 | |||
| 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 | 7. JSON Serialization . . . . . . . . . . . . . . . . . . . . . . 21 | |||
| 7.1. Registration of JWE Header Parameter Names . . . . . . . . 20 | 7.1. Example JWE-JS . . . . . . . . . . . . . . . . . . . . . . 23 | |||
| 7.1.1. Registry Contents . . . . . . . . . . . . . . . . . . 21 | 8. Implementation Considerations . . . . . . . . . . . . . . . . 24 | |||
| 7.2. JSON Web Signature and Encryption Type Values | 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 24 | |||
| Registration . . . . . . . . . . . . . . . . . . . . . . . 22 | 9.1. Registration of JWE Header Parameter Names . . . . . . . . 24 | |||
| 7.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 22 | 9.1.1. Registry Contents . . . . . . . . . . . . . . . . . . 24 | |||
| 7.3. Media Type Registration . . . . . . . . . . . . . . . . . 23 | 9.2. JSON Web Signature and Encryption Type Values | |||
| 7.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 23 | Registration . . . . . . . . . . . . . . . . . . . . . . . 26 | |||
| 8. Security Considerations . . . . . . . . . . . . . . . . . . . 23 | 9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 26 | |||
| 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 24 | 9.3. Media Type Registration . . . . . . . . . . . . . . . . . 26 | |||
| 9.1. Normative References . . . . . . . . . . . . . . . . . . . 24 | 9.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 26 | |||
| 9.2. Informative References . . . . . . . . . . . . . . . . . . 25 | 10. Security Considerations . . . . . . . . . . . . . . . . . . . 28 | |||
| Appendix A. JWE Examples . . . . . . . . . . . . . . . . . . . . 25 | 11. References . . . . . . . . . . . . . . . . . . . . . . . . . . 28 | |||
| A.1. Example JWE using RSAES OAEP and AES GCM . . . . . . . . . 26 | 11.1. Normative References . . . . . . . . . . . . . . . . . . . 28 | |||
| A.1.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 26 | 11.2. Informative References . . . . . . . . . . . . . . . . . . 30 | |||
| A.1.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 26 | Appendix A. JWE Examples . . . . . . . . . . . . . . . . . . . . 30 | |||
| A.1.3. Content Master Key (CMK) . . . . . . . . . . . . . . . 26 | A.1. Example JWE using RSAES OAEP and AES GCM . . . . . . . . . 31 | |||
| A.1.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 26 | A.1.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 31 | |||
| A.1.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 29 | A.1.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 31 | |||
| A.1.6. Initialization Vector . . . . . . . . . . . . . . . . 29 | A.1.3. Content Encryption Key (CEK) . . . . . . . . . . . . . 31 | |||
| A.1.7. "Additional Authenticated Data" Parameter . . . . . . 29 | A.1.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 31 | |||
| A.1.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 30 | A.1.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 34 | |||
| A.1.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 30 | A.1.6. Initialization Vector . . . . . . . . . . . . . . . . 34 | |||
| A.1.10. Encoded JWE Integrity Value . . . . . . . . . . . . . 31 | A.1.7. Additional Authenticated Data Parameter . . . . . . . 34 | |||
| A.1.11. Complete Representation . . . . . . . . . . . . . . . 31 | A.1.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 35 | |||
| A.1.12. Validation . . . . . . . . . . . . . . . . . . . . . . 31 | A.1.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 35 | |||
| A.2. Example JWE using RSAES-PKCS1-V1_5 and AES CBC . . . . . . 31 | A.1.10. Encoded JWE Authentication Tag . . . . . . . . . . . . 36 | |||
| A.2.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 32 | A.1.11. Complete Representation . . . . . . . . . . . . . . . 36 | |||
| A.2.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 32 | A.1.12. Validation . . . . . . . . . . . . . . . . . . . . . . 36 | |||
| A.2.3. Content Master Key (CMK) . . . . . . . . . . . . . . . 32 | A.2. Example JWE using RSAES-PKCS1-V1_5 and | |||
| A.2.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 32 | AES_128_CBC_HMAC_SHA_256 . . . . . . . . . . . . . . . . . 36 | |||
| A.2.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 35 | A.2.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 37 | |||
| A.2.6. Key Derivation . . . . . . . . . . . . . . . . . . . . 35 | A.2.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 37 | |||
| A.2.7. Initialization Vector . . . . . . . . . . . . . . . . 35 | A.2.3. Content Encryption Key (CEK) . . . . . . . . . . . . . 37 | |||
| A.2.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 35 | A.2.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 37 | |||
| A.2.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 36 | A.2.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 40 | |||
| A.2.10. Secured Input Value . . . . . . . . . . . . . . . . . 36 | A.2.6. Initialization Vector . . . . . . . . . . . . . . . . 40 | |||
| A.2.11. JWE Integrity Value . . . . . . . . . . . . . . . . . 37 | A.2.7. Additional Authenticated Data Parameter . . . . . . . 40 | |||
| A.2.12. Encoded JWE Integrity Value . . . . . . . . . . . . . 37 | A.2.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 41 | |||
| A.2.13. Complete Representation . . . . . . . . . . . . . . . 37 | A.2.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 41 | |||
| A.2.14. Validation . . . . . . . . . . . . . . . . . . . . . . 38 | A.2.10. Encoded JWE Authentication Tag . . . . . . . . . . . . 42 | |||
| A.3. Example JWE using AES Key Wrap and AES GCM . . . . . . . . 38 | A.2.11. Complete Representation . . . . . . . . . . . . . . . 42 | |||
| A.3.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 38 | A.2.12. Validation . . . . . . . . . . . . . . . . . . . . . . 42 | |||
| A.3.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 39 | A.3. Example JWE using AES Key Wrap and AES GCM . . . . . . . . 42 | |||
| A.3.3. Content Master Key (CMK) . . . . . . . . . . . . . . . 39 | A.3.1. JWE Header . . . . . . . . . . . . . . . . . . . . . . 43 | |||
| A.3.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 39 | A.3.2. Encoded JWE Header . . . . . . . . . . . . . . . . . . 43 | |||
| A.3.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 39 | A.3.3. Content Encryption Key (CEK) . . . . . . . . . . . . . 43 | |||
| A.3.6. Initialization Vector . . . . . . . . . . . . . . . . 39 | A.3.4. Key Encryption . . . . . . . . . . . . . . . . . . . . 43 | |||
| A.3.7. "Additional Authenticated Data" Parameter . . . . . . 40 | A.3.5. Encoded JWE Encrypted Key . . . . . . . . . . . . . . 44 | |||
| A.3.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 40 | A.3.6. Initialization Vector . . . . . . . . . . . . . . . . 44 | |||
| A.3.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 40 | A.3.7. Additional Authenticated Data Parameter . . . . . . . 44 | |||
| A.3.10. Encoded JWE Integrity Value . . . . . . . . . . . . . 41 | A.3.8. Plaintext Encryption . . . . . . . . . . . . . . . . . 44 | |||
| A.3.11. Complete Representation . . . . . . . . . . . . . . . 41 | A.3.9. Encoded JWE Ciphertext . . . . . . . . . . . . . . . . 45 | |||
| A.3.12. Validation . . . . . . . . . . . . . . . . . . . . . . 41 | A.3.10. Encoded JWE Authentication Tag . . . . . . . . . . . . 45 | |||
| A.4. Example Key Derivation for "enc" value "A128CBC+HS256" . . 41 | A.3.11. Complete Representation . . . . . . . . . . . . . . . 45 | |||
| A.4.1. CEK Generation . . . . . . . . . . . . . . . . . . . . 42 | A.3.12. Validation . . . . . . . . . . . . . . . . . . . . . . 45 | |||
| A.4.2. CIK Generation . . . . . . . . . . . . . . . . . . . . 43 | Appendix B. Example AES_128_CBC_HMAC_SHA_256 Computation . . . . 46 | |||
| A.5. Example Key Derivation for "enc" value "A256CBC+HS512" . . 44 | B.1. Extract MAC_KEY and ENC_KEY from Key . . . . . . . . . . . 46 | |||
| A.5.1. CEK Generation . . . . . . . . . . . . . . . . . . . . 44 | B.2. Encrypt Plaintext to Create Ciphertext . . . . . . . . . . 46 | |||
| A.5.2. CIK Generation . . . . . . . . . . . . . . . . . . . . 45 | B.3. Create 64 Bit Big Endian Representation of AAD Length . . 47 | |||
| Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 46 | B.4. Initialization Vector Value . . . . . . . . . . . . . . . 47 | |||
| Appendix C. Open Issues . . . . . . . . . . . . . . . . . . . . . 47 | B.5. Create Input to HMAC Computation . . . . . . . . . . . . . 47 | |||
| Appendix D. Document History . . . . . . . . . . . . . . . . . . 47 | B.6. Compute HMAC Value . . . . . . . . . . . . . . . . . . . . 48 | |||
| Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 51 | B.7. Truncate HMAC Value to Create Authentication Tag . . . . . 48 | |||
| Appendix C. Acknowledgements . . . . . . . . . . . . . . . . . . 48 | ||||
| Appendix D. Document History . . . . . . . . . . . . . . . . . . 49 | ||||
| Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 54 | ||||
| 1. Introduction | 1. Introduction | |||
| JSON Web Encryption (JWE) is a compact encryption format intended for | JSON Web Encryption (JWE) is a compact encryption format intended for | |||
| space constrained environments such as HTTP Authorization headers and | space constrained environments such as HTTP Authorization headers and | |||
| URI query parameters. It represents this content using JavaScript | URI query parameters. It represents this content using JavaScript | |||
| Object Notation (JSON) [RFC4627] based data structures. The JWE | Object Notation (JSON) [RFC4627] based data structures. The JWE | |||
| cryptographic mechanisms encrypt and provide integrity protection for | cryptographic mechanisms encrypt and provide integrity protection for | |||
| arbitrary sequences of bytes. | arbitrary sequences of octets. | |||
| 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", | |||
| "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this | |||
| document are to be interpreted as described in Key words for use in | document are to be interpreted as described in Key words for use in | |||
| RFCs to Indicate Requirement Levels [RFC2119]. | RFCs to Indicate Requirement Levels [RFC2119]. | |||
| 2. Terminology | 2. Terminology | |||
| JSON Web Encryption (JWE) A data structure representing an encrypted | JSON Web Encryption (JWE) A data structure representing an encrypted | |||
| message. The structure consists of five parts: the JWE Header, | message. The structure represents five values: the JWE Header, | |||
| the JWE Encrypted Key, the JWE Initialization Vector, the JWE | the JWE Encrypted Key, the JWE Initialization Vector, the JWE | |||
| Ciphertext, and the JWE Integrity Value. | Ciphertext, and the JWE Authentication Tag. | |||
| Plaintext The bytes to be encrypted -- a.k.a., the message. The | Authenticated Encryption An Authenticated Encryption algorithm is | |||
| plaintext can contain an arbitrary sequence of bytes. | one that provides an integrated content integrity check. | |||
| Authenticated Encryption algorithms accept two inputs, the | ||||
| Plaintext and the Additional Authenticated Data value, and produce | ||||
| two outputs, the Ciphertext and the Authentication Tag value. AES | ||||
| Galois/Counter Mode (GCM) is one such algorithm. | ||||
| Plaintext The sequence of octets to be encrypted -- a.k.a., the | ||||
| message. The plaintext can contain an arbitrary sequence of | ||||
| octets. | ||||
| Ciphertext An encrypted representation of the Plaintext. | Ciphertext An encrypted representation of the Plaintext. | |||
| Content Encryption Key (CEK) A symmetric key used to encrypt the | Additional Associated Data (AAD) An input to an Authenticated | |||
| Plaintext for the recipient to produce the Ciphertext. | Encryption operation that is integrity protected but not | |||
| encrypted. | ||||
| Content Integrity Key (CIK) A key used with a MAC function to ensure | Authentication Tag An output of an Authenticated Encryption | |||
| the integrity of the Ciphertext and the parameters used to create | operation that ensures the integrity of the Ciphertext and the | |||
| it. | Additional Associated Data. | |||
| Content Master Key (CMK) A key from which the CEK and CIK are | Content Encryption Key (CEK) A symmetric key for the Authenticated | |||
| derived. When key wrapping or key encryption are employed, the | Encryption algorithm used to encrypt the Plaintext for the | |||
| CMK is randomly generated and encrypted to the recipient as the | recipient to produce the Ciphertext and the Authentication Tag. | |||
| JWE Encrypted Key. When direct encryption with a shared symmetric | ||||
| key is employed, the CMK is the shared key. When key agreement | ||||
| without key wrapping is employed, the CMK is the result of the key | ||||
| agreement algorithm. | ||||
| JSON Text Object A UTF-8 encoded text string representing a JSON | JSON Text Object A UTF-8 [RFC3629] encoded text string representing | |||
| object; the syntax of JSON objects is defined in Section 2.2 of | a JSON object; the syntax of JSON objects is defined in Section | |||
| [RFC4627]. | 2.2 of [RFC4627]. | |||
| JWE Header A JSON Text Object that describes the encryption | JWE Header A JSON Text Object that describes the encryption | |||
| operations applied to create the JWE Encrypted Key, the JWE | operations applied to create the JWE Encrypted Key, the JWE | |||
| Ciphertext, and the JWE Integrity Value. | Ciphertext, and the JWE Authentication Tag. | |||
| JWE Encrypted Key When key wrapping or key encryption are employed, | JWE Encrypted Key The result of encrypting the Content Encryption | |||
| the Content Master Key (CMK) is encrypted with the intended | Key (CEK) with the intended recipient's key using the specified | |||
| recipient's key and the resulting encrypted content is recorded as | algorithm. Note that for some algorithms, the JWE Encrypted Key | |||
| a byte array, which is referred to as the JWE Encrypted Key. | value is specified as being the empty octet sequence. | |||
| Otherwise, when direct encryption with a shared or agreed upon | ||||
| symmetric key is employed, the JWE Encrypted Key is the empty byte | ||||
| array. | ||||
| JWE Initialization Vector A byte array containing the Initialization | JWE Initialization Vector A sequence of octets containing the | |||
| Vector used when encrypting the Plaintext. | Initialization Vector used when encrypting the Plaintext. Note | |||
| that some algorithms may not use an Initialization Vector, in | ||||
| which case this value is the empty octet sequence. | ||||
| JWE Ciphertext A byte array containing the Ciphertext. | JWE Ciphertext A sequence of octets containing the Ciphertext for a | |||
| JWE. | ||||
| JWE Integrity Value A byte array containing a MAC value that ensures | JWE Authentication Tag A sequence of octets containing the | |||
| the integrity of the Ciphertext and the parameters used to create | Authentication Tag for a JWE. | |||
| it. | ||||
| Base64url Encoding The URL- and filename-safe Base64 encoding | Base64url Encoding The URL- and filename-safe Base64 encoding | |||
| described in RFC 4648 [RFC4648], Section 5, with the (non URL- | described in RFC 4648 [RFC4648], Section 5, with the (non URL- | |||
| safe) '=' padding characters omitted, as permitted by Section 3.2. | safe) '=' padding characters omitted, as permitted by Section 3.2. | |||
| (See Appendix C of [JWS] for notes on implementing base64url | (See Appendix C of [JWS] for notes on implementing base64url | |||
| encoding without padding.) | encoding without padding.) | |||
| Encoded JWE Header Base64url encoding of the JWE Header. | Encoded JWE Header Base64url encoding of the JWE Header. | |||
| Encoded JWE Encrypted Key Base64url encoding of the JWE Encrypted | Encoded JWE Encrypted Key Base64url encoding of the JWE Encrypted | |||
| Key. | Key. | |||
| Encoded JWE Initialization Vector Base64url encoding of the JWE | 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 Integrity Value Base64url encoding of the JWE Integrity | Encoded JWE Authentication Tag Base64url encoding of the JWE | |||
| Value. | Authentication Tag. | |||
| Header Parameter Name The name of a 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. | 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 Integrity Value 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. | characters. This results in a compact, URL-safe representation. | |||
| Authenticated Encryption An Authenticated Encryption algorithm is | JWE JSON Serialization A representation of the JWE as a JSON | |||
| one that provides an integrated content integrity check. | structure containing Encoded JWE Header, Encoded JWE Encrypted | |||
| Authenticated Encryption algorithms accept two inputs, the | Key, Encoded JWE Initialization Vector, Encoded JWE Ciphertext, | |||
| plaintext and the "additional authenticated data" value, and | and Encoded JWE Authentication Tag values. Unlike the JWE Compact | |||
| produce two outputs, the ciphertext and the "authentication tag" | Serialization, the JWE JSON Serialization enables the same content | |||
| value. AES Galois/Counter Mode (GCM) is one such algorithm. | to be encrypted to multiple parties. This representation is | |||
| 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: | |||
| Domain Names, Object Identifiers (OIDs) as defined in the ITU-T | Domain Names, Object Identifiers (OIDs) as defined in the ITU-T | |||
| X.660 and X.670 Recommendation series, and Universally Unique | X.660 and X.670 Recommendation series, and Universally Unique | |||
| IDentifiers (UUIDs) [RFC4122]. When using an administratively | IDentifiers (UUIDs) [RFC4122]. When using an administratively | |||
| delegated namespace, the definer of a name needs to take | delegated namespace, the definer of a name needs to take | |||
| reasonable precautions to ensure they are in control of the | reasonable precautions to ensure they are in control of the | |||
| portion of the namespace they use to define the name. | portion of the namespace they use to define the name. | |||
| StringOrURI A JSON string value, with the additional requirement | StringOrURI A JSON string value, with the additional requirement | |||
| that while arbitrary string values MAY be used, any value | that while arbitrary string values MAY be used, any value | |||
| containing a ":" character MUST be a URI [RFC3986]. StringOrURI | containing a ":" character MUST be a URI [RFC3986]. StringOrURI | |||
| values are compared as case-sensitive strings with no | values are compared as case-sensitive strings with no | |||
| transformations or canonicalizations applied. | transformations or canonicalizations applied. | |||
| Key Management Mode A method of determining the Content Encryption | ||||
| Key (CEK) value to use. Each algorithm used for determining the | ||||
| CEK value uses a specific Key Management Mode. Key Management | ||||
| Modes employed by this specification are Key Encryption, Key | ||||
| Wrapping, Direct Key Agreement, Key Agreement with Key Wrapping, | ||||
| and Direct Encryption. | ||||
| Key Encryption A Key Management Mode in which the Content Encryption | ||||
| Key (CEK) value is encrypted to the intended recipient using an | ||||
| asymmetric encryption algorithm. | ||||
| Key Wrapping A Key Management Mode in which the Content Encryption | ||||
| Key (CEK) value is encrypted to the intended recipient using a | ||||
| symmetric key wrapping algorithm. | ||||
| Direct Key Agreement A Key Management Mode in which a key agreement | ||||
| algorithm is used to agree upon the Content Encryption Key (CEK) | ||||
| value. | ||||
| Key Agreement with Key Wrapping A Key Management Mode in which a key | ||||
| agreement algorithm is used to agree upon a symmetric key used to | ||||
| encrypt the Content Encryption Key (CEK) value to the intended | ||||
| recipient using a symmetric key wrapping algorithm. | ||||
| Direct Encryption A Key Management Mode in which the Content | ||||
| Encryption Key (CEK) value used is the secret symmetric key value | ||||
| shared between the parties. | ||||
| 3. JSON Web Encryption (JWE) Overview | 3. JSON Web Encryption (JWE) Overview | |||
| JWE represents encrypted content using JSON data structures and | JWE represents encrypted content using JSON data structures and | |||
| base64url encoding. The representation consists of five parts: the | base64url encoding. Five values are represented in a JWE: the JWE | |||
| JWE Header, the JWE Encrypted Key, the JWE Initialization Vector, the | Header, the JWE Encrypted Key, the JWE Initialization Vector, the JWE | |||
| JWE Ciphertext, and the JWE Integrity Value. In the Compact | Ciphertext, and the JWE Authentication Tag. In the Compact | |||
| Serialization, the five parts are base64url-encoded for transmission, | Serialization, the five values are base64url-encoded for | |||
| and represented as the concatenation of the encoded strings in that | transmission, and represented as the concatenation of the encoded | |||
| order, with the five strings being separated by four period ('.') | strings in that order, with the five strings being separated by four | |||
| characters. (A JSON Serialization for this information is defined in | period ('.') characters. A JSON Serialization for this information | |||
| the separate JSON Web Encryption JSON Serialization (JWE-JS) [JWE-JS] | is also defined in Section 7. | |||
| specification.) | ||||
| JWE utilizes encryption to ensure the confidentiality of the | JWE utilizes authenticated encryption to ensure the confidentiality | |||
| Plaintext. JWE adds a content integrity check if not provided by the | and integrity of the Plaintext. | |||
| underlying encryption algorithm. | ||||
| 3.1. Example JWE using RSAES OAEP and AES GCM | 3.1. Example JWE using RSAES OAEP and AES GCM | |||
| This example encrypts the plaintext "Live long and prosper." to the | This example encrypts the plaintext "The true sign of intelligence is | |||
| recipient using RSAES OAEP and AES GCM. The AES GCM algorithm has an | not knowledge but imagination." to the recipient using RSAES OAEP and | |||
| integrated integrity check. | AES GCM. | |||
| The following example JWE Header declares that: | The following example JWE Header declares that: | |||
| o the Content Master Key is encrypted to the recipient using the | o the Content 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 | |||
| o the Plaintext is encrypted using the AES GCM algorithm with a 256 | o the Plaintext is encrypted using the AES GCM algorithm with a 256 | |||
| bit key to produce the Ciphertext. | bit key to produce the Ciphertext. | |||
| {"alg":"RSA-OAEP","enc":"A256GCM"} | {"alg":"RSA-OAEP","enc":"A256GCM"} | |||
| Base64url encoding the bytes 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 Master Key (CMK) | o Generate a random Content Encryption Key (CEK) | |||
| o Encrypt the CMK 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 character | o Concatenate the Encoded JWE Header value, a period ('.') | |||
| ('.'), the Encoded JWE Encrypted Key, a second period character | character, and the Encoded JWE Encrypted Key to create the | |||
| ('.'), and the Encoded JWE Initialization Vector to create the | Additional Authenticated Data parameter | |||
| "additional authenticated data" parameter for the AES GCM | ||||
| algorithm | ||||
| o Encrypt the Plaintext with AES GCM, using the CMK as the | o Encrypt the Plaintext with AES GCM using the CEK as the encryption | |||
| encryption key, the JWE Initialization Vector, and the "additional | key, the JWE Initialization Vector, and the Additional | |||
| authenticated data" value above, requesting a 128 bit | Authenticated Data value, requesting a 128 bit Authentication Tag | |||
| "authentication tag" output | output | |||
| o Base64url encode the resulting Ciphertext to create the Encoded | o Base64url encode the Ciphertext to create the Encoded JWE | |||
| JWE Ciphertext | Ciphertext | |||
| o Base64url encode the resulting "authentication tag" to create the | o Base64url encode the Authentication Tag to create the Encoded JWE | |||
| Encoded JWE Integrity Value | 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 Integrity Value in | the Encoded JWE Ciphertext, and the Encoded JWE Authentication Tag | |||
| that order, with the five strings being separated by four period | in that order, with the five strings being separated by four | |||
| ('.') 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. | |||
| M2XxpbORKezKSzzQL_95-GjiudRBTqn_omS8z9xgoRb7L0Jw5UsEbxmtyHn2T71m | ApfOLCaDbqs_JXPYy2I937v_xmrzj-Iss1mG6NAHmeJViM6j2l0MHvfseIdHVyU2 | |||
| rZLkjg4Mp8gbhYoltPkEOHvAopz25-vZ8C2e1cOaAo5WPcbSIuFcB4DjBOM3t0UA | BIoGVu9ohvkkWiRq5DL2jYZTPA9TAdwq3FUIVyoH-Pedf6elHIVFi2KGDEspYMtQ | |||
| O6JHkWLuAEYoe58lcxIQneyKdaYSLbV9cKqoUoFQpvKWYRHZbfszIyfsa18rmgTj | ARMMSBcS7pslx6flh1Cfh3GBKysztVMEhZ_maFkm4PYVCsJsvq6Ct3fg2CJPOs0X | |||
| zrtLDTPnc09DSJE24aQ8w3i8RXEDthW9T1J6LsTH_vwHdwUgkI-tC2PNeGrnM-dN | 1DHuxZKoIGIqcbeK4XEO5a0h5TAuJObKdfO0dKwfNSSbpu5sFrpRFwV2FTTYoqF4 | |||
| SfzF3Y7-lwcGy0FsdXkPXytvDV7y4pZeeUiQ-0VdibIN2AjjfW60nfrPuOjepMFG | zI46N9-_hMIznlEpftRXhScEJuZ9HG8C8CHB1WRZ_J48PleqdhF4o7fB5J1wFqUX | |||
| 6BBBbR37pHcyzext9epOAQ. | BtbtuGJ_A2Xe6AEhrlzCOw. | |||
| 48V1_ALb6US04U3b. | 48V1_ALb6US04U3b. | |||
| _e21tGGhac_peEFkLXr2dMPUZiUkrw. | 5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji | |||
| 7V5ZDko0v_mf2PAc4JMiUg | SdiwkIr3ajwQzaBtQD_A. | |||
| ghEgxninkHEAMp4xZtB2mA | ||||
| See Appendix A.1 for the complete details of computing this JWE. | See Appendix A.1 for the complete details of computing this JWE. | |||
| 3.2. Example JWE using RSAES-PKCS1-V1_5 and AES CBC | 3.2. Example JWE using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256 | |||
| This example encrypts the plaintext "No matter where you go, there | This example encrypts the plaintext "Live long and prosper." to the | |||
| you are." to the recipient using RSAES-PKCS1-V1_5 and AES CBC. AES | recipient using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. | |||
| CBC does not have an integrated integrity check, so a separate | ||||
| integrity check calculation is performed using HMAC SHA-256, with | ||||
| separate encryption and integrity keys being derived from a master | ||||
| key using the Concat KDF with the SHA-256 digest function. | ||||
| The following example JWE Header (with line breaks for display | The following example JWE Header (with line breaks for display | |||
| purposes only) declares that: | purposes only) declares that: | |||
| o the Content Master Key is encrypted to the recipient using the | o the Content Encryption Key is encrypted to the recipient using the | |||
| RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and | RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and | |||
| o the Plaintext is encrypted using the AES CBC algorithm with a 128 | o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 | |||
| bit key to produce the Ciphertext, with the integrity of the | algorithm to produce the Ciphertext. | |||
| Ciphertext and the parameters used to create it being secured | ||||
| using the HMAC SHA-256 algorithm. | ||||
| {"alg":"RSA1_5","enc":"A128CBC+HS256"} | {"alg":"RSA1_5","enc":"A128CBC-HS256"} | |||
| Base64url encoding the bytes 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: | |||
| eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0 | eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0 | |||
| The remaining steps to finish creating this JWE are like the previous | The remaining steps to finish creating this JWE are the same as for | |||
| example, but with an additional step to compute the separate | the previous example, but using RSAES-PKCS1-v1_5 instead of RSAES | |||
| integrity value: | 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. | ||||
| o Generate a random Content Master Key (CMK) | ||||
| o Encrypt the CMK with the recipient's public key using the RSAES- | ||||
| PKCS1-V1_5 algorithm to produce the JWE Encrypted Key | ||||
| o Base64url encode the JWE Encrypted Key to produce the Encoded JWE | ||||
| Encrypted Key | ||||
| o Generate a random JWE Initialization Vector | ||||
| o Base64url encode the JWE Initialization Vector to produce the | ||||
| Encoded JWE Initialization Vector | ||||
| o Use the Concat key derivation function to derive Content | ||||
| Encryption Key (CEK) and Content Integrity Key (CIK) values from | ||||
| the CMK | ||||
| o Encrypt the Plaintext with AES CBC using the CEK and JWE | ||||
| Initialization Vector to produce the Ciphertext | ||||
| o Base64url encode the resulting Ciphertext to create the Encoded | ||||
| JWE Ciphertext | ||||
| o Concatenate the Encoded JWE Header value, a period character | ||||
| ('.'), the Encoded JWE Encrypted Key, a second period character | ||||
| ('.'), the Encoded JWE Initialization Vector, a third period ('.') | ||||
| character, and the Encoded JWE Ciphertext to create the value to | ||||
| integrity protect | ||||
| o Compute the HMAC SHA-256 of this value using the CIK to create the | ||||
| JWE Integrity Value | ||||
| o Base64url encode the resulting JWE Integrity Value to create the | ||||
| Encoded JWE Integrity Value | ||||
| o Assemble the final representation: The Compact Serialization of | ||||
| this result is the concatenation of the Encoded JWE Header, the | ||||
| Encoded JWE Encrypted Key, the Encoded JWE Initialization Vector, | ||||
| the Encoded JWE Ciphertext, and the Encoded JWE Integrity Value in | ||||
| that order, with the five strings being separated by four period | ||||
| ('.') characters. | ||||
| The final result in this example (with line breaks for display | The final result in this example (with line breaks for display | |||
| purposes only) is: | purposes only) is: | |||
| eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0. | eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. | |||
| O6AqXqgVlJJ4c4lp5sXZd7bpGHAw6ARkHUeXQxD1cAW4-X1x0qtj_AN0mukqEOl4 | nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMkmOm | |||
| Y6UOwJXIJY9-G1ELK-RQWrKH_StR-AM9H7GpKmSEji8QYOcMOjr-u9H1Lt_pBEie | kkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZjDYENR | |||
| G802SxWz0rbFTXRcj4BWLxcpCtjUZ31AP-sc-L_eCZ5UNl0aSRNqFskuPkzRsFZR | WiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfEJmNmfsx5f | |||
| DJqSSJeVOyJ7pZCQ83fli19Vgi_3R7XMUqluQuuc7ZHOWixi47jXlBTlWRZ5iFxa | cB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWyEHW6WzQ4iH9S | |||
| S8G6J8wUrd4BKggAw3qX5XoIfXQVlQZE0Vmkq_zQSIo5LnFKyowooRcdsEuNh9B9 | IcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_NSsx24LxtK6fIkej | |||
| Mkyt0ZQElG-jGdtHWjZSOA. | RlMBmCfxv0Tg8CtxpURigg. | |||
| AxY8DCtDaGlsbGljb3RoZQ. | AxY8DCtDaGlsbGljb3RoZQ. | |||
| 1eBWFgcrz40wC88cgv8rPgu3EfmC1p4zT0kIxxfSF2zDJcQ-iEHk1jQM95xAdr5Z. | KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY. | |||
| RBGhYzE8_cZLHjJqqHuLhzbgWgL_wV3LDSUrcbkOiIA | fY2U_Hx5VcfXmipEldHhMA | |||
| See Appendix A.2 for the complete details of computing this JWE. | See Appendix A.2 for the complete details of computing this JWE. | |||
| 4. JWE Header | 4. JWE Header | |||
| The members of the JSON object represented by the JWE Header describe | The members of the JSON object represented by the JWE Header describe | |||
| the encryption applied to the Plaintext and optionally additional | the encryption applied to the Plaintext and optionally additional | |||
| properties of the JWE. The Header Parameter Names within this object | properties of the JWE. The Header Parameter Names within this object | |||
| MUST be unique; JWEs with duplicate Header Parameter Names MUST be | MUST be unique; JWEs with duplicate Header Parameter Names MUST be | |||
| rejected. Implementations MUST understand the entire contents of the | rejected. | |||
| header; otherwise, the JWE MUST be rejected. | ||||
| Implementations are required to understand the specific header | ||||
| parameters defined by this specification that are designated as "MUST | ||||
| be understood" and process them in the manner defined in this | ||||
| specification. All other header parameters defined by this | ||||
| specification that are not so designated MUST be ignored when not | ||||
| understood. Unless listed as a critical header parameter, per | ||||
| Section 4.1.15, all other header parameters MUST be ignored when not | ||||
| 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 value. If the value represents a digital signature or MAC | header parameter value. If the value represents a digital signature | |||
| algorithm, or is the value "none", it is for a JWS; if it represents | or MAC algorithm, or is the value "none", it is for a JWS; if it | |||
| an encryption or key agreement algorithm, it is for a JWE. A second | represents a Key Encryption, Key Wrapping, Direct Key Agreement, Key | |||
| method is determining whether an "enc" (encryption method) member | Agreement with Key Wrapping, or Direct Encryption algorithm, it is | |||
| exists. If the "enc" member exists, it is a JWE; otherwise, it is a | for a JWE. A second method is determining whether an "enc" | |||
| JWS. Both methods will yield the same result for all legal input | (encryption method) member exists. If the "enc" member exists, it is | |||
| values. | a JWE; otherwise, it is a JWS. Both methods will yield the same | |||
| result for all legal input values. | ||||
| There are three classes of Header Parameter Names: Reserved Header | There are three classes of Header Parameter Names: Reserved Header | |||
| 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 JWE is | defined below. All the names are short because a core goal of this | |||
| for the representations to be compact. | specification is for the resulting representations using the JWE | |||
| Compact Serialization to be compact. | ||||
| Additional reserved Header Parameter Names MAY be defined via the | Additional reserved Header Parameter Names MAY 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 | |||
| Master Key (CMK). The algorithm specified by the "alg" value MUST be | Encryption Key (CEK). The algorithm specified by the "alg" value | |||
| supported by the implementation and there MUST be a key for use with | MUST be supported by the implementation and there MUST be a key for | |||
| that algorithm associated with the intended recipient or the JWE MUST | use with that algorithm associated with the intended recipient or the | |||
| be rejected. "alg" values SHOULD either be registered in the IANA | JWE MUST be rejected. "alg" values SHOULD either be registered in the | |||
| JSON Web Signature and Encryption Algorithms registry [JWA] or be a | IANA JSON Web Signature and Encryption Algorithms registry [JWA] or | |||
| value that contains a Collision Resistant Namespace. The "alg" value | be a value that contains a Collision Resistant Namespace. The "alg" | |||
| is a case sensitive string containing a StringOrURI value. Use of | value is a case sensitive string containing a StringOrURI value. Use | |||
| this header parameter is REQUIRED. | of this header parameter is REQUIRED. This header parameter MUST be | |||
| understood by implementations. | ||||
| A list of defined "alg" values can be found in the IANA JSON Web | A list of defined "alg" values can be found in the IANA JSON Web | |||
| Signature and Encryption Algorithms registry [JWA]; the initial | Signature and Encryption Algorithms registry [JWA]; the initial | |||
| contents of this registry are the values defined in Section 4.1 of | contents of this registry are the values defined in Section 4.1 of | |||
| the JSON Web Algorithms (JWA) [JWA] specification. | the JSON Web Algorithms (JWA) [JWA] specification. | |||
| 4.1.2. "enc" (Encryption Method) Header Parameter | 4.1.2. "enc" (Encryption Method) Header Parameter | |||
| The "enc" (encryption method) header parameter identifies the block | The "enc" (encryption method) header parameter identifies the block | |||
| encryption algorithm used to encrypt the Plaintext to produce the | encryption algorithm used to encrypt the Plaintext to produce the | |||
| Ciphertext. This algorithm MUST be an Authenticated Encryption | Ciphertext. This algorithm MUST be an Authenticated Encryption | |||
| algorithm with a specified key length. The algorithm specified by | algorithm with a specified key length. The algorithm specified by | |||
| the "enc" value MUST be supported by the implementation or the JWE | the "enc" value MUST be supported by the implementation or the JWE | |||
| MUST be rejected. "enc" values SHOULD either be registered in the | MUST be rejected. "enc" values SHOULD either be registered in the | |||
| IANA JSON Web Signature and Encryption Algorithms registry [JWA] or | IANA JSON Web Signature and Encryption Algorithms registry [JWA] or | |||
| be a value that contains a Collision Resistant Namespace. The "enc" | be a value that contains a Collision Resistant Namespace. The "enc" | |||
| value is a case sensitive string containing a StringOrURI value. Use | value is a case sensitive string containing a StringOrURI value. Use | |||
| of this header parameter is REQUIRED. | of this header parameter is REQUIRED. This header parameter MUST be | |||
| understood by implementations. | ||||
| 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. Use of this header parameter is OPTIONAL, | |||
| although its use is REQUIRED with some "alg" algorithms. | although its use is REQUIRED with some "alg" algorithms. When its | |||
| use is REQUIRED, this header parameter MUST be understood by | ||||
| implementations. | ||||
| 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. | before encryption. Use of this header parameter is OPTIONAL. This | |||
| 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 corresponds to the key used to encrypt the JWE; this can be | which is the key to which the JWE was encrypted; this can be used to | |||
| used to determine the private key needed to decrypt the JWE. The | determine the private key needed to decrypt the JWE. The keys MUST | |||
| keys MUST be encoded as a JSON Web Key Set (JWK Set) [JWK]. The | be encoded as a JSON Web Key Set (JWK Set) [JWK]. The protocol used | |||
| protocol used to acquire the resource MUST provide integrity | to acquire the resource MUST provide integrity protection; an HTTP | |||
| protection; an HTTP GET request to retrieve the certificate MUST use | GET request to retrieve the certificate MUST use TLS [RFC2818] | |||
| TLS [RFC2818] [RFC5246]; the identity of the server MUST be | [RFC5246]; the identity of the server MUST be validated, as per | |||
| validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. Use of | Section 3.1 of HTTP Over TLS [RFC2818]. Use of this header parameter | |||
| this header parameter is OPTIONAL. | is OPTIONAL. | |||
| 4.1.6. "jwk" (JSON Web Key) Header Parameter | 4.1.6. "jwk" (JSON Web Key) Header Parameter | |||
| The "jwk" (JSON Web Key) header parameter is a public key that | The "jwk" (JSON Web Key) header parameter is the public key to which | |||
| corresponds to the key used to encrypt the JWE; this can be used to | the JWE was encrypted; this can be used to determine the private key | |||
| determine the private key needed to decrypt the JWE. This key is | needed to decrypt the JWE. This key is represented as a JSON Web Key | |||
| represented as a JSON Web Key [JWK]. Use of this header parameter is | [JWK]. Use of this header parameter is OPTIONAL. | |||
| OPTIONAL. | ||||
| 4.1.7. "x5u" (X.509 URL) Header Parameter | 4.1.7. "x5u" (X.509 URL) Header Parameter | |||
| The "x5u" (X.509 URL) header parameter is a URI [RFC3986] that refers | The "x5u" (X.509 URL) header parameter is a URI [RFC3986] that refers | |||
| to a resource for the X.509 public key certificate or certificate | to a resource for the X.509 public key certificate or certificate | |||
| chain [RFC5280] corresponding to the key used to encrypt the JWE; | chain [RFC5280] containing the key to which the JWE was encrypted; | |||
| this can be used to determine the private key needed to decrypt the | this can be used to determine the private key needed to decrypt the | |||
| JWE. The identified resource MUST provide a representation of the | JWE. The identified resource MUST provide a representation of the | |||
| certificate or certificate chain that conforms to RFC 5280 [RFC5280] | certificate or certificate chain that conforms to RFC 5280 [RFC5280] | |||
| in PEM encoded form [RFC1421]. The certificate containing the public | in PEM encoded form [RFC1421]. The certificate containing the public | |||
| key of the entity that encrypted the JWE MUST be the first | key to which the JWE was encrypted MUST be the first certificate. | |||
| certificate. This MAY be followed by additional certificates, with | This MAY be followed by additional certificates, with each subsequent | |||
| each subsequent certificate being the one used to certify the | certificate being the one used to certify the previous one. The | |||
| previous one. The protocol used to acquire the resource MUST provide | protocol used to acquire the resource MUST provide integrity | |||
| integrity protection; an HTTP GET request to retrieve the certificate | protection; an HTTP GET request to retrieve the certificate MUST use | |||
| 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 provides a | |||
| base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER | base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER | |||
| encoding of the X.509 certificate [RFC5280] corresponding to the key | encoding of the X.509 certificate [RFC5280] containing the key to | |||
| used to encrypt the JWE; this can be used to determine the private | which the JWE was encrypted; this can be used to determine the | |||
| key needed to decrypt the JWE. Use of this header parameter is | private key needed to decrypt the JWE. Use of this header parameter | |||
| 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] | |||
| corresponding to the key used to encrypt the JWE; this can be used to | containing the key to which the JWE was encrypted; this can be used | |||
| determine the private key needed to decrypt the JWE. The certificate | to determine the private key needed to decrypt the JWE. The | |||
| or certificate chain is represented as an array of certificate value | certificate or certificate chain is represented as an array of | |||
| strings. Each string is a base64 encoded ([RFC4648] Section 4 -- not | certificate value strings. Each string is a base64 encoded | |||
| base64url encoded) DER [ITU.X690.1994] PKIX certificate value. The | ([RFC4648] Section 4 -- not base64url encoded) DER [ITU.X690.1994] | |||
| certificate containing the public key of the entity that encrypted | PKIX certificate value. The certificate containing the public key to | |||
| the JWE MUST be the first certificate. This MAY be followed by | which the JWE was encrypted MUST be the first certificate. This MAY | |||
| additional certificates, with each subsequent certificate being the | be followed by additional certificates, with each subsequent | |||
| one used to certify the previous one. The recipient MUST verify the | certificate being the one used to certify the previous one. Use of | |||
| certificate chain according to [RFC5280] and reject the JWE if any | this header parameter is OPTIONAL. | |||
| validation failure occurs. 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 | The "kid" (key ID) header parameter is a hint indicating which key to | |||
| was used to encrypt the JWE; 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 | |||
| "kid" value, they SHOULD treat that condition as an error. The | "kid" value, they SHOULD treat that condition as an error. The | |||
| interpretation of the "kid" value is unspecified. Its value MUST be | interpretation of the "kid" value is unspecified. Its value MUST be | |||
| a string. Use of this header parameter is OPTIONAL. | a string. Use of this header parameter is OPTIONAL. | |||
| When used with a JWK, the "kid" value MAY be used to match a JWK | When used with a JWK, the "kid" value 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" MAY be used to indicate that this | object. The type value "JWE" is used to indicate that this object is | |||
| object is a JWE. The "typ" value is a case sensitive string. Use of | a JWE using the JWE Compact Serialization. The type value "JWE-JS" | |||
| 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 | ||||
| this header parameter is OPTIONAL. | 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). The "cty" value is a case | of the encrypted content (the Plaintext). For example, the JSON Web | |||
| sensitive string. Use of this header parameter is OPTIONAL. | Token (JWT) [JWT] specification uses the "cty" value "JWT" to | |||
| indicate that the Plaintext is a JSON Web Token (JWT). The "cty" | ||||
| value is 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. | string. Use of this header parameter is OPTIONAL. When the "alg" | |||
| value used identifies an algorithm for which "apu" is a parameter, | ||||
| this header parameter MUST be understood by implementations. | ||||
| 4.1.14. "apv" (Agreement PartyVInfo) Header Parameter | 4.1.14. "apv" (Agreement PartyVInfo) Header Parameter | |||
| The "apv" (agreement PartyVInfo) value for key agreement algorithms | The "apv" (agreement PartyVInfo) 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. | 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. "epu" (Encryption PartyUInfo) Header Parameter | 4.1.15. "crit" (Critical) Header Parameter | |||
| The "epu" (encryption PartyUInfo) value for plaintext encryption | The "crit" (critical) header parameter is array listing the names of | |||
| algorithms using it (such as "A128CBC+HS256"), represented as a | header parameters that are present in the JWE Header that MUST be | |||
| base64url encoded string. Use of this header parameter is OPTIONAL. | understood and processed by the implementation or if not understood, | |||
| MUST cause the JWE to be rejected. This list MUST NOT include header | ||||
| parameters defined by this specification, duplicate names, or names | ||||
| that do not occur as header parameters within the JWE. Use of this | ||||
| header parameter is OPTIONAL. This header parameter MUST be | ||||
| understood by implementations. | ||||
| 4.1.16. "epv" (Encryption PartyVInfo) Header Parameter | An example use, along with a hypothetical "exp" (expiration-time) | |||
| field is: | ||||
| The "epv" (encryption PartyVInfo) value for plaintext encryption | {"alg":"RSA-OAEP", | |||
| algorithms using it (such as "A128CBC+HS256"), represented as a | "enc":"A256GCM", | |||
| base64url encoded string. Use of this header parameter is OPTIONAL. | "crit":["exp"], | |||
| "exp":1363284000 | ||||
| } | ||||
| 4.2. Public Header Parameter Names | 4.2. Public Header Parameter Names | |||
| Additional Header Parameter Names can be defined by those using JWEs. | Additional Header Parameter Names can be defined by those using JWEs. | |||
| However, in order to prevent collisions, any new Header Parameter | However, in order to prevent collisions, any new Header Parameter | |||
| Name SHOULD either be registered in the IANA JSON Web Signature and | Name SHOULD either be registered in the IANA JSON Web Signature and | |||
| Encryption Header Parameters registry [JWS] or be a Public Name: a | Encryption Header Parameters registry [JWS] or be a Public Name: a | |||
| value that contains a Collision Resistant Namespace. In each case, | value that contains a Collision Resistant Namespace. In each case, | |||
| the definer of the name or value needs to take reasonable precautions | the definer of the name or value needs to take reasonable precautions | |||
| to make sure they are in control of the part of the namespace they | to make sure they are in control of the part of the namespace they | |||
| skipping to change at page 16, line 47 ¶ | skipping to change at page 17, line 16 ¶ | |||
| caution. | caution. | |||
| 5. Producing and Consuming JWEs | 5. Producing and Consuming JWEs | |||
| 5.1. Message Encryption | 5.1. Message Encryption | |||
| The message encryption process is as follows. The order of the steps | The message encryption process is as follows. The order of the steps | |||
| is not significant in cases where there are no dependencies between | is not significant in cases where there are no dependencies between | |||
| the inputs and outputs of the steps. | the inputs and outputs of the steps. | |||
| 1. When key wrapping, key encryption, or key agreement with key | 1. Determine the Key Management Mode employed by the algorithm used | |||
| wrapping are employed, generate a random Content Master Key | to determine the Content Encryption Key (CEK) value. (This is | |||
| (CMK). See RFC 4086 [RFC4086] for considerations on generating | the algorithm recorded in the "alg" (algorithm) header parameter | |||
| random values. The CMK MUST have a length equal to that | of the resulting JWE.) | |||
| required for the block encryption algorithm. | ||||
| 2. When key agreement is employed, use the key agreement algorithm | 2. When Key Wrapping, Key Encryption, or Key Agreement with Key | |||
| to compute the value of the agreed upon key. When key agreement | Wrapping are employed, generate a random Content Encryption Key | |||
| without key wrapping is employed, let the Content Master Key | (CEK) value. See RFC 4086 [RFC4086] for considerations on | |||
| (CMK) be the agreed upon key. When key agreement with key | generating random values. The CEK MUST have a length equal to | |||
| wrapping is employed, the agreed upon key will be used to wrap | that required for the block encryption algorithm. | |||
| the CMK. | ||||
| 3. When key wrapping, key encryption, or key agreement with key | 3. When Direct Key Agreement or Key Agreement with Key Wrapping are | |||
| wrapping are employed, encrypt the CMK for the recipient (see | employed, use the key agreement algorithm to compute the value | |||
| of the agreed upon key. When Direct Key Agreement is employed, | ||||
| let the Content Encryption Key (CEK) be the agreed upon key. | ||||
| When Key Agreement with Key Wrapping is employed, the agreed | ||||
| upon key will be used to wrap the CEK. | ||||
| 4. When Key Wrapping, Key Encryption, or Key Agreement with Key | ||||
| Wrapping are employed, encrypt the CEK to the recipient (see | ||||
| Section 6.1) and let the result be the JWE Encrypted Key. | Section 6.1) and let the result be the JWE Encrypted Key. | |||
| Otherwise, when direct encryption with a shared or agreed upon | ||||
| symmetric key is employed, let the JWE Encrypted Key be the | ||||
| empty byte array. | ||||
| 4. When direct encryption with a shared symmetric key is employed, | 5. Otherwise, when Direct Key Agreement or Direct Encryption are | |||
| let the Content Master Key (CMK) be the shared key. | employed, let the JWE Encrypted Key be the empty octet sequence. | |||
| 5. Base64url encode the JWE Encrypted Key to create the Encoded JWE | 6. When Direct Encryption is employed, let the Content Encryption | |||
| Key (CEK) be the shared symmetric key. | ||||
| 7. Base64url encode the JWE Encrypted Key to create the Encoded JWE | ||||
| Encrypted Key. | Encrypted Key. | |||
| 6. Generate a random JWE Initialization Vector of the correct size | 8. 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 byte string. | empty octet sequence. | |||
| 7. Base64url encode the JWE Initialization Vector to create the | 9. Base64url encode the JWE Initialization Vector to create the | |||
| Encoded JWE Initialization Vector. | Encoded JWE Initialization Vector. | |||
| 8. Compress the Plaintext if a "zip" parameter was included. | 10. Compress the Plaintext if a "zip" parameter was included. | |||
| 9. Serialize the (compressed) Plaintext into a byte sequence M. | 11. Serialize the (compressed) Plaintext into an octet sequence M. | |||
| 10. Create a JWE Header containing the encryption parameters used. | 12. Create a JWE Header containing the encryption parameters used. | |||
| Note that white space is explicitly allowed in the | Note that white space is explicitly allowed in the | |||
| representation and no canonicalization need be performed before | representation and no canonicalization need be performed before | |||
| encoding. | encoding. | |||
| 11. Base64url encode the bytes of the UTF-8 representation of the | 13. Base64url encode the octets of the UTF-8 representation of the | |||
| JWE Header to create the Encoded JWE Header. | JWE Header to create the Encoded JWE Header. | |||
| 12. Let the "additional authenticated data" value be the bytes of | 14. Let the Additional Authenticated Data value be the octets of the | |||
| the ASCII representation of the concatenation of the Encoded JWE | ASCII representation of the concatenation of the Encoded JWE | |||
| Header, a period ('.') character, the Encoded JWE Encrypted Key, | Header, a period ('.') character, and the Encoded JWE Encrypted | |||
| a second period character ('.'), and the Encoded JWE | Key. | |||
| Initialization Vector. | ||||
| 13. Encrypt M using the CMK, the JWE Initialization Vector, and the | 15. 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 Integrity Value (which is the "authentication tag" output | JWE Authentication Tag (which is the Authentication Tag output | |||
| from the calculation). | from the calculation). | |||
| 14. Base64url encode the JWE Ciphertext to create the Encoded JWE | 16. Base64url encode the JWE Ciphertext to create the Encoded JWE | |||
| Ciphertext. | Ciphertext. | |||
| 15. Base64url encode the JWE Integrity Value to create the Encoded | 17. Base64url encode the JWE Authentication Tag to create the | |||
| JWE Integrity Value. | Encoded JWE Authentication Tag. | |||
| 16. The five encoded parts, taken together, are the result. | 18. The five encoded parts are the result values used in both the | |||
| JWE Compact Serialization and the JWE JSON Serialization | ||||
| representations. | ||||
| 17. The Compact Serialization of this result is the concatenation of | 19. If the JWE JSON Serialization is being used, repeat this process | |||
| the Encoded JWE Header, the Encoded JWE Encrypted Key, the | for each recipient. | |||
| Encoded JWE Initialization Vector, the Encoded JWE Ciphertext, | ||||
| and the Encoded JWE Integrity Value in that order, with the five | 20. Create the desired serialized output. The JWE Compact | |||
| strings being separated by four period ('.') characters. | Serialization of this result is the concatenation of the Encoded | |||
| JWE Header, the Encoded JWE Encrypted Key, the Encoded JWE | ||||
| Initialization Vector, the Encoded JWE Ciphertext, and the | ||||
| Encoded JWE Authentication Tag in that order, with the five | ||||
| strings being separated by four period ('.') characters. The | ||||
| JWE JSON Serialization is described in Section 7. | ||||
| 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. Determine the Encoded JWE Header, the Encoded JWE Encrypted Key, | 1. Parse the serialized input to determine the values of the | |||
| the Encoded JWE Initialization Vector, the Encoded JWE | Encoded JWE Header, the Encoded JWE Encrypted Key, the Encoded | |||
| Ciphertext, and the Encoded JWE Integrity Value values contained | JWE Initialization Vector, the Encoded JWE Ciphertext, and the | |||
| in the JWE. When using the Compact Serialization, these five | Encoded JWE Authentication Tag. When using the JWE Compact | |||
| values are represented in that order, separated by four period | Serialization, these five values are represented as text strings | |||
| ('.') characters. | in that order, separated by four period ('.') characters. The | |||
| JWE JSON Serialization is described in Section 7. | ||||
| 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 Integrity Value 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 Header MUST be completely valid JSON syntax | |||
| conforming to RFC 4627 [RFC4627]. | conforming to RFC 4627 [RFC4627]. | |||
| 4. The resulting JWE Header MUST be validated to only include | 4. The resulting JWE Header MUST be validated to only include | |||
| parameters and values whose syntax and semantics are both | parameters and values whose syntax and semantics are both | |||
| understood and supported. | understood and supported or that are specified as being ignored | |||
| when not understood. | ||||
| 5. Verify that the JWE uses a key known to the recipient. | 5. Determine the Key Management Mode employed by the algorithm | |||
| specified by the "alg" (algorithm) header parameter. | ||||
| 6. When key agreement is employed, use the key agreement algorithm | 6. Verify that the JWE uses a key known to the recipient. | |||
| to compute the value of the agreed upon key. When key agreement | ||||
| without key wrapping is employed, let the Content Master Key | ||||
| (CMK) be the agreed upon key. When key agreement with key | ||||
| wrapping is employed, the agreed upon key will be used to | ||||
| decrypt the JWE Encrypted Key. | ||||
| 7. When key wrapping, key encryption, or key agreement with key | 7. When Direct Key Agreement or Key Agreement with Key Wrapping are | |||
| wrapping are employed, decrypt the JWE Encrypted Key to produce | employed, use the key agreement algorithm to compute the value | |||
| the Content Master Key (CMK). The CMK MUST have a length equal | of the agreed upon key. When Direct Key Agreement is employed, | |||
| to that required for the block encryption algorithm. | let the Content Encryption Key (CEK) be the agreed upon key. | |||
| When Key Agreement with Key Wrapping is employed, the agreed | ||||
| upon key will be used to decrypt the JWE Encrypted Key. | ||||
| 8. When direct encryption with a shared symmetric key is employed, | 8. When Key Wrapping, Key Encryption, or Key Agreement with Key | |||
| let the Content Master Key (CMK) be the shared key. | Wrapping are employed, decrypt the JWE Encrypted Key to produce | |||
| the Content Encryption Key (CEK). The CEK MUST have a length | ||||
| equal to that required for the block encryption algorithm. To | ||||
| mitigate against attacks described in RFC 3218 [RFC3218], the | ||||
| recipient MUST NOT distinguish between format, padding, and | ||||
| length errors of encrypted keys. It is strongly recommended, in | ||||
| the event of receiving an improperly formatted key, that the | ||||
| receiver substitute a randomly generated CEK and proceed to the | ||||
| next step, to mitigate timing attacks. | ||||
| 9. Let the "additional authenticated data" value be the bytes of | 9. Otherwise, when Direct Key Agreement or Direct Encryption are | |||
| the ASCII representation of the concatenation of the Encoded JWE | employed, verify that the JWE Encrypted Key value is empty octet | |||
| Header, a period ('.') character, the Encoded JWE Encrypted Key, | sequence. | |||
| a second period character ('.'), and the Encoded JWE | ||||
| Initialization Vector. | ||||
| 10. Decrypt the JWE Ciphertext using the CMK, the JWE Initialization | 10. When Direct Encryption is employed, let the Content Encryption | |||
| Vector, the "additional authenticated data" value, and the JWE | Key (CEK) be the shared symmetric key. | |||
| Integrity Value (which is the "authentication tag" input to the | ||||
| 11. Let the Additional Authenticated Data value be the octets of the | ||||
| ASCII representation of the concatenation of the Encoded JWE | ||||
| Header, a period ('.') character, and the Encoded JWE Encrypted | ||||
| Key. | ||||
| 12. Decrypt the JWE Ciphertext using the CEK, the JWE Initialization | ||||
| Vector, the Additional Authenticated Data value, and the JWE | ||||
| 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 | |||
| Integrity Value 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 Integrity Value is incorrect. | JWE Authentication Tag is incorrect. | |||
| 11. Uncompress the decrypted plaintext if a "zip" parameter was | 13. Uncompress the decrypted plaintext if a "zip" parameter was | |||
| included. | included. | |||
| 12. Output the resulting Plaintext. | 14. Output the resulting Plaintext. | |||
| 15. If the JWE JSON Serialization is being used, repeat this process | ||||
| for each recipient contained in the representation. | ||||
| 5.3. String Comparison Rules | 5.3. String Comparison Rules | |||
| 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. Encrypting JWEs with Cryptographic Algorithms | |||
| JWE uses cryptographic algorithms to encrypt the Plaintext and the | JWE uses cryptographic algorithms to encrypt the Plaintext and the | |||
| Content Encryption Key (CMK) and to provide integrity protection for | Content Encryption Key (CEK) and to provide integrity protection for | |||
| the JWE Header, JWE Encrypted Key, and JWE Ciphertext. The JSON Web | the JWE Header, JWE Encrypted Key, and JWE Ciphertext. The JSON Web | |||
| Algorithms (JWA) [JWA] specification specifies a set of cryptographic | Algorithms (JWA) [JWA] specification specifies a set of cryptographic | |||
| algorithms and identifiers to be used with this specification and | algorithms and identifiers to be used with this specification and | |||
| defines registries for additional such algorithms. Specifically, | defines registries for additional such algorithms. Specifically, | |||
| Section 4.1 specifies a set of "alg" (algorithm) header parameter | Section 4.1 specifies a set of "alg" (algorithm) header parameter | |||
| values and Section 4.2 specifies a set of "enc" (encryption method) | values and Section 4.2 specifies a set of "enc" (encryption method) | |||
| header parameter values intended for use this specification. It also | header 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 | Public keys employed for encryption can be identified using the | |||
| Header Parameter methods described in Section 4.1 or can be | Header Parameter methods described in Section 4.1 or can be | |||
| distributed using methods that are outside the scope of this | distributed using methods that are outside the scope of this | |||
| specification. | specification. | |||
| 6.1. CMK Encryption | 6.1. CEK Encryption | |||
| JWE supports three forms of Content Master Key (CMK) 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 CMK encryption. | encryption algorithms that can be used for CEK encryption. | |||
| 7. IANA Considerations | 7. JSON Serialization | |||
| 7.1. Registration of JWE Header Parameter Names | 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, and a "ciphertext" | ||||
| member containing a shared Encoded JWE Ciphertext value. Each member | ||||
| of the "recipients" array is a JSON object with a "header" member | ||||
| containing an Encoded JWE Header value, an "encrypted_key" member | ||||
| containing an Encoded JWE Encrypted Key value, and an | ||||
| "authentication_tag" member containing an Encoded JWE Authentication | ||||
| Tag value. | ||||
| Unlike the JWE Compact Serialization, content using the JWE JSON | ||||
| Serialization MAY be encrypted to more than one recipient. Each | ||||
| recipient requires: | ||||
| o a JWE Header value specifying the cryptographic parameters used to | ||||
| 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 | ||||
| represented as an Encoded JWE Encrypted Key value in the | ||||
| "encrypted_key" member of the same object in the "recipients" | ||||
| array. | ||||
| o a JWE Authentication Tag that ensures the integrity of the | ||||
| Ciphertext and the parameters used to create it; this is | ||||
| represented as an Encoded JWE Authentication Tag value in the | ||||
| "authentication_tag" member of the same object in the "recipients" | ||||
| array. | ||||
| Therefore, the syntax is: | ||||
| {"recipients":[ | ||||
| {"header":"<header 1 contents>", | ||||
| "encrypted_key":"<encrypted key 1 contents>", | ||||
| "authentication_tag":"<authentication tag 1 contents>"}, | ||||
| ... | ||||
| {"header":"<header N contents>", | ||||
| "encrypted_key":"<encrypted key N contents>", | ||||
| "authentication_tag":"<authentication tag N contents>"}], | ||||
| "initialization_vector":"<initialization vector contents>", | ||||
| "ciphertext":"<ciphertext contents>" | ||||
| } | ||||
| The contents of the Encoded JWE Header, Encoded JWE Encrypted Key, | ||||
| Encoded JWE Initialization Vector, Encoded JWE Ciphertext, and | ||||
| 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", "encrypted_key", | ||||
| and "authentication_tag" value being created and validated together. | ||||
| Each JWE Encrypted Key value and the corresponding JWE Authentication | ||||
| Tag are computed using the parameters of the corresponding JWE Header | ||||
| value in the same manner as for the JWE Compact Serialization. This | ||||
| has the desirable result that each Encoded JWE Encrypted Key value in | ||||
| the "recipients" array and each Encoded JWE Authentication Tag in the | ||||
| same array element are identical to the values that would have been | ||||
| computed for the same parameters in the JWE Compact Serialization, as | ||||
| are the shared JWE Ciphertext and JWE Initialization Vector values. | ||||
| All recipients use the same JWE Ciphertext and JWE Initialization | ||||
| Vector values, resulting in potentially 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 | ||||
| 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 first using the | ||||
| RSAES-PKCS1-V1_5 algorithm to encrypt the Content Encryption Key | ||||
| (CEK) and the second using RSAES OAEP to encrypt the CEK. The | ||||
| Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 algorithm | ||||
| and the same block encryption parameters to produce the common JWE | ||||
| Ciphertext value. The two Decoded JWE Header Segments used are: | ||||
| {"alg":"RSA1_5","enc":"A128CBC-HS256"} | ||||
| and: | ||||
| {"alg":"RSA-OAEP","enc":"A128CBC-HS256"} | ||||
| The keys used for the first recipient are the same as those in | ||||
| Appendix A.2, as is the Plaintext used. The encryption key used for | ||||
| the second recipient is the same as that used in Appendix A.3; the | ||||
| block encryption keys and parameters for the second recipient are the | ||||
| same as those for the first recipient (which must be the case, since | ||||
| the Initialization Vector and Ciphertext are shared). | ||||
| The complete JSON Web Encryption JSON Serialization (JWE-JS) for | ||||
| these values is as follows (with line breaks for display purposes | ||||
| only): | ||||
| {"recipients":[ | ||||
| {"header": | ||||
| "eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0", | ||||
| "encrypted_key": | ||||
| "nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMk | ||||
| mOmkkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZ | ||||
| jDYENRWiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfE | ||||
| JmNmfsx5fcB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWy | ||||
| EHW6WzQ4iH9SIcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_N | ||||
| Ssx24LxtK6fIkejRlMBmCfxv0Tg8CtxpURigg", | ||||
| "authentication_tag": | ||||
| "fY2U_Hx5VcfXmipEldHhMA"}, | ||||
| {"header": | ||||
| "eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0", | ||||
| "encrypted_key": | ||||
| "6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ", | ||||
| "authentication_tag": | ||||
| "CEH4ZS25HNrocFNPVN0SrA"}], | ||||
| "initialization_vector": | ||||
| "AxY8DCtDaGlsbGljb3RoZQ", | ||||
| "ciphertext": | ||||
| "KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY" | ||||
| } | ||||
| 8. Implementation Considerations | ||||
| The JWE Compact Serialization is mandatory to implement. | ||||
| Implementation of the JWE JSON Serialization is OPTIONAL. | ||||
| 9. IANA Considerations | ||||
| 9.1. Registration of JWE Header Parameter Names | ||||
| This specification registers the Header Parameter Names defined in | This specification registers the Header Parameter Names defined in | |||
| Section 4.1 in the IANA JSON Web Signature and Encryption Header | Section 4.1 in the IANA JSON Web Signature and Encryption Header | |||
| Parameters registry [JWS]. | Parameters registry [JWS]. | |||
| 7.1.1. Registry Contents | 9.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 22, line 29 ¶ | skipping to change at page 26, line 23 ¶ | |||
| 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 Name: "apv" | |||
| 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.14 of [[ this document ]] | o Specification Document(s): Section 4.1.14 of [[ this document ]] | |||
| o Header Parameter Name: "epu" | o Header Parameter Name: "crit" | |||
| o Header Parameter Usage Location(s): JWE | 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.15 of [[ this document ]] | |||
| o Header Parameter Name: "epv" | 9.2. JSON Web Signature and Encryption Type Values Registration | |||
| o Header Parameter Usage Location(s): JWE | ||||
| o Change Controller: IETF | ||||
| o Specification Document(s): Section 4.1.16 of [[ this document ]] | ||||
| 7.2. JSON Web Signature and Encryption Type Values Registration | ||||
| 7.2.1. Registry Contents | 9.2.1. Registry Contents | |||
| This specification registers the "JWE" type value in the IANA JSON | This specification registers the "JWE" and "JWE-JS" type values in | |||
| Web Signature and Encryption Type Values registry [JWS]: | the IANA JSON Web Signature and Encryption Type Values registry | |||
| [JWS]: | ||||
| o "typ" Header Parameter Value: "JWE" | o "typ" Header Parameter Value: "JWE" | |||
| o Abbreviation for MIME Type: application/jwe | o Abbreviation for MIME Type: application/jwe | |||
| o Change Controller: IETF | o Change Controller: IETF | |||
| o Specification Document(s): Section 4.1.11 of [[ this document ]] | o Specification Document(s): Section 4.1.11 of [[ this document ]] | |||
| 7.3. Media Type Registration | o "typ" Header Parameter Value: "JWE-JS" | |||
| o Abbreviation for MIME Type: application/jwe-js | ||||
| o Change Controller: IETF | ||||
| o Specification Document(s): Section 4.1.11 of [[ this document ]] | ||||
| 7.3.1. Registry Contents | 9.3. Media Type Registration | |||
| This specification registers the "application/jwe" Media Type | 9.3.1. Registry Contents | |||
| [RFC2046] in the MIME Media Type registry [RFC4288] to indicate that | ||||
| the content is a JWE using the Compact Serialization. | This specification registers the "application/jwe" and | |||
| "application/jwe-js" Media Types [RFC2046] in the MIME Media Type | ||||
| registry [RFC4288] to indicate, respectively, that the content is a | ||||
| JWE using the JWE Compact Serialization or a JWE using the JWE JSON | ||||
| Serialization. | ||||
| o Type Name: application | o Type Name: application | |||
| o Subtype Name: jwe | o Subtype Name: jwe | |||
| o Required Parameters: n/a | o Required Parameters: n/a | |||
| o Optional Parameters: n/a | o Optional Parameters: n/a | |||
| o Encoding considerations: JWE values are encoded as a series of | o Encoding considerations: JWE values are encoded as a series of | |||
| base64url encoded values (some of which may be the empty string) | base64url encoded values (some of which may be the empty string) | |||
| separated by period ('.') characters | separated by period ('.') characters | |||
| o Security Considerations: See the Security Considerations section | o Security Considerations: See the Security Considerations section | |||
| of this document | of [[ this document ]] | |||
| o Interoperability Considerations: n/a | o Interoperability Considerations: n/a | |||
| o Published Specification: [[ this document ]] | o Published Specification: [[ this document ]] | |||
| o Applications that use this media type: OpenID Connect and other | o Applications that use this media type: OpenID Connect and other | |||
| applications using encrypted JWTs | applications using encrypted JWTs | |||
| o Additional Information: Magic number(s): n/a, File extension(s): | o Additional Information: Magic number(s): n/a, File extension(s): | |||
| n/a, Macintosh file type code(s): n/a | n/a, Macintosh file type code(s): n/a | |||
| o Person & email address to contact for further information: Michael | o Person & email address to contact for further information: Michael | |||
| B. Jones, mbj@microsoft.com | B. Jones, mbj@microsoft.com | |||
| o Intended Usage: COMMON | o Intended Usage: COMMON | |||
| o Restrictions on Usage: none | o Restrictions on Usage: none | |||
| o Author: Michael B. Jones, mbj@microsoft.com | o Author: Michael B. Jones, mbj@microsoft.com | |||
| o Change Controller: IETF | o Change Controller: IETF | |||
| 8. Security Considerations | o Type Name: application | |||
| o Subtype Name: jwe-js | ||||
| o Required Parameters: n/a | ||||
| o Optional Parameters: n/a | ||||
| o Encoding considerations: JWE-JS values are represented as a JSON | ||||
| Object; UTF-8 encoding SHOULD be employed for the JSON object. | ||||
| o Security Considerations: See the Security Considerations section | ||||
| of [[ this document ]] | ||||
| o Interoperability Considerations: n/a | ||||
| o Published Specification: [[ this document ]] | ||||
| o Applications that use this media type: TBD | ||||
| o Additional Information: Magic number(s): n/a, File extension(s): | ||||
| n/a, Macintosh file type code(s): n/a | ||||
| o Person & email address to contact for further information: Michael | ||||
| B. Jones, mbj@microsoft.com | ||||
| o Intended Usage: COMMON | ||||
| o Restrictions on Usage: none | ||||
| o Author: Michael B. Jones, mbj@microsoft.com | ||||
| o Change Controller: IETF | ||||
| 10. Security Considerations | ||||
| All of the security issues faced by any cryptographic application | All of the security issues faced by any cryptographic application | |||
| must be faced by a JWS/JWE/JWK agent. Among these issues are | must be faced by a JWS/JWE/JWK agent. Among these issues are | |||
| protecting the user's private 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 | |||
| XML Encryption 1.1 [W3C.CR-xmlenc-core1-20120313] also apply to JWE, | XML Encryption 1.1 [W3C.CR-xmlenc-core1-20120313] also apply, other | |||
| other than those that are XML specific. | than those that are XML specific. | |||
| 9. References | When decrypting, particular care must be taken not to allow the JWE | |||
| 9.1. Normative References | recipient to be used as an oracle for decrypting messages. RFC 3218 | |||
| [RFC3218] should be consulted for specific countermeasures to attacks | ||||
| 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 | ||||
| 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 | ||||
| particularly important to report all formatting errors to the CEK, | ||||
| Additional Authenticated Data, or ciphertext as a single error when | ||||
| the JWE is rejected. | ||||
| AES GCM MUST NOT be used when using the JWE JSON Serialization for | ||||
| multiple recipients, since this would result in the same | ||||
| Initialization Vector and Plaintext values being used for multiple | ||||
| GCM encryptions. This is prohibited by the GCM specification because | ||||
| of severe security vulnerabilities that would result, were GCM used | ||||
| in this way. | ||||
| 11. References | ||||
| 11.1. Normative References | ||||
| [ITU.X690.1994] | [ITU.X690.1994] | |||
| International Telecommunications Union, "Information | International Telecommunications Union, "Information | |||
| Technology - ASN.1 encoding rules: Specification of Basic | Technology - ASN.1 encoding rules: Specification of Basic | |||
| Encoding Rules (BER), Canonical Encoding Rules (CER) and | Encoding Rules (BER), Canonical Encoding Rules (CER) and | |||
| Distinguished Encoding Rules (DER)", ITU-T Recommendation | Distinguished Encoding Rules (DER)", ITU-T Recommendation | |||
| X.690, 1994. | X.690, 1994. | |||
| [JWA] Jones, M., "JSON Web Algorithms (JWA)", | [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), | |||
| December 2012. | April 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), | |||
| December 2012. | 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), December 2012. | in progress), April 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 25, line 4 ¶ | skipping to change at page 29, line 40 ¶ | |||
| 10646", STD 63, RFC 3629, November 2003. | 10646", STD 63, RFC 3629, November 2003. | |||
| [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform | [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform | |||
| Resource Identifier (URI): Generic Syntax", STD 66, | Resource Identifier (URI): Generic Syntax", STD 66, | |||
| RFC 3986, January 2005. | RFC 3986, January 2005. | |||
| [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness | [RFC4086] Eastlake, D., Schiller, J., and S. Crocker, "Randomness | |||
| Requirements for Security", BCP 106, RFC 4086, June 2005. | Requirements for Security", BCP 106, RFC 4086, June 2005. | |||
| [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and | [RFC4288] Freed, N. and J. Klensin, "Media Type Specifications and | |||
| Registration Procedures", BCP 13, RFC 4288, December 2005. | Registration Procedures", RFC 4288, December 2005. | |||
| [RFC4627] Crockford, D., "The application/json Media Type for | [RFC4627] Crockford, D., "The application/json Media Type for | |||
| JavaScript Object Notation (JSON)", RFC 4627, July 2006. | JavaScript Object Notation (JSON)", RFC 4627, July 2006. | |||
| [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data | [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data | |||
| Encodings", RFC 4648, October 2006. | Encodings", RFC 4648, October 2006. | |||
| [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security | [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security | |||
| (TLS) Protocol Version 1.2", RFC 5246, August 2008. | (TLS) Protocol Version 1.2", RFC 5246, August 2008. | |||
| skipping to change at page 25, line 27 ¶ | skipping to change at page 30, line 14 ¶ | |||
| 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>. | |||
| 9.2. Informative References | 11.2. Informative References | |||
| [I-D.mcgrew-aead-aes-cbc-hmac-sha2] | ||||
| McGrew, D. and K. Paterson, "Authenticated Encryption with | ||||
| AES-CBC and HMAC-SHA", | ||||
| draft-mcgrew-aead-aes-cbc-hmac-sha2-01 (work in progress), | ||||
| 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. | |||
| [JWE-JS] Jones, M., "JSON Web Encryption JSON Serialization | [JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token | |||
| (JWE-JS)", draft-jones-jose-jwe-json-serialization (work | (JWT)", draft-ietf-oauth-json-web-token (work in | |||
| in progress), December 2012. | progress), April 2013. | |||
| [RFC3218] Rescorla, E., "Preventing the Million Message Attack on | ||||
| 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. | |||
| Appendix A. JWE Examples | Appendix A. JWE Examples | |||
| This section provides examples of JWE computations. | This section provides examples of JWE computations. | |||
| A.1. Example JWE using RSAES OAEP and AES GCM | A.1. Example JWE using RSAES OAEP and AES GCM | |||
| This example encrypts the plaintext "Live long and prosper." to the | This example encrypts the plaintext "The true sign of intelligence is | |||
| recipient using RSAES OAEP and AES GCM. The AES GCM algorithm has an | not knowledge but imagination." to the recipient using RSAES OAEP and | |||
| integrated integrity check. The representation of this plaintext is: | AES GCM. The representation of this plaintext is: | |||
| [76, 105, 118, 101, 32, 108, 111, 110, 103, 32, 97, 110, 100, 32, | [84, 104, 101, 32, 116, 114, 117, 101, 32, 115, 105, 103, 110, 32, | |||
| 112, 114, 111, 115, 112, 101, 114, 46] | 111, 102, 32, 105, 110, 116, 101, 108, 108, 105, 103, 101, 110, 99, | |||
| 101, 32, 105, 115, 32, 110, 111, 116, 32, 107, 110, 111, 119, 108, | ||||
| 101, 100, 103, 101, 32, 98, 117, 116, 32, 105, 109, 97, 103, 105, | ||||
| 110, 97, 116, 105, 111, 110, 46] | ||||
| A.1.1. JWE Header | A.1.1. JWE Header | |||
| The following example JWE Header declares that: | The following example JWE Header declares that: | |||
| o the Content Master Key is encrypted to the recipient using the | o the Content 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 | |||
| o the Plaintext is encrypted using the AES GCM algorithm with a 256 | o the Plaintext is encrypted using the AES GCM algorithm with a 256 | |||
| bit key to produce the Ciphertext. | bit key to produce the Ciphertext. | |||
| {"alg":"RSA-OAEP","enc":"A256GCM"} | {"alg":"RSA-OAEP","enc":"A256GCM"} | |||
| A.1.2. Encoded JWE Header | A.1.2. Encoded JWE Header | |||
| Base64url encoding the bytes of the UTF-8 representation of the JWE | Base64url encoding the 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 | |||
| A.1.3. Content Master Key (CMK) | A.1.3. Content Encryption Key (CEK) | |||
| Generate a 256 bit random Content Master Key (CMK). In this example, | Generate a 256 bit random Content Encryption Key (CEK). In this | |||
| the value is: | example, the value is: | |||
| [177, 161, 244, 128, 84, 143, 225, 115, 63, 180, 3, 255, 107, 154, | [177, 161, 244, 128, 84, 143, 225, 115, 63, 180, 3, 255, 107, 154, | |||
| 212, 246, 138, 7, 110, 91, 112, 46, 34, 105, 47, 130, 203, 46, 122, | 212, 246, 138, 7, 110, 91, 112, 46, 34, 105, 47, 130, 203, 46, 122, | |||
| 234, 64, 252] | 234, 64, 252] | |||
| A.1.4. Key Encryption | A.1.4. Key Encryption | |||
| Encrypt the CMK with the recipient's public key using the RSAES OAEP | Encrypt the CEK with the recipient's public key using the RSAES OAEP | |||
| algorithm to produce the JWE Encrypted Key. In this example, the RSA | algorithm to produce the JWE Encrypted Key. In this example, the RSA | |||
| key parameters are: | key parameters are: | |||
| +-----------+-------------------------------------------------------+ | +-----------+-------------------------------------------------------+ | |||
| | Parameter | Value | | | Parameter | Value | | |||
| | Name | | | | Name | | | |||
| +-----------+-------------------------------------------------------+ | +-----------+-------------------------------------------------------+ | |||
| | Modulus | [161, 168, 84, 34, 133, 176, 208, 173, 46, 176, 163, | | | Modulus | [161, 168, 84, 34, 133, 176, 208, 173, 46, 176, 163, | | |||
| | | 110, 57, 30, 135, 227, 9, 31, 226, 128, 84, 92, 116, | | | | 110, 57, 30, 135, 227, 9, 31, 226, 128, 84, 92, 116, | | |||
| | | 241, 70, 248, 27, 227, 193, 62, 5, 91, 241, 145, 224, | | | | 241, 70, 248, 27, 227, 193, 62, 5, 91, 241, 145, 224, | | |||
| skipping to change at page 28, 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: | |||
| [51, 101, 241, 165, 179, 145, 41, 236, 202, 75, 60, 208, 47, 255, | [2, 151, 206, 44, 38, 131, 110, 171, 63, 37, 115, 216, 203, 98, 61, | |||
| 121, 248, 104, 226, 185, 212, 65, 78, 169, 255, 162, 100, 188, 207, | 223, 187, 255, 198, 106, 243, 143, 226, 44, 179, 89, 134, 232, 208, | |||
| 220, 96, 161, 22, 251, 47, 66, 112, 229, 75, 4, 111, 25, 173, 200, | 7, 153, 226, 85, 136, 206, 163, 218, 93, 12, 30, 247, 236, 120, 135, | |||
| 121, 246, 79, 189, 102, 173, 146, 228, 142, 14, 12, 167, 200, 27, | 71, 87, 37, 54, 4, 138, 6, 86, 239, 104, 134, 249, 36, 90, 36, 106, | |||
| 133, 138, 37, 180, 249, 4, 56, 123, 192, 162, 156, 246, 231, 235, | 228, 50, 246, 141, 134, 83, 60, 15, 83, 1, 220, 42, 220, 85, 8, 87, | |||
| 217, 240, 45, 158, 213, 195, 154, 2, 142, 86, 61, 198, 210, 34, 225, | 42, 7, 248, 247, 157, 127, 167, 165, 28, 133, 69, 139, 98, 134, 12, | |||
| 92, 7, 128, 227, 4, 227, 55, 183, 69, 0, 59, 162, 71, 145, 98, 238, | 75, 41, 96, 203, 80, 1, 19, 12, 72, 23, 18, 238, 155, 37, 199, 167, | |||
| 0, 70, 40, 123, 159, 37, 115, 18, 16, 157, 236, 138, 117, 166, 18, | 229, 135, 80, 159, 135, 113, 129, 43, 43, 51, 181, 83, 4, 133, 159, | |||
| 45, 181, 125, 112, 170, 168, 82, 129, 80, 166, 242, 150, 97, 17, 217, | 230, 104, 89, 38, 224, 246, 21, 10, 194, 108, 190, 174, 130, 183, | |||
| 109, 251, 51, 35, 39, 236, 107, 95, 43, 154, 4, 227, 206, 187, 75, | 119, 224, 216, 34, 79, 58, 205, 23, 212, 49, 238, 197, 146, 168, 32, | |||
| 13, 51, 231, 115, 79, 67, 72, 145, 54, 225, 164, 60, 195, 120, 188, | 98, 42, 113, 183, 138, 225, 113, 14, 229, 173, 33, 229, 48, 46, 36, | |||
| 69, 113, 3, 182, 21, 189, 79, 82, 122, 46, 196, 199, 254, 252, 7, | 230, 202, 117, 243, 180, 116, 172, 31, 53, 36, 155, 166, 238, 108, | |||
| 119, 5, 32, 144, 143, 173, 11, 99, 205, 120, 106, 231, 51, 231, 77, | 22, 186, 81, 23, 5, 118, 21, 52, 216, 162, 161, 120, 204, 142, 58, | |||
| 73, 252, 197, 221, 142, 254, 151, 7, 6, 203, 65, 108, 117, 121, 15, | 55, 223, 191, 132, 194, 51, 158, 81, 41, 126, 212, 87, 133, 39, 4, | |||
| 95, 43, 111, 13, 94, 242, 226, 150, 94, 121, 72, 144, 251, 69, 93, | 38, 230, 125, 28, 111, 2, 240, 33, 193, 213, 100, 89, 252, 158, 60, | |||
| 137, 178, 13, 216, 8, 227, 125, 110, 180, 157, 250, 207, 184, 232, | 62, 87, 170, 118, 17, 120, 163, 183, 193, 228, 157, 112, 22, 165, 23, | |||
| 222, 164, 193, 70, 232, 16, 65, 109, 29, 251, 164, 119, 50, 205, 236, | 6, 214, 237, 184, 98, 127, 3, 101, 222, 232, 1, 33, 174, 92, 194, 59] | |||
| 109, 245, 234, 78, 1] | ||||
| A.1.5. Encoded JWE Encrypted Key | A.1.5. Encoded JWE Encrypted Key | |||
| Base64url encode the JWE Encrypted Key to produce the Encoded JWE | Base64url encode the JWE Encrypted Key to produce the Encoded JWE | |||
| Encrypted Key. This result (with line breaks for display purposes | Encrypted Key. This result (with line breaks for display purposes | |||
| only) is: | only) is: | |||
| M2XxpbORKezKSzzQL_95-GjiudRBTqn_omS8z9xgoRb7L0Jw5UsEbxmtyHn2T71m | ApfOLCaDbqs_JXPYy2I937v_xmrzj-Iss1mG6NAHmeJViM6j2l0MHvfseIdHVyU2 | |||
| rZLkjg4Mp8gbhYoltPkEOHvAopz25-vZ8C2e1cOaAo5WPcbSIuFcB4DjBOM3t0UA | BIoGVu9ohvkkWiRq5DL2jYZTPA9TAdwq3FUIVyoH-Pedf6elHIVFi2KGDEspYMtQ | |||
| O6JHkWLuAEYoe58lcxIQneyKdaYSLbV9cKqoUoFQpvKWYRHZbfszIyfsa18rmgTj | ARMMSBcS7pslx6flh1Cfh3GBKysztVMEhZ_maFkm4PYVCsJsvq6Ct3fg2CJPOs0X | |||
| zrtLDTPnc09DSJE24aQ8w3i8RXEDthW9T1J6LsTH_vwHdwUgkI-tC2PNeGrnM-dN | 1DHuxZKoIGIqcbeK4XEO5a0h5TAuJObKdfO0dKwfNSSbpu5sFrpRFwV2FTTYoqF4 | |||
| SfzF3Y7-lwcGy0FsdXkPXytvDV7y4pZeeUiQ-0VdibIN2AjjfW60nfrPuOjepMFG | zI46N9-_hMIznlEpftRXhScEJuZ9HG8C8CHB1WRZ_J48PleqdhF4o7fB5J1wFqUX | |||
| 6BBBbR37pHcyzext9epOAQ | BtbtuGJ_A2Xe6AEhrlzCOw | |||
| 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 Parameter | |||
| Concatenate the Encoded JWE Header value, a period character ('.'), | Concatenate the Encoded JWE Header value, a period ('.') character, | |||
| the Encoded JWE Encrypted Key, a second period character ('.'), and | and the Encoded JWE Encrypted Key to create the Additional | |||
| the Encoded JWE Initialization Vector to create the "additional | Authenticated Data parameter. This result (with line breaks for | |||
| authenticated data" parameter for the AES GCM algorithm. This result | display purposes only) is: | |||
| (with line breaks for display purposes only) is: | ||||
| eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ. | eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ. | |||
| M2XxpbORKezKSzzQL_95-GjiudRBTqn_omS8z9xgoRb7L0Jw5UsEbxmtyHn2T71m | ApfOLCaDbqs_JXPYy2I937v_xmrzj-Iss1mG6NAHmeJViM6j2l0MHvfseIdHVyU2 | |||
| rZLkjg4Mp8gbhYoltPkEOHvAopz25-vZ8C2e1cOaAo5WPcbSIuFcB4DjBOM3t0UA | BIoGVu9ohvkkWiRq5DL2jYZTPA9TAdwq3FUIVyoH-Pedf6elHIVFi2KGDEspYMtQ | |||
| O6JHkWLuAEYoe58lcxIQneyKdaYSLbV9cKqoUoFQpvKWYRHZbfszIyfsa18rmgTj | ARMMSBcS7pslx6flh1Cfh3GBKysztVMEhZ_maFkm4PYVCsJsvq6Ct3fg2CJPOs0X | |||
| zrtLDTPnc09DSJE24aQ8w3i8RXEDthW9T1J6LsTH_vwHdwUgkI-tC2PNeGrnM-dN | 1DHuxZKoIGIqcbeK4XEO5a0h5TAuJObKdfO0dKwfNSSbpu5sFrpRFwV2FTTYoqF4 | |||
| SfzF3Y7-lwcGy0FsdXkPXytvDV7y4pZeeUiQ-0VdibIN2AjjfW60nfrPuOjepMFG | zI46N9-_hMIznlEpftRXhScEJuZ9HG8C8CHB1WRZ_J48PleqdhF4o7fB5J1wFqUX | |||
| 6BBBbR37pHcyzext9epOAQ. | BtbtuGJ_A2Xe6AEhrlzCOw | |||
| 48V1_ALb6US04U3b | ||||
| The representation of this value is: | The representation of this value is: | |||
| [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 48, 69, | [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 48, 69, | |||
| 116, 84, 48, 70, 70, 85, 67, 73, 115, 73, 109, 86, 117, 89, 121, 73, | 116, 84, 48, 70, 70, 85, 67, 73, 115, 73, 109, 86, 117, 89, 121, 73, | |||
| 54, 73, 107, 69, 121, 78, 84, 90, 72, 81, 48, 48, 105, 102, 81, 46, | 54, 73, 107, 69, 121, 78, 84, 90, 72, 81, 48, 48, 105, 102, 81, 46, | |||
| 77, 50, 88, 120, 112, 98, 79, 82, 75, 101, 122, 75, 83, 122, 122, 81, | 65, 112, 102, 79, 76, 67, 97, 68, 98, 113, 115, 95, 74, 88, 80, 89, | |||
| 76, 95, 57, 53, 45, 71, 106, 105, 117, 100, 82, 66, 84, 113, 110, 95, | 121, 50, 73, 57, 51, 55, 118, 95, 120, 109, 114, 122, 106, 45, 73, | |||
| 111, 109, 83, 56, 122, 57, 120, 103, 111, 82, 98, 55, 76, 48, 74, | 115, 115, 49, 109, 71, 54, 78, 65, 72, 109, 101, 74, 86, 105, 77, 54, | |||
| 119, 53, 85, 115, 69, 98, 120, 109, 116, 121, 72, 110, 50, 84, 55, | 106, 50, 108, 48, 77, 72, 118, 102, 115, 101, 73, 100, 72, 86, 121, | |||
| 49, 109, 114, 90, 76, 107, 106, 103, 52, 77, 112, 56, 103, 98, 104, | 85, 50, 66, 73, 111, 71, 86, 117, 57, 111, 104, 118, 107, 107, 87, | |||
| 89, 111, 108, 116, 80, 107, 69, 79, 72, 118, 65, 111, 112, 122, 50, | 105, 82, 113, 53, 68, 76, 50, 106, 89, 90, 84, 80, 65, 57, 84, 65, | |||
| 53, 45, 118, 90, 56, 67, 50, 101, 49, 99, 79, 97, 65, 111, 53, 87, | 100, 119, 113, 51, 70, 85, 73, 86, 121, 111, 72, 45, 80, 101, 100, | |||
| 80, 99, 98, 83, 73, 117, 70, 99, 66, 52, 68, 106, 66, 79, 77, 51, | 102, 54, 101, 108, 72, 73, 86, 70, 105, 50, 75, 71, 68, 69, 115, 112, | |||
| 116, 48, 85, 65, 79, 54, 74, 72, 107, 87, 76, 117, 65, 69, 89, 111, | 89, 77, 116, 81, 65, 82, 77, 77, 83, 66, 99, 83, 55, 112, 115, 108, | |||
| 101, 53, 56, 108, 99, 120, 73, 81, 110, 101, 121, 75, 100, 97, 89, | 120, 54, 102, 108, 104, 49, 67, 102, 104, 51, 71, 66, 75, 121, 115, | |||
| 83, 76, 98, 86, 57, 99, 75, 113, 111, 85, 111, 70, 81, 112, 118, 75, | 122, 116, 86, 77, 69, 104, 90, 95, 109, 97, 70, 107, 109, 52, 80, 89, | |||
| 87, 89, 82, 72, 90, 98, 102, 115, 122, 73, 121, 102, 115, 97, 49, 56, | 86, 67, 115, 74, 115, 118, 113, 54, 67, 116, 51, 102, 103, 50, 67, | |||
| 114, 109, 103, 84, 106, 122, 114, 116, 76, 68, 84, 80, 110, 99, 48, | 74, 80, 79, 115, 48, 88, 49, 68, 72, 117, 120, 90, 75, 111, 73, 71, | |||
| 57, 68, 83, 74, 69, 50, 52, 97, 81, 56, 119, 51, 105, 56, 82, 88, 69, | 73, 113, 99, 98, 101, 75, 52, 88, 69, 79, 53, 97, 48, 104, 53, 84, | |||
| 68, 116, 104, 87, 57, 84, 49, 74, 54, 76, 115, 84, 72, 95, 118, 119, | 65, 117, 74, 79, 98, 75, 100, 102, 79, 48, 100, 75, 119, 102, 78, 83, | |||
| 72, 100, 119, 85, 103, 107, 73, 45, 116, 67, 50, 80, 78, 101, 71, | 83, 98, 112, 117, 53, 115, 70, 114, 112, 82, 70, 119, 86, 50, 70, 84, | |||
| 114, 110, 77, 45, 100, 78, 83, 102, 122, 70, 51, 89, 55, 45, 108, | 84, 89, 111, 113, 70, 52, 122, 73, 52, 54, 78, 57, 45, 95, 104, 77, | |||
| 119, 99, 71, 121, 48, 70, 115, 100, 88, 107, 80, 88, 121, 116, 118, | 73, 122, 110, 108, 69, 112, 102, 116, 82, 88, 104, 83, 99, 69, 74, | |||
| 68, 86, 55, 121, 52, 112, 90, 101, 101, 85, 105, 81, 45, 48, 86, 100, | 117, 90, 57, 72, 71, 56, 67, 56, 67, 72, 66, 49, 87, 82, 90, 95, 74, | |||
| 105, 98, 73, 78, 50, 65, 106, 106, 102, 87, 54, 48, 110, 102, 114, | 52, 56, 80, 108, 101, 113, 100, 104, 70, 52, 111, 55, 102, 66, 53, | |||
| 80, 117, 79, 106, 101, 112, 77, 70, 71, 54, 66, 66, 66, 98, 82, 51, | 74, 49, 119, 70, 113, 85, 88, 66, 116, 98, 116, 117, 71, 74, 95, 65, | |||
| 55, 112, 72, 99, 121, 122, 101, 120, 116, 57, 101, 112, 79, 65, 81, | 50, 88, 101, 54, 65, 69, 104, 114, 108, 122, 67, 79, 119] | |||
| 46, 52, 56, 86, 49, 95, 65, 76, 98, 54, 85, 83, 48, 52, 85, 51, 98] | ||||
| A.1.8. Plaintext Encryption | A.1.8. Plaintext Encryption | |||
| Encrypt the Plaintext with AES GCM using the CMK 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: | |||
| [253, 237, 181, 180, 97, 161, 105, 207, 233, 120, 65, 100, 45, 122, | [229, 236, 166, 241, 53, 191, 115, 196, 174, 43, 73, 109, 39, 122, | |||
| 246, 116, 195, 212, 102, 37, 36, 175] | 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, | ||||
| 123, 143, 168, 226, 73, 216, 176, 144, 138, 247, 106, 60, 16, 205, | ||||
| 160, 109, 64, 63, 192] | ||||
| The resulting "authentication tag" value is: | The resulting Authentication Tag value is: | |||
| [237, 94, 89, 14, 74, 52, 191, 249, 159, 216, 240, 28, 224, 147, 34, | [130, 17, 32, 198, 120, 167, 144, 113, 0, 50, 158, 49, 102, 208, 118, | |||
| 82] | 152] | |||
| A.1.9. Encoded JWE Ciphertext | A.1.9. Encoded JWE Ciphertext | |||
| Base64url encode the resulting Ciphertext to create the Encoded JWE | Base64url encode the Ciphertext to create the Encoded JWE Ciphertext. | |||
| Ciphertext. This result is: | This result (with line breaks for display purposes only) is: | |||
| _e21tGGhac_peEFkLXr2dMPUZiUkrw | 5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji | |||
| SdiwkIr3ajwQzaBtQD_A | ||||
| A.1.10. Encoded JWE Integrity Value | A.1.10. Encoded JWE Authentication Tag | |||
| Base64url encode the resulting "authentication tag" to create the | Base64url encode the Authentication Tag to create the Encoded JWE | |||
| Encoded JWE Integrity Value. This result is: | Authentication Tag. This result is: | |||
| 7V5ZDko0v_mf2PAc4JMiUg | ghEgxninkHEAMp4xZtB2mA | |||
| 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 Integrity Value 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. | |||
| M2XxpbORKezKSzzQL_95-GjiudRBTqn_omS8z9xgoRb7L0Jw5UsEbxmtyHn2T71m | ApfOLCaDbqs_JXPYy2I937v_xmrzj-Iss1mG6NAHmeJViM6j2l0MHvfseIdHVyU2 | |||
| rZLkjg4Mp8gbhYoltPkEOHvAopz25-vZ8C2e1cOaAo5WPcbSIuFcB4DjBOM3t0UA | BIoGVu9ohvkkWiRq5DL2jYZTPA9TAdwq3FUIVyoH-Pedf6elHIVFi2KGDEspYMtQ | |||
| O6JHkWLuAEYoe58lcxIQneyKdaYSLbV9cKqoUoFQpvKWYRHZbfszIyfsa18rmgTj | ARMMSBcS7pslx6flh1Cfh3GBKysztVMEhZ_maFkm4PYVCsJsvq6Ct3fg2CJPOs0X | |||
| zrtLDTPnc09DSJE24aQ8w3i8RXEDthW9T1J6LsTH_vwHdwUgkI-tC2PNeGrnM-dN | 1DHuxZKoIGIqcbeK4XEO5a0h5TAuJObKdfO0dKwfNSSbpu5sFrpRFwV2FTTYoqF4 | |||
| SfzF3Y7-lwcGy0FsdXkPXytvDV7y4pZeeUiQ-0VdibIN2AjjfW60nfrPuOjepMFG | zI46N9-_hMIznlEpftRXhScEJuZ9HG8C8CHB1WRZ_J48PleqdhF4o7fB5J1wFqUX | |||
| 6BBBbR37pHcyzext9epOAQ. | BtbtuGJ_A2Xe6AEhrlzCOw. | |||
| 48V1_ALb6US04U3b. | 48V1_ALb6US04U3b. | |||
| _e21tGGhac_peEFkLXr2dMPUZiUkrw. | 5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji | |||
| 7V5ZDko0v_mf2PAc4JMiUg | SdiwkIr3ajwQzaBtQD_A. | |||
| ghEgxninkHEAMp4xZtB2mA | ||||
| A.1.12. Validation | A.1.12. Validation | |||
| This example illustrates the process of creating a JWE with an | This example illustrates the process of creating a JWE with RSA OAEP | |||
| Authenticated Encryption algorithm. These results can be used to | and AES GCM. These results can be used to validate JWE decryption | |||
| validate JWE decryption implementations for these algorithms. Note | implementations for these algorithms. Note that since the RSAES OAEP | |||
| that since the RSAES OAEP computation includes random values, the | computation includes random values, the encryption results above will | |||
| encryption results above will not be completely reproducible. | not be completely reproducible. However, since the AES GCM | |||
| However, since the AES GCM computation is deterministic, the JWE | computation is deterministic, the JWE Encrypted Ciphertext values | |||
| Encrypted Ciphertext values will be the same for all encryptions | will be the same for all encryptions performed using these inputs. | |||
| performed using these inputs. | ||||
| A.2. Example JWE using RSAES-PKCS1-V1_5 and AES CBC | A.2. Example JWE using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256 | |||
| This example encrypts the plaintext "No matter where you go, there | This example encrypts the plaintext "Live long and prosper." to the | |||
| you are." to the recipient using RSAES-PKCS1-V1_5 and AES CBC. AES | recipient using RSAES-PKCS1-V1_5 and AES_128_CBC_HMAC_SHA_256. The | |||
| CBC does not have an integrated integrity check, so a separate | ||||
| integrity check calculation is performed using HMAC SHA-256, with | ||||
| separate encryption and integrity keys being derived from a master | ||||
| key using the Concat KDF with the SHA-256 digest function. The | ||||
| representation of this plaintext is: | representation of this plaintext is: | |||
| [78, 111, 32, 109, 97, 116, 116, 101, 114, 32, 119, 104, 101, 114, | [76, 105, 118, 101, 32, 108, 111, 110, 103, 32, 97, 110, 100, 32, | |||
| 101, 32, 121, 111, 117, 32, 103, 111, 44, 32, 116, 104, 101, 114, | 112, 114, 111, 115, 112, 101, 114, 46] | |||
| 101, 32, 121, 111, 117, 32, 97, 114, 101, 46] | ||||
| A.2.1. JWE Header | A.2.1. JWE Header | |||
| The following example JWE Header (with line breaks for display | The following example JWE Header (with line breaks for display | |||
| purposes only) declares that: | purposes only) declares that: | |||
| o the Content Master Key is encrypted to the recipient using the | o the Content Encryption Key is encrypted to the recipient using the | |||
| RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and | RSAES-PKCS1-V1_5 algorithm to produce the JWE Encrypted Key and | |||
| o the Plaintext is encrypted using the AES CBC algorithm with a 128 | o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 | |||
| bit key to produce the Ciphertext, with the integrity of the | algorithm to produce the Ciphertext. | |||
| Ciphertext and the parameters used to create it being secured with | ||||
| the HMAC SHA-256 algorithm. | ||||
| {"alg":"RSA1_5","enc":"A128CBC+HS256"} | {"alg":"RSA1_5","enc":"A128CBC-HS256"} | |||
| A.2.2. Encoded JWE Header | A.2.2. Encoded JWE Header | |||
| Base64url encoding the bytes of the UTF-8 representation of the JWE | Base64url encoding the octets of the UTF-8 representation of the JWE | |||
| Header yields this Encoded JWE Header value: | Header yields this Encoded JWE Header value: | |||
| eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0 | eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0 | |||
| A.2.3. Content Master Key (CMK) | A.2.3. Content Encryption Key (CEK) | |||
| Generate a 256 bit random Content Master Key (CMK). In this example, | Generate a 256 bit random Content Encryption Key (CEK). In this | |||
| the key value is: | example, the key value is: | |||
| [4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106, | [4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106, | |||
| 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156, | 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156, | |||
| 44, 207] | 44, 207] | |||
| A.2.4. Key Encryption | A.2.4. Key Encryption | |||
| Encrypt the CMK with the recipient's public key using the RSAES- | Encrypt the CEK with the recipient's public key using the RSAES- | |||
| PKCS1-V1_5 algorithm to produce the JWE Encrypted Key. In this | PKCS1-V1_5 algorithm to produce the JWE Encrypted Key. In this | |||
| example, the RSA key parameters are: | example, the RSA key parameters are: | |||
| +-----------+-------------------------------------------------------+ | +-----------+-------------------------------------------------------+ | |||
| | Parameter | Value | | | Parameter | Value | | |||
| | Name | | | | Name | | | |||
| +-----------+-------------------------------------------------------+ | +-----------+-------------------------------------------------------+ | |||
| | Modulus | [177, 119, 33, 13, 164, 30, 108, 121, 207, 136, 107, | | | Modulus | [177, 119, 33, 13, 164, 30, 108, 121, 207, 136, 107, | | |||
| | | 242, 12, 224, 19, 226, 198, 134, 17, 71, 173, 75, 42, | | | | 242, 12, 224, 19, 226, 198, 134, 17, 71, 173, 75, 42, | | |||
| | | 61, 48, 162, 206, 161, 97, 108, 185, 234, 226, 219, | | | | 61, 48, 162, 206, 161, 97, 108, 185, 234, 226, 219, | | |||
| skipping to change at page 34, line 31 ¶ | skipping to change at page 39, 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: | |||
| [102, 105, 229, 169, 104, 35, 95, 42, 176, 142, 190, 220, 92, 124, | [156, 150, 191, 184, 77, 131, 211, 9, 74, 207, 227, 156, 193, 38, | |||
| 172, 240, 94, 253, 106, 114, 20, 35, 162, 118, 81, 103, 64, 201, 20, | 202, 23, 56, 247, 211, 108, 88, 72, 143, 145, 44, 19, 58, 133, 181, | |||
| 4, 112, 96, 84, 248, 163, 199, 177, 227, 204, 247, 93, 63, 70, 132, | 70, 152, 254, 26, 198, 210, 80, 60, 15, 82, 210, 154, 55, 179, 115, | |||
| 195, 26, 237, 72, 91, 141, 3, 159, 71, 111, 113, 213, 68, 142, 146, | 76, 146, 99, 166, 146, 70, 176, 157, 252, 15, 54, 58, 92, 210, 103, | |||
| 92, 60, 243, 72, 111, 53, 156, 51, 16, 226, 215, 125, 68, 141, 232, | 55, 207, 191, 92, 185, 5, 164, 64, 241, 80, 163, 233, 131, 198, 106, | |||
| 62, 111, 197, 98, 91, 150, 23, 230, 132, 93, 97, 216, 145, 226, 3, | 32, 207, 199, 113, 5, 200, 94, 105, 53, 32, 221, 155, 233, 108, 96, | |||
| 18, 12, 48, 119, 153, 185, 8, 156, 195, 84, 21, 63, 143, 43, 144, | 151, 197, 152, 195, 96, 67, 81, 90, 38, 121, 51, 208, 98, 47, 45, 61, | |||
| 174, 101, 25, 199, 7, 106, 212, 43, 151, 225, 62, 225, 122, 92, 90, | 4, 129, 121, 152, 122, 124, 229, 2, 250, 92, 64, 245, 36, 70, 76, 58, | |||
| 139, 45, 144, 134, 229, 15, 235, 38, 110, 132, 189, 236, 126, 92, | 31, 181, 185, 61, 101, 168, 240, 220, 12, 62, 253, 169, 107, 107, 9, | |||
| 183, 13, 64, 2, 77, 107, 95, 186, 8, 133, 53, 217, 104, 247, 152, | 241, 9, 152, 217, 159, 179, 30, 95, 112, 29, 143, 124, 7, 21, 181, | |||
| 241, 49, 199, 15, 111, 110, 123, 16, 13, 78, 193, 224, 23, 230, 133, | 13, 45, 253, 137, 142, 95, 30, 127, 26, 237, 34, 183, 89, 200, 44, | |||
| 220, 162, 126, 82, 192, 236, 7, 185, 100, 106, 21, 70, 93, 192, 255, | 165, 203, 71, 102, 39, 127, 217, 159, 46, 17, 28, 11, 146, 222, 110, | |||
| 252, 139, 61, 124, 81, 140, 113, 97, 164, 231, 131, 167, 246, 157, | 149, 178, 16, 117, 186, 91, 52, 56, 136, 127, 82, 33, 194, 46, 164, | |||
| 199, 195, 114, 122, 49, 121, 115, 63, 114, 12, 165, 11, 186, 3, 108, | 245, 117, 136, 160, 179, 152, 151, 15, 172, 48, 73, 228, 87, 63, 40, | |||
| 12, 199, 101, 29, 226, 80, 56, 193, 149, 45, 134, 146, 102, 221, 202, | 192, 92, 92, 24, 167, 105, 47, 255, 193, 251, 77, 203, 6, 134, 129, | |||
| 63, 166, 150, 53, 42, 133, 3, 83, 199, 14, 15, 181, 209, 199, 174, | 248, 191, 53, 43, 49, 219, 130, 241, 180, 174, 159, 34, 71, 163, 70, | |||
| 76, 75, 106, 254, 243, 196, 227, 225, 173, 122, 254, 13, 224, 174, 4, | 83, 1, 152, 39, 241, 191, 68, 224, 240, 43, 113, 165, 68, 98, 130] | |||
| 185, 217, 99, 225] | ||||
| 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: | |||
| ZmnlqWgjXyqwjr7cXHys8F79anIUI6J2UWdAyRQEcGBU-KPHsePM910_RoTDGu1I | nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMkmOm | |||
| W40Dn0dvcdVEjpJcPPNIbzWcMxDi131Ejeg-b8ViW5YX5oRdYdiR4gMSDDB3mbkI | kkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZjDYENR | |||
| nMNUFT-PK5CuZRnHB2rUK5fhPuF6XFqLLZCG5Q_rJm6Evex-XLcNQAJNa1-6CIU1 | WiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfEJmNmfsx5f | |||
| 2Wj3mPExxw9vbnsQDU7B4BfmhdyiflLA7Ae5ZGoVRl3A__yLPXxRjHFhpOeDp_ad | cB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWyEHW6WzQ4iH9S | |||
| x8NyejF5cz9yDKULugNsDMdlHeJQOMGVLYaSZt3KP6aWNSqFA1PHDg-10ceuTEtq | IcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_NSsx24LxtK6fIkej | |||
| _vPE4-Gtev4N4K4Eudlj4Q | RlMBmCfxv0Tg8CtxpURigg | |||
| A.2.6. Key Derivation | ||||
| Use the Concat key derivation function to derive Content Encryption | ||||
| Key (CEK) and Content Integrity Key (CIK) values from the CMK. The | ||||
| details of this derivation are shown in Appendix A.4. The resulting | ||||
| CEK value is: | ||||
| [203, 165, 180, 113, 62, 195, 22, 98, 91, 153, 210, 38, 112, 35, 230, | ||||
| 236] | ||||
| The resulting CIK value is: | ||||
| [218, 24, 160, 17, 160, 50, 235, 35, 216, 209, 100, 174, 155, 163, | ||||
| 10, 117, 180, 111, 172, 200, 127, 201, 206, 173, 40, 45, 58, 170, 35, | ||||
| 93, 9, 60] | ||||
| A.2.7. 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.8. Plaintext Encryption | A.2.7. Additional Authenticated Data Parameter | |||
| Encrypt the Plaintext with AES CBC using the CEK and the JWE | ||||
| Initialization Vector to produce the Ciphertext. The resulting | ||||
| Ciphertext is: | ||||
| [71, 27, 35, 131, 163, 200, 19, 23, 38, 25, 33, 123, 46, 116, 132, | Concatenate the Encoded JWE Header value, a period ('.') character, | |||
| 144, 58, 150, 32, 167, 192, 195, 92, 25, 207, 101, 233, 105, 181, | and the Encoded JWE Encrypted Key to create the Additional | |||
| 121, 63, 4, 44, 162, 82, 176, 17, 171, 150, 97, 147, 68, 245, 13, 97, | Authenticated Data parameter. This result (with line breaks for | |||
| 100, 145, 25] | display purposes only) is: | |||
| A.2.9. Encoded JWE Ciphertext | eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. | |||
| nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMkmOm | ||||
| kkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZjDYENR | ||||
| WiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfEJmNmfsx5f | ||||
| cB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWyEHW6WzQ4iH9S | ||||
| IcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_NSsx24LxtK6fIkej | ||||
| RlMBmCfxv0Tg8CtxpURigg | ||||
| Base64url encode the resulting Ciphertext to create the Encoded JWE | The representation of this value is: | |||
| Ciphertext. This result is: | ||||
| Rxsjg6PIExcmGSF7LnSEkDqWIKfAw1wZz2XpabV5PwQsolKwEauWYZNE9Q1hZJEZ | [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, | ||||
| 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, | ||||
| 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.10. Secured Input Value | A.2.8. Plaintext Encryption | |||
| Concatenate the Encoded JWE Header value, a period character ('.'), | Encrypt the Plaintext with AES_128_CBC_HMAC_SHA_256 using the CEK as | |||
| the Encoded JWE Encrypted Key, a second period character, the Encoded | the encryption key, the JWE Initialization Vector, and the Additional | |||
| JWE Initialization Vector, a third period ('.') character, and the | Authenticated Data value above. The steps for doing this using the | |||
| Encoded JWE Ciphertext to create the value to integrity protect. | values from Appendix A.3 are detailed in Appendix B. The resulting | |||
| This result (with line breaks for display purposes only) is: | Ciphertext is: | |||
| eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0. | [40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6, | |||
| ZmnlqWgjXyqwjr7cXHys8F79anIUI6J2UWdAyRQEcGBU-KPHsePM910_RoTDGu1I | 75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143, | |||
| W40Dn0dvcdVEjpJcPPNIbzWcMxDi131Ejeg-b8ViW5YX5oRdYdiR4gMSDDB3mbkI | 112, 56, 102] | |||
| nMNUFT-PK5CuZRnHB2rUK5fhPuF6XFqLLZCG5Q_rJm6Evex-XLcNQAJNa1-6CIU1 | ||||
| 2Wj3mPExxw9vbnsQDU7B4BfmhdyiflLA7Ae5ZGoVRl3A__yLPXxRjHFhpOeDp_ad | ||||
| x8NyejF5cz9yDKULugNsDMdlHeJQOMGVLYaSZt3KP6aWNSqFA1PHDg-10ceuTEtq | ||||
| _vPE4-Gtev4N4K4Eudlj4Q. | ||||
| AxY8DCtDaGlsbGljb3RoZQ. | ||||
| Rxsjg6PIExcmGSF7LnSEkDqWIKfAw1wZz2XpabV5PwQsolKwEauWYZNE9Q1hZJEZ | ||||
| The representation of this value is: | The resulting Authentication Tag value is: | |||
| [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 83, 85, 48, 69, | [125, 141, 148, 252, 124, 121, 85, 199, 215, 154, 42, 68, 149, 209, | |||
| 120, 88, 122, 85, 105, 76, 67, 74, 108, 98, 109, 77, 105, 79, 105, | 225, 48] | |||
| 74, 66, 77, 84, 73, 52, 81, 48, 74, 68, 75, 48, 104, 84, 77, 106, 85, | ||||
| 50, 73, 110, 48, 46, 90, 109, 110, 108, 113, 87, 103, 106, 88, 121, | ||||
| 113, 119, 106, 114, 55, 99, 88, 72, 121, 115, 56, 70, 55, 57, 97, | ||||
| 110, 73, 85, 73, 54, 74, 50, 85, 87, 100, 65, 121, 82, 81, 69, 99, | ||||
| 71, 66, 85, 45, 75, 80, 72, 115, 101, 80, 77, 57, 49, 48, 95, 82, | ||||
| 111, 84, 68, 71, 117, 49, 73, 87, 52, 48, 68, 110, 48, 100, 118, 99, | ||||
| 100, 86, 69, 106, 112, 74, 99, 80, 80, 78, 73, 98, 122, 87, 99, 77, | ||||
| 120, 68, 105, 49, 51, 49, 69, 106, 101, 103, 45, 98, 56, 86, 105, 87, | ||||
| 53, 89, 88, 53, 111, 82, 100, 89, 100, 105, 82, 52, 103, 77, 83, 68, | ||||
| 68, 66, 51, 109, 98, 107, 73, 110, 77, 78, 85, 70, 84, 45, 80, 75, | ||||
| 53, 67, 117, 90, 82, 110, 72, 66, 50, 114, 85, 75, 53, 102, 104, 80, | ||||
| 117, 70, 54, 88, 70, 113, 76, 76, 90, 67, 71, 53, 81, 95, 114, 74, | ||||
| 109, 54, 69, 118, 101, 120, 45, 88, 76, 99, 78, 81, 65, 74, 78, 97, | ||||
| 49, 45, 54, 67, 73, 85, 49, 50, 87, 106, 51, 109, 80, 69, 120, 120, | ||||
| 119, 57, 118, 98, 110, 115, 81, 68, 85, 55, 66, 52, 66, 102, 109, | ||||
| 104, 100, 121, 105, 102, 108, 76, 65, 55, 65, 101, 53, 90, 71, 111, | ||||
| 86, 82, 108, 51, 65, 95, 95, 121, 76, 80, 88, 120, 82, 106, 72, 70, | ||||
| 104, 112, 79, 101, 68, 112, 95, 97, 100, 120, 56, 78, 121, 101, 106, | ||||
| 70, 53, 99, 122, 57, 121, 68, 75, 85, 76, 117, 103, 78, 115, 68, 77, | ||||
| 100, 108, 72, 101, 74, 81, 79, 77, 71, 86, 76, 89, 97, 83, 90, 116, | ||||
| 51, 75, 80, 54, 97, 87, 78, 83, 113, 70, 65, 49, 80, 72, 68, 103, 45, | ||||
| 49, 48, 99, 101, 117, 84, 69, 116, 113, 95, 118, 80, 69, 52, 45, 71, | ||||
| 116, 101, 118, 52, 78, 52, 75, 52, 69, 117, 100, 108, 106, 52, 81, | ||||
| 46, 65, 120, 89, 56, 68, 67, 116, 68, 97, 71, 108, 115, 98, 71, 108, | ||||
| 106, 98, 51, 82, 111, 90, 81, 46, 82, 120, 115, 106, 103, 54, 80, 73, | ||||
| 69, 120, 99, 109, 71, 83, 70, 55, 76, 110, 83, 69, 107, 68, 113, 87, | ||||
| 73, 75, 102, 65, 119, 49, 119, 90, 122, 50, 88, 112, 97, 98, 86, 53, | ||||
| 80, 119, 81, 115, 111, 108, 75, 119, 69, 97, 117, 87, 89, 90, 78, 69, | ||||
| 57, 81, 49, 104, 90, 74, 69, 90] | ||||
| A.2.11. JWE Integrity Value | A.2.9. Encoded JWE Ciphertext | |||
| Compute the HMAC SHA-256 of this value using the CIK to create the | Base64url encode the Ciphertext to create the Encoded JWE Ciphertext. | |||
| JWE Integrity Value. This result is: | This result is: | |||
| [240, 181, 234, 49, 221, 9, 44, 107, 49, 49, 160, 121, 186, 131, 90, | KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY | |||
| 50, 152, 59, 185, 69, 191, 167, 141, 17, 149, 166, 71, 11, 3, 8, 203, | ||||
| 57] | ||||
| A.2.12. Encoded JWE Integrity Value | A.2.10. Encoded JWE Authentication Tag | |||
| Base64url encode the resulting JWE Integrity Value to create the | Base64url encode the Authentication Tag to create the Encoded JWE | |||
| Encoded JWE Integrity Value. This result is: | Authentication Tag. This result is: | |||
| 8LXqMd0JLGsxMaB5uoNaMpg7uUW_p40RlaZHCwMIyzk | fY2U_Hx5VcfXmipEldHhMA | |||
| A.2.13. 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 Integrity Value 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: | |||
| eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDK0hTMjU2In0. | eyJhbGciOiJSU0ExXzUiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. | |||
| ZmnlqWgjXyqwjr7cXHys8F79anIUI6J2UWdAyRQEcGBU-KPHsePM910_RoTDGu1I | nJa_uE2D0wlKz-OcwSbKFzj302xYSI-RLBM6hbVGmP4axtJQPA9S0po3s3NMkmOm | |||
| W40Dn0dvcdVEjpJcPPNIbzWcMxDi131Ejeg-b8ViW5YX5oRdYdiR4gMSDDB3mbkI | kkawnfwPNjpc0mc3z79cuQWkQPFQo-mDxmogz8dxBcheaTUg3ZvpbGCXxZjDYENR | |||
| nMNUFT-PK5CuZRnHB2rUK5fhPuF6XFqLLZCG5Q_rJm6Evex-XLcNQAJNa1-6CIU1 | WiZ5M9BiLy09BIF5mHp85QL6XED1JEZMOh-1uT1lqPDcDD79qWtrCfEJmNmfsx5f | |||
| 2Wj3mPExxw9vbnsQDU7B4BfmhdyiflLA7Ae5ZGoVRl3A__yLPXxRjHFhpOeDp_ad | cB2PfAcVtQ0t_YmOXx5_Gu0it1nILKXLR2Ynf9mfLhEcC5LebpWyEHW6WzQ4iH9S | |||
| x8NyejF5cz9yDKULugNsDMdlHeJQOMGVLYaSZt3KP6aWNSqFA1PHDg-10ceuTEtq | IcIupPV1iKCzmJcPrDBJ5Fc_KMBcXBinaS__wftNywaGgfi_NSsx24LxtK6fIkej | |||
| _vPE4-Gtev4N4K4Eudlj4Q. | RlMBmCfxv0Tg8CtxpURigg. | |||
| AxY8DCtDaGlsbGljb3RoZQ. | AxY8DCtDaGlsbGljb3RoZQ. | |||
| Rxsjg6PIExcmGSF7LnSEkDqWIKfAw1wZz2XpabV5PwQsolKwEauWYZNE9Q1hZJEZ. | KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY. | |||
| 8LXqMd0JLGsxMaB5uoNaMpg7uUW_p40RlaZHCwMIyzk | fY2U_Hx5VcfXmipEldHhMA | |||
| A.2.14. Validation | A.2.12. Validation | |||
| This example illustrates the process of creating a JWE with a | This example illustrates the process of creating a JWE with RSAES- | |||
| composite Authenticated Encryption algorithm created from a non- | PKCS1-V1_5 and AES_CBC_HMAC_SHA2. These results can be used to | |||
| Authenticated Encryption algorithm by adding a separate integrity | validate JWE decryption implementations for these algorithms. Note | |||
| check calculation. These results can be used to validate JWE | that since the RSAES-PKCS1-V1_5 computation includes random values, | |||
| decryption implementations for these algorithms. Note that since the | the encryption results above will not be completely reproducible. | |||
| RSAES-PKCS1-V1_5 computation includes random values, the encryption | However, since the AES CBC computation is deterministic, the JWE | |||
| results above will not be completely reproducible. However, since | Encrypted Ciphertext values will be the same for all encryptions | |||
| the AES CBC computation is deterministic, the JWE Encrypted | performed using these inputs. | |||
| Ciphertext values will be the same for all encryptions performed | ||||
| using these inputs. | ||||
| A.3. Example JWE using AES Key Wrap and AES GCM | A.3. Example JWE using AES Key Wrap and AES GCM | |||
| This example encrypts the plaintext "The true sign of intelligence is | This example encrypts the plaintext "Live long and prosper." to the | |||
| not knowledge but imagination." to the recipient using AES Key Wrap | recipient using AES Key Wrap and AES GCM. The representation of this | |||
| and AES GCM. The representation of this plaintext is: | plaintext is: | |||
| [84, 104, 101, 32, 116, 114, 117, 101, 32, 115, 105, 103, 110, 32, | [76, 105, 118, 101, 32, 108, 111, 110, 103, 32, 97, 110, 100, 32, | |||
| 111, 102, 32, 105, 110, 116, 101, 108, 108, 105, 103, 101, 110, 99, | 112, 114, 111, 115, 112, 101, 114, 46] | |||
| 101, 32, 105, 115, 32, 110, 111, 116, 32, 107, 110, 111, 119, 108, | ||||
| 101, 100, 103, 101, 32, 98, 117, 116, 32, 105, 109, 97, 103, 105, | ||||
| 110, 97, 116, 105, 111, 110, 46] | ||||
| A.3.1. JWE Header | A.3.1. JWE Header | |||
| The following example JWE Header declares that: | The following example JWE Header declares that: | |||
| o the Content Master Key is encrypted to the recipient using the AES | o the Content Encryption Key is encrypted to the recipient using the | |||
| Key Wrap algorithm with a 128 bit key to produce the JWE Encrypted | AES Key Wrap algorithm with a 128 bit key to produce the JWE | |||
| Key and | Encrypted Key and | |||
| o the Plaintext is encrypted using the AES GCM algorithm with a 128 | o the Plaintext is encrypted using the AES_128_CBC_HMAC_SHA_256 | |||
| bit key to produce the Ciphertext. | algorithm to produce the Ciphertext. | |||
| {"alg":"A128KW","enc":"A128GCM"} | {"alg":"A128KW","enc":"A128CBC-HS256"} | |||
| A.3.2. Encoded JWE Header | A.3.2. Encoded JWE Header | |||
| Base64url encoding the bytes 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: | |||
| eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4R0NNIn0 | eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0 | |||
| A.3.3. Content Master Key (CMK) | A.3.3. Content Encryption Key (CEK) | |||
| Generate a 128 bit random Content Master Key (CMK). In this example, | Generate a 256 bit random Content Encryption Key (CEK). In this | |||
| the value is: | example, the value is: | |||
| [64, 154, 239, 170, 64, 40, 195, 99, 19, 84, 192, 142, 192, 238, 207, | [4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106, | |||
| 217] | 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156, | |||
| 44, 207] | ||||
| A.3.4. Key Encryption | A.3.4. Key Encryption | |||
| Encrypt the CMK with the shared symmetric key using the AES Key Wrap | Encrypt the CEK with the shared symmetric key using the AES Key Wrap | |||
| algorithm to produce the JWE Encrypted Key. In this example, the | algorithm to produce the JWE Encrypted Key. In this example, the | |||
| shared symmetric key value is: | shared symmetric key value is: | |||
| [25, 172, 32, 130, 225, 114, 26, 181, 138, 106, 254, 192, 95, 133, | [25, 172, 32, 130, 225, 114, 26, 181, 138, 106, 254, 192, 95, 133, | |||
| 74, 82] | 74, 82] | |||
| The resulting JWE Encrypted Key value is: | The resulting JWE Encrypted Key value is: | |||
| [164, 255, 251, 1, 64, 200, 65, 200, 34, 197, 81, 143, 43, 211, 240, | [232, 160, 123, 211, 183, 76, 245, 132, 200, 128, 123, 75, 190, 216, | |||
| 38, 191, 161, 181, 117, 119, 68, 44, 80] | 22, 67, 201, 138, 193, 186, 9, 91, 122, 31, 246, 90, 28, 139, 57, 3, | |||
| 76, 124, 193, 11, 98, 37, 173, 61, 104, 57] | ||||
| A.3.5. Encoded JWE Encrypted Key | A.3.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 is: | Encrypted Key. This result is: | |||
| pP_7AUDIQcgixVGPK9PwJr-htXV3RCxQ | 6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ | |||
| A.3.6. Initialization Vector | A.3.6. Initialization Vector | |||
| Generate a random 96 bit JWE Initialization Vector. In this example, | Generate a random 128 bit JWE Initialization Vector. In this | |||
| the value is: | example, the value is: | |||
| [253, 220, 80, 25, 166, 152, 178, 168, 97, 99, 67, 89] | [3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111, 116, 104, | |||
| 101] | ||||
| Base64url encoding this value yields the Encoded JWE Initialization | Base64url encoding this value yields the Encoded JWE Initialization | |||
| Vector value: | Vector value: | |||
| _dxQGaaYsqhhY0NZ | AxY8DCtDaGlsbGljb3RoZQ | |||
| A.3.7. "Additional Authenticated Data" Parameter | A.3.7. Additional Authenticated Data Parameter | |||
| Concatenate the Encoded JWE Header value, a period character ('.'), | Concatenate the Encoded JWE Header value, a period ('.') character, | |||
| the Encoded JWE Encrypted Key, a second period character ('.'), and | and the Encoded JWE Encrypted Key to create the Additional | |||
| the Encoded JWE Initialization Vector to create the "additional | Authenticated Data parameter. This result (with line breaks for | |||
| authenticated data" parameter for the AES GCM algorithm. This result | display purposes only) is: | |||
| (with line breaks for display purposes only) is: | ||||
| eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4R0NNIn0. | eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. | |||
| pP_7AUDIQcgixVGPK9PwJr-htXV3RCxQ. | 6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ | |||
| _dxQGaaYsqhhY0NZ | ||||
| The representation of this value is: | The representation of this 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, 82, 48, 78, 78, 73, 110, 48, 46, 112, 80, 95, 55, 65, | 77, 84, 73, 52, 81, 48, 74, 68, 76, 85, 104, 84, 77, 106, 85, 50, 73, | |||
| 85, 68, 73, 81, 99, 103, 105, 120, 86, 71, 80, 75, 57, 80, 119, 74, | 110, 48, 46, 54, 75, 66, 55, 48, 55, 100, 77, 57, 89, 84, 73, 103, | |||
| 114, 45, 104, 116, 88, 86, 51, 82, 67, 120, 81, 46, 95, 100, 120, 81, | 72, 116, 76, 118, 116, 103, 87, 81, 56, 109, 75, 119, 98, 111, 74, | |||
| 71, 97, 97, 89, 115, 113, 104, 104, 89, 48, 78, 90] | 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 GCM using the CMK as the encryption | Encrypt the Plaintext with AES_128_CBC_HMAC_SHA_256 using the CEK as | |||
| key, the JWE Initialization Vector, and the "additional authenticated | the encryption key, the JWE Initialization Vector, and the Additional | |||
| data" value above, requesting a 128 bit "authentication tag" output. | Authenticated Data value above. The steps for doing this using the | |||
| The resulting Ciphertext is: | values from this example are detailed in Appendix B. The resulting | |||
| Ciphertext is: | ||||
| [227, 12, 89, 132, 185, 16, 248, 93, 145, 87, 53, 130, 95, 115, 62, | [40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6, | |||
| 104, 138, 96, 109, 71, 124, 211, 165, 103, 202, 99, 21, 193, 4, 226, | 75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143, | |||
| 84, 229, 254, 106, 144, 241, 39, 86, 148, 132, 160, 104, 88, 232, | 112, 56, 102] | |||
| 228, 109, 85, 7, 86, 80, 134, 106, 166, 24, 92, 199, 210, 188, 153, | ||||
| 187, 218, 69, 227] | ||||
| The resulting "authentication tag" value is: | The resulting Authentication Tag value is: | |||
| [154, 35, 80, 107, 37, 148, 81, 6, 103, 4, 60, 206, 171, 165, 113, | [8, 65, 248, 101, 45, 185, 28, 218, 232, 112, 83, 79, 84, 221, 18, | |||
| 67] | 172] | |||
| A.3.9. Encoded JWE Ciphertext | A.3.9. Encoded JWE Ciphertext | |||
| Base64url encode the resulting Ciphertext to create the Encoded JWE | Base64url encode the Ciphertext to create the Encoded JWE Ciphertext. | |||
| Ciphertext. This result (with line breaks for display purposes only) | This result is: | |||
| is: | ||||
| 4wxZhLkQ-F2RVzWCX3M-aIpgbUd806VnymMVwQTiVOX-apDxJ1aUhKBoWOjkbVUH | KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY | |||
| VlCGaqYYXMfSvJm72kXj | ||||
| A.3.10. Encoded JWE Integrity Value | A.3.10. Encoded JWE Authentication Tag | |||
| Base64url encode the resulting "authentication tag" to create the | Base64url encode the Authentication Tag to create the Encoded JWE | |||
| Encoded JWE Integrity Value. This result is: | Authentication Tag. This result is: | |||
| miNQayWUUQZnBDzOq6VxQw | CEH4ZS25HNrocFNPVN0SrA | |||
| 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 Integrity Value 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: | |||
| eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4R0NNIn0. | eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4Q0JDLUhTMjU2In0. | |||
| pP_7AUDIQcgixVGPK9PwJr-htXV3RCxQ. | 6KB707dM9YTIgHtLvtgWQ8mKwboJW3of9locizkDTHzBC2IlrT1oOQ. | |||
| _dxQGaaYsqhhY0NZ. | AxY8DCtDaGlsbGljb3RoZQ. | |||
| 4wxZhLkQ-F2RVzWCX3M-aIpgbUd806VnymMVwQTiVOX-apDxJ1aUhKBoWOjkbVUH | KDlTtXchhZTGufMYmOYGS4HffxPSUrfmqCHXaI9wOGY. | |||
| VlCGaqYYXMfSvJm72kXj. | CEH4ZS25HNrocFNPVN0SrA | |||
| miNQayWUUQZnBDzOq6VxQw | ||||
| 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 an Authenticated Encryption algorithm. These results | key wrap and AES_CBC_HMAC_SHA2. These results can be used to | |||
| can be used to validate JWE decryption implementations for these | validate JWE decryption implementations for these algorithms. Also, | |||
| algorithms. Also, since both the AES Key Wrap and AES GCM | since both the AES Key Wrap and AES GCM computations are | |||
| computations are deterministic, the resulting JWE value will be the | deterministic, the resulting JWE value will be the same for all | |||
| same for all encryptions performed using these inputs. Since the | encryptions performed using these inputs. Since the computation is | |||
| computation is reproducible, these results can also be used to | reproducible, these results can also be used to validate JWE | |||
| validate JWE encryption implementations for these algorithms. | encryption implementations for these algorithms. | |||
| A.4. Example Key Derivation for "enc" value "A128CBC+HS256" | Appendix B. Example AES_128_CBC_HMAC_SHA_256 Computation | |||
| This example uses the Concat KDF to derive the Content Encryption Key | This example shows the steps in the AES_128_CBC_HMAC_SHA_256 | |||
| (CEK) and Content Integrity Key (CIK) from the Content Master Key | authenticated encryption computation using the values from the | |||
| (CMK) in the manner described in Section 4.8.1 of [JWA]. In this | example in Appendix A.3. As described where this algorithm is | |||
| example, a 256 bit CMK is used to derive a 128 bit CEK and a 256 bit | defined in Sections 4.8 and 4.8.3 of JWA, the AES_CBC_HMAC_SHA2 | |||
| CIK. | family of algorithms are implemented using Advanced Encryption | |||
| Standard (AES) in Cipher Block Chaining (CBC) mode with PKCS #5 | ||||
| padding to perform the encryption and an HMAC SHA-2 function to | ||||
| perform the integrity calculation - in this case, HMAC SHA-256. | ||||
| The CMK value used is: | B.1. Extract MAC_KEY and ENC_KEY from Key | |||
| The 256 bit AES_128_CBC_HMAC_SHA_256 key K used in this example is: | ||||
| [4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106, | [4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106, | |||
| 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156, | 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156, | |||
| 44, 207] | 44, 207] | |||
| A.4.1. CEK Generation | Use the first 128 bits of this key as the HMAC SHA-256 key MAC_KEY, | |||
| which is: | ||||
| These values are concatenated to produce the round 1 hash input: | ||||
| o the round number 1 as a 32 bit big endian integer ([0, 0, 0, 1]), | ||||
| o the CMK value (as above), | ||||
| o the output bit size 128 as a 32 bit big endian number ([0, 0, 0, | ||||
| 128]), | ||||
| o the bytes of the UTF-8 representation of the "enc" value | ||||
| "A128CBC+HS256" -- [65, 49, 50, 56, 67, 66, 67, 43, 72, 83, 50, | ||||
| 53, 54], | ||||
| o the Datalen value of zero for the omitted "epu" (encryption | ||||
| PartyUInfo) value ([0, 0, 0, 0]), | ||||
| o the Datalen value of zero for the omitted "epv" (encryption | ||||
| PartyVInfo) value ([0, 0, 0, 0]), | ||||
| o the bytes of the ASCII representation of the label "Encryption" -- | ||||
| [69, 110, 99, 114, 121, 112, 116, 105, 111, 110]. | ||||
| Thus the round 1 hash input is: | ||||
| [0, 0, 0, 1, 4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, | ||||
| 63, 170, 106, 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, | ||||
| 240, 143, 156, 44, 207, 0, 0, 0, 128, 65, 49, 50, 56, 67, 66, 67, 43, | ||||
| 72, 83, 50, 53, 54, 0, 0, 0, 0, 0, 0, 0, 0, 69, 110, 99, 114, 121, | ||||
| 112, 116, 105, 111, 110] | ||||
| The SHA-256 hash of this value, which is the round 1 hash output, is: | ||||
| [203, 165, 180, 113, 62, 195, 22, 98, 91, 153, 210, 38, 112, 35, 230, | ||||
| 236, 181, 193, 129, 233, 251, 107, 70, 80, 36, 150, 216, 251, 182, | ||||
| 29, 104, 150] | ||||
| Given that 128 bits are needed for the CEK and the hash has produced | ||||
| 256 bits, the CEK value is the first 128 bits of that value: | ||||
| [203, 165, 180, 113, 62, 195, 22, 98, 91, 153, 210, 38, 112, 35, 230, | ||||
| 236] | ||||
| A.4.2. CIK Generation | ||||
| These values are concatenated to produce the round 1 hash input: | ||||
| o the round number 1 as a 32 bit big endian integer ([0, 0, 0, 1]), | ||||
| o the CMK value (as above), | ||||
| o the output bit size 256 as a 32 bit big endian number ([0, 0, 1, | ||||
| 0]), | ||||
| o the bytes of the UTF-8 representation of the "enc" value | ||||
| "A128CBC+HS256" -- [65, 49, 50, 56, 67, 66, 67, 43, 72, 83, 50, | ||||
| 53, 54], | ||||
| o the Datalen value of zero for the omitted "epu" (encryption | ||||
| PartyUInfo) value ([0, 0, 0, 0]), | ||||
| o the Datalen value of zero for the omitted "epv" (encryption | ||||
| PartyVInfo) value ([0, 0, 0, 0]), | ||||
| o the bytes of the ASCII representation of the label "Integrity" -- | ||||
| [73, 110, 116, 101, 103, 114, 105, 116, 121]. | ||||
| Thus the round 1 hash input is: | ||||
| [0, 0, 0, 1, 4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, | ||||
| 63, 170, 106, 206, 107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, | ||||
| 240, 143, 156, 44, 207, 0, 0, 1, 0, 65, 49, 50, 56, 67, 66, 67, 43, | ||||
| 72, 83, 50, 53, 54, 0, 0, 0, 0, 0, 0, 0, 0, 73, 110, 116, 101, 103, | ||||
| 114, 105, 116, 121] | ||||
| The SHA-256 hash of this value, which is the round 1 hash output, is: | ||||
| [218, 24, 160, 17, 160, 50, 235, 35, 216, 209, 100, 174, 155, 163, | ||||
| 10, 117, 180, 111, 172, 200, 127, 201, 206, 173, 40, 45, 58, 170, 35, | ||||
| 93, 9, 60] | ||||
| Given that 256 bits are needed for the CIK and the hash has produced | ||||
| 256 bits, the CIK value is that same value: | ||||
| [218, 24, 160, 17, 160, 50, 235, 35, 216, 209, 100, 174, 155, 163, | ||||
| 10, 117, 180, 111, 172, 200, 127, 201, 206, 173, 40, 45, 58, 170, 35, | ||||
| 93, 9, 60] | ||||
| A.5. Example Key Derivation for "enc" value "A256CBC+HS512" | ||||
| This example uses the Concat KDF to derive the Content Encryption Key | ||||
| (CEK) and Content Integrity Key (CIK) from the Content Master Key | ||||
| (CMK) in the manner described in Section 4.8.1 of [JWA]. In this | ||||
| example, a 512 bit CMK is used to derive a 256 bit CEK and a 512 bit | ||||
| CIK. | ||||
| The CMK value used is: | ||||
| [148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193, 61, 34, 239, | ||||
| 226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49, 176, 68, | ||||
| 119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137, 138, 67, | ||||
| 23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124, 45, 156, | ||||
| 249, 7, 225, 168] | ||||
| A.5.1. CEK Generation | ||||
| These values are concatenated to produce the round 1 hash input: | ||||
| o the round number 1 as a 32 bit big endian integer ([0, 0, 0, 1]), | ||||
| o the CMK value (as above), | ||||
| o the output bit size 256 as a 32 bit big endian number ([0, 0, 1, | ||||
| 0]), | ||||
| o the bytes of the UTF-8 representation of the "enc" value | [4, 211, 31, 197, 84, 157, 252, 254, 11, 100, 157, 250, 63, 170, 106, | |||
| "A256CBC+HS512" -- [65, 50, 53, 54, 67, 66, 67, 43, 72, 83, 53, | 206] | |||
| 49, 50], | ||||
| o the Datalen value of zero for the omitted "epu" (encryption | Use the last 128 bits of this key as the AES CBC key ENC_KEY, which | |||
| PartyUInfo) value ([0, 0, 0, 0]), | is: | |||
| o the Datalen value of zero for the omitted "epv" (encryption | [107, 124, 212, 45, 111, 107, 9, 219, 200, 177, 0, 240, 143, 156, 44, | |||
| PartyVInfo) value ([0, 0, 0, 0]), | 207] | |||
| o the bytes of the ASCII representation of the label "Encryption" -- | Note that the MAC key comes before the encryption key in the input | |||
| [69, 110, 99, 114, 121, 112, 116, 105, 111, 110]. | key K; this is in the opposite order of the algorithm names in the | |||
| identifiers "AES_128_CBC_HMAC_SHA_256" and "A128CBC-HS256". | ||||
| Thus the round 1 hash input is: | B.2. Encrypt Plaintext to Create Ciphertext | |||
| [0, 0, 0, 1, 148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193, | Encrypt the Plaintext with AES in Cipher Block Chaining (CBC) mode | |||
| 61, 34, 239, 226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49, | using PKCS #5 padding using the ENC_KEY above. The Plaintext in this | |||
| 176, 68, 119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137, | example is: | |||
| 138, 67, 23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124, | ||||
| 45, 156, 249, 7, 225, 168, 0, 0, 1, 0, 65, 50, 53, 54, 67, 66, 67, | ||||
| 43, 72, 83, 53, 49, 50, 0, 0, 0, 0, 0, 0, 0, 0, 69, 110, 99, 114, | ||||
| 121, 112, 116, 105, 111, 110] | ||||
| The SHA-512 hash of this value, which is the round 1 hash output, is: | [76, 105, 118, 101, 32, 108, 111, 110, 103, 32, 97, 110, 100, 32, | |||
| 112, 114, 111, 115, 112, 101, 114, 46] | ||||
| The encryption result is as follows, which is the Ciphertext output: | ||||
| [157, 19, 75, 205, 31, 190, 110, 46, 117, 217, 137, 19, 116, 166, | [40, 57, 83, 181, 119, 33, 133, 148, 198, 185, 243, 24, 152, 230, 6, | |||
| 126, 60, 18, 244, 226, 114, 38, 153, 78, 198, 26, 0, 181, 168, 113, | 75, 129, 223, 127, 19, 210, 82, 183, 230, 168, 33, 215, 104, 143, | |||
| 45, 149, 89, 107, 213, 109, 183, 207, 164, 86, 131, 51, 105, 214, 29, | 112, 56, 102] | |||
| 229, 32, 243, 46, 40, 53, 123, 4, 13, 7, 250, 48, 227, 207, 167, 211, | ||||
| 147, 91, 0, 171] | ||||
| Given that 256 bits are needed for the CEK and the hash has produced | B.3. Create 64 Bit Big Endian Representation of AAD Length | |||
| 512 bits, the CEK value is the first 256 bits of that value: | ||||
| [157, 19, 75, 205, 31, 190, 110, 46, 117, 217, 137, 19, 116, 166, | The Additional Authenticated Data (AAD) in this example is: | |||
| 126, 60, 18, 244, 226, 114, 38, 153, 78, 198, 26, 0, 181, 168, 113, | ||||
| 45, 149, 89] | ||||
| A.5.2. CIK Generation | [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 66, 77, 84, 73, 52, | |||
| 83, 49, 99, 105, 76, 67, 74, 108, 98, 109, 77, 105, 79, 105, 74, 66, | ||||
| 77, 84, 73, 52, 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, | ||||
| 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] | ||||
| These values are concatenated to produce the round 1 hash input: | This AAD is 106 bytes long, which is 848 bits long. The octet string | |||
| AL, which is the number of bits in AAD expressed as a big endian 64 | ||||
| bit unsigned integer is: | ||||
| o the round number 1 as a 32 bit big endian integer ([0, 0, 0, 1]), | [0, 0, 0, 0, 0, 0, 3, 80] | |||
| o the CMK value (as above), | B.4. Initialization Vector Value | |||
| o the output bit size 512 as a 32 bit big endian number ([0, 0, 2, | The Initialization Vector value used in this example is: | |||
| 0]), | ||||
| o the bytes of the UTF-8 representation of the "enc" value | [3, 22, 60, 12, 43, 67, 104, 105, 108, 108, 105, 99, 111, 116, 104, | |||
| "A256CBC+HS512" -- [65, 50, 53, 54, 67, 66, 67, 43, 72, 83, 53, | 101] | |||
| 49, 50], | ||||
| o the Datalen value of zero for the omitted "epu" (encryption | B.5. Create Input to HMAC Computation | |||
| PartyUInfo) value ([0, 0, 0, 0]), | ||||
| o the Datalen value of zero for the omitted "epv" (encryption | Concatenate the AAD, the Initialization Vector, the Ciphertext, and | |||
| PartyVInfo) value ([0, 0, 0, 0]), | the AL value. The result of this concatenation is: | |||
| o the bytes of the ASCII representation of the label "Integrity" -- | [101, 121, 74, 104, 98, 71, 99, 105, 79, 105, 74, 66, 77, 84, 73, 52, | |||
| [73, 110, 116, 101, 103, 114, 105, 116, 121]. | 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, | ||||
| 110, 48, 46, 54, 75, 66, 55, 48, 55, 100, 77, 57, 89, 84, 73, 103, | ||||
| 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, 3, 22, 60, 12, 43, 67, | ||||
| 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] | ||||
| Thus the round 1 hash input is: | B.6. Compute HMAC Value | |||
| [0, 0, 0, 1, 148, 116, 199, 126, 2, 117, 233, 76, 150, 149, 89, 193, | Compute the HMAC SHA-256 of the concatenated value above. This | |||
| 61, 34, 239, 226, 109, 71, 59, 160, 192, 140, 150, 235, 106, 204, 49, | result M is: | |||
| 176, 68, 119, 13, 34, 49, 19, 41, 69, 5, 20, 252, 145, 104, 129, 137, | ||||
| 138, 67, 23, 153, 83, 81, 234, 82, 247, 48, 211, 41, 130, 35, 124, | ||||
| 45, 156, 249, 7, 225, 168, 0, 0, 2, 0, 65, 50, 53, 54, 67, 66, 67, | ||||
| 43, 72, 83, 53, 49, 50, 0, 0, 0, 0, 0, 0, 0, 0, 73, 110, 116, 101, | ||||
| 103, 114, 105, 116, 121] | ||||
| The SHA-512 hash of this value, which is the round 1 hash output, is: | [8, 65, 248, 101, 45, 185, 28, 218, 232, 112, 83, 79, 84, 221, 18, | |||
| 172, 50, 145, 207, 8, 14, 74, 44, 220, 100, 117, 32, 57, 239, 149, | ||||
| 173, 226] | ||||
| [81, 249, 131, 194, 25, 166, 147, 155, 47, 249, 146, 160, 200, 236, | B.7. Truncate HMAC Value to Create Authentication Tag | |||
| 115, 72, 103, 248, 228, 30, 130, 225, 164, 61, 105, 172, 198, 31, | ||||
| 137, 170, 215, 141, 27, 247, 73, 236, 125, 113, 151, 33, 0, 251, 72, | ||||
| 53, 72, 63, 146, 117, 247, 13, 49, 20, 210, 169, 232, 156, 118, 1, | ||||
| 16, 45, 29, 21, 15, 208] | ||||
| Given that 512 bits are needed for the CIK and the hash has produced | Use the first half (128 bits) of the HMAC output M as the | |||
| 512 bits, the CIK value is that same value: | Authentication Tag output T. This truncated value is: | |||
| [81, 249, 131, 194, 25, 166, 147, 155, 47, 249, 146, 160, 200, 236, | [8, 65, 248, 101, 45, 185, 28, 218, 232, 112, 83, 79, 84, 221, 18, | |||
| 115, 72, 103, 248, 228, 30, 130, 225, 164, 61, 105, 172, 198, 31, | 172] | |||
| 137, 170, 215, 141, 27, 247, 73, 236, 125, 113, 151, 33, 0, 251, 72, | ||||
| 53, 72, 63, 146, 117, 247, 13, 49, 20, 210, 169, 232, 156, 118, 1, | ||||
| 16, 45, 29, 21, 15, 208] | ||||
| Appendix B. 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 47, line 9 ¶ | skipping to change at page 49, line 6 ¶ | |||
| 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, Tony Nadalin, Axel | |||
| Nennker, Emmanuel Raviart, Nat Sakimura, Jim Schaad, Hannes | Nennker, Emmanuel Raviart, Nat Sakimura, Jim Schaad, Hannes | |||
| Tschofenig, and Sean Turner. | 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 C. Open Issues | 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 ]] | |||
| The following items remain to be considered or done in this draft: | -09 | |||
| o Should all header fields continue to be required to be understood | o Added JWE JSON Serialization, as specified by | |||
| by implementations using them or should a means of declaring that | draft-jones-jose-jwe-json-serialization-04. | |||
| specific header fields may be safely ignored if not understood | ||||
| should be defined? | ||||
| Appendix D. Document History | o Registered "application/jwe-js" MIME type and "JWE-JS" typ header | |||
| parameter value. | ||||
| [[ to be removed by the RFC editor before publication as an RFC ]] | o Defined that the default action for header parameters that are not | |||
| understood is to ignore them unless specifically designated as | ||||
| "MUST be understood" or included in the new "crit" (critical) | ||||
| header parameter list. This addressed issue #6. | ||||
| o Corrected "x5c" description. This addressed issue #12. | ||||
| o Changed from using the term "byte" to "octet" when referring to 8 | ||||
| bit values. | ||||
| o Added Key Management Mode definitions to terminology section and | ||||
| used the defined terms to provide clearer key management | ||||
| instructions. This addressed issue #5. | ||||
| o Added text about preventing the recipient from behaving as an | ||||
| oracle during decryption, especially when using RSAES-PKCS1-V1_5. | ||||
| o Changed from using the term "Integrity Value" to "Authentication | ||||
| Tag". | ||||
| o Changed member name from "integrity_value" to "authentication_tag" | ||||
| in the JWE JSON Serialization. | ||||
| o Removed Initialization Vector from the AAD value since it is | ||||
| already integrity protected by all of the authenticated encryption | ||||
| algorithms specified in the JWA specification. | ||||
| o Replaced "A128CBC+HS256" and "A256CBC+HS512" with "A128CBC-HS256" | ||||
| and "A256CBC-HS512". The new algorithms perform the same | ||||
| cryptographic computations as [I-D.mcgrew-aead-aes-cbc-hmac-sha2], | ||||
| but with the Initialization Vector and Authentication Tag values | ||||
| remaining separate from the Ciphertext value in the output | ||||
| representation. Also deleted the header parameters "epu" | ||||
| (encryption PartyUInfo) and "epv" (encryption PartyVInfo), since | ||||
| they are no longer used. | ||||
| -08 | -08 | |||
| o Replaced uses of the term "AEAD" with "Authenticated Encryption", | o Replaced uses of the term "AEAD" with "Authenticated Encryption", | |||
| since the term AEAD in the RFC 5116 sense implied the use of a | since the term AEAD in the RFC 5116 sense implied the use of a | |||
| particular data representation, rather than just referring to the | particular data representation, rather than just referring to the | |||
| class of algorithms that perform authenticated encryption with | class of algorithms that perform authenticated encryption with | |||
| associated data. | associated data. | |||
| o Applied editorial improvements suggested by Jeff Hodges and Hannes | o Applied editorial improvements suggested by Jeff Hodges and Hannes | |||
| skipping to change at page 50, line 16 ¶ | skipping to change at page 52, line 46 ¶ | |||
| o Added Registry Contents sections to populate registry values. | o Added Registry Contents sections to populate registry values. | |||
| o Numerous editorial improvements. | o Numerous editorial improvements. | |||
| -02 | -02 | |||
| o When using Authenticated Encryption algorithms (such as AES GCM), | o When using Authenticated Encryption algorithms (such as AES GCM), | |||
| use the "additional authenticated data" parameter to provide | use the "additional authenticated data" parameter to provide | |||
| integrity for the header, encrypted key, and ciphertext and use | integrity for the header, encrypted key, and ciphertext and use | |||
| the resulting "authentication tag" value as the JWE Integrity | the resulting "authentication tag" value as the JWE Authentication | |||
| Value. | Tag. | |||
| o Defined KDF output key sizes. | o Defined KDF output key sizes. | |||
| o Generalized text to allow key agreement to be employed as an | o Generalized text to allow key agreement to be employed as an | |||
| alternative to key wrapping or key encryption. | alternative to key wrapping or key encryption. | |||
| o Changed compression algorithm from gzip to DEFLATE. | o Changed compression algorithm from gzip to DEFLATE. | |||
| o Clarified that it is an error when a "kid" value is included and | o Clarified that it is an error when a "kid" value is included and | |||
| no matching key is found. | no matching key is found. | |||
| End of changes. 261 change blocks. | ||||
| 955 lines changed or deleted | 1063 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/ | ||||