<?xml version="1.0" encoding="utf-8"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY SELF "[[this specification]]">
<!ENTITY I-D.selander-ace-cose-ecdhe SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.selander-ace-cose-ecdhe.xml">
<!ENTITY I-D.ietf-ace-oauth-authz SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ace-oauth-authz.xml">
<!ENTITY I-D.ietf-ace-oauth-params SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-ace-oauth-params.xml">
<!ENTITY I-D.ietf-cbor-7049bis SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-cbor-7049bis.xml">
<!--<!ENTITY I-D.gerdes-ace-dcaf-authorize SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml3/reference.I-D.gerdes-ace-dcaf-authorize.xml">-->
<!ENTITY RFC8747 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8747.xml">
<!ENTITY RFC7800 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7800.xml"> 
<!ENTITY RFC2119 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC7252 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7252.xml">
<!ENTITY RFC8152 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8152.xml">
<!ENTITY RFC8174 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC4949 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.4949.xml">
<!ENTITY RFC6749 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.6749.xml">
<!ENTITY RFC8610 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8610.xml">
<!ENTITY RFC7231 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.7231.xml">
<!ENTITY RFC8392 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8392.xml">
<!ENTITY RFC8613 SYSTEM "https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.8613.xml">
]>

<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>

<rfc ipr="trust200902" docName="draft-ietf-ace-oscore-profile-12" category="std">

