draft-ietf-jose-json-web-signature-07.txt   draft-ietf-jose-json-web-signature-08.txt 
JOSE Working Group M. Jones JOSE Working Group M. Jones
Internet-Draft Microsoft Internet-Draft Microsoft
Intended status: Standards Track J. Bradley Intended status: Standards Track J. Bradley
Expires: May 10, 2013 Ping Identity Expires: June 30, 2013 Ping Identity
N. Sakimura N. Sakimura
NRI NRI
November 6, 2012 December 27, 2012
JSON Web Signature (JWS) JSON Web Signature (JWS)
draft-ietf-jose-json-web-signature-07 draft-ietf-jose-json-web-signature-08
Abstract Abstract
JSON Web Signature (JWS) is a means of representing content secured JSON Web Signature (JWS) is a means of representing content secured
with digital signatures or Message Authentication Codes (MACs) using with digital signatures or Message Authentication Codes (MACs) using
JavaScript Object Notation (JSON) data structures. Cryptographic JavaScript Object Notation (JSON) data structures. Cryptographic
algorithms and identifiers for use with this specification are algorithms and identifiers for use with this specification are
described in the separate JSON Web Algorithms (JWA) specification. described in the separate JSON Web Algorithms (JWA) specification.
Related encryption capabilities are described in the separate JSON Related encryption capabilities are described in the separate JSON
Web Encryption (JWE) specification. Web Encryption (JWE) specification.
skipping to change at page 1, line 39 skipping to change at page 1, line 39
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 May 10, 2013. This Internet-Draft will expire on June 30, 2013.
Copyright Notice Copyright Notice
Copyright (c) 2012 IETF Trust and the persons identified as the Copyright (c) 2012 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 2, line 31 skipping to change at page 2, line 31
4.1.3. "jwk" (JSON Web Key) Header Parameter . . . . . . . . 8 4.1.3. "jwk" (JSON Web Key) Header Parameter . . . . . . . . 8
4.1.4. "x5u" (X.509 URL) Header Parameter . . . . . . . . . . 8 4.1.4. "x5u" (X.509 URL) Header Parameter . . . . . . . . . . 8
4.1.5. "x5t" (X.509 Certificate Thumbprint) Header 4.1.5. "x5t" (X.509 Certificate Thumbprint) Header
Parameter . . . . . . . . . . . . . . . . . . . . . . 8 Parameter . . . . . . . . . . . . . . . . . . . . . . 8
4.1.6. "x5c" (X.509 Certificate Chain) Header Parameter . . . 9 4.1.6. "x5c" (X.509 Certificate Chain) Header Parameter . . . 9
4.1.7. "kid" (Key ID) Header Parameter . . . . . . . . . . . 9 4.1.7. "kid" (Key ID) Header Parameter . . . . . . . . . . . 9
4.1.8. "typ" (Type) Header Parameter . . . . . . . . . . . . 9 4.1.8. "typ" (Type) Header Parameter . . . . . . . . . . . . 9
4.1.9. "cty" (Content Type) Header Parameter . . . . . . . . 10 4.1.9. "cty" (Content Type) Header Parameter . . . . . . . . 10
4.2. Public Header Parameter Names . . . . . . . . . . . . . . 10 4.2. Public Header Parameter Names . . . . . . . . . . . . . . 10
4.3. Private Header Parameter Names . . . . . . . . . . . . . . 10 4.3. Private Header Parameter Names . . . . . . . . . . . . . . 10
5. Rules for Creating and Validating a JWS . . . . . . . . . . . 10 5. Producing and Consuming JWSs . . . . . . . . . . . . . . . . . 10
6. Securing JWSs with Cryptographic Algorithms . . . . . . . . . 12 5.1. Message Signing or MACing . . . . . . . . . . . . . . . . 10
5.2. Message Signature or MAC Validation . . . . . . . . . . . 11
5.3. String Comparison Rules . . . . . . . . . . . . . . . . . 12
6. Securing JWSs with Cryptographic Algorithms . . . . . . . . . 13
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 13
7.1. JSON Web Signature and Encryption Header Parameters 7.1. JSON Web Signature and Encryption Header Parameters
Registry . . . . . . . . . . . . . . . . . . . . . . . . . 13 Registry . . . . . . . . . . . . . . . . . . . . . . . . . 13
7.1.1. Registration Template . . . . . . . . . . . . . . . . 13 7.1.1. Registration Template . . . . . . . . . . . . . . . . 14
7.1.2. Initial Registry Contents . . . . . . . . . . . . . . 14 7.1.2. Initial Registry Contents . . . . . . . . . . . . . . 14
7.2. JSON Web Signature and Encryption Type Values Registry . . 15 7.2. JSON Web Signature and Encryption Type Values Registry . . 15
7.2.1. Registration Template . . . . . . . . . . . . . . . . 15 7.2.1. Registration Template . . . . . . . . . . . . . . . . 16
7.2.2. Initial Registry Contents . . . . . . . . . . . . . . 15 7.2.2. Initial Registry Contents . . . . . . . . . . . . . . 16
7.3. Media Type Registration . . . . . . . . . . . . . . . . . 16 7.3. Media Type Registration . . . . . . . . . . . . . . . . . 16
7.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 16 7.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 16
8. Security Considerations . . . . . . . . . . . . . . . . . . . 16 8. Security Considerations . . . . . . . . . . . . . . . . . . . 17
8.1. Cryptographic Security Considerations . . . . . . . . . . 16 8.1. Cryptographic Security Considerations . . . . . . . . . . 17
8.2. JSON Security Considerations . . . . . . . . . . . . . . . 17 8.2. JSON Security Considerations . . . . . . . . . . . . . . . 18
8.3. Unicode Comparison Security Considerations . . . . . . . . 18 8.3. Unicode Comparison Security Considerations . . . . . . . . 18
9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 18 9. References . . . . . . . . . . . . . . . . . . . . . . . . . . 19
9.1. Normative References . . . . . . . . . . . . . . . . . . . 18 9.1. Normative References . . . . . . . . . . . . . . . . . . . 19
9.2. Informative References . . . . . . . . . . . . . . . . . . 20 9.2. Informative References . . . . . . . . . . . . . . . . . . 20
Appendix A. JWS Examples . . . . . . . . . . . . . . . . . . . . 20 Appendix A. JWS Examples . . . . . . . . . . . . . . . . . . . . 21
A.1. JWS using HMAC SHA-256 . . . . . . . . . . . . . . . . . . 20 A.1. JWS using HMAC SHA-256 . . . . . . . . . . . . . . . . . . 21
A.1.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 20 A.1.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 21
A.1.2. Decoding . . . . . . . . . . . . . . . . . . . . . . . 22 A.1.2. Decoding . . . . . . . . . . . . . . . . . . . . . . . 23
A.1.3. Validating . . . . . . . . . . . . . . . . . . . . . . 22 A.1.3. Validating . . . . . . . . . . . . . . . . . . . . . . 23
A.2. JWS using RSA SHA-256 . . . . . . . . . . . . . . . . . . 23 A.2. JWS using RSA SHA-256 . . . . . . . . . . . . . . . . . . 23
A.2.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 23 A.2.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 23
A.2.2. Decoding . . . . . . . . . . . . . . . . . . . . . . . 26 A.2.2. Decoding . . . . . . . . . . . . . . . . . . . . . . . 27
A.2.3. Validating . . . . . . . . . . . . . . . . . . . . . . 26 A.2.3. Validating . . . . . . . . . . . . . . . . . . . . . . 27
A.3. JWS using ECDSA P-256 SHA-256 . . . . . . . . . . . . . . 26 A.3. JWS using ECDSA P-256 SHA-256 . . . . . . . . . . . . . . 27
A.3.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 26 A.3.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 27
A.3.2. Decoding . . . . . . . . . . . . . . . . . . . . . . . 28 A.3.2. Decoding . . . . . . . . . . . . . . . . . . . . . . . 29
A.3.3. Validating . . . . . . . . . . . . . . . . . . . . . . 28 A.3.3. Validating . . . . . . . . . . . . . . . . . . . . . . 29
A.4. JWS using ECDSA P-521 SHA-512 . . . . . . . . . . . . . . 29 A.4. JWS using ECDSA P-521 SHA-512 . . . . . . . . . . . . . . 30
A.4.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 29 A.4.1. Encoding . . . . . . . . . . . . . . . . . . . . . . . 30
A.4.2. Decoding . . . . . . . . . . . . . . . . . . . . . . . 31 A.4.2. Decoding . . . . . . . . . . . . . . . . . . . . . . . 32
A.4.3. Validating . . . . . . . . . . . . . . . . . . . . . . 31 A.4.3. Validating . . . . . . . . . . . . . . . . . . . . . . 32
A.5. Example Plaintext JWS . . . . . . . . . . . . . . . . . . 32 A.5. Example Plaintext JWS . . . . . . . . . . . . . . . . . . 33
Appendix B. "x5c" (X.509 Certificate Chain) Example . . . . . . . 32 Appendix B. "x5c" (X.509 Certificate Chain) Example . . . . . . . 33
Appendix C. Notes on implementing base64url encoding without Appendix C. Notes on implementing base64url encoding without
padding . . . . . . . . . . . . . . . . . . . . . . . 34 padding . . . . . . . . . . . . . . . . . . . . . . . 35
Appendix D. Acknowledgements . . . . . . . . . . . . . . . . . . 35 Appendix D. Acknowledgements . . . . . . . . . . . . . . . . . . 36
Appendix E. Open Issues . . . . . . . . . . . . . . . . . . . . . 36 Appendix E. Open Issues . . . . . . . . . . . . . . . . . . . . . 37
Appendix F. Document History . . . . . . . . . . . . . . . . . . 36 Appendix F. Document History . . . . . . . . . . . . . . . . . . 37
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 39 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . . 41
1. Introduction 1. Introduction
JSON Web Signature (JWS) is a compact format for representing content JSON Web Signature (JWS) is a compact format for representing content
secured with digital signatures or Message Authentication Codes secured with digital signatures or Message Authentication Codes
(MACs) intended for space constrained environments such as HTTP (MACs) intended for space constrained environments such as HTTP
Authorization headers and URI query parameters. It represents this Authorization headers and URI query parameters. It represents this
content using JavaScript Object Notation (JSON) [RFC4627] based data content using JavaScript Object Notation (JSON) [RFC4627] based data
structures. The JWS cryptographic mechanisms provide integrity structures. The JWS cryptographic mechanisms provide integrity
protection for arbitrary sequences of bytes. protection for arbitrary sequences of bytes.
skipping to change at page 4, line 29 skipping to change at page 4, line 29
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 Signature (JWS) A data structure cryptographically securing JSON Web Signature (JWS) A data structure representing a digitally
a JWS Header and a JWS Payload with a JWS Signature value. signed or MACed message. The structure consists of three parts:
the JWS Header, the JWS Payload, and the JWS Signature value.
JWS Header A string representing a JSON object that describes the JSON Text Object A UTF-8 encoded text string representing a JSON
digital signature or MAC operation applied to create the JWS object; the syntax of JSON objects is defined in Section 2.2 of
Signature value. [RFC4627].
JWS Header A JSON Text Object that describes the digital signature
or MAC operation applied to create the JWS Signature value.
JWS Payload The bytes to be secured -- a.k.a., the message. The JWS Payload The bytes to be secured -- a.k.a., the message. The
payload can contain an arbitrary sequence of bytes. payload can contain an arbitrary sequence of bytes.
JWS Signature A byte array containing the cryptographic material JWS Signature A byte array containing the cryptographic material
that secures the JWS Header and the JWS Payload. that secures the JWS Header and the JWS Payload.
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 for notes on implementing base64url encoding (See Appendix C for notes on implementing base64url encoding
without padding.) without padding.)
Encoded JWS Header Base64url encoding of the bytes of the UTF-8 Encoded JWS Header Base64url encoding of the JWS Header.
[RFC3629] representation of the JWS Header.
Encoded JWS Payload Base64url encoding of the JWS Payload. Encoded JWS Payload Base64url encoding of the JWS Payload.
Encoded JWS Signature Base64url encoding of the JWS Signature. Encoded JWS Signature Base64url encoding of the JWS Signature.
JWS Secured Input The concatenation of the Encoded JWS Header, a JWS Secured Input The concatenation of the Encoded JWS Header, a
period ('.') character, and the Encoded JWS Payload. period ('.') character, and the Encoded JWS Payload.
Header Parameter Name The name of a member of the JSON object Header Parameter Name The name of a member of the JWS Header.
representing a JWS Header.
Header Parameter Value The value of a member of the JSON object Header Parameter Value The value of a member of the JWS Header.
representing a JWS Header.
JWS Compact Serialization A representation of the JWS as the JWS Compact Serialization A representation of the JWS as the
concatenation of the Encoded JWS Header, the Encoded JWS Payload, concatenation of the Encoded JWS Header, the Encoded JWS Payload,
and the Encoded JWS Signature in that order, with the three and the Encoded JWS Signature in that order, with the three
strings being separated by two period ('.') characters. strings being separated by two period ('.') characters.
Collision Resistant Namespace A namespace that allows names to be Collision Resistant Namespace A namespace that allows names to be
allocated in a manner such that they are highly unlikely to allocated in a manner such that they are highly unlikely to
collide with other names. For instance, collision resistance can collide with other names. For instance, collision resistance can
be achieved through administrative delegation of portions of the be achieved through administrative delegation of portions of the
skipping to change at page 7, line 30 skipping to change at page 7, line 30
JWSs with duplicate Header Parameter Names MUST be rejected. JWSs with duplicate Header Parameter Names MUST be rejected.
Implementations MUST understand the entire contents of the header; Implementations MUST understand the entire contents of the header;
otherwise, the JWS MUST be rejected. otherwise, the JWS MUST be rejected.
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 JWSs defined below. All the names are short because a core goal of JWSs
is for the representations to be compact. is for the representations 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
Section 7.1. As indicated by the common registry, JWSs and JWEs Section 7.1. As indicated by the common registry, JWSs and JWEs
share a common header parameter space; when a parameter is used by share a common header parameter space; when a parameter is used by
both specifications, its usage must be compatible between the both 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 secure the JWS. The algorithm specified by the algorithm used to secure the JWS. The algorithm specified by the
"alg" value MUST be supported by the implementation and there MUST be "alg" value MUST be supported by the implementation and there MUST be
a key for use with that algorithm associated with the party that a key for use with that algorithm associated with the party that
digitally signed or MACed the content or the JWS MUST be rejected. digitally signed or MACed the content or the JWS MUST be rejected.
"alg" values SHOULD either be registered in the IANA JSON Web "alg" values SHOULD either be registered in the IANA JSON Web
Signature and Encryption Algorithms registry [JWA] or be a URI that Signature and Encryption Algorithms registry [JWA] or be a value that
contains a Collision Resistant Namespace. The "alg" value is a case contains a Collision Resistant Namespace. The "alg" value is a case
sensitive string containing a StringOrURI value. This header sensitive string containing a StringOrURI value. Use of this header
parameter is REQUIRED. parameter is REQUIRED.
A list of defined "alg" values can be found in the IANA JSON Web A list of defined "alg" values can be found in the IANA JSON Web
Signature and Encryption Algorithms registry [JWA]; the initial Signature and Encryption Algorithms registry [JWA]; the initial
contents of this registry are the values defined in Section 3.1 of contents of this registry are the values defined in Section 3.1 of
the JSON Web Algorithms (JWA) [JWA] specification. the JSON Web Algorithms (JWA) [JWA] specification.
4.1.2. "jku" (JWK Set URL) Header Parameter 4.1.2. "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 digitally sign the JWS. The which corresponds to the key used to digitally sign the JWS. The
keys MUST be encoded as a JSON Web Key Set (JWK Set) [JWK]. The keys MUST be encoded as a JSON Web Key Set (JWK Set) [JWK]. The
protocol used to acquire the resource MUST provide integrity protocol used to acquire the resource MUST provide integrity
protection; an HTTP GET request to retrieve the certificate MUST use protection; an HTTP GET request to retrieve the certificate MUST use
TLS [RFC2818] [RFC5246]; the identity of the server MUST be TLS [RFC2818] [RFC5246]; the identity of the server MUST be
validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. This validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. Use of
header parameter is OPTIONAL. this header parameter is OPTIONAL.
4.1.3. "jwk" (JSON Web Key) Header Parameter 4.1.3. "jwk" (JSON Web Key) Header Parameter
The "jwk" (JSON Web Key) header parameter is a public key that The "jwk" (JSON Web Key) header parameter is a public key that
corresponds to the key used to digitally sign the JWS. This key is corresponds to the key used to digitally sign the JWS. This key is
represented as a JSON Web Key [JWK]. This header parameter is represented as a JSON Web Key [JWK]. Use of this header parameter is
OPTIONAL. OPTIONAL.
4.1.4. "x5u" (X.509 URL) Header Parameter 4.1.4. "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 digitally sign the chain [RFC5280] corresponding to the key used to digitally sign the
JWS. The identified resource MUST provide a representation of the JWS. 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 digitally signed the JWS MUST be the first key of the entity that digitally signed the JWS MUST be the first
certificate. This MAY be followed by additional certificates, with certificate. This MAY be followed by additional certificates, with
each subsequent certificate being the one used to certify the each subsequent certificate being the one used to certify the
previous one. The protocol used to acquire the resource MUST provide previous one. The protocol used to acquire the resource MUST provide
integrity protection; an HTTP GET request to retrieve the certificate integrity protection; an HTTP GET request to retrieve the certificate
MUST use TLS [RFC2818] [RFC5246]; the identity of the server MUST be MUST use TLS [RFC2818] [RFC5246]; the identity of the server MUST be
validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. This validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. Use of
header parameter is OPTIONAL. this header parameter is OPTIONAL.
4.1.5. "x5t" (X.509 Certificate Thumbprint) Header Parameter 4.1.5. "x5t" (X.509 Certificate Thumbprint) Header Parameter
The "x5t" (X.509 Certificate Thumbprint) header parameter provides a The "x5t" (X.509 Certificate Thumbprint) header parameter provides a
base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER
encoding of the X.509 certificate [RFC5280] corresponding to the key encoding of the X.509 certificate [RFC5280] corresponding to the key
used to digitally sign the JWS. This header parameter is OPTIONAL. used to digitally sign the JWS. Use of this header parameter is
OPTIONAL.
If, in the future, certificate thumbprints need to be computed using If, in the future, certificate thumbprints need to be computed using
hash functions other than SHA-1, it is suggested that additional hash functions other than SHA-1, it is suggested that additional
related header parameters be defined for that purpose. For example, related header parameters be defined for that purpose. For example,
it is suggested that a new "x5t#S256" (X.509 Certificate Thumbprint it is suggested that a new "x5t#S256" (X.509 Certificate Thumbprint
using SHA-256) header parameter could be defined by registering it in using SHA-256) header parameter could be defined by registering it in
the IANA JSON Web Signature and Encryption Header Parameters registry the IANA JSON Web Signature and Encryption Header Parameters registry
Section 7.1. Section 7.1.
4.1.6. "x5c" (X.509 Certificate Chain) Header Parameter 4.1.6. "x5c" (X.509 Certificate Chain) Header Parameter
skipping to change at page 9, line 28 skipping to change at page 9, line 29
corresponding to the key used to digitally sign the JWS. The corresponding to the key used to digitally sign the JWS. The
certificate or certificate chain is represented as an array of certificate or certificate chain is represented as an array of
certificate value strings. Each string is a base64 encoded certificate value strings. Each string is a base64 encoded
([RFC4648] Section 4 -- not base64url encoded) DER [ITU.X690.1994] ([RFC4648] Section 4 -- not base64url encoded) DER [ITU.X690.1994]
PKIX certificate value. The certificate containing the public key of PKIX certificate value. The certificate containing the public key of
the entity that digitally signed the JWS MUST be the first the entity that digitally signed the JWS MUST be the first
certificate. This MAY be followed by additional certificates, with certificate. This MAY be followed by additional certificates, with
each subsequent certificate being the one used to certify the each subsequent certificate being the one used to certify the
previous one. The recipient MUST verify the certificate chain previous one. The recipient MUST verify the certificate chain
according to [RFC5280] and reject the JWS if any validation failure according to [RFC5280] and reject the JWS if any validation failure
occurs. This header parameter is OPTIONAL. occurs. Use of this header parameter is OPTIONAL.
See Appendix B for an example "x5c" value. See Appendix B for an example "x5c" value.
4.1.7. "kid" (Key ID) Header Parameter 4.1.7. "kid" (Key ID) Header Parameter
The "kid" (key ID) header parameter is a hint indicating which key The "kid" (key ID) header parameter is a hint indicating which key
was used to secure the JWS. This parameter allows originators to was used to secure the JWS. This parameter allows originators to
explicitly signal a change of key to recipients. Should the explicitly signal a change of key to recipients. Should the
recipient be unable to locate a key corresponding to the "kid" value, recipient be unable to locate a key corresponding to the "kid" value,
they SHOULD treat that condition as an error. The interpretation of they SHOULD treat that condition as an error. The interpretation of
the "kid" value is unspecified. Its value MUST be a string. This the "kid" value is unspecified. Its value MUST be a string. Use of
header parameter is OPTIONAL. this header parameter is OPTIONAL.
When used with a JWK, the "kid" value MAY be used to match a JWK When used with a JWK, the "kid" value MAY be used to match a JWK
"kid" parameter value. "kid" parameter value.
4.1.8. "typ" (Type) Header Parameter 4.1.8. "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 "JWS" MAY be used to indicate that this object. The type value "JWS" MAY be used to indicate that this
object is a JWS. The "typ" value is a case sensitive string. This object is a JWS. The "typ" value is a case sensitive string. Use of
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 Section 7.2 or be a URI Signature and Encryption Type Values registry Section 7.2 or be a
that contains a Collision Resistant Namespace. value that contains a Collision Resistant Namespace.
4.1.9. "cty" (Content Type) Header Parameter 4.1.9. "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 secured content (the Payload). The "cty" value is a case of the secured content (the Payload). The "cty" value is a case
sensitive string. This header parameter is OPTIONAL. 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.2. Public Header Parameter Names 4.2. Public Header Parameter Names
Additional header parameter names can be defined by those using JWSs. Additional Header Parameter Names can be defined by those using JWSs.
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 Section 7.1 or be a URI that Encryption Header Parameters registry Section 7.1 or be a Public
contains a Collision Resistant Namespace. In each case, the definer Name: a value that contains a Collision Resistant Namespace. In each
of the name or value needs to take reasonable precautions to make case, the definer of the name or value needs to take reasonable
sure they are in control of the part of the namespace they use to precautions to make sure they are in control of the part of the
define the header parameter name. namespace they use to define the Header Parameter Name.
New header parameters should be introduced sparingly, as they can New header parameters should be introduced sparingly, as they can
result in non-interoperable JWSs. result in non-interoperable JWSs.
4.3. Private Header Parameter Names 4.3. Private Header Parameter Names
A producer and consumer of a JWS may agree to any header parameter A producer and consumer of a JWS may agree to use Header Parameter
name that is not a Reserved Name Section 4.1 or a Public Name Names that are Private Names: names that are not Reserved Names
Section 4.2. Unlike Public Names, these private names are subject to Section 4.1 or Public Names Section 4.2. Unlike Public Names,
collision and should be used with caution. Private Names are subject to collision and should be used with
caution.
5. Rules for Creating and Validating a JWS 5. Producing and Consuming JWSs
5.1. Message Signing or MACing
To create a JWS, one MUST perform these steps. The order of the To create a JWS, one MUST perform these steps. The order of the
steps is not significant in cases where there are no dependencies steps is not significant in cases where there are no dependencies
between the inputs and outputs of the steps. between the inputs and outputs of the steps.
1. Create the content to be used as the JWS Payload. 1. Create the content to be used as the JWS Payload.
2. Base64url encode the bytes of the JWS Payload. This encoding 2. Base64url encode the bytes of the JWS Payload. This encoding
becomes the Encoded JWS Payload. becomes the Encoded JWS Payload.
skipping to change at page 11, line 30 skipping to change at page 11, line 35
6. Base64url encode the representation of the JWS Signature to 6. Base64url encode the representation of the JWS Signature to
create the Encoded JWS Signature. create the Encoded JWS Signature.
7. The three encoded parts, taken together, are the result. The 7. The three encoded parts, taken together, are the result. The
Compact Serialization of this result is the concatenation of the Compact Serialization of this result is the concatenation of the
Encoded JWS Header, the Encoded JWS Payload, and the Encoded JWS Encoded JWS Header, the Encoded JWS Payload, and the Encoded JWS
Signature in that order, with the three strings being separated Signature in that order, with the three strings being separated
by two period ('.') characters. by two period ('.') characters.
5.2. Message Signature or MAC Validation
When validating a JWS, the following steps MUST be taken. The order When validating a JWS, the following steps MUST be taken. The order
of the steps is not significant in cases where there are no of the steps is not significant in cases where there are no
dependencies between the inputs and outputs of the steps. If any of dependencies between the inputs and outputs of the steps. If any of
the listed steps fails, then the JWS MUST be rejected. the listed steps fails, then the JWS MUST be rejected.
1. Parse the three parts of the input (which are separated by period 1. Parse the three parts of the input (which are separated by period
('.') characters when using the JWS Compact Serialization) into ('.') characters when using the JWS Compact Serialization) into
the Encoded JWS Header, the Encoded JWS Payload, and the Encoded the Encoded JWS Header, the Encoded JWS Payload, and the Encoded
JWS Signature. JWS Signature.
skipping to change at page 12, line 17 skipping to change at page 12, line 24
following the restriction given in this specification that no following the restriction given in this specification that no
padding characters have been used. padding characters have been used.
7. The JWS Signature MUST be successfully validated against the JWS 7. The JWS Signature MUST be successfully validated against the JWS
Secured Input (the concatenation of the Encoded JWS Header, a Secured Input (the concatenation of the Encoded JWS Header, a
period ('.') character, and the Encoded JWS Payload) in the period ('.') character, and the Encoded JWS Payload) in the
manner defined for the algorithm being used, which MUST be manner defined for the algorithm being used, which MUST be
accurately represented by the value of the "alg" (algorithm) accurately represented by the value of the "alg" (algorithm)
header parameter, which MUST be present. header parameter, which MUST be present.
5.3. String Comparison Rules
Processing a JWS inevitably requires comparing known strings to Processing a JWS inevitably requires comparing known strings to
values in the header. For example, in checking what the algorithm values in JSON objects. For example, in checking what the algorithm
is, the Unicode string encoding "alg" will be checked against the is, the Unicode string encoding "alg" will be checked against the
member names in the JWS Header to see if there is a matching header member names in the JWS Header to see if there is a matching Header
parameter name. A similar process occurs when determining if the Parameter Name. A similar process occurs when determining if the
value of the "alg" header parameter represents a supported algorithm. value of the "alg" header parameter represents a supported algorithm.
Comparisons between JSON strings and other Unicode strings MUST be Comparisons between JSON strings and other Unicode strings MUST be
performed as specified below: performed as specified below:
1. Remove any JSON applied escaping to produce an array of Unicode 1. Remove any JSON escaping from the input JSON string and convert
code points. the string into a sequence of Unicode code points.
2. Unicode Normalization [USA15] MUST NOT be applied at any point to 2. Likewise, convert the string to be compared against into a
sequence of Unicode code points.
3. Unicode Normalization [USA15] MUST NOT be applied at any point to
either the JSON string or to the string it is to be compared either the JSON string or to the string it is to be compared
against. against.
3. Comparisons between the two strings MUST be performed as a 4. Comparisons between the two strings MUST be performed as a
Unicode code point to code point equality comparison. Unicode code point to code point equality comparison. (Note that
values that originally used different Unicode encodings (UTF-8,
UTF-16, etc.) may result in the same code point values.)
Also, see the JSON security considerations in Section 8.2 and the
Unicode security considerations in Section 8.3.
6. Securing JWSs with Cryptographic Algorithms 6. Securing JWSs with Cryptographic Algorithms
JWS uses cryptographic algorithms to digitally sign or MAC the JWS JWS uses cryptographic algorithms to digitally sign or MAC the JWS
Header and the JWS Payload. The JSON Web Algorithms (JWA) [JWA] Header and the JWS Payload. The JSON Web Algorithms (JWA) [JWA]
specification describes a set of cryptographic algorithms and specification describes a set of cryptographic algorithms and
identifiers to be used with this specification. Specifically, identifiers to be used with this specification. Specifically,
Section 3.1 specifies a set of "alg" (algorithm) header parameter Section 3.1 specifies a set of "alg" (algorithm) header parameter
values intended for use this specification. It also describes the values intended for use this specification. It also describes the
semantics and operations that are specific to these algorithms and semantics and operations that are specific to these algorithms.
algorithm families.
Public keys employed for digital signing can be identified using the Public keys employed for digital signing 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.
7. IANA Considerations 7. IANA Considerations
The following registration procedure is used for all the registries The following registration procedure is used for all the registries
established by this specification. established by this specification.
skipping to change at page 13, line 37 skipping to change at page 13, line 51
and, if applicable, suggestions as to how to make the request and, if applicable, suggestions as to how to make the request
successful. successful.
IANA must only accept registry updates from the Designated Expert(s) IANA must only accept registry updates from the Designated Expert(s)
and should direct all requests for registration to the review mailing and should direct all requests for registration to the review mailing
list. list.
7.1. JSON Web Signature and Encryption Header Parameters Registry 7.1. JSON Web Signature and Encryption Header Parameters Registry
This specification establishes the IANA JSON Web Signature and This specification establishes the IANA JSON Web Signature and
Encryption Header Parameters registry for reserved JWS and JWE header Encryption Header Parameters registry for reserved JWS and JWE Header
parameter names. The registry records the reserved header parameter Parameter Names. The registry records the reserved Header Parameter
name and a reference to the specification that defines it. The same Name and a reference to the specification that defines it. The same
Header Parameter Name may be registered multiple times, provided that Header Parameter Name may be registered multiple times, provided that
the parameter usage is compatible between the specifications. the parameter usage is compatible between the specifications.
Different registrations of the same Header Parameter Name will
typically use different Header Parameter Usage Location(s) values.
7.1.1. Registration Template 7.1.1. Registration Template
Header Parameter Name: Header Parameter Name:
The name requested (e.g., "example"). This name is case The name requested (e.g., "example"). This name is case
sensitive. Names that match other registered names in a case sensitive. Names that match other registered names in a case
insensitive manner SHOULD NOT be accepted. insensitive manner SHOULD NOT be accepted.
Header Parameter Usage Location(s):
The header parameter usage locations, which should be one or more
of the values "JWS" or "JWE".
Change Controller: Change Controller:
For Standards Track RFCs, state "IETF". For others, give the name For Standards Track RFCs, state "IETF". For others, give the name
of the responsible party. Other details (e.g., postal address, of the responsible party. Other details (e.g., postal address,
email address, home page URI) may also be included. email address, home page URI) may also be included.
Specification Document(s): Specification Document(s):
Reference to the document(s) that specify the parameter, Reference to the document(s) that specify the parameter,
preferably including URI(s) that can be used to retrieve copies of preferably including URI(s) that can be used to retrieve copies of
the document(s). An indication of the relevant sections may also the document(s). An indication of the relevant sections may also
be included but is not required. be included but is not required.
7.1.2. Initial Registry Contents 7.1.2. Initial Registry Contents
This specification registers the Header Parameter Names defined in This specification registers the Header Parameter Names defined in
Section 4.1 in this registry. Section 4.1 in this registry.
o Header Parameter Name: "alg" o Header Parameter Name: "alg"
o Header Parameter Usage Location(s): JWS
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: "jku" o Header Parameter Name: "jku"
o Header Parameter Usage Location(s): JWS
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: "jwk" o Header Parameter Name: "jwk"
o Header Parameter Usage Location(s): JWS
o Change Controller: IETF o Change Controller: IETF
o Specification document(s): Section 4.1.3 of [[ this document ]] o Specification document(s): Section 4.1.3 of [[ this document ]]
o Header Parameter Name: "x5u" o Header Parameter Name: "x5u"
o Header Parameter Usage Location(s): JWS
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.4 of [[ this document ]] o Specification Document(s): Section 4.1.4 of [[ this document ]]
o Header Parameter Name: "x5t" o Header Parameter Name: "x5t"
o Header Parameter Usage Location(s): JWS
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.5 of [[ this document ]] o Specification Document(s): Section 4.1.5 of [[ this document ]]
o Header Parameter Name: "x5c" o Header Parameter Name: "x5c"
o Header Parameter Usage Location(s): JWS
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.6 of [[ this document ]] o Specification Document(s): Section 4.1.6 of [[ this document ]]
o Header Parameter Name: "kid" o Header Parameter Name: "kid"
o Header Parameter Usage Location(s): JWS
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.7 of [[ this document ]] o Specification Document(s): Section 4.1.7 of [[ this document ]]
o Header Parameter Name: "typ" o Header Parameter Name: "typ"
o Header Parameter Usage Location(s): JWS
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.8 of [[ this document ]] o Specification Document(s): Section 4.1.8 of [[ this document ]]
o Header Parameter Name: "cty" o Header Parameter Name: "cty"
o Header Parameter Usage Location(s): JWS
o Change Controller: IETF o Change Controller: IETF
o Specification Document(s): Section 4.1.9 of [[ this document ]] o Specification Document(s): Section 4.1.9 of [[ this document ]]
7.2. JSON Web Signature and Encryption Type Values Registry 7.2. JSON Web Signature and Encryption Type Values Registry
This specification establishes the IANA JSON Web Signature and This specification establishes the IANA JSON Web Signature and
Encryption Type Values registry for values of the JWS and JWE "typ" Encryption Type Values registry for values of the JWS and JWE "typ"
(type) header parameter. It is RECOMMENDED that all registered "typ" (type) header parameter. It is RECOMMENDED that all registered "typ"
values also include a MIME Media Type [RFC2046] value that the values also include a MIME Media Type [RFC2046] value that the
registered value is a short name for. The registry records the "typ" registered value is a short name for. The registry records the "typ"
skipping to change at page 16, line 47 skipping to change at page 17, line 27
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 8. Security Considerations
8.1. Cryptographic Security Considerations 8.1. Cryptographic Security Considerations
All of the security issues faced by any cryptographic application All of the security issues faced by any cryptographic application
must be faced by a JWS/JWE/JWK agent. Among these issues are must be faced by a JWS/JWE/JWK agent. Among these issues are
protecting the user's private key, preventing various attacks, and protecting the user's private and symmetric keys, preventing various
helping the user avoid mistakes such as inadvertently encrypting a attacks, and helping the user avoid mistakes such as inadvertently
message for the wrong recipient. The entire list of security encrypting a message for the wrong recipient. The entire list of
considerations is beyond the scope of this document, but some security considerations is beyond the scope of this document, but
significant concerns are listed here. some significant concerns are listed here.
All the security considerations in XML DSIG 2.0 All the security considerations in XML DSIG 2.0
[W3C.CR-xmldsig-core2-20120124], also apply to this specification, [W3C.CR-xmldsig-core2-20120124], also apply to this specification,
other than those that are XML specific. Likewise, many of the best other than those that are XML specific. Likewise, many of the best
practices documented in XML Signature Best Practices practices documented in XML Signature Best Practices
[W3C.WD-xmldsig-bestpractices-20110809] also apply to this [W3C.WD-xmldsig-bestpractices-20110809] also apply to this
specification, other than those that are XML specific. specification, other than those that are XML specific.
Keys are only as strong as the amount of entropy used to generate Keys are only as strong as the amount of entropy used to generate
them. A minimum of 128 bits of entropy should be used for all keys, them. A minimum of 128 bits of entropy should be used for all keys,
skipping to change at page 18, line 13 skipping to change at page 18, line 42
[RFC4627] states "The names within an object SHOULD be unique", [RFC4627] states "The names within an object SHOULD be unique",
whereas this specification states that "Header Parameter Names within whereas this specification states that "Header Parameter Names within
this object MUST be unique; JWSs with duplicate Header Parameter this object MUST be unique; JWSs with duplicate Header Parameter
Names MUST be rejected". Thus, this specification requires that the Names MUST be rejected". Thus, this specification requires that the
Section 2.2 "SHOULD" be treated as a "MUST". Ambiguous and Section 2.2 "SHOULD" be treated as a "MUST". Ambiguous and
potentially exploitable situations could arise if the JSON parser potentially exploitable situations could arise if the JSON parser
used does not enforce the uniqueness of member names. used does not enforce the uniqueness of member names.
8.3. Unicode Comparison Security Considerations 8.3. Unicode Comparison Security Considerations
Header parameter names and algorithm names are Unicode strings. For Header Parameter Names and algorithm names are Unicode strings. For
security reasons, the representations of these names must be compared security reasons, the representations of these names must be compared
verbatim after performing any escape processing (as per RFC 4627 verbatim after performing any escape processing (as per RFC 4627
[RFC4627], Section 2.5). This means, for instance, that these JSON [RFC4627], Section 2.5). This means, for instance, that these JSON
strings must compare as being equal ("sig", "\u0073ig"), whereas strings must compare as being equal ("sig", "\u0073ig"), whereas
these must all compare as being not equal to the first set or to each these must all compare as being not equal to the first set or to each
other ("SIG", "Sig", "si\u0047"). other ("SIG", "Sig", "si\u0047").
JSON strings MAY contain characters outside the Unicode Basic JSON strings MAY contain characters outside the Unicode Basic
Multilingual Plane. For instance, the G clef character (U+1D11E) may Multilingual Plane. For instance, the G clef character (U+1D11E) may
be represented in a JSON string as "\uD834\uDD1E". Ideally, JWS be represented in a JSON string as "\uD834\uDD1E". Ideally, JWS
skipping to change at page 18, line 41 skipping to change at page 19, line 22
9.1. Normative References 9.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)", November 2012. [JWA] Jones, M., "JSON Web Algorithms (JWA)",
draft-ietf-jose-json-web-algorithms (work in progress),
December 2012.
[JWK] Jones, M., "JSON Web Key (JWK)", November 2012. [JWK] Jones, M., "JSON Web Key (JWK)",
draft-ietf-jose-json-web-key (work in progress),
December 2012.
[RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic [RFC1421] Linn, J., "Privacy Enhancement for Internet Electronic
Mail: Part I: Message Encryption and Authentication Mail: Part I: Message Encryption and Authentication
Procedures", RFC 1421, February 1993. Procedures", RFC 1421, February 1993.
[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,
November 1996. November 1996.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
skipping to change at page 20, line 14 skipping to change at page 20, line 46
9.2. Informative References 9.2. Informative References
[CanvasApp] [CanvasApp]
Facebook, "Canvas Applications", 2010. Facebook, "Canvas Applications", 2010.
[JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign", [JSS] Bradley, J. and N. Sakimura (editor), "JSON Simple Sign",
September 2010. September 2010.
[JWE] Jones, M., Rescorla, E., and J. Hildebrand, "JSON Web [JWE] Jones, M., Rescorla, E., and J. Hildebrand, "JSON Web
Encryption (JWE)", November 2012. Encryption (JWE)", draft-ietf-jose-json-web-encryption
(work in progress), December 2012.
[JWS-JS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web [JWS-JS] Jones, M., Bradley, J., and N. Sakimura, "JSON Web
Signature JSON Serialization (JWS-JS)", November 2012. Signature JSON Serialization (JWS-JS)",
draft-jones-jose-jws-json-serialization (work in
progress), December 2012.
[JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token [JWT] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token
(JWT)", November 2012. (JWT)", draft-ietf-oauth-json-web-token (work in
progress), December 2012.
[MagicSignatures] [MagicSignatures]
Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic Panzer (editor), J., Laurie, B., and D. Balfanz, "Magic
Signatures", January 2011. Signatures", January 2011.
[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.
[W3C.CR-xmldsig-core2-20120124] [W3C.CR-xmldsig-core2-20120124]
Reagle, J., Solo, D., Datta, P., Hirsch, F., Eastlake, D., Yiu, K., Solo, D., Eastlake, D., Datta, P., Hirsch, F.,
Cantor, S., Roessler, T., and K. Yiu, "XML Signature Reagle, J., Cantor, S., and T. Roessler, "XML Signature
Syntax and Processing Version 2.0", World Wide Web Syntax and Processing Version 2.0", World Wide Web
Consortium CR CR-xmldsig-core2-20120124, January 2012, Consortium CR CR-xmldsig-core2-20120124, January 2012,
<http://www.w3.org/TR/2012/CR-xmldsig-core2-20120124>. <http://www.w3.org/TR/2012/CR-xmldsig-core2-20120124>.
Appendix A. JWS Examples Appendix A. JWS Examples
This section provides several examples of JWSs. While these examples This section provides several examples of JWSs. While these examples
all represent JSON Web Tokens (JWTs) [JWT], the payload can be any all represent JSON Web Tokens (JWTs) [JWT], the payload can be any
base64url encoded content. base64url encoded content.
skipping to change at page 35, line 5 skipping to change at page 36, line 5
Appendix C. Notes on implementing base64url encoding without padding Appendix C. Notes on implementing base64url encoding without padding
This appendix describes how to implement base64url encoding and This appendix describes how to implement base64url encoding and
decoding functions without padding based upon standard base64 decoding functions without padding based upon standard base64
encoding and decoding functions that do use padding. encoding and decoding functions that do use padding.
To be concrete, example C# code implementing these functions is shown To be concrete, example C# code implementing these functions is shown
below. Similar code could be used in other languages. below. Similar code could be used in other languages.
static string base64urlencode(byte [] arg) static string base64urlencode(byte [] arg)
{ {
string s = Convert.ToBase64String(arg); // Standard base64 encoder string s = Convert.ToBase64String(arg); // Regular base64 encoder
s = s.Split('=')[0]; // Remove any trailing '='s s = s.Split('=')[0]; // Remove any trailing '='s
s = s.Replace('+', '-'); // 62nd char of encoding s = s.Replace('+', '-'); // 62nd char of encoding
s = s.Replace('/', '_'); // 63rd char of encoding s = s.Replace('/', '_'); // 63rd char of encoding
return s; return s;
} }
static byte [] base64urldecode(string arg) static byte [] base64urldecode(string arg)
{ {
string s = arg; string s = arg;
s = s.Replace('-', '+'); // 62nd char of encoding s = s.Replace('-', '+'); // 62nd char of encoding
s = s.Replace('_', '/'); // 63rd char of encoding s = s.Replace('_', '/'); // 63rd char of encoding
switch (s.Length % 4) // Pad with trailing '='s switch (s.Length % 4) // Pad with trailing '='s
{ {
case 0: break; // No pad chars in this case case 0: break; // No pad chars in this case
case 2: s += "=="; break; // Two pad chars case 2: s += "=="; break; // Two pad chars
case 3: s += "="; break; // One pad char case 3: s += "="; break; // One pad char
default: throw new System.Exception( default: throw new System.Exception(
"Illegal base64url string!"); "Illegal base64url string!");
} }
return Convert.FromBase64String(s); // Standard base64 decoder return Convert.FromBase64String(s); // Standard base64 decoder
} }
As per the example code above, the number of '=' padding characters As per the example code above, the number of '=' padding characters
that needs to be added to the end of a base64url encoded string that needs to be added to the end of a base64url encoded string
without padding to turn it into one with padding is a deterministic without padding to turn it into one with padding is a deterministic
function of the length of the encoded string. Specifically, if the function of the length of the encoded string. Specifically, if the
length mod 4 is 0, no padding is added; if the length mod 4 is 2, two length mod 4 is 0, no padding is added; if the length mod 4 is 2, two
'=' padding characters are added; if the length mod 4 is 3, one '=' '=' padding characters are added; if the length mod 4 is 3, one '='
padding character is added; if the length mod 4 is 1, the input is padding character is added; if the length mod 4 is 1, the input is
malformed. malformed.
An example correspondence between unencoded and encoded values An example correspondence between unencoded and encoded values
follows. The byte sequence below encodes into the string below, follows. The byte sequence below encodes into the string below,
which when decoded, reproduces the byte sequence. which when decoded, reproduces the byte sequence.
3 236 255 224 193 3 236 255 224 193
A-z_4ME A-z_4ME
Appendix D. Acknowledgements Appendix D. Acknowledgements
Solutions for signing JSON content were previously explored by Magic Solutions for signing JSON content were previously explored by Magic
Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas Signatures [MagicSignatures], JSON Simple Sign [JSS], and Canvas
Applications [CanvasApp], all of which influenced this draft. Dirk Applications [CanvasApp], all of which influenced this draft.
Balfanz, Yaron Y. Goland, John Panzer, and Paul Tarjan all made
significant contributions to the design of this specification.
Thanks to Axel Nennker for his early implementation and feedback on Thanks to Axel Nennker for his early implementation and feedback on
the JWS and JWE specifications. the JWS and JWE specifications.
This specification is the work of the JOSE Working Group, which
includes dozens of active and dedicated participants. In particular,
the following individuals contributed ideas, feedback, and wording
that influenced this specification:
Dirk Balfanz, Richard Barnes, Brian Campbell, Breno de Medeiros, Dick
Hardt, Joe Hildebrand, Jeff Hodges, Edmund Jay, Yaron Y. Goland, Ben
Laurie, James Manger, Tony Nadalin, Axel Nennker, John Panzer,
Emmanuel Raviart, Eric Rescorla, Jim Schaad, Paul Tarjan, Hannes
Tschofenig, and Sean Turner.
Jim Schaad and Karen O'Donoghue chaired the JOSE working group and Jim Schaad and Karen O'Donoghue chaired the JOSE working group and
Sean Turner and Stephen Farrell served as Security area directors Sean Turner and Stephen Farrell served as Security area directors
during the creation of this specification. during the creation of this specification.
Appendix E. Open Issues Appendix E. Open Issues
[[ 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: The following items remain to be considered or done in this draft:
o Should we define optional nonce, timestamp, and/or uninterpreted o Should all header fields continue to be required to be understood
string header parameter(s)? by implementations using them or should a means of declaring that
specific header fields may be safely ignored if not understood
should be defined?
Appendix F. Document History Appendix F. 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 ]]
-07 -08
o Applied editorial improvements suggested by Jeff Hodges and Hannes
Tschofenig. Many of these simplified the terminology used.
o Clarified statements of the form "This header parameter is
OPTIONAL" to "Use of this header parameter is OPTIONAL".
o Added a Header Parameter Usage Location(s) field to the IANA JSON
Web Signature and Encryption Header Parameters registry.
o Added seriesInfo information to Internet Draft references.
-07
o Updated references. o Updated references.
-06 -06
o Changed "x5c" (X.509 Certificate Chain) representation from being o Changed "x5c" (X.509 Certificate Chain) representation from being
a single string to being an array of strings, each containing a a single string to being an array of strings, each containing a
single base64 encoded DER certificate value, representing elements single base64 encoded DER certificate value, representing elements
of the certificate chain. of the certificate chain.
o Applied changes made by the RFC Editor to RFC 6749's registry o Applied changes made by the RFC Editor to RFC 6749's registry
skipping to change at page 38, line 39 skipping to change at page 40, line 12
o Clarified the relationship between "typ" header parameter values o Clarified the relationship between "typ" header parameter values
and MIME types. and MIME types.
o Registered application/jws MIME type and "JWS" typ header o Registered application/jws MIME type and "JWS" typ header
parameter value. parameter value.
o Simplified JWK terminology to get replace the "JWK Key Object" and o Simplified JWK terminology to get replace the "JWK Key Object" and
"JWK Container Object" terms with simply "JSON Web Key (JWK)" and "JWK Container Object" terms with simply "JSON Web Key (JWK)" and
"JSON Web Key Set (JWK Set)" and to eliminate potential confusion "JSON Web Key Set (JWK Set)" and to eliminate potential confusion
between single keys and sets of keys. As part of this change, the between single keys and sets of keys. As part of this change, the
header parameter name for a public key value was changed from Header Parameter Name for a public key value was changed from
"jpk" (JSON Public Key) to "jwk" (JSON Web Key). "jpk" (JSON Public Key) to "jwk" (JSON Web Key).
o Added suggestion on defining additional header parameters such as o Added suggestion on defining additional header parameters such as
"x5t#S256" in the future for certificate thumbprints using hash "x5t#S256" in the future for certificate thumbprints using hash
algorithms other than SHA-1. algorithms other than SHA-1.
o Specify RFC 2818 server identity validation, rather than RFC 6125 o Specify RFC 2818 server identity validation, rather than RFC 6125
(paralleling the same decision in the OAuth specs). (paralleling the same decision in the OAuth specs).
o Generalized language to refer to Message Authentication Codes o Generalized language to refer to Message Authentication Codes
 End of changes. 69 change blocks. 
134 lines changed or deleted 199 lines changed or added

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