draft-ietf-ace-cbor-web-token-07.txt   draft-ietf-ace-cbor-web-token-08.txt 
ACE Working Group M. Jones ACE Working Group M. Jones
Internet-Draft Microsoft Internet-Draft Microsoft
Intended status: Standards Track E. Wahlstroem Intended status: Standards Track E. Wahlstroem
Expires: December 31, 2017 Expires: February 17, 2018
S. Erdtman S. Erdtman
Spotify AB Spotify AB
H. Tschofenig H. Tschofenig
ARM Ltd. ARM Ltd.
June 29, 2017 August 16, 2017
CBOR Web Token (CWT) CBOR Web Token (CWT)
draft-ietf-ace-cbor-web-token-07 draft-ietf-ace-cbor-web-token-08
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. The claims in a CWT are encoded in transferred between two parties. The claims in a CWT are encoded in
the Concise Binary Object Representation (CBOR) and CBOR Object the Concise Binary Object Representation (CBOR) and CBOR Object
Signing and Encryption (COSE) is used for added application layer Signing and Encryption (COSE) is used for added application layer
security protection. A claim is a piece of information asserted security protection. A claim is a piece of information asserted
about a subject and is represented as a name/value pair consisting of about a subject and is represented as a name/value pair consisting of
a claim name and a claim value. CWT is derived from JSON Web Token a claim name and a claim value. CWT is derived from JSON Web Token
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 December 31, 2017. This Internet-Draft will expire on February 17, 2018.
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
carefully, as they describe your rights and restrictions with respect carefully, as they describe your rights and restrictions with respect
to this document. Code Components extracted from this document must to this document. Code Components extracted from this document must
include Simplified BSD License text as described in Section 4.e of include Simplified BSD License text as described in Section 4.e of
the Trust Legal Provisions and are provided without warranty as the Trust Legal Provisions and are provided without warranty as
described in the Simplified BSD License. described in the Simplified BSD License.
Table of Contents Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1. CBOR Related Terminology . . . . . . . . . . . . . . . . 3 1.1. CBOR Related Terminology . . . . . . . . . . . . . . . . 3
2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3
3. Claims . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 3. Claims . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.1. Registered Claims . . . . . . . . . . . . . . . . . . . . 5 3.1. Registered Claims . . . . . . . . . . . . . . . . . . . . 5
3.1.1. iss (Issuer) Claim . . . . . . . . . . . . . . . . . 5 3.1.1. iss (Issuer) Claim . . . . . . . . . . . . . . . . . 5
3.1.2. sub (Subject) Claim . . . . . . . . . . . . . . . . . 5 3.1.2. sub (Subject) Claim . . . . . . . . . . . . . . . . . 5
3.1.3. aud (Audience) Claim . . . . . . . . . . . . . . . . 5 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 . . . . . . . . . . . . . . . . . 6 3.1.7. cti (CWT ID) Claim . . . . . . . . . . . . . . . . . 6
4. Summary of the claim names, keys, and value types . . . . . . 6 4. Summary of the claim names, keys, and value types . . . . . . 6
5. CBOR Tags and Claim Values . . . . . . . . . . . . . . . . . 6 5. CBOR Tags and Claim Values . . . . . . . . . . . . . . . . . 6
6. CWT CBOR Tag . . . . . . . . . . . . . . . . . . . . . . . . 6 6. CWT CBOR Tag . . . . . . . . . . . . . . . . . . . . . . . . 6
7. Creating and Validating CWTs . . . . . . . . . . . . . . . . 7 7. Creating and Validating CWTs . . . . . . . . . . . . . . . . 7
7.1. Creating a CWT . . . . . . . . . . . . . . . . . . . . . 7 7.1. Creating a CWT . . . . . . . . . . . . . . . . . . . . . 7
7.2. Validating a CWT . . . . . . . . . . . . . . . . . . . . 8 7.2. Validating a CWT . . . . . . . . . . . . . . . . . . . . 8
8. Security Considerations . . . . . . . . . . . . . . . . . . . 9 8. Security Considerations . . . . . . . . . . . . . . . . . . . 9
9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 9
9.1. CBOR Web Token (CWT) Claims Registry . . . . . . . . . . 10 9.1. CBOR Web Token (CWT) Claims Registry . . . . . . . . . . 10
9.1.1. Registration Template . . . . . . . . . . . . . . . . 10 9.1.1. Registration Template . . . . . . . . . . . . . . . . 10
9.1.2. Initial Registry Contents . . . . . . . . . . . . . . 11 9.1.2. Initial Registry Contents . . . . . . . . . . . . . . 11
9.2. Media Type Registration . . . . . . . . . . . . . . . . . 13 9.2. Media Type Registration . . . . . . . . . . . . . . . . . 13
9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 13 9.2.1. Registry Contents . . . . . . . . . . . . . . . . . . 13
9.3. CoAP Content-Formats Registration . . . . . . . . . . . . 13 9.3. CoAP Content-Formats Registration . . . . . . . . . . . . 13
9.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 14 9.3.1. Registry Contents . . . . . . . . . . . . . . . . . . 13
9.4. CBOR Tag registration . . . . . . . . . . . . . . . . . . 14 9.4. CBOR Tag registration . . . . . . . . . . . . . . . . . . 14
9.4.1. Registry Contents . . . . . . . . . . . . . . . . . . 14 9.4.1. Registry Contents . . . . . . . . . . . . . . . . . . 14
10. References . . . . . . . . . . . . . . . . . . . . . . . . . 14 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 14
10.1. Normative References . . . . . . . . . . . . . . . . . . 14 10.1. Normative References . . . . . . . . . . . . . . . . . . 14
10.2. Informative References . . . . . . . . . . . . . . . . . 15 10.2. Informative References . . . . . . . . . . . . . . . . . 15
Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 15 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 15
A.1. Example CWT Claims Set . . . . . . . . . . . . . . . . . 15 A.1. Example CWT Claims Set . . . . . . . . . . . . . . . . . 15
A.2. Example keys . . . . . . . . . . . . . . . . . . . . . . 16 A.2. Example keys . . . . . . . . . . . . . . . . . . . . . . 16
A.2.1. 128-bit Symmetric Key as Hex Encoded String . . . . . 16 A.2.1. 128-bit Symmetric Key as Hex Encoded String . . . . . 16
A.2.2. 256-bit Symmetric Key as Hex Encoded String . . . . . 16 A.2.2. 256-bit Symmetric Key as Hex Encoded String . . . . . 16
skipping to change at page 3, line 34 skipping to change at page 3, line 34
Internet of Things (IoT) systems that use low power radio Internet of Things (IoT) systems that use low power radio
technologies. technologies.
An alternative encoding of claims is defined in this document. An alternative encoding of claims is defined in this document.
Instead of using JSON, as provided by JWTs, this specification uses Instead of using JSON, as provided by JWTs, this specification uses
CBOR [RFC7049] and calls this new structure "CBOR Web Token (CWT)", CBOR [RFC7049] and calls this new structure "CBOR Web Token (CWT)",
which is a compact means of representing secured claims to be which is a compact means of representing secured claims to be
transferred between two parties. CWT is closely related to JWT. It transferred between two parties. CWT is closely related to JWT. It
references the JWT claims and both its name and pronunciation are references the JWT claims and both its name and pronunciation are
derived from JWT. To protect the claims contained in CWTs, the CBOR derived from JWT. To protect the claims contained in CWTs, the CBOR
Object Signing and Encryption (COSE) [I-D.ietf-cose-msg] Object Signing and Encryption (COSE) [RFC8152] specification is used.
specification is used.
The suggested pronunciation of CWT is the same as the English word The suggested pronunciation of CWT is the same as the English word
"cot". "cot".
1.1. CBOR Related Terminology 1.1. CBOR Related Terminology
In JSON, maps are called objects and only have one kind of map key: a In JSON, maps are called objects and only have one kind of map key: a
string. CBOR uses strings, negative integers, and unsigned integers string. CBOR uses strings, negative integers, and unsigned integers
as map keys. The integers are used for compactness of encoding and as map keys. The integers are used for compactness of encoding and
easy comparison. The inclusion of strings allows for an additional easy comparison. The inclusion of strings allows for an additional
range of short encoded values to be used. range of short encoded values to be used.
2. Terminology 2. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
"OPTIONAL" in this document are to be interpreted as described in "OPTIONAL" in this document are to be interpreted as described in
"Key words for use in RFCs to Indicate Requirement Levels" [RFC2119]. "Key words for use in RFCs to Indicate Requirement Levels" [RFC2119].
This document reuses terminology from JWT [RFC7519] and COSE This document reuses terminology from JWT [RFC7519] and COSE
[I-D.ietf-cose-msg]. [RFC8152].
StringOrURI StringOrURI
The "StringOrURI" term has the same meaning, syntax, and The "StringOrURI" term has the same meaning, syntax, and
processing rules as the "StringOrUri" term defined in Section 2 of processing rules as the "StringOrUri" term defined in Section 2 of
JWT [RFC7519], except that it uses a CBOR text string instead of a JWT [RFC7519], except that it uses a CBOR text string instead of a
JSON string value. JSON string value.
NumericDate NumericDate
The "NumericDate" term has the same meaning, syntax, and The "NumericDate" term has the same meaning, syntax, and
processing rules as the "NumericDate" term defined in Section 2 of processing rules as the "NumericDate" term defined in Section 2 of
skipping to change at page 6, line 18 skipping to change at page 6, line 18
3.1.7. cti (CWT ID) Claim 3.1.7. cti (CWT ID) Claim
The "cti" (CWT ID) claim has the same meaning, syntax, and processing The "cti" (CWT ID) claim has the same meaning, syntax, and processing
rules as the "jti" claim defined in Section 4.1.7 of JWT [RFC7519], rules as the "jti" claim defined in Section 4.1.7 of JWT [RFC7519],
except that the value is of type binary string. The Claim Key 7 is except that the value is of type binary string. The Claim Key 7 is
used to identify this claim. used to identify this claim.
4. Summary of the claim names, keys, and value types 4. Summary of the claim names, keys, and value types
/---------+-----+----------------------------------\ /---------+-----+----------------------------------\
| Name | Key | Value type | | Name | Key | Value type |
|---------+-----+----------------------------------| |---------+-----+----------------------------------|
| iss | 1 | text string | | iss | 1 | text string |
| sub | 2 | text string | | sub | 2 | text string |
| aud | 3 | text string | | aud | 3 | text string |
| exp | 4 | integer or floating-point number | | exp | 4 | integer or floating-point number |
| nbf | 5 | integer or floating-point number | | nbf | 5 | integer or floating-point number |
| iat | 6 | integer or floating-point number | | iat | 6 | integer or floating-point number |
| cti | 7 | binary string | | cti | 7 | binary string |
\---------+-----+----------------------------------/ \---------+-----+----------------------------------/
Figure 1: Summary of the claim names, keys, and value types Figure 1: Summary of the claim names, keys, and value types
5. CBOR Tags and Claim Values 5. CBOR Tags and Claim Values
The claim values defined in this specification MUST NOT be prefixed The claim values defined in this specification MUST NOT be prefixed
with any CBOR tag. For instance, while CBOR tag 1 (epoch-based date/ with any CBOR tag. For instance, while CBOR tag 1 (epoch-based date/
time) could logically be prefixed to values of the "exp", "nbf", and time) could logically be prefixed to values of the "exp", "nbf", and
"iat" claims, this is unnecessary, since the representation of the "iat" claims, this is unnecessary, since the representation of the
skipping to change at page 7, line 36 skipping to change at page 7, line 36
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 per the Parameters. The COSE Header MUST be valid per the [RFC8152]
[I-D.ietf-cose-msg] specification. 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 [RFC8152] for creating a COSE_Sign/
COSE_Sign/COSE_Sign1 object MUST be followed. 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 [RFC8152] for creating a COSE_Mac/COSE_Mac0
COSE_Mac0 object MUST be followed. object MUST be followed.
* Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, * Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object,
create a COSE_Encrypt/COSE_Encrypt0 using the Message as the create a COSE_Encrypt/COSE_Encrypt0 using the Message as the
plaintext for the COSE_Encrypt/COSE_Encrypt0 object; all steps plaintext for the COSE_Encrypt/COSE_Encrypt0 object; all steps
specified in [I-D.ietf-cose-msg] for creating a COSE_Encrypt/ specified in [RFC8152] for creating a COSE_Encrypt/
COSE_Encrypt0 object MUST be followed. COSE_Encrypt0 object MUST be followed.
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, add the matching COSE COSE_Mac0, or COSE_Encrypt/COSE_Encrypt0, add the matching COSE
CBOR tag, and return to Step 3. CBOR tag, and return to Step 3.
6. If needed by the application, add the appropriate COSE CBOR tag 6. If needed by the application, add the appropriate COSE CBOR tag
to the COSE object to indicate the type of the COSE object. If to the COSE object to indicate the type of the COSE object. If
needed by the application, add the CWT CBOR tag to indicate that needed by the application, add the CWT CBOR tag to indicate that
skipping to change at page 8, line 49 skipping to change at page 8, line 49
4. Verify that the resulting COSE Header includes only parameters 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.
5. Depending upon whether the CWT is a signed, MACed, or encrypted, 5. Depending upon whether the CWT is a signed, MACed, or encrypted,
there are three cases: there are three 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 [RFC8152] Section 4 (Signing Objects) for
for validating a COSE_Sign/COSE_Sign1 object. Let the Message validating a COSE_Sign/COSE_Sign1 object. Let the Message be
be the COSE_Sign/COSE_Sign1 payload. 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 [RFC8152] Section 6 (MAC Objects) for validating
validating a COSE_Mac/COSE_Mac0 object. Let the Message be a COSE_Mac/COSE_Mac0 object. Let the Message be the COSE_Mac/
the COSE_Mac/COSE_Mac0 payload. 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 [RFC8152] Section 5 (Encryption
(Encryption Objects) for validating a COSE_Encrypt/ Objects) for validating a COSE_Encrypt/COSE_Encrypt0 object.
COSE_Encrypt0 object. Let the Message be the resulting Let the Message be the resulting plaintext.
plaintext.
6. If the Message begins with a COSE CBOR tag, then the Message is a 6. If the Message begins with a COSE CBOR tag, then the Message is a
CWT that was the subject of nested signing, MACing, or encryption CWT that was the subject of nested signing, MACing, or encryption
operations. In this case, return to Step 1, using the Message as operations. In this case, return to Step 1, using the Message as
the CWT. the CWT.
7. Verify that the Message is a valid CBOR map; let the CWT Claims 7. Verify that the Message is a valid CBOR map; let the CWT Claims
Set be this CBOR map. Set be this CBOR map.
8. Security Considerations 8. Security Considerations
skipping to change at page 14, line 31 skipping to change at page 14, line 25
o Data Item: CBOR Web Token (CWT) o Data Item: CBOR Web Token (CWT)
o Semantics: CBOR Web Token (CWT), as defined in [[ this o Semantics: CBOR Web Token (CWT), as defined in [[ this
specification ]] specification ]]
o Reference: [[ this specification ]] o Reference: [[ this specification ]]
o Point of Contact: Michael B. Jones, mbj@microsoft.com o Point of Contact: Michael B. Jones, mbj@microsoft.com
10. References 10. References
10.1. Normative References 10.1. Normative References
[I-D.ietf-cose-msg]
Schaad, J., "CBOR Object Signing and Encryption (COSE)",
draft-ietf-cose-msg-24 (work in progress), November 2016.
[IANA.CBOR.Tags] [IANA.CBOR.Tags]
IANA, "Concise Binary Object Representation (CBOR) Tags", IANA, "Concise Binary Object Representation (CBOR) Tags",
<http://www.iana.org/assignments/cbor-tags/ <http://www.iana.org/assignments/cbor-tags/
cbor-tags.xhtml>. 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>.
skipping to change at page 15, line 13 skipping to change at page 15, line 5
<http://www.rfc-editor.org/info/rfc2119>. <http://www.rfc-editor.org/info/rfc2119>.
[RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object [RFC7049] Bormann, C. and P. Hoffman, "Concise Binary Object
Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049,
October 2013, <http://www.rfc-editor.org/info/rfc7049>. October 2013, <http://www.rfc-editor.org/info/rfc7049>.
[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>.
[RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)",
RFC 8152, DOI 10.17487/RFC8152, July 2017,
<http://www.rfc-editor.org/info/rfc8152>.
10.2. Informative References 10.2. Informative References
[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>.
[RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an
IANA Considerations Section in RFCs", RFC 5226, IANA Considerations Section in RFCs", RFC 5226,
DOI 10.17487/RFC5226, May 2008, DOI 10.17487/RFC5226, May 2008,
<http://www.rfc-editor.org/info/rfc5226>. <http://www.rfc-editor.org/info/rfc5226>.
skipping to change at page 15, line 46 skipping to change at page 15, line 42
Appendix A. Examples Appendix A. Examples
This appendix includes a set of CWT examples that show how the CWT This appendix includes a set of CWT examples that show how the CWT
Claims Set can be protected. There are examples that are signed, Claims Set can be protected. There are examples that are signed,
MACed, encrypted, and that use nested signing and encryption. To MACed, encrypted, and that use nested signing and encryption. To
make the examples easier to read, they are presented both as hex make the examples easier to read, they are presented both as hex
strings and in the extended CBOR diagnostic notation described in strings and in the extended CBOR diagnostic notation described in
Section 6 of [RFC7049]. Section 6 of [RFC7049].
Where a byte string is to carry an embedded CBOR-encoded item, the
diagnostic notation for this CBOR data item can be enclosed in '<<'
and '>>' to notate the byte string resulting from encoding the data
item, e.g., h'63666F6F' translates to <<"foo">>.
A.1. Example CWT Claims Set A.1. Example CWT Claims Set
The CWT Claims Set used for the different examples displays usage of The CWT Claims Set used for the different examples displays usage of
all the defined claims. For signed and MACed examples, the CWT all the defined claims. For signed and MACed examples, the CWT
Claims Set is the CBOR encoding as a binary string. Claims Set is the CBOR encoding as a binary string.
a70175636f61703a2f2f61732e6578616d706c652e636f6d02656572696b7703 a70175636f61703a2f2f61732e6578616d706c652e636f6d02656572696b7703
7818636f61703a2f2f6c696768742e6578616d706c652e636f6d041a5612aeb0 7818636f61703a2f2f6c696768742e6578616d706c652e636f6d041a5612aeb0
051a5610d9f0061a5610d9f007420b71 051a5610d9f0061a5610d9f007420b71
skipping to change at page 17, line 7 skipping to change at page 17, line 7
a622582060f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168db952997 a622582060f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168db952997
1a36e7b92358206c1382765aec5358f117733d281c1c7bdc39884d04a45a1e6c 1a36e7b92358206c1382765aec5358f117733d281c1c7bdc39884d04a45a1e6c
67c858bc206c1903260102215820143329cce7868e416927599cf65a34f3ce2f 67c858bc206c1903260102215820143329cce7868e416927599cf65a34f3ce2f
fda55a7eca69ed8919a394d42f0f2001 fda55a7eca69ed8919a394d42f0f2001
Figure 5: ECDSA 256-bit COSE Key as hex string Figure 5: ECDSA 256-bit COSE Key as hex string
{ {
/ d / -4: h'6c1382765aec5358f117733d281c1c7bdc39884d04a45a1e / d / -4: h'6c1382765aec5358f117733d281c1c7bdc39884d04a45a1e
6c67c858bc206c19', 6c67c858bc206c19',
/ y / -3: h'60f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168 / y / -3: h'60f7f1a780d8a783bfb7a2dd6b2796e8128dbbcef9d3d168
db9529971a36e7b9', db9529971a36e7b9',
/ x / -2: h'143329cce7868e416927599cf65a34f3ce2ffda55a7eca69 / x / -2: h'143329cce7868e416927599cf65a34f3ce2ffda55a7eca69
ed8919a394d42f0f', ed8919a394d42f0f',
/ crv / -1: 1 / P-256 / , / crv / -1: 1 / P-256 /,
/ kty / 1: 2 / EC2 / , / kty / 1: 2 / EC2 /,
/ alg / 3: -7 / ECDSA 256 / / alg / 3: -7 / ECDSA 256 /
} }
Figure 6: ECDSA 256-bit COSE Key in CBOR diagnostic notation Figure 6: ECDSA 256-bit COSE Key in CBOR diagnostic notation
A.3. Example Signed CWT A.3. Example Signed CWT
This section shows a signed CWT with a single recipient and a full This section shows a signed CWT with a single recipient and a full
CWT Claims Set. CWT Claims Set.
skipping to change at page 18, line 7 skipping to change at page 18, line 7
d28443a10126a05850a70175636f61703a2f2f61732e6578616d706c652e636f6 d28443a10126a05850a70175636f61703a2f2f61732e6578616d706c652e636f6
d02656572696b77037818636f61703a2f2f6c696768742e6578616d706c652e63 d02656572696b77037818636f61703a2f2f6c696768742e6578616d706c652e63
6f6d041a5612aeb0051a5610d9f0061a5610d9f007420b7158405427c1ff28d23 6f6d041a5612aeb0051a5610d9f0061a5610d9f007420b7158405427c1ff28d23
fbad1f29c4c7c6a555e601d6fa29f9179bc3d7438bacaca5acd08c8d4d4f96131 fbad1f29c4c7c6a555e601d6fa29f9179bc3d7438bacaca5acd08c8d4d4f96131
680c429a01f85951ecee743a52b9b63632c57209120e1c9e30 680c429a01f85951ecee743a52b9b63632c57209120e1c9e30
Figure 7: Signed CWT as hex string Figure 7: Signed CWT as hex string
18( 18(
[ [
/ protected / h'a10126' / { / protected / << {
/ alg / 1: -7 / ECDSA 256 / / alg / 1: -7 / ECDSA 256 /
} / , } >>,
/ unprotected / {}, / unprotected / {},
/ payload / h'a70175636f61703a2f2f61732e6578616d706c652e63 / payload / << {
6f6d02656572696b77037818636f61703a2f2f6c6967 / iss / 1: "coap://as.example.com",
68742e6578616d706c652e636f6d041a5612aeb0051a / sub / 2: "erikw",
5610d9f0061a5610d9f007420b71' / { / aud / 3: "coap://light.example.com",
/ iss / 1: "coap://as.example.com", / exp / 4: 1444064944,
/ sub / 2: "erikw", / nbf / 5: 1443944944,
/ aud / 3: "coap://light.example.com", / iat / 6: 1443944944,
/ exp / 4: 1444064944, / cti / 7: h'0b71'
/ nbf / 5: 1443944944, } >>,
/ iat / 6: 1443944944,
/ cti / 7: h'0b71'
} / ,
/ signature / h'5427c1ff28d23fbad1f29c4c7c6a555e601d6fa29f / signature / h'5427c1ff28d23fbad1f29c4c7c6a555e601d6fa29f
9179bc3d7438bacaca5acd08c8d4d4f96131680c42 9179bc3d7438bacaca5acd08c8d4d4f96131680c42
9a01f85951ecee743a52b9b63632c57209120e1c9e 9a01f85951ecee743a52b9b63632c57209120e1c9e
30' 30'
] ]
) )
Figure 8: Signed CWT in CBOR diagnostic notation Figure 8: Signed CWT in CBOR diagnostic notation
A.4. Example MACed CWT A.4. Example MACed CWT
This section shows a MACed CWT with a single recipient, a full CWT This section shows a MACed CWT with a single recipient, a full CWT
Claims Set, and a CWT tag. Claims Set, and a CWT tag.
skipping to change at page 19, line 8 skipping to change at page 19, line 8
d83dd18443a10104a05850a70175636f61703a2f2f61732e6578616d706c652e d83dd18443a10104a05850a70175636f61703a2f2f61732e6578616d706c652e
636f6d02656572696b77037818636f61703a2f2f6c696768742e6578616d706c 636f6d02656572696b77037818636f61703a2f2f6c696768742e6578616d706c
652e636f6d041a5612aeb0051a5610d9f0061a5610d9f007420b7148093101ef 652e636f6d041a5612aeb0051a5610d9f0061a5610d9f007420b7148093101ef
6d789200 6d789200
Figure 9: MACed CWT with CWT tag as hex string Figure 9: MACed CWT with CWT tag as hex string
61( 61(
17( 17(
[ [
/ protected / h'a10104' / { / protected / << {
/ alg / 1: 4 / HMAC 256/64 / / alg / 1: 4 / HMAC-256-64 /
} / , } >>,
/ unprotected / {}, / unprotected / {},
/ payload / h'a70175636f61703a2f2f61732e6578616d706c652e636f / payload / << {
6d02656572696b77037818636f61703a2f2f6c69676874 / iss / 1: "coap://as.example.com",
2e6578616d706c652e636f6d041a5612aeb0051a5610d9 / sub / 2: "erikw",
f0061a5610d9f007420b71' / { / aud / 3: "coap://light.example.com",
/ iss / 1: "coap://as.example.com", / exp / 4: 1444064944,
/ sub / 2: "erikw", / nbf / 5: 1443944944,
/ aud / 3: "coap://light.example.com", / iat / 6: 1443944944,
/ exp / 4: 1444064944, / cti / 7: h'0b71'
/ nbf / 5: 1443944944, } >>,
/ iat / 6: 1443944944,
/ cti / 7: h'0b71'
} / ,
/ tag / h'093101ef6d789200' / tag / h'093101ef6d789200'
] ]
) )
) )
Figure 10: MACed CWT with CWT tag in CBOR diagnostic notation Figure 10: MACed CWT with CWT tag in CBOR diagnostic notation
A.5. Example Encrypted CWT A.5. Example Encrypted CWT
This section shows an encrypted CWT with a single recipient and a This section shows an encrypted CWT with a single recipient and a
skipping to change at page 20, line 7 skipping to change at page 20, line 7
d08343a1010aa1054d99a0d7846e762c49ffe8a63e0b5858b918a11fd81e438b d08343a1010aa1054d99a0d7846e762c49ffe8a63e0b5858b918a11fd81e438b
7f973d9e2e119bcb22424ba0f38a80f27562f400ee1d0d6c0fdb559c02421fd3 7f973d9e2e119bcb22424ba0f38a80f27562f400ee1d0d6c0fdb559c02421fd3
84fc2ebe22d7071378b0ea7428fff157444d45f7e6afcda1aae5f6495830c586 84fc2ebe22d7071378b0ea7428fff157444d45f7e6afcda1aae5f6495830c586
27087fc5b4974f319a8707a635dd643b 27087fc5b4974f319a8707a635dd643b
Figure 11: Encrypted CWT as hex string Figure 11: Encrypted CWT as hex string
16( 16(
[ [
/ protected / h'a1010a' / { / protected / << {
/ alg / 1: 10 / AES-CCM-16-64-128 / / alg / 1: 10 / AES-CCM-16-64-128 /
} /, } >>,
/ unprotected / { / unprotected / {
/ iv / 5: h'99a0d7846e762c49ffe8a63e0b' / iv / 5: h'99a0d7846e762c49ffe8a63e0b'
}, },
/ ciphertext / h'b918a11fd81e438b7f973d9e2e119bcb22424ba0f38 / ciphertext / h'b918a11fd81e438b7f973d9e2e119bcb22424ba0f38
a80f27562f400ee1d0d6c0fdb559c02421fd384fc2e a80f27562f400ee1d0d6c0fdb559c02421fd384fc2e
be22d7071378b0ea7428fff157444d45f7e6afcda1a be22d7071378b0ea7428fff157444d45f7e6afcda1a
ae5f6495830c58627087fc5b4974f319a8707a635dd ae5f6495830c58627087fc5b4974f319a8707a635dd
643b' 643b'
] ]
) )
Figure 12: Encrypted CWT in CBOR diagnostic notation Figure 12: Encrypted CWT in CBOR diagnostic notation
A.6. Example Nested CWT A.6. Example Nested CWT
This section shows a Nested CWT, signed and then encrypted, with a This section shows a Nested CWT, signed and then encrypted, with a
single recipient and a full CWT Claims Set. single recipient and a full CWT Claims Set.
skipping to change at page 21, line 7 skipping to change at page 21, line 7
601ebfb29454050a3c99fd13b27216d084556496c7355c4bb462510f8e0e8479 601ebfb29454050a3c99fd13b27216d084556496c7355c4bb462510f8e0e8479
dbe08722d620e96bcb7764d75140d96220f062679b46b897e7abe0c325dc2c96 dbe08722d620e96bcb7764d75140d96220f062679b46b897e7abe0c325dc2c96
d8bb2c8334e3b92a42c0078983e753c054e647ad5387ed149f802f52b5a95ebf d8bb2c8334e3b92a42c0078983e753c054e647ad5387ed149f802f52b5a95ebf
5f153c4fd64854ab7531e082b7f22721f939d257c94f8bc248e1d9cf04f9dd4e 5f153c4fd64854ab7531e082b7f22721f939d257c94f8bc248e1d9cf04f9dd4e
5de7ab62df37842fabec230a657d4abf7162bc786345ebb8eb3af0 5de7ab62df37842fabec230a657d4abf7162bc786345ebb8eb3af0
Figure 13: Signed and Encrypted CWT as hex string Figure 13: Signed and Encrypted CWT as hex string
16( 16(
[ [
/ protected / h'a203183d010a' / { / protected / << {
/ alg / 1: 10 / AES-CCM-16-64-128 / / alg / 1: 10 / AES-CCM-16-64-128 /
} / , } >>,
/ unprotected / { / unprotected / {
/ iv / 5: h'86bbd41cc32604396324b7f380' / iv / 5: h'86bbd41cc32604396324b7f380'
}, },
/ ciphertext / h'72439fbff538aa7b601ebfb29454050a3c99fd13b27 / ciphertext / h'72439fbff538aa7b601ebfb29454050a3c99fd13b27
216d084556496c7355c4bb462510f8e0e8479dbe087 216d084556496c7355c4bb462510f8e0e8479dbe087
22d620e96bcb7764d75140d96220f062679b46b897e 22d620e96bcb7764d75140d96220f062679b46b897e
7abe0c325dc2c96d8bb2c8334e3b92a42c0078983e7 7abe0c325dc2c96d8bb2c8334e3b92a42c0078983e7
53c054e647ad5387ed149f802f52b5a95ebf5f153c4 53c054e647ad5387ed149f802f52b5a95ebf5f153c4
fd64854ab7531e082b7f22721f939d257c94f8bc248 fd64854ab7531e082b7f22721f939d257c94f8bc248
e1d9cf04f9dd4e5de7ab62df37842fabec230a657d4 e1d9cf04f9dd4e5de7ab62df37842fabec230a657d4
abf7162bc786345ebb8eb3af0' abf7162bc786345ebb8eb3af0'
] ]
) )
Figure 14: Signed and Encrypted CWT in CBOR diagnostic notation Figure 14: Signed and Encrypted CWT in CBOR diagnostic notation
A.7. Example MACed CWT with a floating-point value A.7. Example MACed CWT with a floating-point value
This section shows a MACed CWT with a single recipient and a simple This section shows a MACed CWT with a single recipient and a simple
CWT Claims Set. The CWT Claims Set with a floating-point 'iat' value. CWT Claims Set. The CWT Claims Set with a floating-point 'iat' value.
The MAC is generated using the 256-bit symmetric key from The MAC is generated using the 256-bit symmetric key from
Appendix A.2.2 with a 64-bit truncation. Line breaks are for display Appendix A.2.2 with a 64-bit truncation. Line breaks are for display
purposes only. purposes only.
d18443a10104a04ba106fb41d584367c20000048b8816f34c0542892 d18443a10104a04ba106fb41d584367c20000048b8816f34c0542892
Figure 15: MACed CWT with a floating-point value as hex string Figure 15: MACed CWT with a floating-point value as hex string
17( 17(
[ [
/ protected / h'a10104' / { / protected / << {
/ alg / 1: 4 / HMAC 256/64 / / alg / 1: 4 / HMAC-256-64 /
} / , } >>,
/ unprotected / {}, / unprotected / {},
/ payload / h'a106fb41d584367c200000' / { / payload / << {
/ iat / 6: 1443944944.5 / iat / 6: 1443944944.5
} / , } >>,
/ tag / h'b8816f34c0542892' / tag / h'b8816f34c0542892'
] ]
) )
Figure 16: MACed CWT with a floating-point value in CBOR diagnostic Figure 16: MACed CWT with a floating-point value in CBOR diagnostic
notation 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. It also authors of which also include Nat Sakimura and John Bradley. It also
incorporates suggestions made by many people, notably Carsten incorporates suggestions made by many people, notably Carsten
Bormann, Jim Schaad, Ludwig Seitz, and Goeran Selander. Bormann, Jim Schaad, 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 ]]
-08
o Updated the diagnostic notation for embedded objects in the
examples, addressing feedback by Carsten Bormann.
-07 -07
o Updated examples for signing and encryption. Signatures are now o Updated examples for signing and encryption. Signatures are now
deterministic as recommended by COSE specification. deterministic as recommended by COSE specification.
-06 -06
o Addressed review comments by Carsten Bormann and Jim Schaad. All o Addressed review comments by Carsten Bormann and Jim Schaad. All
changes were editorial in nature. changes were editorial in nature.
 End of changes. 40 change blocks. 
94 lines changed or deleted 96 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/