<front>

  <title abbrev="OSCORE Profile of ACE">OSCORE Profile of the Authentication and Authorization for Constrained Environments Framework</title>


    <author initials="F." surname="Palombini" fullname="Francesca Palombini">
     <organization>Ericsson AB</organization>
      <address>
        <email>francesca.palombini@ericsson.com</email>
      </address>
    </author>
  <author fullname="Ludwig Seitz" initials="L." surname="Seitz">
      <organization>Combitech</organization>
      <address>
        <postal>
          <street>Djäknegatan 31</street>
          <!-- Reorder these if your country does things differently -->
          <city>Malmö</city>
          <code>211 35</code>
          <country>Sweden</country>
        </postal>
        <email>ludwig.seitz@combitech.se</email>
        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>
      <author fullname="Göran Selander" initials="G." surname="Selander">
      <organization>Ericsson AB</organization>
      <address>
        <email>goran.selander@ericsson.com</email>
        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>
  <author fullname="Martin Gunnarsson" initials="M." surname="Gunnarsson">
      <organization>RISE</organization>
      <address>
        <postal>
          <street>Scheelevagen 17</street>
          <!-- Reorder these if your country does things differently -->
          <city>Lund</city>
          <code>22370</code>
          <country>Sweden</country>
        </postal>
        <email>martin.gunnarsson@ri.se</email>
        <!-- uri and facsimile elements may also be added -->
      </address>
    </author>


    <date/>

    <area>Security</area>
    <workgroup>ACE Working Group</workgroup>
    <abstract>
      <t>
        This memo specifies a profile for the Authentication and Authorization for Constrained Environments (ACE) framework.  It utilizes Object Security for Constrained RESTful Environments (OSCORE) to provide communication security and proof-of-possession for a key owned by the client and bound to an OAuth 2.0 access token.
      </t>
      <!-- 
        Jim: Lookup on the RFC Editor page if you need to expand OAuth

        From editor's list of well known:
        OAuth     *- [seems to be more of a name rather than an abbreviation] 
      -->
    </abstract>

  </front>

  <middle>

    <section anchor="introduction" title=" Introduction"> 
      
      <t>
        This memo specifies a profile of the ACE framework <xref target="I-D.ietf-ace-oauth-authz"/>.  In this profile, a client and a resource server use the Constrained Application Protocol (CoAP) <xref target="RFC7252"/> to communicate.  The client uses an access token, bound to a symmetric key (the proof-of-possession key) to authorize its access to the resource server.  Note that this profile uses a symmetric-crypto-based scheme, where the symmetric secret is used as input material for keying material derivation.  In order to provide communication security and proof of possession, the client and resource server use Object Security for Constrained RESTful Environments (OSCORE) <xref target="RFC8613"/>.  Note that the proof of possession is not done by a dedicated protocol element, but rather occurs after the first OSCORE exchange.
      </t>

      <t>
        OSCORE specifies how to use CBOR Object Signing and Encryption (COSE) <xref target="RFC8152"/> to secure CoAP messages.
        Note that OSCORE can be used to secure CoAP messages, as well as HTTP and combinations of HTTP and CoAP; a profile of ACE similar to the one described in this document, with the difference of using HTTP instead of CoAP as communication protocol, could be specified analogously to this one.
      </t>

      <section anchor="terminology" title=" Terminology">

        <t>
          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 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
      appear in all capitals, as shown here.
        </t>

        <t>
          Certain security-related terms such as "authentication", "authorization", "confidentiality", "(data) integrity", "message  authentication code", and "verify" are taken from <xref target="RFC4949"/>.
        </t>

        <t>
          RESTful terminology follows HTTP <xref target="RFC7231"/>.
        </t>

        <t>
          Terminology for entities in the architecture is defined in OAuth 2.0 <xref target="RFC6749"/>, such as client (C), resource server (RS), and authorization server (AS). It is assumed in this document that a given resource on a specific RS is associated to a unique AS.
        </t>

        <t>
          Concise Binary Object Representation (CBOR) <xref target="I-D.ietf-cbor-7049bis"/> and Concise Data Definition Language (CDDL) <xref target="RFC8610"/> are used in this specification. CDDL predefined type names, especially bstr for CBOR byte strings and tstr for CBOR text strings, are used extensively in the document.
        </t>

        <t>
          Note that the term "endpoint" is used here, as in <xref target="I-D.ietf-ace-oauth-authz"/>, following its OAuth definition, which is to denote resources such as token and introspect at the AS and authz-info at the RS.  The CoAP <xref target="RFC7252"/> definition, which is "An entity participating in the CoAP protocol" is not used in this memo.
        </t> 
        <!-- UNDONE: changed the above to "resource" in the whole doc-->

      </section>
    </section>

    <section title="Protocol Overview"> 
    
      <t>
        This section gives an overview of how to use the ACE Framework <xref target="I-D.ietf-ace-oauth-authz"/> to secure the communication between a client and a resource server using OSCORE <xref target="RFC8613"/>. The parameters needed by the client to negotiate the use of this profile with the authorization server, as well as the OSCORE setup process, are described in detail in the following sections.
      </t>

      <t>
        The RS maintains a collection of OSCORE Security Contexts with associated authorization information for all the clients that it is communicating with. The
        authorization information is maintained as policy that is used as input to processing requests from those clients.  
      </t>

      <t>
        This profile requires a client to retrieve an access token from the AS for the resource it wants to access on an RS, by sending an access token request to the token endpoint, as specified in section 5.6 of <xref target="I-D.ietf-ace-oauth-authz"/>. The access token request and response MUST be confidentiality-protected and ensure authenticity.  This profile RECOMMENDS the use of OSCORE between client and AS, but other protocols (such as TLS or DTLS) can be used as well.
      </t>

      <t>
        Once the client has retrieved the access token, it generates a nonce N1 and posts both the token and N1 to the RS using the authz-info endpoint and mechanisms specified in section 5.8 of <xref target="I-D.ietf-ace-oauth-authz"/> and Content-Format = application/ace+cbor. When using this profile, the communication with the authz-info endpoint is not protected, except for update of access rights.
      </t>

      <t>
        If the access token is valid, the RS replies to this request with a 2.01 (Created) response with Content-Format = application/ace+cbor, which contains a nonce N2 in a CBOR map. Moreover, the server concatenates the input salt received in the token, N1, and N2 to obtain the Master Salt of the OSCORE Security Context (see section 3 of <xref target="RFC8613"/>).  The RS then derives the complete Security Context associated with the received token from it plus the parameters received in the access token from the AS, following section 3.2 of <xref target="RFC8613"/>.
      </t>

      <t>
        After receiving the nonce N2, the client concatenates the input salt (received from the AS), N1 and N2 to obtain the Master Salt of the OSCORE Security Context (see section 3 of <xref target="RFC8613"/>). The client then derives the complete Security Context from the nonces plus the parameters received from the AS.
      </t>

      <t>
        Finally, the client sends a request protected with OSCORE to the RS. If the request verifies, the server stores the complete Security Context state that is ready for use in protecting messages, and uses it in the response, and in further communications with the client, until token expiration. This Security Context is discarded when a token (whether the same or different) is used to successfully derive a new Security Context for that client. 
      </t>

      <t>
        The use of random nonces during the exchange prevents the reuse of an Authenticated Encryption with Associated Data (AEAD) nonces/key pair for two different messages. Two-time pad might otherwise occur when client and RS derive a new Security Context from an existing (non-expired) access token, as might occur when either party has just rebooted. Instead, by using random nonces as part of the Master Salt, the request to the authz-info endpoint posting the same token results in a different Security Context, by OSCORE construction, since even though the Master Secret, Sender ID and Recipient ID are the same, the Master Salt is different (see Section 3.2.1 of <xref target="RFC8613"/>). Therefore, the main requirement for the nonces is that they have a good amount of randomness. If random nonces were not used, a node re-using a non-expired old token would be susceptible to on-path attackers provoking the creation of OSCORE messages using old AEAD keys and nonces.
      </t>

      <t>
        After the whole message exchange has taken place, the client can contact the AS to request an update of its access rights, sending a similar request to the token endpoint that also includes an identifier so that the AS can find the correct OSCORE security material it has previously shared with the Client. This specific identifier, which <xref target="I-D.ietf-ace-oauth-authz"/> encodes as a bstr, is formatted to include two OSCORE identifiers, namely ID context and client ID, that are necessary to determine the correct OSCORE Input material.
      </t>

      <t>
        An overview of the profile flow for the OSCORE profile is given in <xref target="prof-overview"/>. The names of messages coincide with those of <xref target="I-D.ietf-ace-oauth-authz"/> when applicable.
      </t>


      <figure anchor="prof-overview" title="Protocol Overview">
        <artwork><![CDATA[
   C                            RS                   AS
   |                            |                     |
   | ----- POST /token  ----------------------------> |
   |                            |                     |
   | <---------------------------- Access Token ----- |
   |                           + Access Information   |
   | ---- POST /authz-info ---> |                     |
   |     (access_token, N1)     |                     |
   |                            |                     |
   | <--- 2.01 Created (N2) --- |                     |
   |                            |                     |
 /Sec Context             /Sec Context                |
   derivation/              derivation/               |
   |                            |                     |
   | ---- OSCORE Request -----> |                     |
   |                            |                     |
   |                    /proof-of-possession          |
   |                    Sec Context storage/          |
   |                            |                     |
   | <--- OSCORE Response ----- |                     |
   |                            |                     |
/proof-of-possession            |                     |
Sec Context storage/            |                     |
   |                            |                     |
   | ---- OSCORE Request -----> |                     |
   |                            |                     |
   | <--- OSCORE Response ----- |                     |
   |           ...              |                     |
]]>
        </artwork>
      </figure>

    </section> <!-- closes from line 142 -->
    

    <section anchor="client-as" title="Client-AS Communication"> 

      <t>
        The following subsections describe the details of the POST request and response to the token endpoint between client and AS. Section 3.2 of <xref target="RFC8613"/> defines how to derive a Security Context based on a shared master secret and a set of other parameters, established between client and server, which the client receives from the AS in this exchange.  The proof-of-possession key (pop-key) included in the response from the AS MUST be used as master secret in OSCORE.
      </t>

      <section anchor="c-as" title="C-to-AS: POST to token endpoint"> 

        <t>
          The client-to-AS request is specified in Section 5.6.1 of <xref target="I-D.ietf-ace-oauth-authz"/>.
        </t>

        <t>
          The client must send this POST request to the token endpoint over a secure channel that guarantees authentication, message integrity and confidentiality (see <xref target="introsp"/>). 
        </t>

        <t>
          An example of such a request, with payload in CBOR diagnostic notation without the tag and value abbreviations is reported in <xref target="ex0"/>
        </t>

        <figure anchor="ex0" title="Example C-to-AS POST /token request for an access token bound to a symmetric key.">
          <artwork><![CDATA[
    Header: POST (Code=0.02)
    Uri-Host: "as.example.com"
    Uri-Path: "token"
    Content-Format: "application/ace+cbor"
    Payload:
    {
      "req_aud" : "tempSensor4711",
      "scope" : "read"
     }
]]>
          </artwork>
        </figure>
      
        <t>
          If the client wants to update its access rights without changing an existing OSCORE Security Context, it MUST include in its POST request to the token endpoint a req_cnf object. The req_cnf MUST include a kid field carrying a bstr-wrapped CBOR array object containing the client's identifier (assigned as discussed in <xref target="as-c"/>) and the context identifier (if assigned as discussed in <xref target="as-c"/>). The CBOR array is defined in <xref target="kid"/>, and follows the notation of <xref target="RFC8610"/>. These identifiers, together with other information such as audience (see Section 5.6.1 of <xref target="I-D.ietf-ace-oauth-authz"/>), can be used by the AS to determine the shared secret bound to the proof-of-possession token and therefore MUST identify a symmetric key that was previously generated by the AS as a shared secret for the communication between the client and the RS. The AS MUST verify that the received value identifies a proof-of-possession key that has previously been issued to the requesting client. If that is not the case, the Client-to-AS request MUST be declined with the error code 'invalid_request' as defined in Section 5.6.3 of <xref target="I-D.ietf-ace-oauth-authz"/>.
        </t>

        <figure anchor="kid" title="CDDL Notation of kid for Update of Access Rights">
          <artwork><![CDATA[
    kid_arr = [ 
      clientId, 
      ?ContextId
      ]

    kid = bstr .cbor kid_arr
]]>
          </artwork>
        </figure>

        <t>
          An example of such a request, with payload in CBOR diagnostic notation without the tag and value abbreviations is reported in <xref target="ex7"/>
        </t>

        <figure anchor="ex7" title="Example C-to-AS POST /token request for updating rights to an access token bound to a symmetric key.">
          <artwork><![CDATA[
    Header: POST (Code=0.02)
    Uri-Host: "as.example.com"
    Uri-Path: "token"
    Content-Format: "application/ace+cbor"
    Payload:
    {
      "req_aud" : "tempSensor4711",
      "scope" : "write",
      "req_cnf" : {
        "kid" : << ["myclient","contextid1"] >>
     }
]]>
          </artwork>
        </figure>
      

      </section> <!-- closes from line 227 -->

      <section anchor="as-c" title="AS-to-C: Access Token"> 

        <t>
          After verifying the POST request to the token endpoint and that the client is authorized to obtain an access token corresponding to its access token request, the AS responds as defined in section 5.6.2 of <xref target="I-D.ietf-ace-oauth-authz"/>. If the client request was invalid, or not authorized, the AS returns an error response as described in section 5.6.3 of <xref target="I-D.ietf-ace-oauth-authz"/>.
        </t>

        <t>
          The AS can signal that the use of OSCORE is REQUIRED for a specific access token by including the "profile" parameter with the value "coap_oscore" in the access token response.  This means that the client MUST use OSCORE towards all resource servers for which this access token is valid, and follow <xref target="oscore-setup"/> to derive the security context to run OSCORE.
Usually it is assumed that constrained devices will be pre-configured with the necessary profile, so that this kind of profile negotiation can be omitted.	  
        </t>

        <t>
          Moreover, the AS MUST send the following data:
        </t>

        <t>
          <list style="symbols">
            <t>a master secret</t>
            <t>a server identifier</t>
            <t>a client identifier</t>
          </list>
        </t>

        <t>
          Additionally, the AS MAY send the following data, in the same response. 
        </t>

        <t>
          <list style="symbols">
            <t>a context identifier</t>
            <t>an AEAD algorithm</t>
            <t>an HMAC-based key derivation function (HKDF) algorithm</t>
            <t>a salt</t>
            <t>the OSCORE version number</t>
          </list>
        </t>

        <t>
          This data is transported in the the OSCORE_Input_Material. The OSCORE_Input_Material is a CBOR map object, defined in <xref target="oscore-sec-ctx"/>. This object is transported in the 'cnf' parameter of the access token response as defined in Section 3.2 of <xref target="I-D.ietf-ace-oauth-params"/>, as the value of a field named 'osc', registered in <xref target="osc-cwt"/> and <xref target="osc-jwt"/>.
        </t>

        <t>
          The AS MUST assign an identifier to the RS (server identifier), and to the client (client identifier), and MAY assign an identifier to the context (context identifier). These identifiers are then used as Sender ID, Recipient ID and ID Context in the OSCORE context as described in section 3.1 of <xref target="RFC8613"/>: specifically, the server identifier is used as Sender ID of the node acting as RS in this profile, and the client identifier is used as Sender ID of the node acting as ACE client. These parameters are sent as clientId, serverId and (when assigned) contextId in the OSCORE_Input_Material. ClientId and serverId MUST be included in the OSCORE_Input_Material, contextId MUST be included when assigned. The applications need to consider that these identifiers are sent in the clear and may reveal information about the endpoints, as mentioned in section 12.8 of <xref target="RFC8613"/>. The pair (client identifier, context identifier) MUST be unique in the set of all clients for a single RS.
        </t>
 
        <t>
          The master secret MUST be communicated as the 'ms' field in the 'osc' field in the 'cnf' parameter of the access token response.
          If included, the AEAD algorithm is sent in the 'alg' parameter in the OSCORE_Input_Material; the HKDF algorithm in the 'hkdf' parameter of the OSCORE_Input_Material; a salt in the 'salt' parameter of the OSCORE_Input_Material; and the OSCORE version in the 'version' parameter of the OSCORE_Input_Material.
        </t>
	      
        <t>
        	The same parameters MUST be included in the claims associated with the access token. This profile RECOMMENDS the use of CBOR web token (CWT) as specified in  <xref target="RFC8392"/>. If the token is a CWT, the same OSCORE_Input_Material structure defined above MUST be placed in the 'osc' field of the 'cnf' claim of this token.
	      </t>

        <t>
          We assume in this document that an RS is associated to one single AS, which makes it possible for the AS to enforce uniqueness of identifiers for each client sending requests to an RS. If this is not the case, collisions of identifiers may occur at the RS, in which case the RS needs to have a mechanism in place to disambiguate identifiers or mitigate the effect of the collisions.
        </t>
        <t>
          Moreover, implementers of this specification need to be aware that if other authentication mechanisms are used to set up OSCORE between the same client and RS, that do not rely on AS assigning identifiers, collisions may happen and need to be mitigated.
          A mitigation example would be to use distinct namespaces of identifiers for different authentication mechanisms.
        </t>

        <t>
          The AS MUST send different OSCORE_Input_Material (and therefore different access tokens) to different authorized clients, in order for the RS to differentiate between clients.
        </t>

        <t>
          Note that in <xref target="oscore-setup"/> C sets the Sender ID of its Security Context to the clientId value received and the Recipient ID to the serverId value, and RS does the opposite.
        </t>

        <t>
          <xref target="ex1"/> shows an example of an AS response, with payload in CBOR diagnostic notation without the tag and value abbreviations. The access token has been truncated for readability.
        </t>

        <figure anchor="ex1" title="Example AS-to-C Access Token response with OSCORE profile.">
          <artwork><![CDATA[
    Header: Created (Code=2.01)
    Content-Type: "application/ace+cbor"
    Payload:
    {
      "access_token" : h'8343a1010aa2044c53 ...
       (remainder of access token (CWT) omitted for brevity)',
      "profile" : "coap_oscore",
      "expires_in" : "3600",
      "cnf" : {
        "osc" : {
          "alg" : "AES-CCM-16-64-128",
          "clientId" : h'00',
          "serverId" : h'01',
          "ms" : h'f9af838368e353e78888e1426bd94e6f' 
        }
      }
    }
]]>
          </artwork>
        </figure>

        <t>
          <xref target="ex2"/> shows an example CWT Claims Set, including the relevant OSCORE parameters in the 'cnf' claim, in CBOR diagnostic notation without tag and value abbreviations.
        </t>

        <figure anchor="ex2" title="Example CWT Claims Set with OSCORE parameters.">
          <artwork><![CDATA[
  {
    "aud" : "tempSensorInLivingRoom",
    "iat" : "1360189224",
    "exp" : "1360289224",
    "scope" :  "temperature_g firmware_p",
    "cnf" : {
      "osc" : {
        "alg" : "AES-CCM-16-64-128",
        "clientId" : h'00',
        "serverId" : h'01',
        "ms" : h'f9af838368e353e78888e1426bd94e6f' 
    }
  }
]]>
          </artwork>
        </figure>


        <t>
          The same CWT Claims Set as in <xref target="ex2"/>, using the value abbreviations defined in <xref target="I-D.ietf-ace-oauth-authz"/> and <xref target="RFC8747"/> and encoded in CBOR is shown in <xref target="ex2-cbor"/>. The bytes in hexadecimal are reported in the first column, while their corresponding CBOR meaning is reported after the '#' sign on the second column, for easiness of readability.
        </t>

        <t>
          NOTE TO THE RFC EDITOR: before publishing, it should be checked (and in case fixed) that the values used below (which are not yet registered) are the final values registered in IANA.
        </t>

        <figure anchor="ex2-cbor" title="Example CWT Claims Set with OSCORE parameters, CBOR encoded.">
          <artwork><![CDATA[
A5                                      # map(5)
   03                                   # unsigned(3)
   76                                   # text(22)
      74656D7053656E736F72496E4C6976696E67526F6F6D 
                                        # "tempSensorInLivingRoom"
   06                                   # unsigned(6)
   1A 5112D728                          # unsigned(1360189224)
   04                                   # unsigned(4)
   1A 51145DC8                          # unsigned(1360289224)
   09                                   # unsigned(9)
   78 18                                # text(24)
      74656D70657261747572655F67206669726D776172655F70 
                                        # "temperature_g firmware_p"
   08                                   # unsigned(8)
   A1                                   # map(1)
      04                                # unsigned(4)
      A4                                # map(4)
         05                             # unsigned(5)
         0A                             # unsigned(10)
         02                             # unsigned(2)
         46                             # bytes(6)
            636C69656E74                # "client"
         03                             # unsigned(3)
         46                             # bytes(6)
            736572766572                # "server"
         01                             # unsigned(1)
         50                             # bytes(16)
            F9AF838368E353E78888E1426BD94E6F 
                                        # "\xF9\xAF\x83\x83h\xE3S\xE7
                                           \x88\x88\xE1Bk\xD9No"

]]>
          </artwork>
        </figure>


        <t>
          If the client has requested an update to its access rights using the same OSCORE Security Context, which is valid and authorized, the AS MUST omit the 'cnf' parameter in the response, and MUST carry the client identifier and the context identifier (if it was set and included in the initial access token response by the AS) in the 'kid' field in the 'cnf' parameter of the token, with the same structure defined in <xref target="kid"/>. These identifiers need to be included in the token in order for the RS to identify the previously generated Security Context.
        </t>

        <t>
          <xref target="ex5"/> shows an example of such an AS response, with payload in CBOR diagnostic notation without the tag and value abbreviations. The access token has been truncated for readability.
        </t>

        <figure anchor="ex5" title="Example AS-to-C Access Token response with OSCORE profile, for update of access rights.">
          <artwork><![CDATA[
    Header: Created (Code=2.01)
    Content-Type: "application/ace+cbor"
    Payload:
    {
      "access_token" : h'8343a1010aa2044c53 ...
       (remainder of access token (CWT) omitted for brevity)',
      "profile" : "coap_oscore",
      "expires_in" : "3600"
    }
]]>
          </artwork>
        </figure>

        <t>
          <xref target="ex6"/> shows an example CWT Claims Set, containing the necessary OSCORE parameters in the 'cnf' claim for update of access rights, in CBOR diagnostic notation without tag and value abbreviations.
        </t>

        <figure anchor="ex6" title="Example CWT Claims Set with OSCORE parameters for update of access rights.">
          <artwork><![CDATA[
  {
    "aud" : "tempSensorInLivingRoom",
    "iat" : "1360189224",
    "exp" : "1360289224",
    "scope" :  "temperature_h",
    "cnf" : {
      "kid" : h'43814100'
    }
  }
]]>
          </artwork>
        </figure>

        <!-- Client rejecting OSCORE_Security_Context if invalid <- This is not done as the client does not verify the token, so it would be easy for an attacker to interrupt ACE by just injecting unexisting fields.
        <t>
          When receiving the access token response, the client MUST verify the OSCORE_Security_Context. If any of the expected parameters in the OSCORE_Security_Context is missing (e.g. any of the mandatory parameters from the AS), or if any parameters received in the OSCORE_Security_Context is unrecognized, the client MUST NOT continue processing, and MAY attempt to retrieve a new token from the AS.
        <t>
        -->

        <section anchor="oscore-sec-ctx" title="The OSCORE_Input_Material">

          <t>
            An OSCORE_Input_Material is an object that represents the input material to derive an OSCORE Security Context, i.e., the local set of information elements necessary to carry out the cryptographic operations in OSCORE (Section 3.1 of <xref target="RFC8613"/>). In particular, the OSCORE_Input_Material is defined to be serialized and transported between nodes, as specified by this document, but can also be used by other specifications if needed. The OSCORE_Input_Material can either be encoded as a JSON object or as a CBOR map. The set of common parameters that can appear in an OSCORE_Input_Material can be found in the IANA "OSCORE Security Context Parameters" registry (<xref target="sec-ctx-params-reg"/>), defined for extensibility, and is specified below.
            All parameters are optional.
            <xref target="key-labels"/> provides a summary of the OSCORE_Input_Material parameters defined in this section.
          </t>

          <texttable title="OSCORE_Input_Material Parameters" anchor="key-labels">
            <ttcol align='left'>name</ttcol>
            <ttcol align='left'>CBOR label</ttcol>
            <ttcol align='left' width="14em">CBOR type</ttcol>
            <ttcol align='left'>registry</ttcol>
            <ttcol align='left'>description</ttcol>
            
            <c>version</c>        <c>0</c>        <c>unsigned integer</c>  <c></c>        <c>OSCORE Version</c>
            <c>ms</c>        <c>1</c>        <c>byte string</c>  <c></c>        <c>OSCORE Master Secret value</c>
            <c>clientId</c>        <c>2</c>        <c>byte string</c>        <c></c>        <c>OSCORE Sender ID value of the client, OSCORE Recipient ID value of the server</c>
            <c>serverId</c>        <c>3</c>        <c>byte string</c>        <c></c>        <c>OSCORE Sender ID value of the server, OSCORE Recipient ID value of the client</c>
            <c>hkdf</c>        <c>4</c>        <c>text string / integer</c>        <c><xref target="COSE.Algorithms"/> Values (HMAC-based)</c>        <c>OSCORE HKDF value</c>
            <c>alg</c>        <c>5</c>        <c>text string / integer</c>  <c><xref target="COSE.Algorithms"/> Values (AEAD)</c>        <c>OSCORE AEAD Algorithm value</c>
            <c>salt</c>        <c>6</c>        <c>byte string</c>        <c></c>        <c>an input to OSCORE Master Salt value</c>
            <c>contextId</c>        <c>7</c>        <c>byte string</c>        <c></c>        <c>OSCORE ID Context value</c>
          </texttable>


          <t>
            <list style="hanging">
              <t hangText="version:">
                This parameter identifies the OSCORE Version number, which is an unsigned integer. For more information about this field, see section 5.4 of <xref target="RFC8613"/>.
                In JSON, the "version" value is an integer.
                In CBOR, the "version" type is int, and has label 0.
              </t>

              <t hangText="ms:">
                This parameter identifies the OSCORE Master Secret value, which is a byte string. For more information about this field, see section 3.1 of <xref target="RFC8613"/>.
                In JSON, the "ms" value is a Base64 encoded byte string.
                In CBOR, the "ms" type is bstr, and has label 1.
              </t>

              <t hangText="clientId:">
                This parameter identifies a client identifier as a byte string. This identifier is used as OSCORE Sender ID in the client and OSCORE Recipient ID in the server. For more information about this field, see section 3.1 of <xref target="RFC8613"/>.
                In JSON, the "clientId" value is a Base64 encoded byte string.
                In CBOR, the "clientId" type is bstr, and has label 2.
              </t>

              <t hangText="serverId:">
                This parameter identifies a server identifier as a byte string. This identifier is used as OSCORE Sender ID in the server and OSCORE Recipient ID in the client. For more information about this field, see section 3.1 of <xref target="RFC8613"/>.
                In JSON, the "serverId" value is a Base64 encoded byte string.
                In CBOR, the "serverId" type is bstr, and has label 3.
              </t>
              
              <t hangText="hkdf:">
                This parameter identifies the OSCORE HKDF Algorithm. For more information about this field, see section 3.1 of <xref target="RFC8613"/>. 
                The values used MUST be registered in the IANA "COSE Algorithms" registry (see <xref target="COSE.Algorithms"/>) and MUST be HMAC-based HKDF algorithms. The value can either be the integer or the text string value of the HMAC-based HKDF algorithm in the "COSE Algorithms" registry.
                In JSON, the "hkdf" value is a case-sensitive ASCII string or an integer.
                In CBOR, the "hkdf" type is tstr or int, and has label 4.
              </t>

              <t hangText="alg:">
                This parameter identifies the OSCORE AEAD Algorithm. For more information about this field, see section 3.1 of <xref target="RFC8613"/>
                The values used MUST be registered in the IANA "COSE Algorithms" registry (see <xref target="COSE.Algorithms"/>) and MUST be AEAD algorithms. The value can either be the integer or the text string value of the HMAC-based HKDF algorithm in the "COSE Algorithms" registry.
                In JSON, the "alg" value is a case-sensitive ASCII string or an integer.
                In CBOR, the "alg" type is tstr or int, and has label 5.
              </t>

              <t hangText="salt:">
                This parameter identifies an input to the OSCORE Master Salt value, which is a byte string. For more information about this field, see section 3.1 of <xref target="RFC8613"/>.
                In JSON, the "salt" value is a Base64 encoded byte string.
                In CBOR, the "salt" type is bstr, and has label 6.
              </t>

              <t hangText="contextId:">
                This parameter identifies the security context as a byte string. This identifier is used as OSCORE ID Context. For more information about this field, see section 3.1 of <xref target="RFC8613"/>.
                In JSON, the "contextID" value is a Base64 encoded byte string.
                In CBOR, the "contextID" type is bstr, and has label 7.
              </t>
              
            </list>
          </t>

          <t>
            An example of JSON OSCORE_Input_Material is given in <xref target="JSON-osc"/>.
          </t>

          <figure anchor="JSON-osc" title="Example JSON OSCORE_Input_Material">
            <artwork><![CDATA[
        "osc" : {
          "alg" : "AES-CCM-16-64-128",
          "clientId" : b64'AA',
          "serverId" : b64'AQ',
          "ms" : b64'+a+Dg2jjU+eIiOFCa9lObw'
        }
  ]]>
            </artwork>
          </figure>

          <t>
            The CDDL grammar describing the CBOR OSCORE_Input_Material is:
          </t>

          <figure><artwork type="CDDL"><![CDATA[
OSCORE_Input_Material = {
    ? 0 => int,               ; version
    ? 1 => bstr,              ; ms
    ? 2 => bstr,              ; clientId
    ? 3 => bstr,              ; serverId
    ? 4 => tstr / int,        ; hkdf
    ? 5 => tstr / int,        ; alg
    ? 6 => bstr,              ; salt
    ? 7 => bstr,              ; contextId
    * int / tstr => any
}
]]></artwork></figure>

        </section>

      </section>
    
    </section>

    <section anchor="c-rs1" title="Client-RS Communication">

      <t>
        The following subsections describe the details of the POST request and response to the authz-info endpoint between client and RS. The client generates a nonce N1, and posts it together with the token that includes the materials (e.g., OSCORE parameters) received from the AS to the RS. The RS then generates a nonce N2, and uses Section 3.2 of <xref target="RFC8613"/> to derive a security context based on a shared master secret and the two nonces, established between client and server. The nonces are encoded as bstr if CBOR is used, and as Base64 string if JSON is used. This security context is used to protect all future communication between client and RS using OSCORE, as long as the access token is valid.
      </t>

<!--      <t>
        Note that the proof-of-possession required to bind the access token to the
        client is implicitly performed by generating the shared OSCORE Security Context using
        the pop-key as master secret, for both client and RS.  An attacker
        using a stolen token will not be able to generate a valid OSCORE context and
        thus not be able to prove possession of the pop-key.
      </t> -->

      <t>
        Note that the RS and client authenticates themselves
        by generating the shared OSCORE Security Context using
        the pop-key as master secret.  An attacker
        posting a valid token to the RS will not be able to generate a valid OSCORE context and
        thus not be able to prove possession of the pop-key. Additionally, the mutual authentication is only achieved after the client has successfully verified the response from the RS.
      </t>


      <section anchor="c-rs" title="C-to-RS: POST to authz-info endpoint">

        <t>
          The client MUST generate a nonce value very unlikely to have been previously used with the same input keying material. This profile RECOMMENDS to use a 64-bit long random number as nonce's value. The client MUST store the nonce N1 as long as the response from the RS is not received and the access token related to it is still valid. The client MUST use CoAP and the Authorization Information resource as described in section 5.8.1 of <xref target="I-D.ietf-ace-oauth-authz"/> to transport the token and N1 to the RS.
        </t>
        <t>
           Note that the use of the payload and the Content-Format is different from what is described in section 5.8.1 of <xref target="I-D.ietf-ace-oauth-authz"/>, which only transports the token without any CBOR wrapping. In this profile, the client MUST wrap the token and N1 in a CBOR map. The client MUST use the Content-Format "application/ace+cbor" defined in section 8.14 of <xref target="I-D.ietf-ace-oauth-authz"/>. The client MUST include the access token using the "access_token" parameter and N1 using the 'nonce1' parameter defined in <xref target="nonce1"/>.
        </t>

        <t>
          The communication with the authz-info endpoint does not have to be protected, except for the update of access rights case described below.
        </t>

        <t>
          Note that a client may be required to re-POST the access token in order to complete a request, since an RS may delete a stored access token (and associated Security Context) at any time, for example due to all storage space being consumed. This situation is detected by the client when it receives an AS Request Creation Hints response. Reposting the same access token will result in deriving a new OSCORE Security Context to be used with the RS, as different nonces will be used.
        </t>

        <t>
          <xref target="ex3"/> shows an example of the request sent from the client to the RS, with payload in CBOR diagnostic notation without the tag and value abbreviations. The access token has been truncated for readability.
        </t>

        <figure anchor="ex3" title="Example C-to-RS POST /authz-info request using CWT">
          <artwork><![CDATA[
      Header: POST (Code=0.02)
      Uri-Host: "rs.example.com"
      Uri-Path: "authz-info"
      Content-Format: "application/ace+cbor"
      Payload:
        {
          "access_token": h'8343a1010aa2044c53 ...
       (remainder of access token (CWT) omitted for brevity)',
          "nonce1": h'018a278f7faab55a'
        }
  ]]>
          </artwork>
        </figure>

        <t>
          If the client has already posted a valid token, has already established a security association with the RS, and wants to update its access rights, the client can do so by posting the new token (retrieved from the AS and containing the update of access rights) to the /authz-info endpoint. The client MUST protect the request using the OSCORE Security Context established during the first token exchange. The client MUST only send the access token in the payload, no nonce is sent. After proper verification (see <xref target="rs-c"/>), the RS will replace the old token with the new one, maintaining the same Security Context.
        </t>

        <section anchor="nonce1" title="The Nonce 1 Parameter" >
          <t>
             This parameter MUST be sent from the client to the RS, together with the access token, if the ace profile used is coap_oscore.  The parameter is encoded as a byte string for
   CBOR-based interactions, and as a string (Base64 encoded binary) for
   JSON-based interactions. This parameter is registered in <xref target="iana-nonces" />.
          </t>
        </section>

      </section>

      <section anchor="rs-c" title="RS-to-C: 2.01 (Created)">

        <t>
          The RS MUST follow the procedures defined in section 5.8.1 of <xref target="I-D.ietf-ace-oauth-authz"/>: the RS must verify the validity of the token. If the token is valid, the RS must respond to the POST request with 2.01 (Created). If the token is valid but is associated to claims that the RS cannot process (e.g., an unknown scope), or if any of the expected parameters in the 'osc' is missing (e.g., any of the mandatory parameters from the AS), or if any parameters received in the 'osc' is unrecognized, the RS must respond with an error response code equivalent to the CoAP code 4.00 (Bad Request). In the latter two cases, the RS may provide additional information in the error response, in order to clarify what went wrong.
          The RS may make an introspection request (see Section 5.7.1 of <xref target="I-D.ietf-ace-oauth-authz"/>) to validate the token before responding to the POST request to the authz-info endpoint. 
        </t>

        <t>
          Additionally, the RS MUST generate a nonce N2 very unlikely to have been previously used with the same input keying material, and send it within the 2.01 (Created) response. The payload of the 2.01 (Created) response MUST be a CBOR map containing the 'nonce2' parameter defined in <xref target="nonce2"/>, set to N2. This profile RECOMMENDS to use a 64-bit long random number as nonce's value. The RS MUST use the Content-Format "application/ace+cbor" defined in section 8.14 of <xref target="I-D.ietf-ace-oauth-authz"/>.
        </t>

<!--     
        <t>
        	Note that, when using this profile, an identifier of the token (e.g., the cti for a CWT) is not transported in the payload of this request, as section 5.8.1 of <xref target="I-D.ietf-ace-oauth-authz"/> allows. 
        </t> 
-->

        <t>
          <xref target="ex4"/> shows an example of the response sent from the RS to the client, with payload in CBOR diagnostic notation without the tag and value abbreviations.
        </t>

        <figure anchor="ex4" title="Example RS-to-C 2.01 (Created) response">
          <artwork><![CDATA[
      Header: Created (Code=2.01)
      Content-Format: "application/ace+cbor"
      Payload:
        {
          "nonce2": h'25a8991cd700ac01'
        }
  ]]>
          </artwork>
        </figure>
        
        <t>
          As specified in section 5.8.3 of <xref target="I-D.ietf-ace-oauth-authz"/>, the RS must notify the client with an error response with code 4.01 (Unauthorized) for any long running request before terminating the session, when the access token expires.
        </t>

        <t>
          If the RS receives the token in a OSCORE protected message, it means that the client is requesting an update of access rights. The RS MUST discard any nonce in the request, if any was sent. The RS MUST check that the "kid" of the "cnf" parameter of the new access token matches the OSCORE Security Context used to protect the message. If that is the case, the RS MUST discard the old token and associate the new token to the Security Context identified by the "kid" value in the "cnf" parameter. The RS MUST respond with a 2.01 (Created) response protected with the same Security Context, with no payload. If any verification fails, the RS MUST respond with a 4.01 (Unauthorized) error response.
        </t>

        <t>
          As specified in section 5.8.1 of <xref target="I-D.ietf-ace-oauth-authz"/>, when receiving an updated access token with updated authorization information from the client (see <xref target="c-as"/>), it is recommended that the RS overwrites the previous token, that is only the latest authorization information in the token received by the RS is valid. This simplifies the process needed by the RS to keep track of authorization information for a given client.
        </t>

        <section anchor="nonce2" title="The Nonce 2 Parameter" >
          <t>
             This parameter MUST be sent from the RS to the Client if the ace profile used is coap_oscore.  The parameter is encoded as a byte string for
   CBOR-based interactions, and as a string (Base64 encoded binary) for
   JSON-based interactions. This parameter is registered in <xref target="iana-nonces" />.
          </t>
        </section>
      </section>

      <section anchor="oscore-setup" title="OSCORE Setup">

        <t>
          Once receiving the 2.01 (Created) response from the RS, following the POST request to authz-info endpoint, the client MUST extract the bstr nonce N2 from the 'nonce2' parameter in the CBOR map in the payload of the response. Then, the client MUST set the Master Salt of the Security Context created to communicate with the RS to the concatenation of salt, N1, and N2, in this order: Master Salt = salt | N1 | N2, where | denotes byte string concatenation, where salt is the CBOR byte string received from the AS in <xref target="as-c"/>, and where N1 and N2 are the two nonces encoded as CBOR byte strings.  An example of Master Salt construction using CBOR encoding is given in <xref target="ms-ex" />.
        </t>

        <figure anchor="ms-ex" title="Example of Master Salt construction using CBOR encoding">
          <artwork><![CDATA[
N1, N2 and input salt expressed in CBOR diagnostic notation:
      nonce1 = h'018a278f7faab55a'
      nonce2 = h'25a8991cd700ac01'
      input salt = h'f9af838368e353e78888e1426bd94e6f'

N1, N2 and input salt as CBOR encoded byte strings:
      nonce1 = 0x48018a278f7faab55a
      nonce2 = 0x4825a8991cd700ac01
      input salt = 0x50f9af838368e353e78888e1426bd94e6f

Master Salt = 0x50 f9af838368e353e78888e1426bd94e6f 48 018a278f7faab55a 48 25a8991cd700ac01
  ]]>
          </artwork>
        </figure>

        <t>
          If JSON is used instead of CBOR, the Master Salt of the Security Context is the Base64 encoding of the concatenation of the same parameters, each of them prefixed by their size, encoded in 1 byte. When using JSON, the nonces and input salt have a maximum size of 255 bytes. An example of Master Salt construction using Base64 encoding is given in <xref target="ms-ex-2" />.
        </t>

        <figure anchor="ms-ex-2" title="Example of Master Salt construction using Base64 encoding">
          <artwork><![CDATA[
N1, N2 and input salt values:
      nonce1 = 0x018a278f7faab55a (8 bytes)
      nonce2 = 0x25a8991cd700ac01 (8 bytes)
      input salt = 0xf9af838368e353e78888e1426bd94e6f (16 bytes)

Input to Base64 encoding: 0x10 f9af838368e353e78888e1426bd94e6f 08 018a278f7faab55a 08 25a8991cd700ac01

Master Salt = b64'EPmvg4No41PniIjhQmvZTm8IAYonj3+qtVoIJaiZHNcArAE='
  ]]>
          </artwork>
        </figure>

        <t>
          The client MUST set the Master Secret, Sender ID and Recipient ID from the parameters received from the AS in <xref target="as-c"/>. The client MUST set the AEAD Algorithm, ID Context, HKDF, and OSCORE Version from the parameters received from the AS in <xref target="as-c"/>, if present. In case an optional parameter is omitted, the default value SHALL be used as described in sections 3.2 and 5.4 of <xref target="RFC8613"/>. After that, the client MUST derive the complete Security Context following section 3.2.1 of <xref target="RFC8613"/>. From this point on, the client MUST use this Security Context to communicate with the RS when accessing the resources as specified by the authorization information.
        </t>

        <t>
          If any of the expected parameters is missing (e.g., any of the mandatory parameters from the AS, the client MUST stop the exchange, and MUST NOT derive the Security Context. The client MAY restart the exchange, to get the correct security material.
        </t>

        <t>
          The client then uses this Security Context to send requests to RS using OSCORE.
        </t>

        <t>
          After sending the 2.01 (Created) response, the RS MUST set the Master Salt of the Security Context created to communicate with the client to the concatenation of salt, N1, and N2, in the same way described above. An example of Master Salt construction using CBOR encoding is given in <xref target="ms-ex" /> and using Base64 encoding is given in <xref target="ms-ex-2" />. The RS MUST set the Master Secret, Sender ID and Recipient ID from the parameters, received from the AS and forwarded by the client in the access token in <xref target="c-rs"/> after validation of the token as specified in <xref target="rs-c"/>. The RS MUST set the AEAD Algorithm, ID Context, HKDF, and OSCORE Version from the parameters received from the AS and forwarded by the client in the access token in <xref target="c-rs"/> after validation of the token as specified in <xref target="rs-c"/>, if present. In case an optional parameter is omitted, the default value SHALL be used as described in sections 3.2 and 5.4 of <xref target="RFC8613"/>. After that, the RS MUST derive the complete Security Context following section 3.2.1 of <xref target="RFC8613"/>, and MUST associate this Security Context with the authorization information from the access token.
        </t>

        <t>
          The RS then uses this Security Context to verify requests and send responses to C using OSCORE. If OSCORE verification fails, error responses are used, as specified in section 8 of <xref target="RFC8613"/>. Additionally, if OSCORE verification succeeds, the verification of access rights is performed as described in section <xref target="tok-ver"/>. The RS MUST NOT use the Security Context after the related token has expired, and MUST respond with a unprotected 4.01 (Unauthorized) error message to
requests received that correspond to a Security Context with an expired
token.
        </t>

        <t>
          Note that the ID Context can be assigned by the AS, communicated and set in both the RS and client after the exchange specified in this profile is executed. Subsequently, client and RS can update their ID Context by running a mechanism such as the one defined in Appendix B.2 of <xref target="RFC8613"/> if they support it. In that case, the ID Context in the OSCORE Security Context will not match the "contextId" parameter of the corresponding OSCORE_Input_Material. That is fine, as long as the nodes store and use the "contextId" value to identify the correct OSCORE_Input_Material at the AS.
        </t>

      </section>

      <section anchor="tok-ver" title="Access rights verification">

        <t>
          The RS MUST follow the procedures defined in section 5.8.2 of <xref target="I-D.ietf-ace-oauth-authz"/>: if an RS receives an OSCORE-protected request from a client, then the RS processes it according to <xref target="RFC8613"/>. If OSCORE verification succeeds, and the target resource
          requires authorization, the RS retrieves the authorization information using the access token associated to the Security Context. The RS then must verify that the authorization information covers the resource and the action requested.
        </t>

      </section>

    </section>

    <section anchor="introsp" title="Secure Communication with AS">

      <t>
        As specified in the ACE framework (section 5.7 of <xref target="I-D.ietf-ace-oauth-authz"/>), the requesting entity (RS and/or client) and the AS communicates via the introspection or token endpoint. The use of CoAP and OSCORE (<xref target="RFC8613"/>) for this communication is RECOMMENDED in this profile, other protocols (such as HTTP and DTLS or TLS) MAY be used instead.
      </t>

      <t>
        If OSCORE is used, the requesting entity and the AS are expected to have pre-established security contexts in place.  How these security contexts are established is out of scope for this profile.  Furthermore the requesting entity and the AS communicate through the introspection endpoint as specified in section 5.7 of <xref target="I-D.ietf-ace-oauth-authz"/> and through the token endpoint as specified in section 5.6 of <xref target="I-D.ietf-ace-oauth-authz"/>.
      </t>

    </section>

    <section anchor="sec-ctx-discard" title="Discarding the Security Context">

      <t>
        There are a number of scenarios where a client or RS needs to discard the OSCORE security context, and acquire a new one.
      </t>

      <t>
        The client MUST discard the current Security Context associated with an RS when:
      </t>

      <t>
        <list style="symbols">
          <t> the Sequence Number space ends. </t>
          <t> the access token associated with the context expires. </t>
          <t> the client receives a number of 4.01 Unauthorized responses to OSCORE requests using the same Security Context. The exact number needs to be specified by the application. </t>
          <t> the client receives a new nonce in the 2.01 (Created) response (see <xref target="rs-c"/>) to a POST request to the authz-info endpoint, when re-posting a (non-expired) token associated to the existing context. </t>
        </list>
      </t>

      <t>
        The RS MUST discard the current Security Context associated with a client when:
      </t>

      <t>
        <list style="symbols">
          <t> the Sequence Number space ends. </t>
          <t> the access token associated with the context expires. </t>
          <t> the client has successfully replaced the current security context with a newer one by posting an access token to the unprotected /authz-info endpoint at the RS, e.g., by re-posting the same token, as specified in <xref target="c-rs"/>.</t>
        </list>
      </t>

      <t>
        Whenever one more access token is successfully posted to the RS, and a new Security Context is derived between the client and RS, messages in transit that were protected with the previous Security Context might not pass verification, as the old context is discarded. That means that messages sent shortly before the client posts one more access token to the RS might not successfully reach the destination. Analogously, implementations may want to cancel CoAP observations at the RS registered before the Security Context is replaced, or conversely they will need to implement a mechanism to ensure that those observation are to be protected with the newly derived Security Context.
      </t>

    </section>

    <section anchor="sec-cons" title="Security Considerations">

      <t>
        This document specifies a profile for the Authentication and
        Authorization for Constrained Environments (ACE) framework
        <xref target="I-D.ietf-ace-oauth-authz"/>.  Thus the general security
        considerations from the framework also apply to this profile.
      </t>

      <t>
        Furthermore the general security considerations of OSCORE <xref
        target="RFC8613"/> also apply to this specific
        use of the OSCORE protocol.
      </t>

      <t>
        As previously stated, the proof-of-possession in this profile is performed by both parties verifying that they have established the same Security Context, as specified in <xref target="oscore-setup"/>, which means that both the OSCORE request and OSCORE pass verification.
        RS authentication requires both that the client trusts the AS and that the OSCORE response from the RS pass verification.
      </t>
      
      <t>
        OSCORE is designed to secure point-to-point communication,
        providing a secure binding between the request and the response(s).
        Thus the basic OSCORE protocol is not intended for use in
        point-to-multipoint communication (e.g., multicast, publish-subscribe).
        Implementers of this profile should make sure that their usecase
        corresponds to the expected use of OSCORE, to prevent weakening the
        security assurances provided by OSCORE.
      </t>
      
      <t>
        Since the use of nonces in the exchange guarantees uniqueness of AEAD keys and nonces, it is REQUIRED that nonces are not reused with the same input keying material even in case of re-boots. This document RECOMMENDS the use of 64 bit random nonces. Considering the birthday paradox, the average collision for each nonce will happen after 2^32 messages, which is considerably more token provisionings than expected for intended applications. If applications use something else, such as a counter, they need to guarantee that reboot and loss of state on either node does not provoke re-use.
        If that is not guaranteed, nodes are susceptible to re-use of AEAD (nonces, keys) pairs, especially since an on-path attacker can cause the client to use an arbitrary nonce for Security Context establishment by replaying client-to-server messages.
      </t>

      <t>
        This profile recommends that the RS maintains a single access token for a client. 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 indicating different or disjoint permissions from each other 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. 
      </t>

      <t>
        If a single OSCORE_Input_Material is used with multiple RSs, the RSs can impersonate C to one of the other RS, and impersonate another RS to the client. If a master secret is used with several clients, the Cs can impersonate RS to one of the other C. Similarly if symmetric keys are used to integrity protect the token between AS and RS and the token can be used with multiple RSs, the RSs can impersonate AS to one of the other RS. If the token key is used for any other communication between the RSs and AS, the RSs can impersonate each other to the AS.
      </t>
    
    </section>

    <section title="Privacy Considerations">
      <t>
        This document specifies a profile for the Authentication and
        Authorization for Constrained Environments (ACE) framework
        <xref target="I-D.ietf-ace-oauth-authz"/>.  Thus the general privacy
        considerations from the framework also apply to this profile.
      </t>
      <t>
        As this document uses OSCORE, thus the privacy considerations from
	<xref target="RFC8613"/> apply here as well.
      </t>

      <t>
      	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 an OSCORE Security Context already exists between the client and the resource server, more detailed information may be included.
      </t> 

      <t>
        The token is sent in the clear to the authz-info endpoint, so if a client uses the same single token from multiple locations with multiple Resource Servers, it can risk being tracked by the token's value even when the access token is encrypted.
      </t>

       <t>
        The nonces exchanged in the request and response to the authz-info endpoint are also sent in the clear, so using random nonces is best for privacy (as opposed to, e.g., a counter, that might leak some information about the client).
      </t>

      <t>
        The AS is the party tasked with assigning the identifiers used in OSCORE, which are privacy sensitive (see Section 12.8 of <xref target="RFC8613"/>), and which could reveal information about the client, or may be used for correlating requests from one client.
      </t>

      <t>
      	Note that some information might still leak after OSCORE is established, due to observable message sizes, the source, and the destination addresses.
      </t>
    </section>

    <section title=" IANA Considerations ">

       <t>Note to RFC Editor: Please replace all occurrences of "&SELF;"
      with the RFC number of this specification and delete this paragraph.</t>

      <section title="ACE Profile Registry" >

        <t>The following registration is done for the ACE Profile
        Registry following the procedure specified in section 8.8 of <xref
        target="I-D.ietf-ace-oauth-authz"/>:</t>

        <t><?rfc subcompact="yes"?><list style='symbols'>
          <t>Name: coap_oscore</t>

          <t>Description: Profile for using OSCORE to secure communication
        between constrained nodes using the Authentication and Authorization
        for Constrained Environments framework.</t>

          <t>CBOR Value: TBD (value between 1 and 255)</t>

          <t>Reference: &SELF;</t>
        </list></t>

      </section>

      <section title="OAuth Parameters Registry" anchor="iana-nonces">

        <t>The following registrations are done for the OAuth Parameters
        Registry following the procedure specified in section 11.2 of <xref
        target="RFC6749"/>:</t>

        <t><?rfc subcompact="yes"?><list style='symbols'>
          <t>Parameter name: nonce1</t>

          <t>Parameter usage location: client-rs request</t>
        
          <t>Change Controller: IESG</t>

          <t>Specification Document(s): &SELF;</t>
        </list></t>
        <t><?rfc subcompact="yes"?><list style='symbols'>
          <t>Parameter name: nonce2</t>

          <t>Parameter usage location: rs-client response</t>
        
          <t>Change Controller: IESG</t>

          <t>Specification Document(s): &SELF;</t>
        </list></t>

      </section>

      <section title="OAuth Parameters CBOR Mappings Registry">

        <t>The following registrations are done for the OAuth Parameters CBOR Mappings 
        Registry following the procedure specified in section 8.10 of <xref
        target="I-D.ietf-ace-oauth-authz"/>:</t>

        <t><?rfc subcompact="yes"?><list style='symbols'>
          <t>Name: nonce1</t>

          <t>CBOR Key: TBD1</t>
        
          <t>Value Type: bstr</t>

          <t>Reference: &SELF;</t>
        </list></t>
        <t><?rfc subcompact="yes"?><list style='symbols'>
          <t>Name: nonce2</t>

          <t>CBOR Key: TBD2</t>
        
          <t>Value Type: bstr</t>

          <t>Reference: &SELF;</t>
        </list></t>

      </section>


      <section anchor="sec-ctx-params-reg" title="OSCORE Security Context Parameters Registry">
	
      <t>
          It is requested that IANA create a new registry entitled "OSCORE Security Context Parameters" registry.
          The registry is to be created as Expert Review Required.
          Guidelines for the experts is provided <xref target="review"/>.
          It should be noted that in addition to the expert review, some portions of the registry require a specification, potentially on standards track, be supplied as well.
        </t>

        <t>
          The columns of the registry are:
        </t>

        <t>
          <list style="hanging">
            <t hangText='name'>
              The JSON name requested (e.g., "ms").
              Because a core goal of this specification is for the resulting representations to be compact, it is RECOMMENDED that the name be short.
              This name is case sensitive.
              Names may not match other registered names in a case-insensitive manner unless the Designated Experts determine that there is a compelling reason to allow an exception.
              The name is not used in the CBOR encoding.
            </t>
            <t hangText='CBOR label'>
              The value to be used to identify this algorithm.
              Map key labels MUST be unique.
              The label can be a positive integer, a negative integer or a string.
              Integer values between -256 and 255 and strings of length 1 are designated as Standards Track Document required.
              Integer values from -65536 to -257 and from 256 to 65535 and strings of length 2 are designated as Specification Required.
              Integer values greater than 65535 and strings of length greater than 2 are designated as expert review.
              Integer values less than -65536 are marked as private use.
            </t>
            <t hangText='CBOR Type'>
              This field contains the CBOR type for the field.
            </t>
            <t hangText='registry'>
              This field denotes the registry that values may come from, if one exists.
            </t>
            <t hangText='description'>
              This field contains a brief description for the field.
            </t>
            <t hangText='specification'>
              This contains a pointer to the public specification for the field if one exists
            </t>
          </list>
        </t>

        <t>
          This registry will be initially populated by the values in <xref target="key-labels"/>.
          The specification column for all of these entries will be this document and <xref target="RFC8613"/>.
        </t>

      </section>

      <section anchor="osc-cwt" title="CWT Confirmation Methods Registry">

        <t>The following registration is done for the CWT Confirmation Methods Registry following the procedure specified in section 7.2.1 of <xref target="RFC8747"/>:</t>

        <t><?rfc subcompact="yes"?><list style='symbols'>
          <t>Confirmation Method Name: "osc"</t>

          <t>Confirmation Method Description: OSCORE_Input_Material carrying the parameters for using OSCORE per-message security with implicit key confirmation</t>

          <t>Confirmation Key: TBD (value between 4 and 255)</t>

          <t>Confirmation Value Type(s): map</t>
        
          <t>Change Controller: IESG</t>

          <t>Specification Document(s): <xref target="oscore-sec-ctx"/> of &SELF;</t>
        </list></t>

      </section>


      <section anchor="osc-jwt" title="JWT Confirmation Methods Registry">

        <t>The following registration is done for the JWT Confirmation Methods Registry following the procedure specified in section 6.2.1 of <xref target="RFC7800"/>:</t>

        <t><?rfc subcompact="yes"?><list style='symbols'>
          <t>Confirmation Method Value: "osc"</t>

          <t>Confirmation Method Description: OSCORE_Input_Material carrying the parameters for using OSCORE per-message security with implicit key confirmation</t>
        
          <t>Change Controller: IESG</t>

          <t>Specification Document(s): <xref target="oscore-sec-ctx"/> of &SELF;</t>
        </list></t>

      </section>


      <section title="Expert Review Instructions" anchor="review">
        <t>
          The IANA registry established in this document is defined to use the Expert Review registration policy.
          This section gives some general guidelines for what the experts should be looking for, but they are being designated as experts for a reason so they should be given substantial latitude.
        </t>

        <t>
          Expert reviewers should take into consideration the following points:

          <list style="symbols">
            <t>
              Point squatting should be discouraged.
              Reviewers are encouraged to get sufficient information for registration requests to ensure that the usage is not going to duplicate one that is already registered and that the point is likely to be used in deployments.
              The zones tagged as private use are intended for testing purposes and closed environments. Code points in other ranges should not be assigned for testing.
            </t>

            <t>
              Specifications are required for the standards track range of point assignment.
              Specifications should exist for specification required ranges, but early assignment before a specification is available is considered to be permissible.
              Specifications are needed for the first-come, first-serve range if they are expected to be used outside of closed environments in an interoperable way.
              When specifications are not provided, the description provided needs to have sufficient information to identify what the point is being used for.
            </t>

            <t>
              Experts should take into account the expected usage of fields when approving point assignment.
              The fact that there is a range for standards track documents does not mean that a standards track document cannot have points assigned outside of that range.
              The length of the encoded value should be weighed against how many code points of that length are left, the size of device it will be used on, and the number of code points left that encode to that size.
            </t>

          </list>
        </t>
          
      </section>

    </section>

  </middle>

  <back>

    <references title="Normative References">

      &RFC8613;
      &I-D.ietf-ace-oauth-authz;
      &I-D.ietf-ace-oauth-params;
      &I-D.ietf-cbor-7049bis;
      &RFC8392;
      &RFC2119;
      &RFC7252;
      &RFC8152;
      &RFC8174;
      &RFC8610;

      <reference anchor="COSE.Algorithms" target="https://www.iana.org/assignments/cose/cose.xhtml#algorithms">
          <front>
            <title>COSE Algorithms</title>
            <author>
              <organization>IANA</organization>
            </author>
            <date/>
          </front>
      </reference>


    </references>

    <references title='Informative References'>
      
      <!--&I-D.gerdes-ace-dcaf-authorize;-->
      <!--&I-D.selander-ace-cose-ecdhe;-->
      &RFC8747;
      &RFC7800;
      &RFC4949;
      &RFC6749;
      <!--&RFC7049;-->
      &RFC7231;

    </references>

    <section title="Profile Requirements">

      <t>
        This section lists the specifications on this profile based on the requirements on the framework, as requested in Appendix C of <xref target="I-D.ietf-ace-oauth-authz"/>.
      </t>

      <t>
        <list style="symbols">
          <t>
            Optionally define new methods for the client to discover the
            necessary permissions and AS for accessing a resource, different
            from the one proposed in: Not specified
          </t>
          <t>
            Optionally specify new grant types: Not specified
          </t>
          <t>
            Optionally define the use of client certificates as client
            credential type: Not specified
          </t>
          <t>
            Specify the communication protocol the client and RS the must use: CoAP
          </t>
          <t>
            Specify the security protocol the client and RS must use to
            protect their communication: OSCORE
          </t>
          <t>
            Specify how the client and the RS mutually authenticate: Implicitly by possession of a common OSCORE security context. Note that the mutual authentication is not completed before the client has verified an OSCORE response using this security context.
          </t>
          <t>
            Specify the proof-of-possession protocol(s) and how to select one,
            if several are available.  Also specify which key types (e.g.,
            symmetric/asymmetric) are supported by a specific proof-of-
            possession protocol: OSCORE algorithms; pre-established symmetric keys
          </t>
          <t>
            Specify a unique ace_profile identifier: coap_oscore
          </t>
          <t>
            If introspection is supported: Specify the communication and
            security protocol for introspection: HTTP/CoAP (+ TLS/DTLS/OSCORE)
          </t>
          <t>
            Specify the communication and security protocol for interactions
            between client and AS: HTTP/CoAP (+ TLS/DTLS/OSCORE)
          </t>
          <t>
            Specify how/if the authz-info endpoint is protected, including how
            error responses are protected: Not protected.
          </t>
          <t>
            Optionally define other methods of token transport than the authz-
            info endpoint: Not defined
          </t>
        </list>
      </t>

    </section>


<!--
    <section anchor= "oscore-edhoc" title="Using the pop-key with EDHOC (EDHOC+OSCORE)" >

      <t>
        EDHOC specifies an authenticated Diffie-Hellman protocol that allows two parties to use CBOR <xref target="RFC7049"/> and COSE in order to establish a shared secret key with perfect forward secrecy.  The use of Ephemeral Diffie-Hellman Over COSE (EDHOC) <xref target="I-D.selander-ace-cose-ecdhe"/> in this profile in addition to OSCORE, provides perfect forward secrecy (PFS) and the initial proof-of-possession, which ties the proof-of-possession key to an OSCORE security context.
      </t>

      <t>
        If EDHOC is used together with OSCORE, and the pop-key (symmetric or asymmetric) is used to authenticate the messages in EDHOC, then the AS MUST provision the following data, in response to the access token request:
      <!- - Jim: Again the symmetric key is not a POP key. - ->
      </t>

      <t>
        <list style="symbols">
          <t>a symmetric or public key (associated to the RS)</t>
          <t>a key identifier;</t>
        </list>
      </t>

      <t>
        How these parameters are communicated depends on the type of key (asymmetric or symmetric).  Moreover, the AS MUST signal the use of OSCORE + EDHOC with the 'profile' parameter set to "coap_oscore_edhoc".
      </t>

      <t>
        Note that in the case described in this section, the 'expires_in' parameter, defined in Section 4.2.2. of <xref target="RFC6749"/> defines the lifetime in seconds of both the access token and the shared secret. After expiration, C MUST acquire a new access token from the AS, and run EDHOC again, as specified in this section
      </t>

      <section anchor="edhoc-asym" title="Using Asymmetric Keys">
        
        <t>
          In case of an asymmetric key, C MUST communicate its own asymmetric key to the AS in the 'req_cnf' parameter of the access token request, as specified in Section 3.1 of <xref target="I-D.ietf-ace-oauth-params"/>; the AS MUST communicate the RS's public key to C in the response, in the 'rs_cnf' parameter, as specified in Section 3.2 of <xref target="I-D.ietf-ace-oauth-params"/>. Note that the RS's public key MUST include a 'kid' parameter, and that the value of the 'kid' MUST be included in the access token, to let the RS know which of its public keys C used.  If the access token is a CWT <xref target="RFC8392"/>, the key identifier MUST be placed directly in the 'cnf' structure (if the key is only referenced).
        <!- - TODO: check that the rs_cnf is used correctly - ->
        </t>

        <t>
          Figure 3 shows an example of such a request in CBOR diagnostic notation without tag and value abbreviations.
        </t>

<figure><artwork><![CDATA[
Header: POST (Code=0.02)
Uri-Host: "server.example.com"
Uri-Path: "token"
Content-Type: "application/cose+cbor"
Payload:
{
 "req_cnf" : {
   "COSE_Key" : {
     "kid" : "client_key"
     "kty" : "EC",
     "crv" : "P-256",
     "x" : b64'usWxHK2PmfnHKwXPS54m0kTcGJ90UiglWiGahtagnv8',
     "y" : b64'IBOL+C3BttVivg+lSreASjpkttcsz+1rb7btKLv8EX4'
   }
 }
}

Figure 3: Example access token request (OSCORE+EDHOC, asymmetric).
]]></artwork></figure>

        <t>
          Figure 4 shows an example of a corresponding response in CBOR diagnostic notation without tag and value abbreviations.
        </t>

<figure><artwork><![CDATA[
  Header: Created (Code=2.01)
  Content-Type: "application/cose+cbor"
  Payload:
  {
    "access_token" : b64'SlAV32hkKG ...
     (contains "kid" : "client_key")',
    "profile" : "coap_oscore_edhoc",
    "expires_in" : "3600",
    "cnf" : {
      "COSE_Key" : {
        "kid" : "server_key"
        "kty" : "EC",
        "crv" : "P-256",
        "x" : b64'cGJ90UiglWiGahtagnv8usWxHK2PmfnHKwXPS54m0kT',
        "y" : b64'reASjpkttcsz+1rb7btKLv8EX4IBOL+C3BttVivg+lS'
     }
    }
  }

Figure 4: Example AS response (EDHOC+OSCORE, asymmetric).
]]></artwork></figure>

      </section> <!- - ends for line 299- ->

      <section anchor="edhoc-sym" title="Using Symmetric Keys">
        
        <t>
          In the case of a symmetric key, the AS MUST communicate the key to the client in the 'cnf' parameter of the access token response, as specified in Section 3.2. of <xref target="I-D.ietf-ace-oauth-params"/>.   The AS MUST also select a key identifier, that MUST be included as the 'kid' parameter of the COSE_key, as in figure 9 of <xref target="I-D.ietf-ace-oauth-authz"/>.
        </t>

        <t>
          Figure 5 shows an example of the necessary parameters in the AS response to the access token request when EDHOC is used.  The example uses CBOR  diagnostic notation without tag and value abbreviations.
        </t>

<figure><artwork><![CDATA[
  Header: Created (Code=2.01)
  Content-Type: "application/cose+cbor"
  Payload:
  {
    "access_token" : b64'SlAV32hkKG ...
     (remainder of access token omitted for brevity)',
    "profile" : "coap_oscore_edhoc",
    "expires_in" : "3600",
    "cnf" : {
      "COSE_Key" : {
        "kty" : "Symmetric",
        "kid" : b64'5tOS+h42dkw',
        "k" : b64'+a+Dg2jjU+eIiOFCa9lObw'
      }
    }
  }

Figure 5: Example AS response (EDHOC+OSCORE, symmetric).
]]></artwork></figure>

        <t>
          In both cases, the AS MUST also include the same key identifier as 'kid' parameter in the access token metadata. If the access token is a CWT <xref target="RFC8392"/>, the key identifier MUST be placed inside the 'cnf' claim as 'kid' parameter of the COSE_Key or directly in the 'cnf' structure (if the key is only referenced).
        </t>
        <t>
          Figure 6 shows an example CWT containing the necessary EDHOC+OSCORE parameters in the 'cnf' claim, in CBOR diagnostic notation without tag and value abbreviations.
        </t>

<figure><artwork><![CDATA[
{
  "aud" : "tempSensorInLivingRoom",
  "iat" : "1360189224",
  "exp" : "1360289224",
  "scope" :  "temperature_g firmware_p",
  "cnf" : {
    "COSE_Key" : {
      "kty" : "Symmetric",
      "kid" : b64'5tOS+h42dkw',
      "k" : b64'+a+Dg2jjU+eIiOFCa9lObw' 
  }
}

  Figure 6: Example CWT with EDHOC+OSCORE, symmetric case.
]]></artwork></figure>

        <t>
          All other parameters defining OSCORE security context are derived from EDHOC message exchange, including the master secret (see Appendix D.2 of <xref target="I-D.selander-ace-cose-ecdhe"/>).
        </t>

      </section> <!- - ends for line 361- ->

      <section anchor="edhoc-proc" title="Processing">
        
        <t>
          To provide forward secrecy and mutual authentication in the case of pre-shared keys, pre-established raw public keys or with X.509 certificates it is RECOMMENDED to use EDHOC <xref target="I-D.selander-ace-cose-ecdhe"/> to generate the keying material.  EDHOC MUST be used as defined in Appendix D of <xref target="I-D.selander-ace-cose-ecdhe"/>, with the following additions and modifications.
        </t>
        
        <t>
          The first EDHOC message is sent after the access token is posted to the authz-info endpoint of the RS as specified in Section 5.8.1 of <xref target="I-D.ietf-ace-oauth-authz"/>. Then the EDHOC message_1 is sent and the EDHOC protocol is initiated <xref target="I-D.selander-ace-cose-ecdhe"/>).
        </t>
        
        <t>
          Before the RS continues with the EDHOC protocol and responds to this token submission request, additional verifications on the access token are done: the RS SHALL process the access token according to <xref target="I-D.ietf-ace-oauth-authz"/>.  If the token is valid then the RS continues processing EDHOC following Appendix D of <xref target="I-D.selander-ace-cose-ecdhe"/>, otherwise it discontinues EDHOC and responds with the error code as specified in <xref target="I-D.ietf-ace-oauth-authz"/>.
        </t>

        <t>
          <list style="symbols">
            <t>In case the EDHOC verification fails, the RS MUST return an error response to the client with code 4.01 (Unauthorized).
            </t>
            <t>If RS has an access token for C but not for the resource that C has requested, RS MUST reject the request with a 4.03 (Forbidden).
            </t>
            <t>If RS has an access token for C but it does not cover the action C requested on the resource, RS MUST reject the request with a 4.05 (Method Not Allowed).
            </t>
            <t>If all verifications above succeeds, further communication between client and RS is protected with OSCORE, including the RS response to the OSCORE request.
            </t>
          </list>
        </t>

        <t>
          In the case of EDHOC being used with symmetric keys, the protocol in Section 5 of <xref target="I-D.selander-ace-cose-ecdhe"/> MUST be used.  If the key is asymmetric, the RS MUST also use an asymmetric key for authentication.  This key is known to the client through the access token response (see Section 5.6.2 of <xref target="I-D.ietf-ace-oauth-authz"/>).  In this case the protocol in Section 4 of <xref target="I-D.selander-ace-cose-ecdhe"/> MUST be used.
        </t>

        <t>
          Figure 7 illustrates the message exchanges for using OSCORE+EDHOC (step C in figure 1 of <xref target="I-D.ietf-ace-oauth-authz"/>).
        </t>

<figure><artwork><![CDATA[
                 Resource
        Client    Server
        |          |
        |          |
        +- - - - - - - - ->| Header: POST (Code=0.02)
        | POST     | Uri-Path:"authz-info"
        |          | Content-Type: application/cbor
        |          | Payload: access token
        |          |
        |          |
        +- - - - - - - - ->| Header: POST (Code=0.02)
        |   POST   | Uri-Path: "/.well-known/edhoc"
        |          | Content-Type: application/edhoc
        |          | Payload: EDHOC message_1
        |          |
        |<- - - - - - - - -+ Header: 2.04 Changed
        |   2.04   | Content-Type: application/edhoc
        |          | Payload: EDHOC message_2
        |          |
        +- - - - - - - - ->| Header: POST (Code=0.02)
        |   POST   | Uri-Path: "/.well-known/edhoc"
        |          | Content-Type: application/edhoc
        |          | Payload: EDHOC message_3
        |          |
        |<- - - - - - - - -+ Header: 2.04 Changed
        |   2.04   |
        |          |
 start of protected communication
        |          |
        +- - - - - - - - ->| CoAP request +
        |  OSCORE  | Object-Security option
        | request  | 
        |          |
        |<- - - - - - - - -+ CoAP response +
        |  OSCORE  | Object-Security option
        | response | 
        |          |  

Figure 7: Access token and key establishment with EDHOC
]]></artwork></figure>

<!- -
Jim: in the section above: Is there a reason for not supporting multiple edhoc negotiations w/ the same secret - it seemed to be an original mode that was supported.

where does it say that? - ->

      </section> <!- - ends for line 422- ->
    </section>
-->

    <section title="Acknowledgments" numbered='no'> 

      <t>
        The authors wish to thank Jim Schaad and Marco Tiloca for the input on this memo. Special thanks to the responsible area director Benjamin Kaduk for his extensive review and contributed text.
        Ludwig Seitz worked on this document as part of the CelticNext projects CyberWI, and CRITISEC with funding from Vinnova.
      </t>

    </section>

  </back>

</rfc>
