ACE Working Group S. Gerdes Internet-Draft O. Bergmann Intended status: Standards Track C. Bormann Expires:March 10,April 11, 2019 Universitaet Bremen TZI G. Selander Ericsson AB L. Seitz RISE SICSSeptember 06,October 08, 2018 Datagram Transport Layer Security (DTLS) Profile for Authentication and Authorization for Constrained Environments (ACE)draft-ietf-ace-dtls-authorize-04draft-ietf-ace-dtls-authorize-05 Abstract This specification defines a profilefor delegatingthat allows constrained servers to delegate client authentication andauthorization in a constrained environment by establishing a Datagram Transport Layer Security (DTLS) channel between resource-constrained nodes.authorization. The protocol relies on DTLS for communication security between entities in a constrained network using either raw public keys or pre-shared keys. Aresource- constrained noderesource-constrained server can use this protocol to delegate management of authorization information to a trusted host with less severe limitations regarding processing power and memory. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire onMarch 10,April 11, 2019. Copyright Notice Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License. Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 2. Protocol Overview . . . . . . . . . . . . . . . . . . . . . . 32.1. Resource Access . . . .3. Protocol Flow . . . . . . . . . . . . . . . . .5 2.2. Dynamic Update of Authorization Information. . . . . . .7 2.3. Token Expiration5 3.1. Communication between C and AS . . . . . . . . . . . . . 5 3.2. RawPublicKey Mode . . . . . . .8 3. RawPublicKey Mode. . . . . . . . . . . . . 6 3.2.1. DTLS Channel Setup Between C and RS . . . . . . . . .9 4.7 3.3. PreSharedKey Mode . . . . . . . . . . . . . . . . . . . .. . 10 4.1.8 3.3.1. DTLS Channel Setup Between C and RS . . . . . . . . . 10 3.4. Resource Access . . . . . . . . . . . . . . . . . . . . . 124.2. Updating4. Dynamic Update of Authorization Information . . . . . . . . .. .13 5.Security ConsiderationsToken Expiration . . . . . . . . . . . . . . . . . . . . . . 14 6.PrivacySecurity Considerations . . . . . . . . . . . . . . . . . . .1415 7. Privacy Considerations . . . . . . . . . . . . . . . . . . . 15 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . .14 8.16 9. References . . . . . . . . . . . . . . . . . . . . . . . . .15 8.1.16 9.1. Normative References . . . . . . . . . . . . . . . . . .15 8.2.16 9.2. Informative References . . . . . . . . . . . . . . . . .16 8.3.17 9.3. URIs . . . . . . . . . . . . . . . . . . . . . . . . . .1718 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . .1819 1. Introduction This specification defines a profile of the ACE framework [I-D.ietf-ace-oauth-authz]. In this profile, a client and a resource server use CoAP [RFC7252] over DTLS [RFC6347] to communicate. The clientusesobtains an access token, bound to a key (theproof-of-possession key)proof-of- possession key), from an authorization server toauthorizeprove itsaccessauthorization to access protected resources hosted by the resource server.DTLS provides communication security, proof of possession, and server authentication. OptionallyAlso, the client and the resource servermay also use CoAP over DTLS to communicateare provided by the authorization server with the necessary keying material to establish a DTLS session. The communication between client and authorizationserver.server may also be secured with DTLS. This specification supportstheDTLShandshakewith Raw Public Keys (RPK) [RFC7250] andthe DTLS handshakewithPre- SharedPre-Shared Keys (PSK) [RFC4279]. The DTLSRPKhandshake [RFC7250] requires the clientauthenticationand server toprovide proof-of-possession forprove that they can use certain keying material. In thekey tiedRPK mode, the client proves with the DTLS handshake that it can use the RPK bound to theaccess token. Heretoken and the server shows that it can use a certain RPK. The access tokenneeds tomust betransferredpresented to the resourceserver beforeserver. For thehandshake is initiated, asRPK mode, the access token needs to be uploaded to the resource server before the handshake is initiated, as described insectionSection 5.8.1 of draft-ietf-ace-oauth-authz [1].The DTLSIn the PSKhandshake [RFC4279] providesmode, client and server show with theproof-of-possession forDTLS handshake that they can use thekey tiedkeying material that is bound to the access token.FurthermoreTo transfer the access token from the client to thepsk_identityresource server, the "psk_identity" parameter in the DTLS PSK handshakeismay be usedto transferinstead of uploading theaccesstokenfrom the clientprior to theresource server.handshake. 1.1. Terminology 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 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. Readers are expected to be familiar with the terms and concepts described in[I-D.ietf-ace-oauth-authz].I-D.ietf-ace-oauth-authz [2]. The authz-info resource refers to the authz-info endpoint as specified in I-D.ietf-ace-oauth-authz [3]. 2. Protocol Overview The CoAP-DTLS profile for ACE specifies the transfer of authentication information and, if necessary, authorization information between the clientC(C) and the resource serverRS(RS) during setup of a DTLS session for CoAP messaging. It also specifies howa ClientC can use CoAP over DTLS to retrieve anAccess Tokenaccess token from the authorization serverAS(AS) for a protected resource hosted on the resourceserver RS.server. This profile requiresa Client (C)the client to retrieve anAccess Tokenaccess token fortheprotected resource(s) it wants to access ona Resource Server (RS)RS as specified in[I-D.ietf-ace-oauth-authz].I- D.ietf-ace-oauth-authz [4]. Figure 1 shows the typical message flow in this scenario (messages in square brackets are optional): C RS AS | [-- Resource Request --->] | | | | | | [<----- AS Information --] | | | | | | --- Token Request ----------------------------> | | | | | <---------------------------- Access Token ----- | | +RSAccess Information | Figure 1: Retrieving an Access Token To determine the AS in charge of a resource hosted at the RS,the clientC MAY send an initial Unauthorized Resource Request message to the RS. The RS then denies the request and sends an AS information message containing the address of its AS back to the clientCas specified insectionSection 5.1.2 ofdraft-ietf- ace-oauth-authz [2].draft-ietf-ace-oauth-authz [5]. Once the clientCknows the authorization server's address, it can send anAccess Tokenaccess token request to the token endpoint at the AS as specified in[I-D.ietf-ace-oauth-authz].I-D.ietf-ace-oauth-authz [6]. As theAccess Tokenaccess token request as well as the response may contain confidential data, the communication between the client and the authorization server MUST be confidentiality-protected and ensure authenticity.How the mutual authentication between the client and the authorization server is achieved is out of scope for this document; the clientC may have beenconfigured with a public key of the authorization server and have beenregistered at the AS via the OAuth 2.0 client registration mechanism as outlined insectionSection 5.3 of draft-ietf-ace-oauth-authz[3]. If C wants to use the CoAP RawPublicKey mode as described in Section 9 of RFC 7252 [4] it MUST provide a key or key identifier within a "cnf" object in the[7]. The access tokenrequest. Ifreturned by the authorization serverAS decides that the request is tocan then beauthorized it generates an access token response forused by the clientC containingto establish a"profile" parameternew DTLS session with thevalue "coap_dtls" to indicate that this profile MUST be used for communication between the client C and the resource server. For RPK mode, the authorization server also adds a "rs_cnf" parameter containing information about the public that is used by the resource server (see Section 3). For PSK mode, the authorization server adds a "cnf" parameter containing information about the shared secret that C can use to setup a DTLS session with the resource server (see Section 4). The Access Token returned by the authorization server then can be used by the client to establish a new DTLS session with the resource server. When the client intendsresource server. When the client intends to use asymmetric cryptography in the DTLS handshake with the resource server, the client MUST upload theAccess Tokenaccess token to the authz-inforesourceresource, i.e. the authz-info endpoint, on the resource server before starting the DTLS handshake, as described insectionSection 5.8.1 of draft-ietf-ace-oauth-authz[5].[8]. If only symmetric cryptography is used between the client and the resource server, theAccess Tokenaccess token MAY instead be transferred in the DTLS ClientKeyExchange message (see Section4.1).3.3.1). Figure 2 depicts the common protocol flow for the DTLS profile after the client C has retrieved theAccess Tokenaccess token from the authorization server AS. C RS AS | [--- Access Token ------>] | | | | | | <== DTLS channel setup ==> | | | | | | == Authorized Request ===> | | | | | | <=== Protected Resource == | | Figure 2: Protocol overview 3. Protocol Flow The following sections specify how CoAP is used to interchange access-related data between the resourceserverserver, the client and the authorization server so that the authorization server can provide the client and the resource server with sufficient information to establish a secure channel, and convey authorization information specific for this communication relationship to the resource server. Section 3.1 describes how the communication between C and AS must be secured. Depending on thedesiredused CoAP securitymode,mode (see also Section 9 of RFC 7252 [9]), the Client-to-AS request, AS-to-Client response and DTLS session establishment carry slightly different information. Section33.2 addresses the use of raw public keys while Section43.3 defines how pre-shared keys are used in this profile.2.1. Resource Access Once a DTLS channel has been established as described in Section 33.1. Communication between C andSection 4, respectively, the client is authorized toAS To retrieve an accessresources covered by the Access Token it has uploaded to the authz- info resource hosted by the resource server. Ontoken for the resourceserver side, successful establishment of the DTLS channel bindsthat the client wants to access, the client requests an accesstoken, functioning as a proof- of-possession associated key. Any request thattoken from theresource server receives on this channel MUST be checked against theseauthorizationrules that are associated with the identity ofserver. Before C can request theclient. Incoming CoAP requests that are not authorized with respect to any Accessaccess token, C and AS must establish a secure communication channel. C must securely have obtained keying material to communicate with AS, and C must securely have received authorization information intended for C that states that AS is authorized to provide keying material concerning RS to C. Also, AS must securely have obtained keying material for C, and obtained authorization rules approved by the resource owner (RO) concerning C and RS that relate to this keying material. C and AS must use their respective keying material for all exchanged messages. How the security association between C and AS is established is not part of this document. C and AS MUST ensure the confidentiality, integrity and authenticity of all exchanged messages. If C is constrained, C and AS should use DTLS to communicate with each other. But C and AS may also use other means to secure their communication, e.g., TLS. The used security protocol must provide confidentiality, integrity and authenticity, and enable the client to determine if it is the intended recipient of a message, e.g., by using an AEAD mechanism. C must also be able to determine if a response from AS belongs to a certain request. Additionally, the protocol must offer replay protection. 3.2. RawPublicKey Mode After C and AS mutually authenticated each other and validated each other's authorization, C sends a token request to AS's token endpoint. The client MUST add a "cnf" object carrying either its raw public key or a unique identifier for a public key that it has previously made known to the authorization server. To prove that the client is in possession of this key, C MUST use the same keying material that it uses to secure the communication with AS, e.g., the DTLS session. An example access token request from the client to the AS is depicted in Figure 3. POST coaps://as.example.com/token Content-Format: application/ace+cbor { grant_type: client_credentials, req_aud: "tempSensor4711", req_cnf: { COSE_Key: { kty: EC2, crv: P-256, x: h'e866c35f4c3c81bb96a1...', y: h'2e25556be097c8778a20...' } } } Figure 3: Access Token Request Example for RPK Mode The example shows an access token request for the resource identified by the string "tempSensor4711" on the authorization server using a raw public key. AS MUST check if the client that it communicates with is associated with theclient MUSTRPK in the cnf object before issuing an access token to it. If AS determines that the request is to be authorized according to the respective authorization rules, it generates an access token response for C. The response SHOULD contain a "profile" parameter with the value "coap_dtls" to indicate that this profile must berejected byused for communication between the client C and the resourceserver with 4.01 response as described in Section 5.1.1 of draft-ietf-ace-oauth-authz [6]. Note:server. Theidentity ofresponse also contains an access token and an "rs_cnf" parameter containing information about theclientpublic key that isdeterminedused by theauthentication process duringresource server. AS MUST ascertain that theDTLS handshake. InRPK specified in "rs_cnf" belongs to theasymmetric case,resource server that C wants to communicate with. AS MUST protect thepublic key will defineintegrity of theclient's identity, while intoken. If thePSK case,access token contains confidential data, AS MUST also protect theclient's identity is defined byconfidentiality of theshared secret generated byaccess token. C MUST ascertain that the access token response belongs to a certain previously sent access token request, as the request may specify theauthorization server for this communication. Theresource serverSHOULD treat an incoming CoAPwith which C wants to communicate. 3.2.1. DTLS Channel Setup Between C and RS Before the client initiates the DTLS handshake with the resource server, C MUST send a "POST" requestas authorized ifcontaining thefollowing holds: 1. The message was received onnew access token to the authz-info resource hosted by the resource server. If this operation yields asecurepositive response, the client SHOULD proceed to establish a new DTLS channelthat has been established usingwith theprocedureresource server. To use the RawPublicKey mode, the client MUST specify the public key that AS defined inthis document. 2. The authorization information tied tothesending peer is valid. 3. The request is destined for"cnf" field of the access token response in theresource server. 4. The resource URI specifiedSubjectPublicKeyInfo structure in therequest is covered byDTLS handshake as specified in RFC 7250 [10]. An implementation that supports theauthorization information. 5. The request method is an authorized action onRPK mode of this profile MUST at least support theresourceciphersuite TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 [RFC7251] withrespect totheauthorization information. Incominged25519 curve (cf. [RFC8032], [RFC8422]). Note: According to RFC 7252 [11], CoAPrequests received on a secure DTLS channelimplementations MUSTbe rejected according to [Section 5.1.1 of draft-ietf-ace-oauth- authz](https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 13#section-5.1.1 1. with response code 4.03 (Forbidden) whensupport theresource URI specifiedciphersuite TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 [RFC7251] and the NIST P-256 curve. As discussed in RFC 7748 [12], new ECC curves have been defined recently that are considered superior to therequestso-called NIST curves. The curve that isnot covered by the authorization information,mandatory to implement in this specification is said to be efficient and2. with response code 4.05 (Method Not Allowed) whenless dangerous regarding implementation errors than theresource URI specifiedsecp256r1 curve mandated in RFC 7252 [13]. RS MUST check if therequest covered byaccess token is still valid, if RS is theauthorization information but notintended destination, i.e., therequested action. The client cannot always know a prioriaudience, of the token, and if the token was issued by anAuthorized Resource Request will succeed. Ifauthorized AS. The access token is constructed by theclient repeatedly gets error responses containing AS Information (cf. Section 5.1.1 of draft-ietf-ace- oauth-authz [7] as response to its requests, it SHOULD request a new Access Token fromauthorization server such that theauthorizationresource serverin order to continue communicationcan associate the access token with theresource server. 2.2. Dynamic Update of Authorization InformationClient's public key. Theclient can update"cnf" claim MUST contain either C's RPK or, if theauthorization information stored atkey is already known by the resource serverat any time without changing an established DTLS session. To do so, the Client requests(e.g., from previous communication), a reference to this key. If the authorization servera new Access Token for the intended action onhas no certain knowledge that therespective resource and uploads this Access TokenClient's key is already known to theauthz-info resource on theresourceserver. Figure 3 depictsserver, themessage flow whereClient's public key MUST be included in theclient C requestsaccess token's "cnf" parameter. If CBOR web tokens [RFC8392] are used as recommended in I-D.ietf-ace-oauth-authz [14], unencrypted keys MUST be specified using anew Access Token after"COSE_Key" object, encrypted keys with asecurity association between the client"COSE_Encrypt0" structure and references to theresource serverkey as "key_id" parameters in a CBOR map. RShas been established using this protocol. The token requestMUSTspecify the key identifier of the existing DTLS channel betweenuse theclient andkeying material in theresource serverhandshake that AS specified in the"kid"rs_cnf parameterofin theClient-to-AS request. The authorization server MUST verify thataccess token. Thus, thespecified "kid" denotes a valid verifier for a proof- of-possession ticket that has previously been issuedhandshake only finishes if C and RS are able to use their respective keying material. 3.3. PreSharedKey Mode To retrieve an access token for therequesting client. Otherwise, the Client-to-AS request MUST be declined with aresource that theerror code "unsupported_pop_key" as defined in Section 5.6.3 of draft-ietf-ace-oauth-authz [8]. Whenclient wants to access, theauthorization server issuesclient MAY include anew"cnf" object carrying an identifier for a symmetric key in its access token request toupdate existing authorization information it MUST include the specified "kid" parameter in this access token. A resource server MUST associatetheupdatedauthorizationinformation with any existing DTLS session that is identifiedserver. This identifier can be used bythis key identifier. Note: By associatingtheaccess tokens withauthorization server to determine theidentifier of an existing DTLS session,shared secret to construct theauthorization information can be updated without changingproof-of-possession token. AS MUST check if thecryptographic keysidentifier refers to a symmetric key that was previously generated by AS as a shared secret for theDTLScommunication betweenthethis client and the resourceserver, i.e. an existing session can be used with updated permissions.server. The authorization server MUST determine the authorization rules for the CRS AS | <===== DTLS channel =====> | | | + Access Token | | | | | | --- Token Request ----------------------------> | | | | | <---------------------------- New Access Token - | | + RS Information | | | | | --- Update /authz-info --> | | | New Access Token | | | | | | == Authorized Request ===> | | | | | | <=== Protected Resource == | | Figure 3: Overview of Dynamic Update Operation 2.3. Token Expiration DTLS sessions that have been established in accordanceit communicates withthis profile are always tied to a specific set of access tokens. As these tokens may become invalid at any time (either becauseas defined by RO and generate the access tokenhas expired oraccordingly. If theresponsibleauthorization serverhas revokedauthorizes thetoken),client, it returns an AS-to-Client response. If thesession may become useless at some point. A resource server therefore may decideprofile parameter is present, it is set toterminate existing DTLS sessions after"coap_dtls". AS MUST ascertain that thelast validaccess token is generated forthis session has been deleted. As specified in section 5.8.3 of draft-ietf-ace-oauth-authz [9],the resource server that C wants to communicate with. Also, AS MUSTnotifyprotect theclient with an error response with code 4.01 (Unauthorized) for any long running request before terminatingintegrity of thesession. The resource server MAYaccess token. If the token contains confidential data such as the symmetric key, the confidentiality of the token MUST alsokeepbe protected. Depending on thesession alive for some timerequested token type andrespondalgorithm in the access token request, the authorization server adds access Information toincoming requeststhe response that provides the client with sufficient information to setup a4.01 (Unauthorized) error message includingDTLS channel with the resource server. ASInformationadds a "cnf" parameter tosignalthe access information carrying a "COSE_Key" object that informs the clientneedsabout the symmetric key that is touploadbe used between C and the resource server. An example access token response is illustrated in Figure 4. In this example, the authorization server returns a 2.01 response containing a new access tokenbefore it can continue using this DTLS session.and information for the client, including the symmetric key in the cnf claim. TheAS Informationinformation iscreatedtransferred as a CBOR data structure as specified insection 5.1.2I-D.ietf-ace-oauth-authz [15]. 2.01 Created Content-Format: application/ace+cbor Max-Age: 86400 { access_token: h'd08343a10... (remainder ofdraft- ietf-ace-oauth-authz [10].CWT omitted for brevity) token_type: pop, alg: HS256, expires_in: 86400, profile: coap_dtls, cnf: { COSE_Key: { kty: symmetric, k: h'73657373696f6e6b6579' } } } Figure 4: Example Access Token Response Theresource server SHOULD addaccess token also comprises a"kid" parameter to the AS Information denoting the identifier of"cnf" claim. This claim usually contains a "COSE_Key" object that carries either the symmetric keythat it uses internally for this DTLS session. The client then includes this "kid" parameter initself or or aClient-to-AS requestkey identifier that can be used by the resource server toretrievedetermine the shared secret. If the access token carries anewsymmetric key, the access tokentoMUST beused with this DTLS session. In case the key identifier is already known byencrypted using a "COSE_Encrypt0" structure. The AS MUST use theclient (e.g. because it was included inkeying material shared with the RSInformation in an AS-to-Client response),to encrypt the"kid" parameter MAY be elided fromtoken. Instead of providing the keying material, the ASInformation. Table 1 updates Figure 2MAY include a key derivation function and a salt insection 5.1.2 of draft-ietf-ace-oauth- authz [11] withthenew "kid" parameter in accordance with [RFC8152]. +----------------+----------+-----------------+ | Parameter name | CBOR Key | Major Type | +----------------+----------+-----------------+ | kid | 4 | 2 (byte string) | +----------------+----------+-----------------+ Table 1: Updated AS Information parameters 3. RawPublicKey Mode To retrieve anaccess tokenfor the resourcethat enables theclient wantsresource server toaccess,calculate theclient requests an Access Tokenkeying material for the communication with C from theauthorization server. The client MUST addaccess token. In this case, the token contains a "cnf"object carrying either its raw publicstructure that specifies the keyor a unique identifier for a publicderivation algorithm and the salt that the AS has used to construct the shared key. AS and RS MUST use their shared keying material for the keythat it has previously made known toderivation, and theauthorization server. To prove thatkey derivation MUST follow Section 11 of RFC 8152 [16] with parameters as specified here. The KDF specified in theclient"alg" parameter SHOULD be HKDF-SHA-256. The salt picked by the AS must be uniformly random and is carried inpossessionthe "salt" parameter. The fields in the context information "COSE_KDF_Context" (Section 11.2 ofthis key, itRFC 8152 [17]) MUSTusehave thesame public key as in certificate message thatfollowing values: o AlgorithmID = "ACE-CoAP-DTLS-salt" o PartyUInfo = PartyVInfo = ( null, null, null ) o keyDataLength isused to establisha uint equal theDTLS session withlength of theauthorization server.key shared between AS and RS in bits o protected MUST be a zero length bstr o other is a zero length bstr o SuppPrivInfo is omitted An exampleAccess Token request from the client to the resource server"cnf" structure specifying HMAC-based key derivation of a symmetric key with SHA-256 as pseudo-random function and a random salt value isdepictedprovided in Figure4. POST coaps://as.example.com/token Content-Format: application/cbor { grant_type: client_credentials, aud: "tempSensor4711", cnf: { COSE_Key:5. cnf : {kty: EC2, crv: P-256, x: h'TODOX', y: h'TODOY' } }kty : symmetric, alg : HKDF-SHA-256, salt : h'eIiOFCa9lObw' } Figure4: Access Token Request Example for RPK Mode The example shows5: Key Derivation Specification in an Access Tokenrequest for the resource identified by the audience string "tempSensor4711"A response that declines any operation on theauthorization server using a raw public key. When the authorization server authorizes a request, it will return anrequested resource is constructed according to Section 5.2 of RFC 6749 [18], (cf. Section 5.7.3. of draft-ietf-ace-oauth-authz [19]). 4.00 Bad Request Content-Format: application/ace+cbor { error: invalid_request } Figure 6: Example Access Token Response With Reject 3.3.1. DTLS Channel Setup Between C and RS When a"cnf" object in the AS-to-Client response. Before theclientinitiatesreceives an access token response from an authorization server, C MUST ascertain that theDTLS handshake withaccess token response belongs to a certain previously sent access token request, as theresource server, it MUST send a "POST"requestcontainingmay specify thenew Access Tokenresource server with which C wants to communicate. C checks if theauthz-info resource hosted bypayload of theresource server. If this operation yieldsaccess token response contains an "access_token" parameter and apositive response,"cnf" parameter. With this information the clientSHOULD proceed to establishcan initiate the establishment of a new DTLS channel withthea resource server. To useraw public key mode,DTLS with pre-shared keys, the clientMUST passfollows thesame publicPSK keythat was used for constructing the Access Token with the SubjectPublicKeyInfo structure in the DTLS handshake asexchange algorithm specified in[RFC7250]. An implementation that supports the RPK modeSection 2 ofthis profile MUST at least support the ciphersuite TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 [RFC7251] with the ed25519 curve (cf. [RFC8032], [RFC8422]). Note: According to [RFC7252], CoAP implementations MUST support the ciphersuite TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 [RFC7251] and the NIST P-256 curve. As discussed in [RFC7748], new ECC curves have been defined recently that are considered superior to the so- called NIST curves. The curve that is mandatory to implement in this specification is said to be efficient and less dangerous regarding implementation errors thanRFC 4279 [20] using thesecp256r1 curve mandatedkey conveyed in[RFC7252]. The Access Token is constructed by the authorization server such that the resource server can associatetheAccess Token with"cnf" parameter of theClient's public key. If CBOR web tokens [RFC8392] are usedAS response asrecommended in [I-D.ietf-ace-oauth-authz],PSK when constructing theauthorization server MUST include a "COSE_Key" object inpremaster secret. In PreSharedKey mode, the"cnf" claimknowledge of theAccess Token. This "COSE_Key" object MAY contain a reference to a key forshared secret by the client and theclient thatresource server isalready known byused for mutual authentication between both peers. Therefore, the resource server(e.g.,must be able to determine the shared secret fromprevious communication). Ifthe access token. Following the general ACE authorizationserver has no certain knowledge thatframework, theClient's key is already knownclient can upload the access token to the resourceserver,server's authz-info resource before starting theClient's public key MUST be included inDTLS handshake. Alternatively, theAccess Token's "cnf" parameter. 4. PreSharedKey Mode To retrieve anclient MAY provide the most recent access tokenforin theresource that"psk_identity" field of theclient wants to access,ClientKeyExchange message. To do so, the clientMAY include a "cnf" object carrying an identifier for a symmetric key in its Access Token request toMUST treat theauthorization server. This identifier can be used bycontents of theauthorization server to determine"access_token" field from theshared secret to constructAS-to-Client response as opaque data and not perform any re-coding. Note: As stated in Section 4.2 of RFC 7925 [21], theproof-of-possession tokenPSK identity should be treated as binary data in the Internet of Things space andtherefore MUST specifynot assumed to have asymmetric keyhuman-readable form of any sort. If a resource server receives a ClientKeyExchange message thatwas previously generated bycontains a "psk_identity" with a length greater zero, it uses theauthorization servercontents asa shared secretindex for its key store (i.e., treat thecommunication between the client and thecontents as key identifier). The resourceserver. Depending on the requested token type and algorithm inserver MUST check if it has one or more access tokens that are associated with theAccess Token request,specified key. If no key with a matching identifier is found, theauthorizationresource serveradds RS Information toMAY process theresponse that providescontents of theclient"psk_identity" field as access token that is stored withsufficientthe authorization informationto setup aendpoint, before continuing the DTLSchannel withhandshake. If theresource server. For symmetric proof- of-possession keys (c.f. [I-D.ietf-ace-oauth-authz]),contents of theclient must ensure that"psk_identity" do not yield a valid access token for theAccess Token requestrequesting client, the DTLS session setup issent overterminated with an "illegal_parameter" DTLS alert message. Note1: As asecure channel that guarantees authentication, message integrity and confidentiality. When the authorizationresource serverauthorizes thecannot provide a clientit returns an AS- to-Client responsewiththe profile parameter set to "coap_dtls" and a "cnf" parameter carryinga"COSE_Key" object that containsmeaningful PSK identity hint in response to thesymmetric keyclient's ClientHello message, the resource server SHOULD NOT send a ServerKeyExchange message. Note2: According tobe used betweenRFC 7252 [22], CoAP implementations MUST support the ciphersuite TLS_PSK_WITH_AES_128_CCM_8 [RFC6655]. A clientandis therefore expected to offer at least this ciphersuite to the resourceserver as illustrated in Figure 5. 2.01 Created Content-Format: application/cbor Location-Path: /token/asdjbaskd { access_token: h'd08343a10... (remainderserver. When RS receives an access token, RS MUST check if the access token is still valid, if RS is the intended destination, i.e., the audience ofCWT omitted for brevity) token_type: pop, alg: HS256, expires_in: 86400, profile: coap_dtls, cnf: { COSE_Key: { kty: symmetric, k: h'73657373696f6e6b6579' } } } Figure 5: Example Access Token response In this example,theauthorization server returns a 2.01 response containing a new Access Token. The informationtoken, and if the token was issued by an authorized AS. This specification assumes that the access token istransferred asaCBOR data structurePoP token asspecifieddescribed in[I-D.ietf-ace-oauth-authz]. A response that declines any operation onI-D.ietf-ace-oauth-authz [23] unless specifically stated otherwise. Therefore, therequested resourceaccess token isconstructed accordingbound toSection 5.2 of RFC 6749 [12], (cf. Section 5.7.3 of [I-D.ietf-ace-oauth-authz]). 4.00 Bad Request Content-Format: application/cbor { error: invalid_request } Figure 6: Example Access Token response with reject 4.1. DTLS Channel Setup Between C and RS Whenaclient receives an Access Token from an authorization server, it checks ifsymmetric PoP key that is used as shared secret between thepayload contains an "access_token" parameterclient anda "cnf" parameter. With this informationtheclient can initiate establishment of a new DTLS channel with aresource server.To use DTLS with pre-shared keys,While the clientfollowscan retrieve thePSK key exchange algorithm specified in Section 2 of [RFC4279] usingshared secret from thekey conveyed incontents of the "cnf" parameterof the AS response as PSK when constructing the premaster secret. In PreSharedKey mode, the knowledge of the shared secret byin theclient andAS-to-Client response, the resource serveris used for mutual authentication between both peers. Therefore,uses theresource server must be ableinformation contained in the "cnf" claim of the access token to determine thesharedactual secretfromwhen no explicit "kid" was provided in theAccess Token. Following"psk_identity" field. If key derivation is used, thegeneral ACE authorization framework,RS uses the "COSE_KDF_Context" information as described above. 3.4. Resource Access Once a DTLS channel has been established as described in Section 3.2 and Section 3.3, respectively, the clientcan uploadis authorized to access resources covered by theAccess Tokenaccess token it has uploaded to the authz- info resourceserver's authz-info resource before starting the DTLS handshake. Alternatively, the client MAY providehosted by themost recent Access Token inresource server. With the"psk_identity" fieldsuccessful establishment of theClientKeyExchange message. To do so,DTLS channel, C and RS have proven that they can use their respective keying material. An access token that is bound to theclient MUST treatclient's keying material is associated with thecontents ofchannel. Any request that the"access_token" field fromresource server receives on this channel MUST be checked against these authorization rules. RS MUST check for every request if theAS-to-Client response as opaque data andaccess token is still valid. Incoming CoAP requests that are notperformauthorized with respect to anyre-coding. Note: As stated in section 4.2 of [RFC7925],access token that is associated with thePSK identity shouldclient MUST betreatedrejected by the resource server with 4.01 response asbinary datadescribed inthe Internet of Things space and not assumed to have a human-readable formSection 5.1.1 ofany sort. If adraft-ietf-ace-oauth-authz [24]. The resource serverreceives a ClientKeyExchangeSHOULD treat an incoming CoAP request as authorized if the following holds: 1. The messagethat contains a "psk_identity" withwas received on alength greater zero, it usessecure channel that has been established using thecontents as indexprocedure defined in this document. 2. The authorization information tied to the sending client is valid. 3. The request is destined forits key store (i.e., treatthecontents as key identifier).resource server. 4. The resource URI specified in the request is covered by the authorization information. 5. The request method is an authorized action on the resourceserver MUST check if it has one or more Access Tokenswith respect to the authorization information. Incoming CoAP requests received on a secure DTLS channel that areassociatednot thus authorized MUST be rejected according to Section 5.8.2 of draft- ietf-ace-oauth-authz [25] 1. with response code 4.03 (Forbidden) when the resource URI specifiedkey. If no valid Access Token is available for this key,in theDTLS session setup is terminated with an "illegal_parameter" DTLS alert message. If no key with a matching identifierrequest isfoundnot covered by theresource serverauthorization information, and 2. with response code 4.05 (Method Not Allowed) when the resourceserver MAY process the decoded contents ofURI specified in the"psk_identity" field as access token that is stored withrequest covered by the authorization informationendpoint before continuingbut not theDTLS handshake.requested action. The client cannot always know a priori if an Authorized Resource Request will succeed. If thedecoded contentsclient repeatedly gets error responses containing AS Information (cf. Section 5.1.2 ofthe "psk_identity" do not yielddraft-ietf-ace- oauth-authz [26]) as response to its requests, it SHOULD request avalidnew access tokenfor the requesting client,from theDTLS session setup is terminated with an "illegal_parameter" DTLS alert message. Note1: As a resourceauthorization servercannot provide a client with a meaningful PSK identity hintinresponseorder to continue communication with theclient's ClientHello message,resource server. 4. Dynamic Update of Authorization Information The client can update the authorization information stored at the resource serverSHOULD NOT sendat any time without changing an established DTLS session. To do so, the Client requests aServerKeyExchange message. Note2: According to [RFC7252], CoAP implementations MUST supportnew access token from the authorization server for theciphersuite TLS_PSK_WITH_AES_128_CCM_8 [RFC6655]. A client is therefore expected to offer at leastintended action on the respective resource and uploads thisciphersuiteaccess token to the authz-info resource on the resource server.This specification assumes thatFigure 7 depicts theAccess Token ismessage flow where the C requests aPoPnew access tokenas described in [I-D.ietf-ace-oauth-authz] unless specifically stated otherwise. Therefore, the Access Token is bound toafter asymmetric PoP key that is used as shared secretsecurity association between the client and the resourceserver. Whileserver has been established using this protocol. If the clientcan retrievewants to update theshared secret fromauthorization information, thecontentstoken request MUST specify the key identifier of the"cnf" parameter inexisting DTLS channel between theAS-to-Client response,client and the resource serveruses the information containedin the"cnf" claim"kid" parameter of theAccess Token to determineClient-to-AS request. The authorization server MUST verify that theactual secret when no explicitspecified "kid"was provided in the "psk_identity" field. Usually, this is done by includingdenotes a"COSE_Key" object carrying eithervalid verifier for akeyproof-of- possession token that has previously beenencryptedissued to the requesting client. Otherwise, the Client-to-AS request MUST be declined with the error code "unsupported_pop_key" as defined in Section 5.6.3 of draft-ietf-ace-oauth-authz [27]. When the authorization server issues ashared secretnew access token to update existing authorization information, it MUST include the specified "kid" parameter in this access token. A resource server MUST associate the updated authorization information with any existing DTLS session that is identified by this key identifier. Note: By associating the access tokens with the identifier of an existing DTLS session, the authorization information can be updated without changing the cryptographic keys for the DTLS communication between theauthorization serverclient and the resource server,or a key identifier thati.e. an existing session can be usedby the resource server to lookup the shared secret. Instead of the "COSE_Key" object, the authorization server MAY include a "COSE_Encrypt" structure to enable the resource server to calculate the shared key from the Access Token. The "COSE_Encrypt" structure MUST use the _Direct KeywithKDF_ method as described in Section 12.1.2updated permissions. C RS AS | <===== DTLS channel =====> | | | + Access Token | | | | | | --- Token Request ----------------------------> | | | | | <---------------------------- New Access Token - | | + Access Information | | | | | --- Update /authz-info --> | | | New Access Token | | | | | | == Authorized Request ===> | | | | | | <=== Protected Resource == | | Figure 7: Overview ofRFC 8152 [13]. The authorization server MUST include a Context information structure carrying a PartyU "nonce" parameter carrying the nonceDynamic Update Operation 5. Token Expiration DTLS sessions thathashave beenused by the authorization serverestablished in accordance with this profile are always tied toconstruct the shared key. This specification mandates thata specific set of access tokens. As these tokens may become invalid atleastany time (either because thekey derivation algorithm "HKDF SHA-256" as defined in [RFC8152] MUST be supported. This key derivation function istoken has expired or thedefault when no "alg" field is included inresponsible authorization server has revoked the"COSE_Encrypt" structure fortoken), the session may become useless at some point. A resourceserver. 4.2. Updating Authorization Information Usually, the authorization information thatserver therefore MUST terminate existing DTLS sessions after theresource server keepslast valid access token fora client is updated by uploading a new Access Token as describedthis session has been deleted. As specified in Section2.2. The Client MAY also perform a new DTLS handshake according to Section 4.1 that replaces the existing DTLS session. After successful completion5.8.3 ofthe DTLS handshakedraft-ietf-ace-oauth-authz [28], the resource serverupdatesMUST notify theexisting authorization informationclient with an error response with code 4.01 (Unauthorized) for any long running request before terminating theclient according tosession. Table 1 updates Figure 2 in Section 5.1.2 of draft-ietf-ace-oauth- authz [29] with the newAccess Token. 5."kid" parameter in accordance with [RFC8152]. +----------------+----------+-----------------+ | Parameter name | CBOR Key | Major Type | +----------------+----------+-----------------+ | kid | 4 | 2 (byte string) | +----------------+----------+-----------------+ Table 1: Updated AS Information parameters 6. Security Considerations This document specifies a profile for the Authentication and Authorization for Constrained Environments (ACE) framework [I-D.ietf-ace-oauth-authz]. As it follows this framework's general approach, the general security and privacy considerations from section 6 and section 7 also apply to this profile. Constrained devices that use DTLS [RFC6347] are inherently vulnerable to Denial of Service (DoS) attacks as the handshake protocol requires creation of internal state within the device. This is specifically of concern where an adversary is able to intercept the initial cookie exchange and interject forged messages with a valid cookie to continue with the handshake. [I-D.tiloca-tls-dos-handshake] specifies a TLS extension to prevent this type of attack which is applicable especially for constrained environments where the authorization server can act as trust anchor.6.The use of multiple access tokens for a single client increases the strain on the resource server as it must consider every access token and calculate the actual permissions of the client. Also, tokens may contradict each other which may lead the server to enforce wrong permissions. If one of the access tokens expires earlier than others, the resulting permissions may offer insufficient protection. Developers should avoid using multiple access tokens for a client. 7. Privacy Considerations An unprotected response to an unauthorized request may disclose information about the resource server and/or its existing relationship with the client. It is advisable to include as little information as possible in an unencrypted response. When a DTLS session between the client and the resource server already exists, more detailed information may be included with an error response to provide the client with sufficient information to react on that particular error. Also, unprotected requests to the resource server may reveal information about the client, e.g., which resources the client attempts to request or the data that the client wants to provide to the resource server. The client should not send confidential data in an unprotected request. Note that some information might still leak after DTLS session is established, due to observable message sizes, the source, and the destination addresses.7.8. IANA Considerations The following registrations are done for the ACE OAuth Profile Registry following the procedure specified in [I-D.ietf-ace-oauth-authz]. Note to RFC Editor: Please replace all occurrences of "[RFC-XXXX]" with the RFC number of this specification and delete this paragraph. Profile name: coap_dtls Profile Description: Profile for delegating client authentication and authorization in a constrained environment by establishing a Datagram Transport Layer Security (DTLS) channel between resource-constrained nodes. Profile ID: 1 Change Controller: IESG Reference: [RFC-XXXX]8.9. References8.1.9.1. Normative References [I-D.ietf-ace-oauth-authz] Seitz, L., Selander, G., Wahlstroem, E., Erdtman, S., and H. Tschofenig, "Authentication and Authorization for Constrained Environments (ACE) using the OAuth 2.0 Framework (ACE-OAuth)",draft-ietf-ace-oauth-authz-13draft-ietf-ace-oauth-authz-16 (work in progress),JulyOctober 2018. [I-D.tiloca-tls-dos-handshake] Tiloca, M., Seitz, L., Hoeve, M., and O. Bergmann, "Extension for protecting (D)TLS handshakes against Denial of Service", draft-tiloca-tls-dos-handshake-02 (work in progress), March 2018. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>. [RFC4279] Eronen, P., Ed. and H. Tschofenig, Ed., "Pre-Shared Key Ciphersuites for Transport Layer Security (TLS)", RFC 4279, DOI 10.17487/RFC4279, December 2005, <https://www.rfc-editor.org/info/rfc4279>.[RFC5746] Rescorla, E., Ray, M., Dispensa, S., and N. Oskov, "Transport Layer Security (TLS) Renegotiation Indication Extension", RFC 5746, DOI 10.17487/RFC5746, February 2010, <https://www.rfc-editor.org/info/rfc5746>.[RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, January 2012, <https://www.rfc-editor.org/info/rfc6347>. [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained Application Protocol (CoAP)", RFC 7252, DOI 10.17487/RFC7252, June 2014, <https://www.rfc-editor.org/info/rfc7252>. [RFC7925] Tschofenig, H., Ed. and T. Fossati, "Transport Layer Security (TLS) / Datagram Transport Layer Security (DTLS) Profiles for the Internet of Things", RFC 7925, DOI 10.17487/RFC7925, July 2016, <https://www.rfc-editor.org/info/rfc7925>. [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", RFC 8152, DOI 10.17487/RFC8152, July 2017, <https://www.rfc-editor.org/info/rfc8152>. [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.8.2.9.2. Informative References [RFC6655] McGrew, D. and D. Bailey, "AES-CCM Cipher Suites for Transport Layer Security (TLS)", RFC 6655, DOI 10.17487/RFC6655, July 2012, <https://www.rfc-editor.org/info/rfc6655>. [RFC7250] Wouters, P., Ed., Tschofenig, H., Ed., Gilmore, J., Weiler, S., and T. Kivinen, "Using Raw Public Keys in Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS)", RFC 7250, DOI 10.17487/RFC7250, June 2014, <https://www.rfc-editor.org/info/rfc7250>. [RFC7251] McGrew, D., Bailey, D., Campagna, M., and R. Dugal, "AES- CCM Elliptic Curve Cryptography (ECC) Cipher Suites for TLS", RFC 7251, DOI 10.17487/RFC7251, June 2014, <https://www.rfc-editor.org/info/rfc7251>. [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves for Security", RFC 7748, DOI 10.17487/RFC7748, January 2016, <https://www.rfc-editor.org/info/rfc7748>. [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital Signature Algorithm (EdDSA)", RFC 8032, DOI 10.17487/RFC8032, January 2017, <https://www.rfc-editor.org/info/rfc8032>. [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, May 2018, <https://www.rfc-editor.org/info/rfc8392>. [RFC8422] Nir, Y., Josefsson, S., and M. Pegourie-Gonnard, "Elliptic Curve Cryptography (ECC) Cipher Suites for Transport Layer Security (TLS) Versions 1.2 and Earlier", RFC 8422, DOI 10.17487/RFC8422, August 2018, <https://www.rfc-editor.org/info/rfc8422>.8.3.9.3. URIs [1] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz-13#section-5.8.116#section-5.8.1 [2]https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 13#section-5.1.2https://tools.ietf.org/html/draft-ietf-ace-oauth-authz [3]https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 13#section-5.3https://tools.ietf.org/html/draft-ietf-ace-oauth-authz [4]https://tools.ietf.org/html/rfc7252#section-9https://tools.ietf.org/html/draft-ietf-ace-oauth-authz [5] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz-13#section-5.8.116#section-5.1.2 [6]https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 13#section-5.1.1https://tools.ietf.org/html/draft-ietf-ace-oauth-authz [7] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz-13#section-5.1.116#section-5.3 [8] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz-13#section-5.6.316#section-5.8.1 [9]https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 13#section-5.8.3https://tools.ietf.org/html/rfc7252#section-9 [10]https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 13#section-5.1.2https://tools.ietf.org/html/rfc7250 [11]https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 13#section-5.1.2https://tools.ietf.org/html/rfc7252 [12]https://tools.ietf.org/html/rfc6749#section-5.2https://tools.ietf.org/html/rfc7748 [13]https://tools.ietf.org/html/rfc8152#section-12.1.2https://tools.ietf.org/html/rfc7252 [14] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz [15] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz [16] https://tools.ietf.org/html/rfc8152#section-11 [17] https://tools.ietf.org/html/rfc8152#section-11.2 [18] https://tools.ietf.org/html/rfc6749#section-5.2 [19] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz#section- 5.7.3 [20] https://tools.ietf.org/html/rfc4279#section-2 [21] https://tools.ietf.org/html/rfc7925#section-4.2 [22] https://tools.ietf.org/html/rfc7252 [23] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz [24] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 16#section-5.1.1 [25] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 16#section-5.8.2 [26] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 16#section-5.1.2 [27] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 16#section-5.6.3 [28] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 16#section-5.8.3 [29] https://tools.ietf.org/html/draft-ietf-ace-oauth-authz- 16#section-5.1.2 Authors' Addresses Stefanie Gerdes Universitaet Bremen TZI Postfach 330440 Bremen D-28359 Germany Phone: +49-421-218-63906 Email: gerdes@tzi.org Olaf Bergmann Universitaet Bremen TZI Postfach 330440 Bremen D-28359 Germany Phone: +49-421-218-63904 Email: bergmann@tzi.org Carsten Bormann Universitaet Bremen TZI Postfach 330440 Bremen D-28359 Germany Phone: +49-421-218-63921 Email: cabo@tzi.org Goeran Selander EricssonFaroegatan 6 Kista 164 80 SwedenAB Email: goran.selander@ericsson.com Ludwig Seitz RISE SICS Scheelevaegen 17 Lund 223 70 Sweden Email: ludwig.seitz@ri.se