draft-ietf-ace-cbor-web-token-02.txt   draft-ietf-ace-cbor-web-token-03.txt 
ACE Working Group M. Jones ACE Working Group M. Jones
Internet-Draft Microsoft Internet-Draft Microsoft
Intended status: Informational E. Wahlstroem Intended status: Standards Track E. Wahlstroem
Expires: July 17, 2017 Expires: September 3, 2017
S. Erdtman S. Erdtman
Spotify AB Spotify AB
H. Tschofenig H. Tschofenig
ARM Ltd. ARM Ltd.
January 13, 2017 March 2, 2017
CBOR Web Token (CWT) CBOR Web Token (CWT)
draft-ietf-ace-cbor-web-token-02 draft-ietf-ace-cbor-web-token-03
Abstract Abstract
CBOR Web Token (CWT) is a compact means of representing claims to be CBOR Web Token (CWT) is a compact means of representing claims to be
transferred between two parties. CWT is a profile of the JSON Web transferred between two parties. CWT is a profile of the JSON Web
Token (JWT) that is optimized for constrained devices. The claims in Token (JWT) that is optimized for constrained devices. The claims in
a CWT are encoded in the Concise Binary Object Representation (CBOR) a CWT are encoded in the Concise Binary Object Representation (CBOR)
and CBOR Object Signing and Encryption (COSE) is used for added and CBOR Object Signing and Encryption (COSE) is used for added
application layer security protection. A claim is a piece of application layer security protection. A claim is a piece of
information asserted about a subject and is represented as a name/ information asserted about a subject and is represented as a name/
skipping to change at page 1, line 42 skipping to change at page 1, line 42
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 July 17, 2017. This Internet-Draft will expire on September 3, 2017.
Copyright Notice Copyright Notice
Copyright (c) 2017 IETF Trust and the persons identified as the Copyright (c) 2017 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 23 skipping to change at page 2, line 23
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Claims . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. Claims . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1. Claim Names . . . . . . . . . . . . . . . . . . . . . . . 4 3.1. Claim Names . . . . . . . . . . . . . . . . . . . . . . . 4
3.1.1. iss (Issuer) Claim . . . . . . . . . . . . . . . . . 4 3.1.1. iss (Issuer) Claim . . . . . . . . . . . . . . . . . 4
3.1.2. sub (Subject) Claim . . . . . . . . . . . . . . . . . 4 3.1.2. sub (Subject) Claim . . . . . . . . . . . . . . . . . 4
3.1.3. aud (Audience) Claim . . . . . . . . . . . . . . . . 4 3.1.3. aud (Audience) Claim . . . . . . . . . . . . . . . . 5
3.1.4. exp (Expiration Time) Claim . . . . . . . . . . . . . 5 3.1.4. exp (Expiration Time) Claim . . . . . . . . . . . . . 5
3.1.5. nbf (Not Before) Claim . . . . . . . . . . . . . . . 5 3.1.5. nbf (Not Before) Claim . . . . . . . . . . . . . . . 5
3.1.6. iat (Issued At) Claim . . . . . . . . . . . . . . . . 5 3.1.6. iat (Issued At) Claim . . . . . . . . . . . . . . . . 5
3.1.7. cti (CWT ID) Claim . . . . . . . . . . . . . . . . . 5 3.1.7. cti (CWT ID) Claim . . . . . . . . . . . . . . . . . 5
4. Summary of the values, CBOR major types and encoded claim 4. Summary of the values, CBOR major types and encoded claim
keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5. Creating and Validating CWTs . . . . . . . . . . . . . . . . 6 5. CWT CBOR Tag . . . . . . . . . . . . . . . . . . . . . . . . 6
5.1. Creating a CWT . . . . . . . . . . . . . . . . . . . . . 6 6. Creating and Validating CWTs . . . . . . . . . . . . . . . . 6
5.2. Validating a CWT . . . . . . . . . . . . . . . . . . . . 7 6.1. Creating a CWT . . . . . . . . . . . . . . . . . . . . . 6
6. Security Considerations . . . . . . . . . . . . . . . . . . . 8 6.2. Validating a CWT . . . . . . . . . . . . . . . . . . . . 7
7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 8 7. Security Considerations . . . . . . . . . . . . . . . . . . . 9
7.1. CBOR Web Token (CWT) Claims Registry . . . . . . . . . . 8 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
7.1.1. Registration Template . . . . . . . . . . . . . . . . 8 8.1. CBOR Web Token (CWT) Claims Registry . . . . . . . . . . 9
7.1.2. Initial Registry Contents . . . . . . . . . . . . . . 9 8.1.1. Registration Template . . . . . . . . . . . . . . . . 9
7.2. Media Type Registration . . . . . . . . . . . . . . . . . 10 8.1.2. Initial Registry Contents . . . . . . . . . . . . . . 10
7.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 10 8.2. Media Type Registration . . . . . . . . . . . . . . . . . 11
7.3. CoAP Content-Formats Registration . . . . . . . . . . . . 11 8.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 11
7.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 11 8.3. CoAP Content-Formats Registration . . . . . . . . . . . . 12
8. References . . . . . . . . . . . . . . . . . . . . . . . . . 11 8.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 12
8.1. Normative References . . . . . . . . . . . . . . . . . . 11 8.4. CBOR Tag registration . . . . . . . . . . . . . . . . . . 12
8.2. Informative References . . . . . . . . . . . . . . . . . 13 8.4.1. Registry Contents . . . . . . . . . . . . . . . . . . 12
Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 13 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 13
A.1. CWT with "aud" and symmetric key . . . . . . . . . . . . 13 9.1. Normative References . . . . . . . . . . . . . . . . . . 13
A.2. CWT with "aud" and EC key . . . . . . . . . . . . . . . . 14 9.2. Informative References . . . . . . . . . . . . . . . . . 14
A.3. Full CWT . . . . . . . . . . . . . . . . . . . . . . . . 16 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 14
Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 19 A.1. Example CWT Claims Set . . . . . . . . . . . . . . . . . 14
A.2. Example keys . . . . . . . . . . . . . . . . . . . . . . 15
A.2.1. 128-bit Symmetric Key as Hex Encoded String . . . . . 15
A.2.2. 256-bit Symmetric Key as Hex Encoded String . . . . . 15
A.2.3. ECDSA P-256 256-bit COSE Key . . . . . . . . . . . . 15
A.3. Example Signed CWT . . . . . . . . . . . . . . . . . . . 16
A.4. Example MACed CWT . . . . . . . . . . . . . . . . . . . . 17
A.5. Example Encrypted CWT . . . . . . . . . . . . . . . . . . 18
A.6. Example Nested CWT . . . . . . . . . . . . . . . . . . . 19
Appendix B. Acknowledgements . . . . . . . . . . . . . . . . . . 20
Appendix C. Document History . . . . . . . . . . . . . . . . . . 20 Appendix C. Document History . . . . . . . . . . . . . . . . . . 20
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 20 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 21
1. Introduction 1. Introduction
The JSON Web Token (JWT) [RFC7519] is a standardized security token The JSON Web Token (JWT) [RFC7519] is a standardized security token
format that has found use in OAuth 2.0 and OpenID Connect format that has found use in OAuth 2.0 and OpenID Connect
deployments, among other applications. JWT uses JSON Web Signatures deployments, among other applications. JWT uses JSON Web Signatures
(JWS) [RFC7515] and JSON Web Encryption (JWE) [RFC7516] to secure the (JWS) [RFC7515] and JSON Web Encryption (JWE) [RFC7516] to secure the
contents of the JWT, which is a set of claims represented in JSON contents of the JWT, which is a set of claims represented in JSON
[RFC7519]. The use of JSON for encoding information is popular for [RFC7519]. The use of JSON for encoding information is popular for
Web and native applications, but it is considered inefficient for Web and native applications, but it is considered inefficient for
skipping to change at page 6, line 5 skipping to change at page 6, line 19
| aud | 3 | 3 | | aud | 3 | 3 |
| exp | 4 | 6 tag value 1 | | exp | 4 | 6 tag value 1 |
| nbf | 5 | 6 tag value 1 | | nbf | 5 | 6 tag value 1 |
| iat | 6 | 6 tag value 1 | | iat | 6 | 6 tag value 1 |
| cti | 7 | 2 | | cti | 7 | 2 |
\---------+------------------------+--------------------------/ \---------+------------------------+--------------------------/
Figure 1: Summary of the values, CBOR major types and encoded claim Figure 1: Summary of the values, CBOR major types and encoded claim
keys. keys.
5. Creating and Validating CWTs 5. CWT CBOR Tag
5.1. Creating a CWT How to determine that a CBOR data structure is a CWT is application-
dependent. In some cases, this information is known from the
application context, such as from the position of the CWT in a data
structure at which the value must be a CWT. One method of indicating
that a CBOR object is a CWT is the use of the "application/cwt"
content type by a transport protocol.
This section defines the CWT CBOR tag as another means for
applications to declare that a CBOR data structure is a CWT. Its use
is optional, and is intended for use in cases in which this
information would not otherwise be known.
The CWT tag MUST prefix a tagged object using one of the COSE CBOR
tags. In this example, the COSE_Mac0 tag is used. The actual
COSE_Mac0 object has been excluded from this example.
/ CWT CBOR tag / 61(
/ COSE_Mac0 CBOR tag / 17(
/ COSE_Mac0 object /
)
)
Figure 2: Example of a CWT tag usage
6. Creating and Validating CWTs
6.1. Creating a CWT
To create a CWT, the following steps are performed. The order of the To create a CWT, the following steps are performed. 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 a CWT Claims Set containing the desired claims. 1. Create a CWT Claims Set containing the desired claims.
2. Let the Message be the binary representation of the CWT Claims 2. Let the Message be the binary representation of the CWT Claims
Set. Set.
3. Create a COSE Header containing the desired set of Header 3. Create a COSE Header containing the desired set of Header
Parameters. The COSE Header MUST be valid according to the Parameters. The COSE Header MUST be valid per the
[I-D.ietf-cose-msg] specification. [I-D.ietf-cose-msg] specification.
4. Depending upon whether the CWT is signed, MACed or encrypted, 4. Depending upon whether the CWT is signed, MACed, or encrypted,
there are three cases: there are three cases:
* If the CWT is signed, create a COSE_Sign/COSE_Sign1 object * If the CWT is signed, create a COSE_Sign/COSE_Sign1 object
using the Message as the COSE_Sign/COSE_Sign1 Payload; all using the Message as the COSE_Sign/COSE_Sign1 Payload; all
steps specified in [I-D.ietf-cose-msg] for creating a steps specified in [I-D.ietf-cose-msg] for creating a
COSE_Sign/COSE_Sign1 object MUST be followed. COSE_Sign/COSE_Sign1 object MUST be followed.
* Else, if the CWT is MACed, create a COSE_Mac/COSE_Mac0 object * Else, if the CWT is MACed, create a COSE_Mac/COSE_Mac0 object
using the Message as the COSE_Mac/COSE_Mac0 Payload; all steps using the Message as the COSE_Mac/COSE_Mac0 Payload; all steps
specified in [I-D.ietf-cose-msg] for creating a COSE_Mac/ specified in [I-D.ietf-cose-msg] for creating a COSE_Mac/
skipping to change at page 7, line 5 skipping to change at page 7, line 43
5. If a nested signing, MACing or encryption operation will be 5. If a nested signing, MACing or encryption operation will be
performed, let the Message be the COSE_Sign/COSE_Sign1, COSE_Mac/ performed, let the Message be the COSE_Sign/COSE_Sign1, COSE_Mac/
COSE_Mac0 or COSE_Encrypt/COSE_Encrypt0, and return to Step 3, COSE_Mac0 or COSE_Encrypt/COSE_Encrypt0, and return to Step 3,
using a "content type" header value corresponding to the media using a "content type" header value corresponding to the media
type "application/cwt" in the new COSE Header created in that type "application/cwt" in the new COSE Header created in that
step. step.
Note: If integrity (signing/MACing) and confidentiality Note: If integrity (signing/MACing) and confidentiality
(encryption) protection are needed, it is recommended to use an (encryption) protection are needed, it is recommended to use an
authenticated encryption algorithm to save space and processing. authenticated encryption algorithm to save space and processing.
5.2. Validating a CWT 6. If needed by the application, add the appropriate COSE CBOR tag
to the COSE object to indicate type of COSE object. If also
needed by the application, add the CWT CBOR tag to indicate that
the COSE object is a CWT.
6.2. Validating a CWT
When validating a CWT, the following steps are performed. The order When validating a CWT, the following steps are performed. 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 fail, then the CWT MUST be rejected -- that is, the listed steps fail, then the CWT MUST be rejected -- that is,
treated by the application as an invalid input. treated by the application as an invalid input.
1. Verify that the CWT is a valid CBOR object. 1. Verify that the CWT is a valid CBOR object.
2. Verify that the resulting COSE Header includes only parameters 2. If the object begins with the CWT CBOR tag, remove it and verify
that one of the COSE CBOR tags follows it.
3. If the object is tagged with one of the COSE CBOR tags, remove it
and verify that it corresponds to the structure of the following
COSE object.
4. Verify that the resulting COSE Header includes only parameters
and values whose syntax and semantics are both understood and and values whose syntax and semantics are both understood and
supported or that are specified as being ignored when not supported or that are specified as being ignored when not
understood. understood.
3. Use the CBOR tag to determine the type of the CWT, COSE_Sign/ 5. Use the CBOR tag to determine the type of the CWT, COSE_Sign/
COSE_Sign1, COSE_Mac/COSE_Mac0, or COSE_Encrypt/COSE_Encrypt0. COSE_Sign1, COSE_Mac/COSE_Mac0, or COSE_Encrypt/COSE_Encrypt0.
4. Depending upon whether the CWT is a COSE_Sign/COSE_Sign1, 6. Depending upon whether the CWT is a signed, MACed, or encrypted,
COSE_Mac/COSE_Mac0 or COSE_Encrypt/COSE_Encrypt0, there are three there are three cases:
cases:
* If the CWT is a COSE_Sign/COSE_Sign1, follow the steps * If the CWT is a COSE_Sign/COSE_Sign1, follow the steps
specified in [I-D.ietf-cose-msg] Section 4 (Signing Objects) specified in [I-D.ietf-cose-msg] Section 4 (Signing Objects)
for validating a COSE_Sign/COSE_Sign1 object. Let the Message for validating a COSE_Sign/COSE_Sign1 object. Let the Message
be the COSE_Sign/COSE_Sign1 payload. be the COSE_Sign/COSE_Sign1 payload.
* Else, if the CWT is a COSE_Mac/COSE_Mac0, follow the steps * Else, if the CWT is a COSE_Mac/COSE_Mac0, follow the steps
specified in [I-D.ietf-cose-msg] Section 6 (MAC Objects) for specified in [I-D.ietf-cose-msg] Section 6 (MAC Objects) for
validating a COSE_Mac/COSE_Mac0 object. Let the Message be validating a COSE_Mac/COSE_Mac0 object. Let the Message be
the COSE_Mac/COSE_Mac0 payload. the COSE_Mac/COSE_Mac0 payload.
* Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, * Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object,
follow the steps specified in [I-D.ietf-cose-msg] Section 5 follow the steps specified in [I-D.ietf-cose-msg] Section 5
(Encryption Objects) for validating a COSE_Encrypt/ (Encryption Objects) for validating a COSE_Encrypt/
COSE_Encrypt0 object. Let the Message be the resulting COSE_Encrypt0 object. Let the Message be the resulting
plaintext. plaintext.
5. If the COSE Header contains a "content type" header value 7. If the COSE Header contains a "content type" header value
corresponding to the media type "application/cwt", then the corresponding to the media type "application/cwt", then the
Message is a CWT that was the subject of nested signing or Message is a CWT that was the subject of nested signing or
encryption operations. In this case, return to Step 1, using the encryption operations. In this case, return to Step 1, using the
Message as the CWT. Message as the CWT.
6. Verify that the Message is a valid CBOR object; let the CWT 8. Verify that the Message is a valid CBOR object; let the CWT
Claims Set be this CBOR object. Claims Set be this CBOR object.
6. Security Considerations 7. Security Considerations
The security of the CWT is dependent on the protection offered by The security of the CWT is dependent on the protections offered by
COSE. Without protecting the claims contained in a CWT an adversary COSE. Unless the claims in a CWT are protected, an adversary can
is able to modify, add or remove claims. Since the claims conveyed modify, add, or remove claims. Since the claims conveyed in a CWT
in a CWT are used to make authorization decisions it is not only may be used to make authorization decisions, it is not only important
important to protect the CWT in transit but also to ensure that the to protect the CWT in transit but also to ensure that the recipient
recipient is able to authenticate the party that collected the claims can authenticate the party that assembled the claims and created the
and created the CWT. Without trust of the recipient in the party CWT. Without trust of the recipient in the party that created the
that created the CWT no sensible authorization decision can be made. CWT, no sensible authorization decision can be made. Furthermore,
Furthermore, the creator of the CWT needs to carefully evaluate each the creator of the CWT needs to carefully evaluate each claim value
claim value prior to including it in the CWT so that the recipient prior to including it in the CWT so that the recipient can be assured
can be assured about the correctness of the provided information. of the validity of the information provided.
7. IANA Considerations 8. IANA Considerations
7.1. CBOR Web Token (CWT) Claims Registry 8.1. CBOR Web Token (CWT) Claims Registry
This section establishes the IANA "CBOR Web Token (CWT) Claims" This section establishes the IANA "CBOR Web Token (CWT) Claims"
registry. registry.
Values are registered on a Specification Required [RFC5226] basis, on Values are registered on a Specification Required [RFC5226] basis, on
the advice of one or more Designated Experts. However, to allow for the advice of one or more Designated Experts. However, to allow for
the allocation of values prior to publication, the Designated Experts the allocation of values prior to publication, the Designated Experts
may approve registration once they are satisfied that such a may approve registration once they are satisfied that such a
specification will be published. specification will be published.
Criteria that should be applied by the Designated Experts includes Criteria that should be applied by the Designated Experts includes
determining whether the proposed registration duplicates existing determining whether the proposed registration duplicates existing
functionality, whether it is likely to be of general applicability or functionality, whether it is likely to be of general applicability or
whether it is useful only for a single application, and whether the whether it is useful only for a single application, and whether the
registration description is clear. registration description is clear.
7.1.1. Registration Template 8.1.1. Registration Template
Claim Name: Claim Name:
The human-readable name requested (e.g., "iss"). The human-readable name requested (e.g., "iss").
Claim Description: Claim Description:
Brief description of the claim (e.g., "Issuer"). Brief description of the claim (e.g., "Issuer").
JWT Claim Name: JWT Claim Name:
Claim Name of the equivalent JWT claim as registered in Claim Name of the equivalent JWT claim as registered in
[IANA.JWT.Claims]. CWT claims should normally have a [IANA.JWT.Claims]. CWT claims should normally have a
skipping to change at page 9, line 23 skipping to change at page 10, line 23
For Standards Track RFCs, list the "IESG". For others, give the For Standards Track RFCs, list the "IESG". For others, give the
name of the responsible party. Other details (e.g., postal name of the responsible party. Other details (e.g., postal
address, email address, home page URI) may also be included. address, email address, home page URI) may also be included.
Specification Document(s): Specification Document(s):
Reference to the document or documents that specify the parameter, Reference to the document or documents that specify the parameter,
preferably including URIs that can be used to retrieve copies of preferably including URIs that can be used to retrieve copies of
the documents. An indication of the relevant sections may also be the documents. An indication of the relevant sections may also be
included but is not required. included but is not required.
7.1.2. Initial Registry Contents 8.1.2. Initial Registry Contents
o Claim Name: "iss" o Claim Name: "iss"
o Claim Description: Issuer o Claim Description: Issuer
o JWT Claim Name: "iss" o JWT Claim Name: "iss"
o CBOR Key Value: 1 o CBOR Key Value: 1
o CBOR Major Type: 3 o CBOR Major Type: 3
o Change Controller: IESG o Change Controller: IESG
o Specification Document(s): Section 3.1.1 of [[ this specification o Specification Document(s): Section 3.1.1 of [[ this specification
]] ]]
skipping to change at page 10, line 39 skipping to change at page 11, line 39
o Claim Name: "cti" o Claim Name: "cti"
o Claim Description: CWT ID o Claim Description: CWT ID
o JWT Claim Name: "jti" o JWT Claim Name: "jti"
o CBOR Key Value: 7 o CBOR Key Value: 7
o CBOR Major Type: 2 o CBOR Major Type: 2
o Change Controller: IESG o Change Controller: IESG
o Specification Document(s): Section 3.1.7 of [[ this specification o Specification Document(s): Section 3.1.7 of [[ this specification
]] ]]
7.2. Media Type Registration 8.2. Media Type Registration
This section registers the "application/cwt" media type [RFC2046] in This section registers the "application/cwt" media type [RFC2046] in
the "Media Types" registry [IANA.MediaTypes] in the manner described the "Media Types" registry [IANA.MediaTypes] in the manner described
in RFC 6838 [RFC6838], which can be used to indicate that the content in RFC 6838 [RFC6838], which can be used to indicate that the content
is a CWT. is a CWT.
7.2.1. Registry Contents 8.2.1. Registry Contents
o Type name: application o Type name: application
o Subtype name: cwt o Subtype name: cwt
o Required parameters: N/A o Required parameters: N/A
o Optional parameters: N/A o Optional parameters: N/A
o Encoding considerations: binary o Encoding considerations: binary
o Security considerations: See the Security Considerations section o Security considerations: See the Security Considerations section
of [[ this specification ]] of [[ this specification ]]
o Interoperability considerations: N/A o Interoperability considerations: N/A
o Published specification: [[ this specification ]] o Published specification: [[ this specification ]]
skipping to change at page 11, line 26 skipping to change at page 12, line 26
Macintosh file type code(s): N/A Macintosh file type code(s): N/A
o Person & email address to contact for further information: o Person & email address to contact for further information:
IESG, iesg@ietf.org IESG, iesg@ietf.org
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: IESG o Change controller: IESG
o Provisional registration? No o Provisional registration? No
7.3. CoAP Content-Formats Registration 8.3. CoAP Content-Formats Registration
This section registers the CoAP Content-Format ID for the This section registers the CoAP Content-Format ID for the
"application/cwt" media type in the "CoAP Content-Formats" registry "application/cwt" media type in the "CoAP Content-Formats" registry
[IANA.CoAP.Content-Formats] established by [RFC7252]. [IANA.CoAP.Content-Formats] established by [RFC7252].
7.3.1. Registry Contents 8.3.1. Registry Contents
o Media Type: application/cwt o Media Type: application/cwt
o Encoding: - o Encoding: -
o Id: TBD (maybe 61) o Id: TBD (maybe 61)
o Reference: [[ this specification ]] o Reference: [[ this specification ]]
8. References 8.4. CBOR Tag registration
8.1. Normative References This section registers the CWT CBOR tag in the "CBOR Tags" registry
[IANA.CBOR.Tags] established by [RFC7049].
8.4.1. Registry Contents
o CBOR Tag: TBD (maybe 61 to use the same value as the Content-
Format)
o Data Item: CBOR Web Token (CWT)
o Semantics: CBOR Web Token (CWT), as defined in [[ this
specification ]]
o Reference: [[ this specification ]]
o Point of Contact: Michael B. Jones, mbj@microsoft.com
9. References
9.1. Normative References
[I-D.ietf-cose-msg] [I-D.ietf-cose-msg]
Schaad, J., "CBOR Object Signing and Encryption (COSE)", Schaad, J., "CBOR Object Signing and Encryption (COSE)",
draft-ietf-cose-msg-24 (work in progress), November 2016. draft-ietf-cose-msg-24 (work in progress), November 2016.
[IANA.CBOR.Tags]
IANA, "Concise Binary Object Representation (CBOR) Tags",
<http://www.iana.org/assignments/cbor-tags/
cbor-tags.xhtml>.
[IANA.CoAP.Content-Formats] [IANA.CoAP.Content-Formats]
IANA, "CoAP Content-Formats", IANA, "CoAP Content-Formats",
<http://www.iana.org/assignments/core-parameters/ <http://www.iana.org/assignments/core-parameters/
core-parameters.xhtml#content-formats>. core-parameters.xhtml#content-formats>.
[IANA.JWT.Claims] [IANA.JWT.Claims]
IANA, "JSON Web Token Claims", IANA, "JSON Web Token Claims",
<http://www.iana.org/assignments/jwt>. <http://www.iana.org/assignments/jwt>.
[IANA.MediaTypes] [IANA.MediaTypes]
skipping to change at page 13, line 9 skipping to change at page 14, line 30
2015, <http://www.rfc-editor.org/info/rfc7515>. 2015, <http://www.rfc-editor.org/info/rfc7515>.
[RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)", [RFC7516] Jones, M. and J. Hildebrand, "JSON Web Encryption (JWE)",
RFC 7516, DOI 10.17487/RFC7516, May 2015, RFC 7516, DOI 10.17487/RFC7516, May 2015,
<http://www.rfc-editor.org/info/rfc7516>. <http://www.rfc-editor.org/info/rfc7516>.
[RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token [RFC7519] Jones, M., Bradley, J., and N. Sakimura, "JSON Web Token
(JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015, (JWT)", RFC 7519, DOI 10.17487/RFC7519, May 2015,
<http://www.rfc-editor.org/info/rfc7519>. <http://www.rfc-editor.org/info/rfc7519>.
8.2. Informative References 9.2. Informative References
[I-D.seitz-ace-oauth-authz] [I-D.greevenbosch-appsawg-cbor-cddl]
Seitz, L., Selander, G., Wahlstroem, E., Erdtman, S., and Vigano, C. and H. Birkholz, "CBOR data definition language
H. Tschofenig, "Authorization for the Internet of Things (CDDL): a notational convention to express CBOR data
using OAuth 2.0", draft-seitz-ace-oauth-authz-00 (work in structures", draft-greevenbosch-appsawg-cbor-cddl-09 (work
progress), October 2015. in progress), September 2016.
Appendix A. Examples Appendix A. Examples
Three examples of CWTs follow. This appendix includes a set of CWT examples that show how the CWT
Claims Set can be protected. There are examples that are signed,
MACed, encrypted, and that use nested signing and encryption. To
make the examples easier to read, they are presented both as hex
strings and in the extended CBOR diagnostic notation
[I-D.greevenbosch-appsawg-cbor-cddl].
A.1. CWT with "aud" and symmetric key A.1. Example CWT Claims Set
A CWT used in the context of ACE requires at least the "aud" and a The CWT Claims Set used for the different examples displays usage of
"cks" claim (defined elsewhere). This means that "iss", "alg", all the defined claims. For signed and MACed examples, the CWT
"key_ops" and others are pre-established and assumed. This would Claims Set is the CBOR encoding as a binary string.
look like this non-normative JSON.
{ a702656572696b77037818636f61703a2f2f6c696768742e6578616d706c652e
"aud":"coap://light.example.com", 636f6d041a5612aeb0051a5610d9f0061a5610d9f00175636f61703a2f2f6173
"cks": 2e6578616d706c652e636f6d07420b71
[ // COSE_Key is a CBOR map with an array of keys
{
"kty":4, // symmetric key is indicated using kty 4
"k": "loremipsum" // the symmetric key
}
]
}
Figure 2: "aud" claim and symmetric key in non-normative JSON Figure 3: Example CWT Claims Set as hex string
Using the CBOR encoded claim keys according to Section 4 and COSE {
[I-D.ietf-cose-msg] makes a CWT with "aud" and a symmetric key look / iss / 1: "coap://as.example.com",
like this in CBOR diagnostic notation: / sub / 2: "erikw",
/ aud / 3: "coap://light.example.com",
/ exp / 4: 1444064944,
/ nbf / 5: 1443944944,
/ iat / 6: 1443944944,
/ cti / 7: h'0b71'
}
Figure 4: Example CWT Claims Set in CBOR diagnostic notation
A.2. Example keys
This section contains the keys used to sign, MAC, and encrypt the
messages in this appendix. Line breaks are for display purposes
only.
A.2.1. 128-bit Symmetric Key as Hex Encoded String
9e4f3e65cc1a558b39ce97b3db469b04
A.2.2. 256-bit Symmetric Key as Hex Encoded String
e60198ac1650ec9210d7f4f5b27aeae2ada8f4adada555909edca75ce2ae506e
A.2.3. ECDSA P-256 256-bit COSE Key
a6225820feb11ca73b028a10cf77d58a2dfdf2a11eab8ffeeeaaeeb03097ffee
9f3ef2fc2358200657fada2568959c49a404583fe237290ebeb1956f3ad3d966
ea09e33369d7b103260102215820c4f9160fc22682991c59c4d96e8accc2da3c
c7b7a9bc197c7c1e1bc6d0c1dc612001
Figure 5: ECDSA 256-bit COSE Key as hex string
{ {
3: "coap://light.example.com", / d / -4: h'0657fada2568959c49a404583fe237290ebeb1956f3ad3d966
8: ea09e33369d7b1',
[ / y / -3: h'feb11ca73b028a10cf77d58a2dfdf2a11eab8ffeeeaaeeb030
{ 97ffee9f3ef2fc',
1: 4, / x / -2: h'c4f9160fc22682991c59c4d96e8accc2da3cc7b7a9bc197c7c
-1: "loremipsum" 1e1bc6d0c1dc61',
} / crv / -1: 1 / P-256 /
] / kty / 1: 2 / EC2 /,
/ alg / 3: -7, \ ECDSA 256 \
} }
Figure 3: CWT in CBOR diagnostic notation Figure 6: ECDSA 256-bit COSE Key in CBOR diagnostic notation
Defined in CBOR. A.3. Example Signed CWT
a2 # map(2) This section shows a signed CWT with a single recipient and a full
03 # unsigned(3) CWT Claims Set.
78 18 # text(24)
636f61703a2f2f6c696768742e6578616d706c652e636f6d # "coap://light.example.com"
08 # unsigned(8)
81 # array(1)
a2 # map(2)
01 # unsigned(1)
04 # unsigned(4)
20 # negative(0)
6a # text(10)
6c6f72656d697073756d # "loremipsum"
Figure 4: CWT with "aud" and symmetric key in CBOR The signature is generated using the private ECDSA key from
Appendix A.2.3 and it can be validated using the public part of the
ECDSA key from Appendix A.2.3. Line breaks are for display purposes
only.
Size of the CWT with a symmetric key of 10 bytes is 45 bytes. This d28446a203183d0126a05850a702656572696b77037818636f61703a2f2f6c69
is then packaged signed and encrypted using COSE. 6768742e6578616d706c652e636f6d041a5612aeb0051a5610d9f0061a5610d9
f00175636f61703a2f2f61732e6578616d706c652e636f6d07420b7158407eef
29abe962ac185e5a372d95d69ce1b5683c5c25efb69a81710dc5173254f5179a
639827694c22828819704eb026676ca78aaf8da76672a6b5537fb90e710d
A.2. CWT with "aud" and EC key Figure 7: Signed CWT as hex string
Token with "aud" set to "coap://light.example.com" and an EC key with 18(
"kid" set to "11". [
/ protected / h'a203183d0126' / {
/ content type / 3: 61, / CWT /
/ alg / 1: -7 / ECDSA 256 /
} / ,
/ unprotected / {},
/ payload / h'a702656572696b77037818636f61703a2f2f6c69676874
2e6578616d706c652e636f6d041a5612aeb0051a5610d9
f0061a5610d9f00175636f61703a2f2f61732e6578616d
706c652e636f6d07420b71' / {
/ iss / 1: "coap://as.example.com",
/ sub / 2: "erikw",
/ aud / 3: "coap://light.example.com",
/ exp / 4: 1444064944,
/ nbf / 5: 1443944944,
/ iat / 6: 1443944944,
/ cti / 7: h'0b71'
} / ,
/ signature / h'7eef29abe962ac185e5a372d95d69ce1b5683c5c25ef
b69a81710dc5173254f5179a639827694c2282881970
4eb026676ca78aaf8da76672a6b5537fb90e710d'
]
)
{ Figure 8: Signed CWT in CBOR diagnostic notation
"aud": "coap://light.example.com",
"cks":
[ // COSE_Key is a CBOR map with an array of keys
{
"kty": "EC",
"kid": "11",
"crv": 1, // using P-384
"x": h'bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a09eff',
"y": h'20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbfc117e'
}
]
}
Figure 5: "aud" claim and EC key in non-normative JSON A.4. Example MACed CWT
Using the CBOR encoded claim keys according to Section 4 and COSE This section shows a MACed CWT with a single recipient and a full CWT
[I-D.ietf-cose-msg] makes a CWT with "aud" and an EC key look like Claims Set.
this in CBOR diagnostic notation:
{ The MAC is generated using the 256-bit symmetric key from
3: "coap://light.example.com", Appendix A.2.2 with a 64-bit truncation. Line breaks are for display
8: purposes only.
[
{
1: 2,
2: "11",
-1: 1,
-2: h'bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a09eff',
-3: h'20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbfc117e'
}
]
}
Figure 6: CWT with EC key in CBOR diagnostic notation d18446a203183d0104a05850a702656572696b77037818636f61703a2f2f6c69
6768742e6578616d706c652e636f6d041a5612aeb0051a5610d9f0061a5610d9
f00175636f61703a2f2f61732e6578616d706c652e636f6d07420b7148b59884
6f1ce93f9d
Defined in CBOR. Figure 9: MACed CWT as hex string
a2 # map(2) 17(
03 # unsigned(3) [
78 18 # text(24) / protected / h'a203183d0104' / {
636f61703a2f2f6c696768742e6578616d706c652e636f6d # "coap://light.example.com" / content type / 3: 61, / CWT /
08 # unsigned(8) / alg / 1: 4 / HMAC 256/64 /
81 # array(1) } / ,
a5 # map(5) / unprotected / {},
01 # unsigned(1) / payload / h'a702656572696b77037818636f61703a2f2f6c69676874
02 # unsigned(2) 2e6578616d706c652e636f6d041a5612aeb0051a5610d9
02 # unsigned(2) f0061a5610d9f00175636f61703a2f2f61732e6578616d
62 # text(2) 706c652e636f6d07420b71' / {
3131 # "11" / iss / 1: "coap://as.example.com",
20 # negative(0) / sub / 2: "erikw",
01 # unsigned(1) / aud / 3: "coap://light.example.com",
21 # negative(1) / exp / 4: 1444064944,
58 20 # bytes(32) / nbf / 5: 1443944944,
bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a09eff # "\xBA\xC5\xB1\x1C\xAD\x8F\x99\xF9\xC7+\x05\xCFK\x9E&\xD2D\xDC\x18\x9FtR(%Z!\x9A\x86\xD6\xA0\x9E\xFF" / iat / 6: 1443944944,
22 # negative(2) / cti / 7: h'0b71'
58 20 # bytes(32) } / ,
20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbfc117e # "\x13\x8B\xF8-\xC1\xB6\xD5b\xBE\x0F\xA5J\xB7\x80J:d\xB6\xD7,\xCF\xEDko\xB6\xED(\xBB\xFC\x11~" / tag / h'b598846f1ce93f9d'
]
)
Figure 7: CWT with EC in CBOR Figure 10: MACed CWT in CBOR diagnostic notation
Size of the CWT with an EC key is 109 bytes. This is then packaged A.5. Example Encrypted CWT
signed and encrypted using COSE.
A.3. Full CWT This section shows an encrypted CWT with a single recipient and a
full CWT Claims Set.
CWT using all claims defined by this specification, plus extensions The encryption is done with AES-CCM mode using the 128-bit symmetric
for AIF and an EC key. key from Appendix A.2.1 with a 64-bit tag and 13-byte nonce, i.e.,
COSE AES-CCM-16-64-128. Line breaks are for display purposes only.
{ d08346a203183d010aa1054dadbe290e8c9c23067a558b15795858f7a8ec3e32
"iss": "coap://as.example.com", 3bb6e006e8aec087666f6fc0d65d7aa272f5f1dde1dfb52fd3a5e1ace97e5bfc
"aud": "coap://light.example.com", 8f05a146fd8a9feab7bb9e722254e2660612f956041264c06ea3b95afb0d8ce3
"sub": "erikw", 138bc80baf2511565d3dad63ea7534699fa449
"exp": 1444064944,
"nbf": 1443944944,
"iat": 1443944944,
"cti": 2929,
"cks":
[ // COSE_Key is a CBOR map with an array of keys
{
"kty": "EC",
"kid": "11",
"crv": 1, // using P-384
"x": h'bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a09eff',
"y": h'20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbfc117e'
}
],
"aif": [["/s/light", 1], ["/a/led", 5], ["/dtls", 2]]
}
Figure 8: All claims, "aif" and EC key in non-normative JSON Figure 11: Encrypted CWT as hex string
Using the CBOR encoded claim keys according to Section 4 and COSE 16(
[I-D.ietf-cose-msg] makes a full CWT look like this in CBOR [
diagnostic notation: / protected / h'a203183d010a' / {
/ content type / 3: 61, / CWT /
/ alg / 1: 10 / AES-CCM-16-64-128 /
} /,
/ unprotected / {
/ iv / 5: h'adbe290e8c9c23067a558b1579'
},
/ ciphertext / h'f7a8ec3e323bb6e006e8aec087666f6fc0d65d7aa27
2f5f1dde1dfb52fd3a5e1ace97e5bfc8f05a146fd8a
9feab7bb9e722254e2660612f956041264c06ea3b95
afb0d8ce3138bc80baf2511565d3dad63ea7534699f
a449'
]
)
{ Figure 12: Encrypted CWT in CBOR diagnostic notation
1: "coap://as.example.com",
3: "coap://light.example.com",
2: "erikw",
4: 1(1444064944),
5: 1(1443944944),
6: 1(1443944944),
7: 2929,
8: [
{
1: 2,
2: "11",
-1: 1,
-2: h'bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a09eff',
-3: h'20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbfc117e'
}
],
9: [["/s/light", 1], ["/a/led", 5], ["/dtls", 2]]
}
Figure 9: Full CWT with EC key in CBOR diagnostic notation A.6. Example Nested CWT
Defined in CBOR. This section shows a Nested CWT, signed and then encrypted, with a
single recipient and a full CWT Claims Set.
a9 # map(9) The signature is generated using the private ECDSA key from
01 # unsigned(1) Appendix A.2.3 and it can be validated using the public ECDSA parts
75 # text(21) from Appendix A.2.3. The encryption is done with AES-CCM mode using
636f61703a2f2f61732e6578616d706c652e636f6d # "coap://as.example.com" the 128-bit symmetric key from Appendix A.2.1 with a 64-bit tag and
03 # unsigned(3) 13-byte nonce, i.e., COSE AES-CCM-16-64-128. The content type is set
78 18 # text(24) to CWT to indicate that there are multiple layers of COSE protection
636f61703a2f2f6c696768742e6578616d706c652e636f6d # "coap://light.example.com" before finding the CWT Claims Set. The decrypted ciphertext will be a
02 # unsigned(2) COSE_sign1 structure. In this example, it is the same one as in
65 # text(5) Appendix A.3, i.e., a Signed CWT Claims Set. Note that there is no
6572696b77 # "erikw" limitation to the number of layers; this is an example with two
04 # unsigned(4) layers. Line breaks are for display purposes only.
c1 # tag(1)
1a 5612aeb0 # unsigned(1444064944)
05 # unsigned(5)
c1 # tag(1)
1a 5610d9f0 # unsigned(1443944944)
06 # unsigned(6)
c1 # tag(1)
1a 5610d9f0 # unsigned(1443944944)
07 # unsigned(7)
19 0b71 # unsigned(2929)
08 # unsigned(8)
81 # array(1)
a5 # map(5)
01 # unsigned(1)
02 # unsigned(2)
02 # unsigned(2)
62 # text(2)
3131 # "11"
20 # negative(0)
01 # unsigned(1)
21 # negative(1)
58 20 # bytes(32)
bac5b11cad8f99f9c72b05cf4b9e26d244dc189f745228255a219a86d6a09eff # "\xBA\xC5\xB1\x1C\xAD\x8F\x99\xF9\xC7+\x05\xCFK\x9E&\xD2D\xDC\x18\x9FtR(%Z!\x9A\x86\xD6\xA0\x9E\xFF"
22 # negative(2)
58 20 # bytes(32)
20138bf82dc1b6d562be0fa54ab7804a3a64b6d72ccfed6b6fb6ed28bbfc117e # "\x13\x8B\xF8-\xC1\xB6\xD5b\xBE\x0F\xA5J\xB7\x80J:d\xB6\xD7,\xCF\xEDko\xB6\xED(\xBB\xFC\x11~"
09 # unsigned(9)
83 # array(3)
82 # array(2)
68 # text(8)
2f732f6c69676874 # "/s/light"
01 # unsigned(1)
82 # array(2)
66 # text(6)
2f612f6c6564 # "/a/led"
05 # unsigned(5)
82 # array(2)
65 # text(5)
2f64746c73 # "/dtls"
02 # unsigned(2)
Figure 10: Full CWT with EC in CBOR d08346a203183d010aa1054d2653469d58937647a6a1bb023458a65da538206c33
cf941df7ea933ba7b93c60322017f9db9c904608fce2688b51028b5b912f9010
ae72802bf65778593c7270b20683b1587824eb4074e03323ccf0541b495a3757
f353a8424b6ceeaaec1898964d8a03e04e514a5b0ca143b57689a2a9f1c6c84d
535d1966adf900dfaf0dd045d2325c40150a07d602b65c60e62894c870ad5fc2
cb709e4d17d381806797b6cf118608e18c3facd0a0ac09d88ea73d4ed7e3b57c
Size of the CWT with an EC key is 194 bytes. This is then packaged Figure 13: Signed and Encrypted CWT as hex string
signed and encrypted using COSE.
16(
[
/ protected / h'a203183d010a' / {
/ content type / 3: 61, / CWT /
/ alg / 1: 10 / AES-CCM-16-64-128 /
} / ,
/ unprotected / {
/ iv / 5: h'2653469d58937647a6a1bb0234'
},
/ ciphertext / h'5da538206c33cf941df7ea933ba7b93c60322017f9d
b9c904608fce2688b51028b5b912f9010ae72802bf6
5778593c7270b20683b1587824eb4074e03323ccf05
41b495a3757f353a8424b6ceeaaec1898964d8a03e0
4e514a5b0ca143b57689a2a9f1c6c84d535d1966adf
900dfaf0dd045d2325c40150a07d602b65c60e62894
c870ad5fc2cb709e4d17d381806797b6cf118608e18
c3facd0a0ac09d88ea73d4ed7e3b57c'
]
)
Figure 14: Signed and Encrypted CWT in CBOR diagnostic notation
Appendix B. Acknowledgements Appendix B. Acknowledgements
This specification is based on JSON Web Token (JWT) [RFC7519], the This specification is based on JSON Web Token (JWT) [RFC7519], the
authors of which also include Nat Sakimura and John Bradley. A straw authors of which also include Nat Sakimura and John Bradley. Ludwig
man proposal of CWT was written in the draft "Authorization for the Seitz and Goeran Selander have made contributions the specification.
Internet of Things using OAuth 2.0" [I-D.seitz-ace-oauth-authz] with
the help of Ludwig Seitz and Goeran Selander.
Appendix C. Document History Appendix C. 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 ]]
-03
o Reworked the examples to include signed, MACed, encrypted, and
nested CWTs.
o Defined the CWT CBOR tag and explained its usage.
-02 -02
o Added IANA registration for the application/cwt media type. o Added IANA registration for the application/cwt media type.
o Clarified the nested CWT language. o Clarified the nested CWT language.
o Corrected nits identified by Ludwig Seitz. o Corrected nits identified by Ludwig Seitz.
-01 -01
o Added IANA registration for CWT Claims. o Added IANA registration for CWT Claims.
o Added IANA registration for the application/cwt CoAP content- o Added IANA registration for the application/cwt CoAP content-
format type. format type.
o Added Samuel Erdtman as an editor. o Added Samuel Erdtman as an editor.
o Changed Erik's e-mail address. o Changed Erik's e-mail address.
-00 -00
o Created the initial working group version based on draft- o Created the initial working group version based on draft-
wahlstroem-ace-cbor-web-token-00. wahlstroem-ace-cbor-web-token-00.
 End of changes. 69 change blocks. 
276 lines changed or deleted 343 lines changed or added

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