CBOR Web Token (CWT)Swedenerik@wahlstromstekniska.seMicrosoftmbj@microsoft.comhttp://self-issued.info/ARM Ltd.6060Hall in TirolAustriaHannes.Tschofenig@arm.comSpotify ABBirger Jarlsgatan 61, 4trStockholm113 56Sweden+46702691499erdtman@spotify.com
Security
ACE Working GroupInternet-DraftJSON Web TokenJWTClaimsCBORCOSEOAuthACE
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
Token (JWT) that is optimized for constrained devices. The claims in a
CWT are encoded in the Concise Binary Object Representation (CBOR) and
CBOR Object Signing and Encryption (COSE) is used for added application
layer security protection. A claim is a piece of information asserted
about a subject and is represented as a name/value pair consisting of a
claim name and a claim value.
The JSON Web Token (JWT) is a standardized security token format
that has found use in OAuth 2.0 and OpenID Connect deployments, among other applications.
JWT uses JSON Web Signatures (JWS) and
JSON Web Encryption (JWE) to secure the contents of the JWT,
which is a set of claims represented in JSON .
The use of JSON for encoding information is popular for
Web and native applications, but it is considered inefficient for some
Internet of Things (IoT) systems that use low power radio technologies.
In this document an alternative encoding of claims is defined. Instead
of using JSON, as provided by JWTs, this specification uses
CBOR and calls this new structure "CBOR Web Token (CWT)", which is a
compact means of representing secured claims to be transferred between two
parties. CWT is closely related to JWT. It references the JWT claims
and both its name and pronunciation are derived from JWT. To protect the
claims contained in CWTs, the CBOR Object Signing and Encryption (COSE)
specification is used.
The suggested pronunciation of CWT is the same as the English word
"cot".
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in "Key words for use in
RFCs to Indicate Requirement Levels" .
This document reuses terminology from JWT
and COSE .
The "Type3StringOrURI" term has the same meaning, syntax, and
processing rules as the "StringOrUri" term defined in Section 2
of JWT , except that Type3StringOrURI uses
CBOR major type 3 instead of a JSON string value.
The "Type6NumericDate" term has the same meaning, syntax, and
processing rules as the "NumericDate" term defined in Section 2
of JWT , except that Type6NumericDate uses
CBOR major type 6, with tag value 1, instead of a numeric JSON
value.
The key used to identify a claim value.
The set of claims that a CWT must contain to be considered valid is
context dependent and is outside the scope of this specification.
Specific applications of CWTs will require implementations to
understand and process some claims in particular ways. However, in
the absence of such requirements, all claims that are not understood
by implementations MUST be ignored.
To keep CWTs as small as possible, the CBOR encoded claim keys are
represented using CBOR major type 0.
summaries all keys used to
identity the claims defined in this document.
None of the claims defined below are intended to be
mandatory to use or implement. They rather provide
a starting point for a set of useful, interoperable claims.
Applications using CWTs should define which specific claims they
use and when they are required or optional.
The iss (issuer) claim has the same meaning, syntax, and
processing rules as the iss claim defined in Section 4.1.1
of JWT , except that the format MUST be a
Type3StringOrURI. The CBOR encoded claim key 1 MUST be used to
identify this claim.
The sub (subject) claim has the same meaning, syntax, and
processing rules as the sub claim defined in Section 4.1.2
of JWT , except that the format MUST be a
Type3StringOrURI. The CBOR encoded claim key 2 MUST be used to
identify this claim.
The aud (audience) claim has the same meaning, syntax, and
processing rules as the aud claim defined in Section 4.1.3
of JWT , except that the format MUST be a
Type3StringOrURI. The CBOR encoded claim key 3 MUST be used to
identify this claim.
The exp (expiration time) claim has the same meaning, syntax,
and processing rules as the exp claim defined in Section
4.1.4 of JWT , except that the format
MUST be a Type6NumericDate. The CBOR encoded claim key 4 MUST be
used to identify this claim.
The nbf (not before) claim has the same meaning, syntax,
and processing rules as the nbf claim defined in Section
4.1.5 of JWT , except that the format
MUST be a Type6NumericDate. The CBOR encoded claim key 5 MUST be
used to identify this claim.
The iat (issued at) claim has the same meaning, syntax,
and processing rules as the iat claim defined in Section
4.1.6 of JWT , except that the format
MUST be a Type6NumericDate. The CBOR encoded claim key 6 MUST be
used to identify this claim.
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 , except that the format
MUST be of major type 2, binary string. The
CBOR encoded claim key 7 MUST be used to identify this claim.
To create a CWT, the following steps are performed. The order of the steps is not significant in cases where there are no dependencies between the inputs and outputs of the steps.
Create a CWT Claims Set containing the desired claims.
Let the Message be the binary representation of the CWT Claims Set.
Create a COSE Header containing the desired set of Header Parameters. The CWT Header MUST be a valid according to the specification.
Depending upon whether the CWT is signed, MACed or encrypted, there are three cases:
If the CWT is signed, create a COSE_Sign/COSE_Sign1 object using the Message as the COSE_Sign/COSE_Sign1 Payload; all steps specified in for creating a COSE_Sign/COSE_Sign1 object MUST be followed.
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 specified in for creating a COSE_Mac/COSE_Mac0 object MUST be followed.
Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, create a COSE_Encrypt/COSE_Encrypt0 using the Message as the plaintext for the COSE_Encrypt/COSE_Encrypt0 object; all steps specified in for creating a COSE_Encrypt/COSE_Encrypt0 object MUST be followed.
If a nested signing, MACing or encryption operation will be performed, let the Message be the COSE_Sign/COSE_Sign1, COSE_Mac/COSE_Mac0 or COSE_Encrypt/COSE_Encrypt0, and return to Step 3, using "content type" header value of "CWT" in the new COSE Header created in that step.
Note: If integrity (signing/MACing) and confidentiality (encryption) protection are needed, it is recommended to use an authenticated encryption algorithm to save space and processing.
When validating a CWT, the following steps are performed. The order of the steps is not significant in cases where there are no dependencies between the inputs and outputs of the steps. If any of the listed steps fail, then the CWT MUST be rejected -- that is, treated by the application as an invalid input.
Verify that the CWT is a valid CBOR object.
Verify that the resulting COSE Header includes only parameters and values whose syntax and semantics are both understood and supported or that are specified as being ignored when not understood.
Use the CBOR tag to determine the type the CWT, COSE_Sign/COSE_Sign1, COSE_Mac/COSE_Mac0 or COSE_Encrypt/COSE_Encrypt0.
Depending upon whether the CWT is a COSE_Sign/COSE_Sign1, COSE_Mac/COSE_Mac0 or COSE_Encrypt/COSE_Encrypt0, there are three cases:
If the CWT is a COSE_Sign/COSE_Sign1, follow the steps specified in Section 4 (Signing Objects) for validating a COSE_Sign/COSE_Sign1 object. Let the Message be the COSE_Sign/COSE_Sign1 payload.
Else, if the CWT is a COSE_Mac/COSE_Mac0, follow the steps specified in Section 6 (MAC Objects) for validating a COSE_Mac/COSE_Mac0 object. Let the Message be the COSE_Mac/COSE_Mac0 payload.
Else, if the CWT is a COSE_Encrypt/COSE_Encrypt0 object, follow the steps specified in Section 5 (Encryption Objects) for validating a COSE_Encrypt/COSE_Encrypt0 object. Let the Message be the resulting plaintext.
If the JOSE Header contains a "content type" value of "CWT", then the Message is a CWT that was the subject of nested signing or encryption operations. In this case, return to Step 1, using the Message as the CWT.
Verify that the Message is a valid CBOR object; let the CWT Claims Set be this CBOR object.
The security of the CWT is dependent on the protection offered by COSE. Without protecting the claims contained in a CWT an adversary is able to modify, add or remove claims. Since the claims conveyed in a CWT are used to make authorization decisions it is not only important to protect the CWT in transit but also to ensure that the recipient is able to authenticate the party that collected the claims and created the CWT. Without trust of the recipient in the party that created the CWT no sensible authorization decision can be made. Furthermore, the creator of the CWT needs to carefully evaluate each claim value prior to including it in the CWT so that the recipient can be assured about the correctness of the provided information.
This section establishes the
IANA "CBOR Web Token (CWT) Claims" registry.
Values are registered on a Specification Required
basis, on the advice of one or more Designated Experts.
However, to allow for the
allocation of values prior to publication, the Designated Experts may approve
registration once they are satisfied that such a specification will be published.
Criteria that should be applied by the Designated Experts includes
determining whether the proposed registration duplicates existing functionality,
whether it is likely to be of general applicability
or whether it is useful only for a single application,
and whether the registration description is clear.
The human-readable name requested (e.g., "iss").
Brief description of the claim (e.g., "Issuer").
Claim Name of the equivalent JWT claim as registered in .
CWT claims should normally have a corresponding JWT claim.
If a corresponding JWT claim would not make sense,
the Designated Experts can choose to accept registrations
for which the JWT Claim Name is listed as "N/A".
Key value for the claim. The key value MUST be an integer in the range of 1 to 65536.
CBOR Major type and optional tag for the claim.
For Standards Track RFCs, list the "IESG". For others, give the name of the responsible party. Other details (e.g., postal address, email address, home page URI) may also be included.
Reference to the document or documents that specify the parameter, preferably including URIs that can be used to retrieve copies of the documents. An indication of the relevant sections may also be included but is not required.
Claim Name: issClaim Description: IssuerJWT Claim Name: issCBOR Key Value: 1CBOR Major Type: 3Change Controller: IESGSpecification Document(s): of [[ this specification ]]Claim Name: subClaim Description: SubjectJWT Claim Name: subCBOR Key Value: 2CBOR Major Type: 3Change Controller: IESGSpecification Document(s): of [[ this specification ]]Claim Name: audClaim Description: AudienceJWT Claim Name: audCBOR Key Value: 3CBOR Major Type: 3Change Controller: IESGSpecification Document(s): of [[ this specification ]]Claim Name: expClaim Description: Expiration TimeJWT Claim Name: expCBOR Key Value: 4CBOR Major Type: 6, tag value 1Change Controller: IESGSpecification Document(s): of [[ this specification ]]Claim Name: nbfClaim Description: Not BeforeJWT Claim Name: nbfCBOR Key Value: 5CBOR Major Type: 6, tag value 1Change Controller: IESGSpecification Document(s): of [[ this specification ]]Claim Name: iatClaim Description: Issued AtJWT Claim Name: iatCBOR Key Value: 6CBOR Major Type: 6, tag value 1Change Controller: IESGSpecification Document(s): of [[ this specification ]]Claim Name: ctiClaim Description: CWT IDJWT Claim Name: jtiCBOR Key Value: 7CBOR Major Type: 2Change Controller: IESGSpecification Document(s): of [[ this specification ]]
This section registers the "application/cwt" CoAP Content-Format ID in the
"CoRE Parameters" sub-registry "CoAP Content-Format" in the manner described
in .
Media Type: application/cwtEncoding: - Id: TBD (maybe 61) Reference: [[ this specification ]]JSON Web Token ClaimsIANAThree examples of CWTs follow.
A CWT used in the context of ACE requires at least the aud and a
cks claim (defined elsewhere).
This means that iss, alg, key_ops and
others are pre-established and assumed.
This would look like this non-normative JSON.
Using the CBOR encoded claim keys according to
and COSE
makes a CWT with aud and a
symmetric key look like this in CBOR diagnostic notation:
Defined in CBOR.
Size of the CWT with a symmetric key of 10 bytes is 45 bytes. This is
then packaged signed and encrypted using COSE.
Token with aud set to "coap://light.example.com" and an EC key with
kid set to 11.
Using the CBOR encoded claim keys according to
and COSE
makes a CWT with aud and an EC key
look like this in CBOR diagnostic notation:
Defined in CBOR.
Size of the CWT with an EC key is 109 bytes. This is
then packaged signed and encrypted using COSE.
CWT using all claims defined by this specification, plus extensions for AIF and an EC key.
Using the CBOR encoded claim keys according to
and COSE
makes a full CWT look like this
in CBOR diagnostic notation:
Defined in CBOR.
Size of the CWT with an EC key is 194 bytes. This is
then packaged signed and encrypted using COSE.
This specification is based on JSON Web Token (JWT) ,
the authors of which also include Nat Sakimura and John Bradley.
A straw man proposal of CWT was written in the draft
"Authorization for the Internet of Things using OAuth 2.0"
with the help of
Ludwig Seitz and Göran Selander.
[[ to be removed by the RFC Editor before publication as an RFC ]]
-01
Added IANA registration for CWT Claims.
Added IANA registration for the application/cwt CoAP content-format type.
Added Samuel Erdtman as an editor.
Changed Erik's e-mail address.
-00
Created the initial working group version based on draft-wahlstroem-ace-cbor-web-token-00.