Network Working Group G. Selander Internet-Draft J. Preuß Mattsson Intended status: Standards Track F. Palombini Expires:January 13,24 February 2022 EricssonAB July 12,23 August 2021 Ephemeral Diffie-Hellman Over COSE (EDHOC)draft-ietf-lake-edhoc-08draft-ietf-lake-edhoc-09 Abstract This document specifies Ephemeral Diffie-Hellman Over COSE (EDHOC), a very compact and lightweight authenticated Diffie-Hellman key exchange with ephemeral keys. EDHOC provides mutual authentication,perfectforward secrecy, and identity protection. EDHOC is intended for usage in constrained scenarios and a main use case is to establish an OSCORE security context. By reusing COSE for cryptography, CBOR for encoding, and CoAP for transport, the additional code size can be kept very low. 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 onJanuary 13,24 February 2022. Copyright Notice Copyright (c) 2021 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)(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 . . . . . . . . . . . . . . . . . . . . . . . . 3 1.1. Motivation . . . . . . . . . . . . . . . . . . . . . . . 3 1.2. Use of EDHOC . . . . . . . . . . . . . . . . . . . . . .45 1.3. Message Size Examples . . . . . . . . . . . . . . . . . . 5 1.4. Document Structure . . . . . . . . . . . . . . . . . . . 6 1.5. Terminology and Requirements Language . . . . . . . . . . 6 2. EDHOC Outline . . . . . . . . . . . . . . . . . . . . . . . .67 3. Protocol Elements . . . . . . . . . . . . . . . . . . . . . .89 3.1. General . . . . . . . . . . . . . . . . . . . . . . . . .89 3.2. Method . . . . . . . . . . . . . . . . . . . . . . . . .910 3.3. Connection Identifiers . . . . . . . . . . . . . . . . .910 3.4. Transport . . . . . . . . . . . . . . . . . . . . . . . . 11 3.5. Authentication Parameters . . . . . . . . . . . . . . . .1112 3.6. Cipher Suites . . . . . . . . . . . . . . . . . . . . . .1618 3.7. Ephemeral Public Keys . . . . . . . . . . . . . . . . . .1820 3.8. External Authorization Data (EAD) . . . . . . . . . . . .. . . 1820 3.9. Applicability Statement . . . . . . . . . . . . . . . . .1921 4. Key Derivation . . . . . . . . . . . . . . . . . . . . . . .2123 4.1.EDHOC-Exporter InterfaceExtract . . . . . . . . . . . . . . . . . . . . . . . . . 23 4.2. Expand . . . . . . . . . . . . . . . . . . . . . . . . . 24 4.3. EDHOC-Exporter . . . . . . . . . . . . . . . . . . . . . 26 4.4. EDHOC-KeyUpdate . . . . . . . . . . . . . . . . . . . . . 27 5. Message Formatting and Processing . . . . . . . . . . . . . .2427 5.1. Message Processing Outline . . . . . . . . . . . . . . .2427 5.2. EDHOC Message 1 . . . . . . . . . . . . . . . . . . . . .2528 5.3. EDHOC Message 2 . . . . . . . . . . . . . . . . . . . . .2730 5.4. EDHOC Message 3 . . . . . . . . . . . . . . . . . . . . .3032 5.5. EDHOC Message 4 . . . . . . . . . . . . . . . . . . . . .3336 6. Error Handling . . . . . . . . . . . . . . . . . . . . . . .3537 6.1. Success . . . . . . . . . . . . . . . . . . . . . . . . .3639 6.2. Unspecified . . . . . . . . . . . . . . . . . . . . . . .3639 6.3. Wrong Selected Cipher Suite . . . . . . . . . . . . . . .3639 7. Security Considerations . . . . . . . . . . . . . . . . . . .3841 7.1. Security Properties . . . . . . . . . . . . . . . . . . .3841 7.2. Cryptographic Considerations . . . . . . . . . . . . . .4044 7.3. Cipher Suites and Cryptographic Algorithms . . . . . . .4145 7.4. Unprotected Data . . . . . . . . . . . . . . . . . . . .4245 7.5. Denial-of-Service . . . . . . . . . . . . . . . . . . . .4246 7.6. Implementation Considerations . . . . . . . . . . . . . .4346 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . .4448 8.1. EDHOC Exporter Label . . . . . . . . . . . . . . . . . .4448 8.2. EDHOC Cipher Suites Registry . . . . . . . . . . . . . .4548 8.3. EDHOC Method Type Registry . . . . . . . . . . . . . . .4750 8.4. EDHOC Error Codes Registry . . . . . . . . . . . . . . .4750 8.5. COSE Header Parameters Registry . . . . . . . . . . . . .4750 8.6. COSE Header Parameters Registry . . . . . . . . . . . . .4751 8.7. COSE Key Common Parameters Registry . . . . . . . . . . .4851 8.8. The Well-Known URI Registry . . . . . . . . . . . . . . .4851 8.9. Media Types Registry . . . . . . . . . . . . . . . . . .4852 8.10. CoAP Content-Formats Registry . . . . . . . . . . . . . .4953 8.11. EDHOC External Authorization Data . . . . . . . . . . . .4953 8.12. Expert Review Instructions . . . . . . . . . . . . . . .5053 9. References . . . . . . . . . . . . . . . . . . . . . . . . .5054 9.1. Normative References . . . . . . . . . . . . . . . . . .5054 9.2. Informative References . . . . . . . . . . . . . . . . .5356 Appendix A. Use with OSCORE and Transfer over CoAP . . . . . . .5559 A.1. Selecting EDHOC Connection Identifier . . . . . . . . . .5559 A.2. Deriving the OSCORE Security Context . . . . . . . . . .5660 A.3. Transferring EDHOC over CoAP . . . . . . . . . . . . . .5761 Appendix B. Compact Representation . . . . . . . . . . . . . . .6064 Appendix C. Use of CBOR, CDDL and COSE in EDHOC . . . . . . . .6065 C.1. CBOR and CDDL . . . . . . . . . . . . . . . . . . . . . .6065 C.2. CDDL Definitions . . . . . . . . . . . . . . . . . . . .6166 C.3. COSE . . . . . . . . . . . . . . . . . . . . . . . . . .6268 Appendix D. Test Vectors . . . . . . . . . . . . . . . . . . . .63 D.1. Test Vectors for EDHOC Authenticated with Signature Keys (x5t)68 Appendix E. Applicability Template . . . . . . . . . . . . . . . 68 Appendix F. EDHOC Message Deduplication . . . . . . . . . . .63 D.2. Test Vectors for EDHOC Authenticated with Static Diffie- Hellman Keys. 69 Appendix G. Transports Not Natively Providing Correlation . . . 70 Appendix H. Change Log . . . . . . . . . . . . . . . . . .81 Appendix E. Applicability Template. . . 70 Acknowledgments . . . . . . . . . . . .96 Appendix F. EDHOC Message Deduplication. . . . . . . . . . . .96 Appendix G. Transports Not Natively Providing Correlation. 75 Authors' Addresses . .97 Appendix H. Change Log. . . . . . . . . . . . . . . . . . . . .98 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 101 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 10175 1. Introduction 1.1. Motivation Many Internet of Things (IoT) deployments require technologies which are highly performant in constrained environments [RFC7228]. IoT devices may be constrained in various ways, including memory, storage, processing capacity, and power. The connectivity for these settings may also exhibit constraints such as unreliable and lossy channels, highly restricted bandwidth, and dynamic topology. The IETF has acknowledged this problem by standardizing a range of lightweight protocols and enablers designed for the IoT, including the Constrained Application Protocol (CoAP, [RFC7252]), Concise Binary Object Representation (CBOR, [RFC8949]), and Static Context Header Compression (SCHC, [RFC8724]). The need for special protocols targeting constrained IoT deployments extends also to the security domain [I-D.ietf-lake-reqs]. Important characteristics in constrained environments are the number of round trips and protocol message sizes, which if kept low can contribute to good performance by enabling transport over a small number of radio frames, reducing latency due to fragmentation or duty cycles, etc. Another important criteria is code size, which may be prohibitive for certain deployments due to device capabilities or network load during firmware update. Some IoT deployments also need to support a variety of underlying transport technologies, potentially even with a single connection. Some security solutions for such settings exist already. CBOR Object Signing and Encryption (COSE, [I-D.ietf-cose-rfc8152bis-struct]) specifies basic application-layer security services efficiently encoded in CBOR. Another example is Object Security for Constrained RESTful Environments (OSCORE, [RFC8613]) which is a lightweight communication security extension to CoAP using CBOR and COSE. In order to establish good quality cryptographic keys for security protocols such as COSE and OSCORE, the two endpoints may run an authenticated Diffie-Hellman key exchange protocol, from which shared secret key material can be derived. Such a key exchange protocol should also be lightweight; to prevent bad performance in case of repeated use, e.g., due to device rebooting or frequent rekeying for security reasons; or to avoid latencies in a network formation setting with many devices authenticating at the same time. This document specifies Ephemeral Diffie-Hellman Over COSE (EDHOC), a lightweight authenticated key exchange protocol providing good security properties includingperfectforward secrecy, identity protection, and cipher suite negotiation. Authentication can be based on raw public keys (RPK) or public keycertificates,certificates and requires the application to provide input on how to verify that endpoints are trusted. This specification focuses on referencing instead of transporting credentials to reduce message overhead. EDHOC does currently not support pre-shared key (PSK) authentication as authentication with static Diffie-Hellman public keys by reference produces equally small message sizes but with much simpler key distribution. EDHOC makes use of known protocol constructions, such as SIGMA [SIGMA] and Extract-and-Expand [RFC5869]. COSE also provides crypto agility and enables the use of future algorithms targeting IoT. 1.2. Use of EDHOC EDHOC is designed for highly constrained settings making it especially suitable for low-power wide area networks [RFC8376] such as Cellular IoT, 6TiSCH, and LoRaWAN. A main objective for EDHOC is to be a lightweight authenticated key exchange for OSCORE,i.e.i.e., to provide authentication and session key establishment for IoT use cases such as those built on CoAP [RFC7252]. CoAP is a specialized web transfer protocol for use with constrained nodes and networks, providing a request/response interaction model between application endpoints. As such, EDHOC is targeting a large variety of use cases involving 'things' with embedded microcontrollers, sensors, and actuators. A typical setting is when one of the endpoints is constrained or in a constrained network, and the other endpoint is a node on the Internet (such as a mobile phone) or at the edge of the constrained network (such as a gateway). Thing-to-thing interactions over constrained networks are also relevant since both endpoints would then benefit from the lightweight properties of the protocol. EDHOC coulde.g.e.g., be run when a device connects for the first time, or to establish fresh keys which are not revealed by a later compromise of thelong-termlong- term keys. Further security properties are described in Section 7.1. EDHOC enables the reuse of the same lightweight primitives as OSCORE: CBOR for encoding, COSE for cryptography, and CoAP for transport. By reusing existinglibrarieslibraries, the additional code size can be kept very low. Note that, while CBOR and COSE primitives are built into the protocol messages, EDHOC is not bound to a particular transport.However, it is recommended to transferTransfer of EDHOC messages in CoAP payloadsasis detailed in Appendix A.3. 1.3. Message Size Examples Compared to the DTLS 1.3 handshake [I-D.ietf-tls-dtls13] with ECDHE and connection ID, the number of bytes in EDHOC + CoAP can be less than 1/6 when RPK authentication is used, see [I-D.ietf-lwig-security-protocol-comparison]. Figure 1 shows two examples of message sizes for EDHOC with different kinds of authentication keys and different COSE header parameters for identification: static Diffie-Hellman keys identified by 'kid' [I-D.ietf-cose-rfc8152bis-struct], and X.509 signature certificates identified by a hash value using 'x5t' [I-D.ietf-cose-x509]. ================================= kid x5t --------------------------------- message_1 37 37 message_2 45 116 message_320 9119 90 --------------------------------- Total103 245101 243 ================================= Figure 1: Example of message sizes in bytes. 1.4. Document Structure The remainder of the document is organized as follows: Section 2 outlines EDHOC authenticated with digital signatures, Section 3 describes the protocol elements of EDHOC, includingmessage flow, andformatting of the ephemeral public keys, Section 4describesspecifies the key derivation, Section 5 specifies message processing for EDHOC authenticated withauthentication based onsignature keys or static Diffie-Hellman keys, Section 6specifiesdescribes theEDHOCerrormessage,messages, and Appendix Adescribesshows how to transfer EDHOCcan be transferred inwith CoAP andused toestablish an OSCORE security context. 1.5. Terminology and Requirements Language 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 CBOR [RFC8949], CBOR Sequences [RFC8742], COSE structures and process [I-D.ietf-cose-rfc8152bis-struct], COSE algorithms [I-D.ietf-cose-rfc8152bis-algs], and CDDL [RFC8610]. The Concise Data Definition Language (CDDL) is used to express CBOR data structures [RFC8949]. Examples of CBOR and CDDL are provided in Appendix C.1. When referring to CBOR, this specification alwaysreferrefers to Deterministically Encoded CBOR as specified in Sections 4.2.1 and 4.2.2 of [RFC8949]. The single output from authenticated encryption (including the authentication tag) is called'ciphertext',"ciphertext", following [RFC5116]. We use the term Unprotected CWT Claims Set (UCCS) just as in [I-D.ietf-rats-uccs] to denote a CBOR Web Token [RFC8392] without wrapping it into a COSE object, i.e., a CBOR map consisting of claims. Editor's note: If [I-D.ietf-rats-uccs] completes before this draft, make it a normative reference. 2. EDHOC Outline EDHOC specifies different authentication methods of the Diffie- Hellman key exchange: digital signatures and static Diffie-Hellman keys. This section outlines the digitalsignature basedsignature-based method. Further details of protocol elements and other authentication methods are provided in the remainder of this document. SIGMA (SIGn-and-MAc) is a family of theoretical protocols with a large number of variants [SIGMA]. Like IKEv2 [RFC7296] and (D)TLS 1.3 [RFC8446], EDHOC authenticated with digital signatures is built on a variant of the SIGMA protocol which provides identity protection of the initiator (SIGMA-I), and like IKEv2 [RFC7296], EDHOC implements the SIGMA-I variant as MAC-then-Sign. The SIGMA-I protocol using an authenticated encryption algorithm is shown in Figure 2. Initiator Responder | G_X | +-------------------------------------------------------->| | | | G_Y, AEAD( K_2; ID_CRED_R, Sig(R; CRED_R, G_X, G_Y) ) | |<--------------------------------------------------------+ | | | AEAD( K_3; ID_CRED_I, Sig(I; CRED_I, G_Y, G_X) ) | +-------------------------------------------------------->| | | Figure 2: Authenticated encryption variant of the SIGMA-I protocol. The parties exchanging messages are called Initiator (I) and Responder (R). They exchange ephemeral public keys, compute a shared secret, and derive symmetric application keys used to protect application data.o* G_X and G_Y are the ECDH ephemeral public keys of I and R, respectively.o* CRED_I and CRED_R are the credentials containing the public authentication keys of I and R, respectively.o* ID_CRED_I and ID_CRED_R are credential identifiers enabling the recipient party to retrieve the credential of I and R, respectively.o* Sig(I; . ) and Sig(R; . ) denote signatures made with the private authentication key of I and R, respectively.o* AEAD(K; . ) denotes authenticated encryption with additional data using a key K derived from the shared secret. In order to create a "full-fledged" protocol some additional protocol elements are needed. EDHOC adds:o* Transcript hashes (hashes of message data) TH_2, TH_3, TH_4 used for key derivation and as additional authenticated data.o* Computationally independent keys derived from the ECDH shared secret and used for authenticated encryption of different messages.o* An optional fourth message giving explicit key confirmation to I in deployments where no protected application data is sent from R to I.o* A key material exporter and a key update function enablingfrequentforward secrecy.o* Verification of a common preferred cipher suite:*- The Initiator lists supported cipher suites in order of preference*- The Responder verifies that the selected cipher suite is the first supported cipher suite (or else rejects and states supported cipher suites).o* Method types and error handling.o* Selection of connection identifiers C_I and C_R which may be used to identify established keys or protocol state.o* Transport of external authorization data. EDHOC is designed to encrypt and integrity protect as much information as possible, and all symmetric keys are derived using as much previous information as possible. EDHOC is furthermore designed to be as compact and lightweight as possible, in terms of message sizes, processing, and the ability to reuse already existing CBOR, COSE, and CoAP libraries. To simplify for implementors, the use of CBOR and COSE in EDHOC is summarized in Appendix C and test vectors including CBOR diagnostic notation are given in Appendix D. 3. Protocol Elements 3.1. GeneralAnThe EDHOCmessage flowprotocol consists of three mandatory messages (message_1, message_2, message_3) between Initiator and Responder, an optional fourth message (message_4), plus anEDHOCerror message. EDHOC messages are CBOR Sequences [RFC8742], see Figure 3. The protocol elements in the figure are introduced in the following sections. Message formatting and processing is specified in Section 5 and Section 6. An implementation may support only Initiator or only Responder. Application data is protected using the agreed application algorithms (AEAD, hash) in the selected cipher suite (see Section 3.6) and the application can make use of the established connection identifiers C_I and C_R (see Section 3.3). EDHOC may be used with the media type application/edhoc defined in Section 8. The Initiator can derive symmetric application keys after creating EDHOC message_3, see Section4.1. Application protected4.3. Protected application data can therefore be sent in parallel or together with EDHOC message_3. Initiator Responder | METHOD, SUITES_I, G_X, C_I, EAD_1 | +------------------------------------------------------------------>| | message_1 | | | | G_Y,C_R,Enc(ID_CRED_R, Signature_or_MAC_2,EAD_2)EAD_2), C_R | |<------------------------------------------------------------------+ | message_2 | | | | AEAD(K_3ae; ID_CRED_I, Signature_or_MAC_3, EAD_3) | +------------------------------------------------------------------>| | message_3 | Figure 3: EDHOC Message Flow 3.2. Method The data item METHOD in message_1 (see Section 5.2.1), is an integer specifying the authentication method. EDHOC supports authentication with signature or static Diffie-Hellman keys, as defined in the four authentication methods: 0, 1, 2, and 3, see Figure 4. (Method 0 corresponds to the case outlined in Section 2 where both Initiator and Responder authenticate with signature keys.) An implementation may support only a single method. The Initiator and the Responder need to have agreed on a single method to be used for EDHOC, see Section 3.9. +-------+-------------------+-------------------+-------------------+ | Value | Initiator | Responder | Reference | +-------+-------------------+-------------------+-------------------+ | 0 | Signature Key | Signature Key | [[this document]] | | 1 | Signature Key | Static DH Key | [[this document]] | | 2 | Static DH Key | Signature Key | [[this document]] | | 3 | Static DH Key | Static DH Key | [[this document]] | +-------+-------------------+-------------------+-------------------+ Figure 4: Method Types 3.3. Connection Identifiers EDHOC includes the selection of connection identifiers (C_I, C_R) identifying a connection for which keys are agreed. Connection identifiers may be used in the ongoing EDHOC protocol (see Section 3.3.2) or in a subsequent application protocol, e.g., OSCORE (see Section 3.3.3). The connection identifiers do not have any cryptographic purpose in EDHOC. Connection identifiers in EDHOC are byte strings or integers, encoded in CBOR. One byte connection identifiers (the integers -24 to 23 and the emptybytestringbyte string h'') are realistic in many scenarios as most constrained devices only have a few connections. 3.3.1. Selection of Connection Identifiers C_I and C_R are chosen by I and R, respectively. The Initiator selects C_I and sends it in message_1 for the Responder to use as a reference to the connection in communications with the Initiator. The Responder selects C_R and sends in message_2 for the Initiator to use as a reference to the connection in communications with the Responder. If connection identifiers are used by an application protocol for which EDHOC establishes keys then the selected connection identifiers SHALL adhere to the requirements for that protocol, see Section 3.3.3 for an example. 3.3.2. Use of Connection Identifiersinwith EDHOC Connection identifiers may be used to correlate EDHOC messages and facilitate the retrieval of protocol state during EDHOC protocol execution. EDHOC transports that do not inherently provide correlation across all messages of an exchange can send connection identifiers along with EDHOC messages to gain that required capability, see Section 3.4. For an example of using connection identifiers when CoAP is used as transport, see Appendix A.3. 3.3.3. Use of Connection Identifiersinwith OSCORE For OSCORE, the choice of a connection identifier results in the endpoint selecting its Recipient ID, see Section 3.1 of[RFC8613]),[RFC8613], for which certain uniqueness requirements apply, see Section 3.3 of[RFC8613]). Therefore[RFC8613]. Therefore, the Initiator and the Responder MUST NOT select connection identifiers such that it results in same OSCORE Recipient ID. Since the Recipient ID is a byte string and a EDHOC connection identifier is either a CBOR byte string or a CBOR integer, care must be taken when selecting the connection identifiers and converting them to Recipient IDs. A mapping from EDHOC connection identifier to OSCORE Recipient ID is specified in Appendix A.1. 3.4. Transport Cryptographically, EDHOC does not put requirements on the lower layers. EDHOC is not bound to a particular transportlayer,layer and can even be used in environments without IP. The transport is responsible, where necessary, to handle:o* message loss,o* message reordering,o* message duplication,o* fragmentation,o* demultiplex EDHOC messages from other types of messages, ando denial of service* denial-of-service protection. Besides these commontransport orientedtransport-oriented properties, EDHOC transport additionally needs to support the correlation between EDHOC messages, including an indication of a message being message_1. The correlation may reuse existing mechanisms in the transport protocol. For example, the CoAP Token may be used to correlate EDHOC messages in a CoAP response and an associated CoAP request. In theabsenseabsence of correlation between a message received and a message previously sent inherent to the transport, the EDHOC connection identifiers may be added,e.g.e.g., by prepending the appropriate connection identifier (when available from the EDHOC protocol) to the EDHOC message. Transport of EDHOC in CoAP payloads is described in Appendix A.3, which also shows how to use connection identifiers and message_1 indication with CoAP. The Initiator and the Responder need to have agreed on a transport to be used for EDHOC, see Section 3.9. 3.5. Authentication Parameters3.5.1. Authentication Keys TheEDHOC enables public-key based authenticationkey MUST be a signature key or static Diffie- Hellman key. The Initiatorand supports various settings for how theResponder MAY useother endpoint's public key is transported, identified, and trusted. The authentication key (i.e., the public key) appears in differenttypesfunctions: 1. as part of the authenticationkeys, e.g. one uses a signature keycredential CRED_x included in the integrity calculation 2. for verification of the Signature_or_MAC field in message_2 and message_3 (see Section 5.3.2 and Section 5.4.2) 3. in theother useskey derivation (in case of a static Diffie-Hellmankey. When using a signaturekey,thesee Section 4). The choice of authenticationis provided by a signature. When using a static Diffie-Hellmankey has an impact on the message size (see Section 3.5.1), and even more so the choice of authenticationis provided by a Message Authentication Code (MAC) computed from an ephemeral-static ECDH shared secret which enables significant reductionscredential (see Section 3.5.2) inmessage sizes. The MACcase it isimplemented with an AEAD algorithm. When using static Diffie-Hellman keystransported within theInitiator's and Responder's privateprotocol (see Section 3.5.4). EDHOC supports authenticationkeyscredentials for which COSE header parameters arecalled I and R, respectively,defined, including: * X.509 v3 certificate [RFC5280] * C509 certificate [I-D.ietf-cose-cbor-encoded-cert] * CBOR Web Token (CWT, [RFC8392]) * Unprotected CWT Claims Set (UCCS, see Section 1.5) For CWT and UCCS, thepublic authentication keys are called G_I and G_R, respectively. Theauthentication keyalgorithm needs to specifiedis represented withenough parameters to make it completely determined. Note thata 'cnf' claim [RFC8747] containing a COSE_Key [I-D.ietf-cose-rfc8152bis-struct]. UCCS can be seen as a generic representation of a raw public key, see Section 3.5.2 formost signature algorithms, the signaturean example. COSE_Key isdetermined by the signature algorithm and the authentication key algorithm together. For example,omitted from thecurve used inlist above because of limitations to represent thesignatureidentity (see Section 3.5.3) and because it can easily be embedded in a UCCS. Identical authentication credentials need to be established in both endpoints to accomplish item 1 above (see Section 3.5.2) but for many settings it istypically determined bynot necessary to transport the authenticationkey parameters. o Onlycredential over constrained links. It may, for example, be pre- provisioned or acquired out-of-band over less constrained links. ID_CRED_x coincides with theResponder SHALL have accessauthentication credential CRED_x in case it is transported, or else contains a reference to theResponder's privateauthenticationkey. o Only the Initiator SHALL have accesscredential tothe Initiator's privatefacilitate its retrieval (see Section 3.5.4). The choice of authenticationkey. 3.5.2. Identities EDHOC assumescredential also depends on theexistence of mechanisms (certification authority,trust model. For example, a certificate or CWT may rely on a trusted third party,manual distribution, etc.) for specifying and distributing authentication keys and identities. Policies are set based on the identity ofwhereas a UCCS may be used when trust in the public key can be achieved by otherparty, and parties typically only allow connections from a specific identitymeans, ora small restricted set of identities. For example,in the case ofa device connecting to a network,trust-on-first-use. A UCCS as authentication credential provides essentially thenetwork may only allow connections from devices which authenticate with certificates havingsame trustworthiness as aparticular range of serial numbersself-signed certificate or CWT but has smaller size. More details are provided in thesubject fieldfollowing subsections. 3.5.1. Authentication Keys The authentication key MUST be a signature key or static Diffie- Hellman key. The Initiator andsigned bythe Responder MAY use different types of authentication keys, e.g., one uses aparticular CA. Onsignature key and the otherside, the device may only be allowed to connect touses anetwork which authenticates withstatic Diffie-Hellman key. When using aparticular public key (information of which may be provisioned, e.g., out of band or in the external authorization data, see Section 3.8). The EDHOC implementation must be able to receive and enforce information from the application about what issignature key, theintended endpoint, and in particular whether itauthentication is provided by aspecific identity or a set of identities. osignature. When using aPublic Key Infrastructure (PKI) is used, the trust anchor is a Certification Authority (CA) certificate, andstatic Diffie-Hellman key theidentityauthentication isthe subject whose unique name (e.g.provided by adomain name, NAI, or EUI) is includedMessage Authentication Code (MAC) computed from an ephemeral-static ECDH shared secret which enables significant reductions in message sizes. When using static Diffie-Hellman keys theendpoint's certificate. Before running EDHOC each party needs at least one CA public key certificate, or justInitiator's and Responder's private authentication keys are called I and R, respectively, and the publickey,authentication keys are called G_I anda specific identity or set of identities it is allowedG_R, respectively. The authentication key algorithm needs tocommunicate with. Only validated public-key certificates with an allowed subject name, asbe specifiedby the application, arewith enough parameters tobe accepted. EDHOC provides proofmake it completely determined. Note that for most signature algorithms, theother party possessessignature is determined jointly by theprivate authentication key corresponding tosignature algorithm and thepublicauthentication keyin its certificate. The certification path provides proof thatalgorithm. For example, thesubject ofcurve used in thecertificate owns the public key in the certificate. o When public keys are used but not with a PKI (RPK, self-signed certificate), the trust anchor is the public authentication key of the other party. In this case, the identitysignature is typicallydirectly associated to the public authentication key of the other party. For example, the name of the subject may be a canonical representation of the public key. Alternatively, if identities can be expressed in the form of unique subject names assigned to public keys, then a binding to identity can be achieveddetermined byincluding both public key and associated subject name in the protocol message computation: CRED_I or CRED_R may be a self- signed certificate or COSE_Key containingthepublicauthentication keyandparameters. * Only thesubject name, see Section 3.5.3. Before running EDHOC, each endpoint needs a specific public authentication key/unique associated subject name, or a set of public authentication keys/unique associated subject names, which it is allowedResponder SHALL have access tocommunicate with. EDHOC provides proof that the other party possessesthe Responder's private authenticationkey correspondingkey. * Only the Initiator SHALL have access to thepublicInitiator's private authentication key.3.5.3.3.5.2. Authentication Credentials The authentication credentials, CRED_I and CRED_R, contain the public authentication key of the Initiator and the Responder, respectively. The Initiator and the Responder MAY use different types of credentials,e.g.e.g., one uses anRPKUCCS and the other usesa public keyan X.509 certificate. The credentials CRED_I and CRED_R aresigned or MAC:ed (depending on method)MACed by the Initiator and the Responder, respectively, see Section5.45.4.2 and Section5.3. When the credential is a certificate, CRED_x is an end-entity certificate (i.e. not the certificate chain) encoded as a CBOR bstr. In X.509 certificates, signature keys typically have key usage "digitalSignature"5.3.2, andDiffie-Hellman keys typically have key usage "keyAgreement".thus included in the message integrity calculation. To prevent misbinding attacks in systems where an attacker can register public keys without proving knowledge of the private key, SIGMA [SIGMA] enforces a MAC to be calculated over the"Identity", which in case of a X.509 certificate would be the 'subject' and 'subjectAltName' fields."identity". EDHOC follows SIGMA by calculating a MAC over the wholecertificate. While the SIGMA paper only focuses on the identity,credential, which in case of a X.509 or C509 certificate includes the "subject" and "subjectAltName" fields, and in the case of CWT or UCCS includes the "sub" claim, see Section 3.5.3. While the SIGMA paper only focuses on the identity, the same principle is true for any information such as policies connected to the public key. When the credential is aCOSE_Key,certificate, CRED_x isaan end-entity certificate (i.e., not the certificate chain). In X.509 and C509 certificates, signature keys typically have key usage "digitalSignature" and Diffie-Hellman public keys typically have key usage "keyAgreement". In case of elliptic curve based credential the claims set for CWT or UCCS includes: * the 'cnf' claim with value COSE_Key, see [RFC8747], where the public key parameters depend on key type: - for OKP the CBOR maponly containing specific fields fromtypically includes theCOSE_Key identifyingparameters 1 (kty), -1 (crv), and -2 (x-coordinate) - for EC2 thepublic key,CBOR map typically includes the parameters 1 (kty), -1 (crv), -2 (x-coordinate), andoptionally-3 (y-coordinate) * the 'sub' (subject) claim containing the "identity", if the parties have agreed on an identity besides the"Identity".public key. CRED_x needs to be defined such that it is identical when generated by Initiator orResponder.Responder, see Section 3.9. The parameters SHALL be encoded in bytewise lexicographic order of their deterministic encodings as specified in Section 4.2.1 of [RFC8949].If the parties have agreed on an identity besides the public key, the identity is included in the CBOR map with the label "subject name", otherwise the subject name is the empty text string. The public key parameters depend on key type. o For COSE_Keys of type OKP the CBOR map SHALL, except for subject name, only include the parameters 1 (kty), -1 (crv), and -2 (x-coordinate). o For COSE_Keys of type EC2 the CBOR map SHALL, except for subject name, only include the parameters 1 (kty), -1 (crv), -2 (x-coordinate), and -3 (y-coordinate).An example of CRED_xwhen the RPK containsbeing a UCCS in bytewise lexicographic order containing an X25519 staticDiffie- HellmanDiffie-Hellman key and where the parties have agreed on an EUI-64 identity is shown below:CRED_x ={1:/UCCS/ 2 : "42-50-31-FF-EF-37-32-39", /sub/ 8 : { /cnf/ 1 : { /COSE_Key/ 1 : 1,-1:/kty/ -1 : 4,-2: h'b1a3e89460e88d3a8d54211dc95f0b90 3ff205eb71912d6db8f4af980d2db83a', "subject name"/crv/ -2 :"42-50-31-FF-EF-37-32-39"h'b1a3e89460e88d3a8d54211dc95f0b90 /x/ 3ff205eb71912d6db8f4af980d2db83a' }3.5.4. Identification of Credentials ID_CRED_I and ID_CRED_R are used to identify and optionally transport} } 3.5.3. Identities EDHOC assumes thepublic authentication keysexistence ofthe Initiator and the Responder, respectively. ID_CRED_I and ID_CRED_R do not have any cryptographic purpose in EDHOC. o ID_CRED_R is intended to facilitate for the Initiator to retrieve the Responder's public authentication key. o ID_CRED_I is intended to facilitatemechanisms (certification authority, trusted third party, pre-provisioning, etc.) forthe Responder to retrieve the Initiator's publicspecifying and distributing authenticationkey. The identifiers ID_CRED_Ikeys andID_CRED_Ridentities. Policies areCOSE header_maps, i.e. CBOR maps containing Common COSE Header Parameters, see Section 3.1 of [I-D.ietf-cose-rfc8152bis-struct]). Intypically set based on thefollowing we give some examplesidentity ofCOSE header_maps. Raw public keys are most optimally stored as COSE_Key objectsthe other party, andidentified withparties typically only allow connections from a'kid2' parameter (see Section 8.6 and Section 8.7): o ID_CRED_x = { 4 : kid_x }, where kid_x : bstr / int, for x = Ispecific identity orR. Note thata small restricted set of identities. For example, in theintegers -24case of a device connecting to23 anda network, theempty bytestring h'' are encoded as one byte. Public key certificates can be identified in different ways. Header parameters for identifying C509 certificates and X.509network may only allow connections from devices which authenticate with certificatesare definedhaving a particular range of serial numbers in[I-D.ietf-cose-cbor-encoded-cert]the subject field and[I-D.ietf-cose-x509], for example: osigned by ahash value withparticular CA. On the'c5t' or 'x5t' parameters; * ID_CRED_x = { 34 : COSE_CertHash }, for x = I or R, * ID_CRED_x = { TDB3 : COSE_CertHash }, for x = I or R, o by a URI with the 'c5u' or 'x5u' parameters; * ID_CRED_x = { 35 : uri }, for x = I or R, * ID_CRED_x = { TBD4 : uri }, for x = I or R, o ID_CRED_x MAY containother side, theactual credential used for authentication, CRED_x. For example, a certificate chain candevice may only betransported in ID_CRED_xallowed to connect to a network which authenticates withCOSE header parameter c5c or x5chain, defined in [I-D.ietf-cose-cbor-encoded-cert] and [I-D.ietf-cose-x509]. It is RECOMMENDED that ID_CRED_x uniquely identify thea particular publicauthenticationkeyas the recipient(information of which mayotherwise have to try several keys. ID_CRED_I and ID_CRED_R are transportedbe provisioned, e.g., out of band or in the'ciphertext',external authorization data, see Section5.4 and Section 5.3. When ID_CRED_x does not contain3.8). The EDHOC implementation or theactual credential it may be very short. One byte credential identifiers are realisticapplication must enforce information about the intended endpoint, and inmany scenarios as most constrained devices only haveparticular whether it is afew keys. In cases wherespecific identity or anode only has one key, the identifier may even be the empty byte string. 3.6. Cipher Suites An EDHOC cipher suite consists of an orderedset ofalgorithms fromidentities. Either EDHOC passes information about identity to the"COSE Algorithms" and "COSE Elliptic Curves" registries. Algorithms needapplication for a decision, or EDHOC needs tobe specified with enough parametershave access tomake them completely determined. Currently, none ofrelevant information and makes thealgorithms require parameters. EDHOCdecision on its own. * When a Public Key Infrastructure (PKI) isonly specified for use with key exchange algorithms of type ECDH curves. Useused withother types of key exchange algorithms would likely require a specification updating EDHOC. Note that for most signature algorithms,certificates, thesignaturetrust anchor isdetermined by the signature algorithma Certification Authority (CA) certificate, and theauthentication key algorithm together, see Section 3.5.1. o EDHOC AEAD algorithm o EDHOC hash algorithm o EDHOC key exchange algorithm (ECDH curve) o EDHOC signature algorithm o Application AEAD algorithm o Application hash algorithm Each cipher suiteidentity isidentified withthe subject whose unique name (e.g. apre-defined int label.domain name, NAI, or EUI) is included in the endpoint's certificate. Before running EDHOCcan be used with all algorithms and curves defined for COSE. Implementation can either useeach party needs at least oneofCA public key certificate, or just thepre-defined cipher suites (Section 8.2)public key, and a specific identity oruse any combinationset ofCOSE algorithms and parametersidentities it is allowed todefine their own private cipher suite. Private cipher suites can be identifiedcommunicate with. Only validated public-key certificates withany ofan allowed subject name, as specified by thefour values -24, -23, -22, -21. The following CCM cipher suitesapplication, arefor constrained IoT where message overhead is a very important factor. Cipher suites 1 and 3 use a larger tag length (128-bit) in theto be accepted. EDHOCAEAD algorithm thanprovides proof that theApplication AEAD algorithm (64-bit): 0. ( 10, -16, 4, -8, 10, -16 ) (AES-CCM-16-64-128, SHA-256, X25519, EdDSA, AES-CCM-16-64-128, SHA-256) 1. ( 30, -16, 4, -8, 10, -16 ) (AES-CCM-16-128-128, SHA-256, X25519, EdDSA, AES-CCM-16-64-128, SHA-256) 2. ( 10, -16, 1, -7, 10, -16 ) (AES-CCM-16-64-128, SHA-256, P-256, ES256, AES-CCM-16-64-128, SHA-256) 3. ( 30, -16, 1, -7, 10, -16 ) (AES-CCM-16-128-128, SHA-256, P-256, ES256, AES-CCM-16-64-128, SHA-256) The following ChaCha20 cipher suites are for less constrained applications and only use 128-bit tag lengths. 4. ( 24, -16, 4, -8, 24, -16 ) (ChaCha20/Poly1305, SHA-256, X25519, EdDSA, ChaCha20/Poly1305, SHA-256) 5. ( 24, -16, 1, -7, 24, -16 ) (ChaCha20/Poly1305, SHA-256, P-256, ES256, ChaCha20/Poly1305, SHA-256)other party possesses the private authentication key corresponding to the public authentication key in its certificate. Thefollowing GCM cipher suite is for general non-constrained applications. It uses high performance algorithmscertification path provides proof thatare widely supported: 6. ( 1, -16, 4, -7, 1, -16 ) (A128GCM, SHA-256, X25519, ES256, A128GCM, SHA-256) The following two cipher suites are for high security application such as government usethe subject of the certificate owns the public key in the certificate. * Similarly, when a PKI is used with CWTs, each party needs to have a trusted third party self-signed CWT, or just the UCCS/raw public key, to verify the CWTs, andfinancial applications. The two cipher suites do not share any algorithms. The firsta specific identity or set of identities in thetwo cipher suites'sub'(subject) claim of the CWT to determine if it iscompatibleallowed to communicate with. * When public keys are used but not with a PKI (UCCS, self-signed certificate/CWT), theCNSA suite [CNSA]. 24. ( 3, -43, 2, -35, 3, -43 ) (A256GCM, SHA-384, P-384, ES384, A256GCM, SHA-384) 25. ( 24, -45, 5, -8, 24, -45 ) (ChaCha20/Poly1305, SHAKE256, X448, EdDSA, ChaCha20/Poly1305, SHAKE256) The different methods use the same cipher suites, but some algorithms are not used in some methods. The EDHOC signature algorithmtrust anchor isnot used in methods without signature authentication. The Initiator needs to have a list of cipher suites it supports in order of preference. The Responder needs to have a listthe authentication key ofcipher suites it supports. SUITES_I is a CBOR array containing cipher suites thattheInitiator supports. SUITES_Iother party. In this case, the identity isformatted and processed as detailed in Section 5.2.1typically directly associated tosecurethecipher suite negotiation. Examplesauthentication key ofcipher suite negotiation are given in Section 6.3.2. 3.7. Ephemeral Public Keys EDHOC always uses compact representationthe other party. For example, the name ofelliptic curve points, see Appendix B. In COSE compactthe subject may be a canonical representationis achieved by formattingof theECDH ephemeralpublickeys as COSE_Keyskey. Alternatively, if identities can be expressed in the form oftype EC2 or OKP accordingunique subject names assigned toSections 7.1 and 7.2 of [I-D.ietf-cose-rfc8152bis-algs], but onlypublic keys, then a binding to identity can be achieved by includingthe 'x' parameter in G_Xboth public key andG_Y. For Elliptic Curve Keys of type EC2, compact representation MAY be used alsoassociated subject name in theCOSE_Key. Ifprotocol message computation: CRED_I or CRED_R may be a self-signed certificate/CWT or UCCS containing theCOSE implementation requires an 'y' parameter,authentication key and thevalue y = false SHALL be used. COSE always use compact output for Elliptic Curve Keyssubject name, see Section 3.5.2. Before running EDHOC, each endpoint needs a specific authentication key/unique associated subject name, or a set oftype EC2. 3.8. External Authorization Data In orderpublic authentication keys/unique associated subject names, which it is allowed toreduce round tripscommunicate with. EDHOC provides proof that the other party possesses the private authentication key corresponding to the public authentication key. 3.5.4. Identification of Credentials ID_CRED_I andnumberID_CRED_R are used to identify and optionally transport the public authentication keys ofmessages orthe Initiator and the Responder, respectively. ID_CRED_I and ID_CRED_R do not have any cryptographic purpose in EDHOC. * ID_CRED_R is intended tosimplify processing, external security applications may be integrated into EDHOC by transporting authorization related data together withfacilitate for themessages. One exampleInitiator to retrieve the Responder's public authentication key. * ID_CRED_I is intended to facilitate for thetransport third-party identityResponder to retrieve the Initiator's public authentication key. The identifiers ID_CRED_I andauthorizationID_CRED_R are registered in the "COSE Header Parameters" IANA registry. As such, ID_CRED_I and ID_CRED_R typically also provide informationprotected out of scope of EDHOC [I-D.selander-ace-ake-authz]. Another example isabout theembeddingformat ofa certificate enrolment request or a newly issued certificate. EDHOC allows opaque external authorization data (EAD) toauthentication credential, CRED_I and CRED_R, respectively. ID_CRED_I and ID_CRED_R MAY besent in the EDHOC messages. External authorization data sent in message_1 (EAD_1) or message_2 (EAD_2) mustof different types. Public key certificates can beconsidered unprotected by EDHOC, see Section 7.4. External authorization data sentidentified inmessage_3 (EAD_3)different ways. COSE header parameters for identifying X.509 ormessage_4 (EAD_4) is protected between InitiatorC509 certificates are defined in [I-D.ietf-cose-x509] andResponder. External authorization data is[I-D.ietf-cose-cbor-encoded-cert], for example: * by aCBOR sequence (see Appendix C.1) as defined below: EADhash value with the 'x5t' or 'c5t' parameters, respectively: - ID_CRED_x =( type{ 34 :int, 1* ext_authz_dataCOSE_CertHash }, for x = I or R, - ID_CRED_x = { TBD3 :any, ) where type is an int and is followedCOSE_CertHash }, for x = I or R; * or byonea URI with the 'x5u' ormore ext_authz_data depending on type as'c5u' parameters, respectively: - ID_CRED_x = { 35 : uri }, for x = I or R, - ID_CRED_x = { TBD4 : uri }, for x = I or R. ID_CRED_x MAY contain the actual credential used for authentication, CRED_x. For example, a certificate chain can be transported in ID_CRED_x with COSE header parameter c5c or x5chain, defined ina separate specification. The EAD fields[I-D.ietf-cose-cbor-encoded-cert] and [I-D.ietf-cose-x509]. Credentials ofEDHOCtype CWT and UCCS arenot intended for generic application data. Since data carriedtransported with the COSE header parameter registered inEAD_1 and EAD_2 fields may not be protected, special considerations need to be made suchSection 8.5: * ID_CRED_x = { TBD1 : CWT }, for x = I or R, * ID_CRED_x = { TBD1 : UCCS }, for x = I or R. It is RECOMMENDED thata) it does not violate security, privacy etc. requirements ofID_CRED_x uniquely identify theservice which uses this data, and b) it does not violate the security properties of EDHOC. Security applications making use of the EAD fields must performpublic authentication key as thenecessary security analysis. 3.9. Applicability Statement EDHOC requires certain parametersrecipient may otherwise have tobe agreed upon between Initiatortry several keys. ID_CRED_I andResponder. Some parameters can be agreed throughID_CRED_R are transported in theprotocol execution (specifically cipher suite negotiation,'ciphertext', see Section3.6) but other parameters may need to be known out-of-band (e.g., which authentication method is used, see5.4.2 and Section3.2). The purpose of5.3.2. When ID_CRED_x does not contain theapplicability statement is describeactual credential, it may be very short, e.g., if theintendedendpoints have agreed to useof EDHOCa key identifier parameter 'kid': * ID_CRED_x = { 4 : key_id_x }, where key_id_x : kid, for x = I or R. Note that 'kid' is extended to support int values to allowformore one- byte identifiers (see Section 8.6 and Section 8.7) which may be useful in many scenarios since constrained devices only have a few keys. 3.6. Cipher Suites An EDHOC cipher suite consists of an ordered set of algorithms from therelevant processing"COSE Algorithms" andverifications"COSE Elliptic Curves" registries as well as the EDHOC MAC length. Algorithms need to bemade, including things like: 1. Howspecified with enough parameters to make them completely determined. Currently, none of theendpoint detects that analgorithms require parameters. EDHOCmessageisreceived. This includes how EDHOC messages are transported,only specified forexample in the payloaduse with key exchange algorithms ofa CoAP messagetype ECDH curves. Use witha certain Uri-Path or Content- Format; see Appendix A.3. * The methodother types oftransporting EDHOC messages may also describe data carried along with the messageskey exchange algorithms would likely require a specification updating EDHOC. Note thatare neededfor most signature algorithms, thetransport to satisfysignature is determined by the signature algorithm and therequirements of Section 3.4, e.g., connection identifiers used with certain messages, see Appendix A.3. 2. Authentication method (METHOD; see Section 3.2). 3. Profile forauthenticationcredentials (CRED_I, CRED_R;key algorithm together, see Section3.5.3), e.g., profile for certificate or COSE_key, including supported authentication key algorithms (subject public key3.5.1. * EDHOC AEAD algorithm * EDHOC hash algorithm * EDHOC MAC length inX.509 certificate). 4. Typebytes (Static DH) * EDHOC key exchange algorithm (ECDH curve) * EDHOC signature algorithm * Application AEAD algorithm * Application hash algorithm Each cipher suite is identified with a pre-defined int label. EDHOC can be usedto identify authentication credentials (ID_CRED_I, ID_CRED_R; see Section 3.5.4). 5. Usewith all algorithms andtypecurves defined for COSE. Implementation can either use one ofexternal authorization data (EAD_1, EAD_2, EAD_3, EAD_4; see Section 3.8). 6. Identifier used as identitythe pre-defined cipher suites (Section 8.2) or use any combination ofendpoint; see Section 3.5.2. 7. If message_4 shall be sent/expected,COSE algorithms andif not, how to ensure a protected application message is sent from the Responderparameters to define their own private cipher suite. Private cipher suites can be identified with any of theInitiator; see Section 5.5.four values -24, -23, -22, -21. Theapplicability statement may also contain information about supportedfollowing CCM ciphersuites. The proceduresuites are forselectingconstrained IoT where message overhead is a very important factor. Cipher suites 1 andverifying3 use a larger tag length (128-bit) in the EDHOC AEAD algorithm than the Application AEAD algorithm (64-bit): 0. ( 10, -16, 8, 4, -8, 10, -16 ) (AES-CCM-16-64-128, SHA-256, 8, X25519, EdDSA, AES-CCM-16-64-128, SHA-256) 1. ( 30, -16, 16, 4, -8, 10, -16 ) (AES-CCM-16-128-128, SHA-256, 16, X25519, EdDSA, AES-CCM-16-64-128, SHA-256) 2. ( 10, -16, 8, 1, -7, 10, -16 ) (AES-CCM-16-64-128, SHA-256, 8, P-256, ES256, AES-CCM-16-64-128, SHA-256) 3. ( 30, -16, 16, 1, -7, 10, -16 ) (AES-CCM-16-128-128, SHA-256, 16, P-256, ES256, AES-CCM-16-64-128, SHA-256) The following ChaCha20 cipher suites are for less constrained applications and only use 128-bit tag lengths. 4. ( 24, -16, 16, 4, -8, 24, -16 ) (ChaCha20/Poly1305, SHA-256, 16, X25519, EdDSA, ChaCha20/Poly1305, SHA-256) 5. ( 24, -16, 16, 1, -7, 24, -16 ) (ChaCha20/Poly1305, SHA-256, 16, P-256, ES256, ChaCha20/Poly1305, SHA-256) The following GCM cipher suite isstill performedfor general non-constrained applications. It uses high performance algorithms that are widely supported: 6. ( 1, -16, 16, 4, -7, 1, -16 ) (A128GCM, SHA-256, 16, X25519, ES256, A128GCM, SHA-256) The following two cipher suites are for high security application such asspecified by the protocol, but it may become simplified by this knowledge. An example of an applicability statement is shown in Appendix E. For some parameters, like METHOD, ID_CRED_x, typegovernment use and financial applications. The two cipher suites do not share any algorithms. The first ofEAD,thereceivertwo cipher suites isable to verify compliancecompatible withapplicability statement, and if it needs to fail because of incompliance, to inferthereason whyCNSA suite [CNSA]. 24. ( 3, -43, 16, 2, -35, 3, -43 ) (A256GCM, SHA-384, 16, P-384, ES384, A256GCM, SHA-384) 25. ( 24, -45, 16, 5, -8, 24, -45 ) (ChaCha20/Poly1305, SHAKE256, 16, X448, EdDSA, ChaCha20/Poly1305, SHAKE256) The different methods use theprotocol failed. For other parameters, like CRED_xsame cipher suites, but some algorithms are not used inthe case that itsome methods. The EDHOC signature algorithm is nottransported,used in methods without signature authentication. The Initiator needs to have a list of cipher suites itmay not be possiblesupports in order of preference. The Responder needs toverifyhave a list of cipher suites it supports. SUITES_I is a CBOR array containing cipher suites thatincompliance with applicability statement wasthereason for failure: Integrity verificationInitiator supports. SUITES_I is formatted and processed as detailed inmessage_2 or message_3 may fail not only becauseSection 5.2.1 to secure the cipher suite negotiation. Examples ofwrong authentication credential. For example,cipher suite negotiation are given incase the InitiatorSection 6.3.2. 3.7. Ephemeral Public Keys EDHOC always usespublic key certificatecompact representation of elliptic curve points, see Appendix B. In COSE compact representation is achieved byreference (i.e. not transported withinformatting theprotocol) then both endpoints need to use an identical data structureECDH ephemeral public keys asCRED_ICOSE_Keys of type EC2 orelse the integrity verification will fail. Note that it is not necessary for the endpointsOKP according tospecify a single transport forSections 7.1 and 7.2 of [I-D.ietf-cose-rfc8152bis-algs], but only including theEDHOC messages.'x' parameter in G_X and G_Y. Forexample, a mixElliptic Curve Keys ofCoAP and HTTP maytype EC2, compact representation MAY be usedalong the path, and this may still allow correlation between messages. The applicability statement may be dependent on the identity ofalso in theother endpoint, but this applies only toCOSE_Key. If thelater phases ofCOSE implementation requires an 'y' parameter, theprotocol when identities are known. (Initiator does not know identityvalue y = false SHALL be used. COSE always use compact output for Elliptic Curve Keys ofResponder before having verified message_2,type EC2. 3.8. External Authorization Data (EAD) In order to reduce round trips andResponder does not know identitynumber ofInitiator before having verified message_3.) Other conditionsmessages or to simplify processing, external security applications may bepart ofintegrated into EDHOC by transporting authorization related data in theapplicability statement, such as target application or use (if theremessages. One example ismore than one application/use) to the extent thatthird-party identity and authorization information protected out of scope of EDHOCcan distinguish between them. In case multiple applicability statements are used, the receiver needs to be able to determine which[I-D.selander-ace-ake-authz]. Another example isapplicable foragiven session, for example based on URIcertificate enrolment request or the resulting issued certificate. EDHOC allows opaque external authorization datatype. 4. Key Derivation EDHOC uses Extract-and-Expand [RFC5869] with the EDHOC hash algorithm in the selected cipher suite(EAD) toderive keys usedbe sent in the EDHOCandmessages. External authorization data sent inthe application. Extractmessage_1 (EAD_1) or message_2 (EAD_2) must be considered unprotected by EDHOC, see Section 7.4. External authorization data sent in message_3 (EAD_3) or message_4 (EAD_4) isused to derive fixed-length uniformly pseudorandom keys (PRK) from ECDH shared secrets. Expand is used to derive additional output keying material (OKM) from the PRKs. The PRKs are derived using Extract. PRK = Extract( salt, IKM ) If the EDHOC hash algorithm is SHA-2, then Extract( salt, IKM ) = HKDF-Extract( salt, IKM ) [RFC5869]. If the EDHOC hash algorithmprotected between Initiator and Responder. External authorization data isSHAKE128, then Extract( salt, IKM )a CBOR sequence (see Appendix C.1) consisting of one or more (type, ext_authz_data) pairs as defined below: ead =KMAC128( salt, IKM, 256, "" ). If the EDHOC hash algorithm is SHAKE256, then Extract( salt, IKM1* ( type : int, ext_authz_data : any, )= KMAC256( salt, IKM, 512, "" ). PRK_2e is used to derive a keystream to encrypt message_2. PRK_3e2mwhere ext_authz_data isused to derive keys and IVs to produce a MACauthorization related data defined inmessage_2a separate specification andto encrypt message_3. PRK_4x3mits type isused to derive keys and IVs to produce a MACan int. Different types of ext_authz_data are registered inmessage_3 and to deriveSection 8.11. The EAD fields of EDHOC are not intended for generic applicationspecificdata.PRK_2e is derived with the following input: o The salt SHALLSince data carried in EAD_1 and EAD_2 fields may not bethe empty byte string. Note that [RFC5869] specifiesprotected, special considerations need to be made such thatif the salt is not provided,itis set to a string of zeros (see Section 2.2 of [RFC5869]). For implementation purposes,does notproviding the salt is the same as setting the salt toviolate security and privacy requirements of theempty byte string. o The input keying material (IKM) SHALL beservice which uses this data. Moreover, theECDH shared secret G_XY (calculated from G_X and Y or G_Y and X) as definedcontent inSection 6.3.1 of [I-D.ietf-cose-rfc8152bis-algs]. Example: Assumingan EAD field may impact the security properties provided by EDHOC. Security applications making use ofSHA-256 the extract phase of HKDF produces PRK_2e as follows: PRK_2e = HMAC-SHA-256( salt, G_XY ) where salt = 0x (the empty byte string). The pseudorandom keys PRK_3e2m and PRK_4x3m are defined as follow: o IftheResponder authenticates with a static Diffie-Hellman key, then PRK_3e2m = Extract( PRK_2e, G_RX ), where G_RX isEAD fields must perform theECDH shared secret calculated from G_R and X, or G_Xnecessary security analysis. 3.9. Applicability Statement EDHOC requires certain parameters to be agreed upon between Initiator andR, else PRK_3e2m = PRK_2e. o IfResponder. Some parameters can be agreed through theInitiator authenticates with a static Diffie-Hellman key, then PRK_4x3m = Extract( PRK_3e2m, G_IY ), where G_IYprotocol execution (specifically cipher suite negotiation, see Section 3.6) but other parameters may need to be known out-of-band (e.g., which authentication method is used, see Section 3.2). The purpose of theECDH shared secret calculated from G_I and Y, or G_Y and I, else PRK_4x3m = PRK_3e2m. Example: Assumingapplicability statement is to describe the intended use ofcurve25519,EDHOC to allow for theECDH shared secrets G_XY, G_RX,relevant processing andG_IY are the outputs ofverifications to be made, including things like: 1. How theX25519 function [RFC7748]: G_XY = X25519( Y, G_X ) = X25519( X, G_Y ) The keys and IVs used inendpoint detects that an EDHOCare derived from PRKs using Expand [RFC5869] where the EDHOC-KDFmessage isinstantiated with thereceived. This includes how EDHOCAEAD algorithmmessages are transported, for example in theselected cipher suite. OKM = EDHOC-KDF( PRK, transcript_hash, label, length ) = Expand( PRK, info, length ) where info is the CBOR encodingpayload ofinfo = [ edhoc_aead_id : int / tstr, transcript_hash : bstr, label : tstr, length : uint ] where o edhoc_aead_id is an inta CoAP message with a certain Uri-Path ortstr containing the algorithm identifierContent- Format; see Appendix A.3. * The method ofthetransporting EDHOCAEAD algorithm inmessages may also describe data carried along with theselected cipher suite encoded as defined in [I-D.ietf-cose-rfc8152bis-algs]. Notemessages thata single fixed edhoc_aead_id is used in all invocations of EDHOC-KDF, including the derivation of KEYSTREAM_2 and invocations ofare needed for theEDHOC-Exporter. o transcript_hash is a bstr settransport toone ofsatisfy thetranscript hashes TH_2, TH_3,requirements of Section 3.4, e.g., connection identifiers used with certain messages, see Appendix A.3. 2. Authentication method (METHOD; see Section 3.2). 3. Profile for authentication credentials (CRED_I, CRED_R; see Section 3.5.2), e.g., profile for certificate orTH_4 as definedUCCS, including supported authentication key algorithms (subject public key algorithm inSections 5.3.1, 5.4.1, and 4.1. o label is a tstr setX.509 or C509 certificate). 4. Type used tothe nameidentify authentication credentials (ID_CRED_I, ID_CRED_R; see Section 3.5.4). 5. Use and type ofthe derived key or IV, i.e. "K_2m", "IV_2m", "KEYSTREAM_2", "K_3m", "IV_3m", "K_3ae", or "IV_3ae". o length is the lengthexternal authorization data (EAD_1, EAD_2, EAD_3, EAD_4; see Section 3.8). 6. Identifier used as identity ofoutput keying material (OKM) in bytes If the EDHOC hash algorithm is SHA-2, then Expand( PRK, info, length ) = HKDF-Expand( PRK, info, length ) [RFC5869]. If the EDHOC hash algorithm is SHAKE128, then Expand( PRK, info, length ) = KMAC128( PRK, info, L, "" ).endpoint; see Section 3.5.3. 7. Ifthe EDHOC hash algorithm is SHAKE256, then Expand( PRK, info, length ) = KMAC256( PRK, info, L, "" ). KEYSTREAM_2 are derived using the transcript hash TH_2 and the pseudorandom key PRK_2e. K_2m and IV_2m are derived using the transcript hash TH_2 and the pseudorandom key PRK_3e2m. K_3ae and IV_3ae are derived using the transcript hash TH_3 and the pseudorandom key PRK_3e2m. K_3m and IV_3m are derived using the transcript hash TH_3message_4 shall be sent/expected, andthe pseudorandom key PRK_4x3m. IVs are only usedifthe EDHOC AEAD algorithm uses IVs. 4.1. EDHOC-Exporter Interface Application keys and other application specific data can be derived using the EDHOC-Exporter interface defined as: EDHOC-Exporter(label, context, length) = EDHOC-KDF(PRK_4x3m, TH_4, label_context, length) label_context isnot, how to ensure aCBOR sequence: label_context = ( label : tstr, context : bstr, ) where labelprotected application message isa registered tstrsent from theEDHOC Exporter Label registry (Section 8.1), context is a bstr defined byResponder to theapplication,Initiator; see Section 5.5. The applicability statement may also contain information about supported cipher suites. The procedure for selecting andlengthverifying cipher suite isa uint definedstill performed as specified by theapplication. The (label, context) pair must be unique, i.e. a (label, context) MUST NOT be used for two different purposes. However an application can re- derive the same key several times as long asprotocol, but it may become simplified by this knowledge. An example of an applicability statement isdoneshown ina secure way.Appendix E. Forexample, in most encryption algorithmssome parameters, like METHOD, ID_CRED_x, type of EAD, thesame (key, nonce) pair must not be reused. The transcript hash TH_4receiver isa CBOR encoded bstrable to verify compliance with applicability statement, andthe inputif it needs to fail because of incompliance, to infer thehash function is a CBOR Sequence. TH_4 = H( TH_3, CIPHERTEXT_3 ) where H() isreason why thehash functionprotocol failed. For other parameters, like CRED_x in theselected cipher suite. Examples of use ofcase that it is not transported, it may not be possible to verify that incompliance with applicability statement was theEDHOC-Exporter are givenreason for failure: Integrity verification inSection 5.5.2 and Appendix A. To provide forward secrecymessage_2 or message_3 may fail not only because of wrong authentication credential. For example, in case the Initiator uses public key certificate by reference (i.e., not transported within the protocol) then both endpoints need to use aneven more efficient way than re- running EDHOC, EDHOC providesidentical data structure as CRED_I or else thefunction EDHOC-KeyUpdate. When EDHOC-KeyUpdateintegrity verification will fail. Note that it iscallednot necessary for theold PRK_4x3m is deleted andendpoints to specify a single transport for thenew PRK_4x3m is calculated asEDHOC messages. For example, a"hash"mix of CoAP and HTTP may be used along theold key using the Extract function as illustrated by the following pseudocode: EDHOC-KeyUpdate( nonce ): PRK_4x3m = Extract( nonce, PRK_4x3m ) 5. Message Formattingpath, andProcessing This section specifies formattingthis may still allow correlation between messages. The applicability statement may be dependent on the identity of themessages and processing steps. Error messages are specifiedother endpoint, or other information carried inSection 6. Anan EDHOCmessage is encoded as a sequence of CBOR data (CBOR Sequence, [RFC8742]). Additional optimizations are mademessage, but it then applies only toreduce message overhead. While EDHOC usestheCOSE_Key, COSE_Sign1, and COSE_Encrypt0 structures, only a subsetlater phases of theparametersprotocol when such information isincluded in the EDHOC messages. The unprotected COSE header in COSE_Sign1,known. (The Initiator does not know identity of Responder before having verified message_2, andCOSE_Encrypt0 (not included in the EDHOC message) MAY contain parameters (e.g. 'alg'). 5.1. Message Processing Outline This section outlinesthemessage processingResponder does not know identity ofEDHOC. For each session,theendpoints are assumed to keep an associated protocol state containing identifiers, keys, etc. used for subsequent processingInitiator before having verified message_3.) Other conditions may be part ofprotocol related data. The protocol statethe applicability statement, such as target application or use (if there isassumed to be associatedmore than one application/use) toan applicability statement (Section 3.9) which providesthecontext for how messages are transported, identified and processed.extent that EDHOCmessages SHALLcan distinguish between them. In case multiple applicability statements are used, the receiver needs to beprocessed accordingable tothe current protocol state. The following steps are expected to be performed at reception of an EDHOC message: 1. Detect that an EDHOC message has been received,determine which is applicable for a given session, for exampleby means of port number, URI,based on URI ormedia type (Section 3.9). 2. Retrieve the protocol state according to the message correlation provided byexternal authorization data type. 4. Key Derivation EDHOC uses Extract-and-Expand [RFC5869] with thetransport, see Section 3.4. If there is no protocol state,EDHOC hash algorithm in thecase of message_1, a new protocol state is created. The Responder endpoint needsselected cipher suite tomake use of available Denial-of-Service mitigation (Section 7.5). 3. Ifderive keys used in EDHOC and in themessage receivedapplication. Extract isan error message then process accordingused toSection 6, else process as the expected next message accordingderive fixed-length uniformly pseudorandom keys (PRK) from ECDH shared secrets. Expand is used to derive additional output keying material (OKM) from theprotocol state. If the processing fails, then the protocolPRKs. This section defines Extract, Expand and other key derivation functions based on these: Expand isdiscontinued, an error message sent,used to define EDHOC-KDF and in turn EDHOC-Exporter, whereas Extract is used to define EDHOC- KeyUpdate. 4.1. Extract The pseudorandom keys (PRKs) are derived using Extract. PRK = Extract( salt, IKM ) where theprotocol state erased. Further detailsinput keying material (IKM) and salt areprovided indefined for each PRK below. The definition of Extract depends on thefollowing subsections. Different instancesEDHOC hash algorithm of thesame message MUST NOT be processed in one session. Note that processing will failselected cipher suite: * if thesame message appears a second time forEDHOCprocessing becausehash algorithm is SHA-2, then Extract( salt, IKM ) = HKDF-Extract( salt, IKM ) [RFC5869] * if thestate ofEDHOC hash algorithm is SHAKE128, then Extract( salt, IKM ) = KMAC128( salt, IKM, 256, "" ) * if theprotocol has moved on and now expects something else. This assumes that message duplication dueEDHOC hash algorithm is SHAKE256, then Extract( salt, IKM ) = KMAC256( salt, IKM, 512, "" ) 4.1.1. PRK_2e PRK_2e is used tore-transmissionsderive a keystream to encrypt message_2. PRK_2e ishandled byderived with thetransport protocol, see Section 3.4.following input: * Thecase whensalt SHALL be thetransport doesempty byte string. Note that [RFC5869] specifies that if the salt is notsupport message deduplicationprovided, it isaddressed in Appendix F. 5.2. EDHOC Message 1 5.2.1. Formattingset to a string ofMessage 1 message_1zeros (see Section 2.2 of [RFC5869]). For implementation purposes, not providing the salt is the same as setting the salt to the empty byte string. * The IKM SHALL bea CBOR Sequence (see Appendix C.1)the ECDH shared secret G_XY (calculated from G_X and Y or G_Y and X) as definedbelow message_1in Section 6.3.1 of [I-D.ietf-cose-rfc8152bis-algs]. Example: Assuming the use of curve25519, the ECDH shared secret G_XY is the output of the X25519 function [RFC7748]: G_XY =( METHOD : int, SUITES_I : [ selected : suite, supported : 2* suite ] / suite,X25519( Y, G_X: bstr, C_I : bstr / int, ? EAD ; EAD_1)suite = int where: o METHOD=0, 1, 2, or 3 (see Figure 4). o SUITES_I - cipher suites whichX25519( X, G_Y ) Example: Assuming theInitiator supports in order of (decreasing) preference. The listuse ofsupported cipher suites can be truncated atSHA-256 theend,extract phase of HKDF produces PRK_2e as follows: PRK_2e = HMAC-SHA-256( salt, G_XY ) where salt = 0x (the empty byte string). 4.1.2. PRK_3e2m PRK_3e2m isdetailedused to produce a MAC inthe processing steps belowmessage_2 andSection 6.3. One of the supported cipher suitesto encrypt message_3. PRK_3e2m isselected. The selected suitederived as follows: If the Responder authenticates with a static Diffie-Hellman key, then PRK_3e2m = Extract( PRK_2e, G_RX ), where G_RX is thefirst suiteECDH shared secret calculated from G_R and X, or G_X and R, else PRK_3e2m = PRK_2e. 4.1.3. PRK_4x3m PRK_4x3m is used to produce a MAC inthe SUITES_I CBOR array.message_3, to encrypt message_4, and to derive application specific data. PRK_4x3m is derived as follows: If the Initiator authenticates with asingle supported cipher suite is conveyedstatic Diffie-Hellman key, thenthat cipher suitePRK_4x3m = Extract( PRK_3e2m, G_IY ), where G_IY isselectedthe ECDH shared secret calculated from G_I andSUITES_I is encoded as an int instead of an array. o G_X -Y, or G_Y and I, else PRK_4x3m = PRK_3e2m. 4.2. Expand The keys, IVs and MACs used in EDHOC are derived from theephemeral public key ofPRKs using Expand, and instantiated with theInitiator o C_I - variableEDHOC AEAD algorithm in the selected cipher suite. OKM = EDHOC-KDF( PRK, transcript_hash, label, context, lengthconnection identifier o EAD_1 - unprotected external authorization data, see Section 3.8. 5.2.2. Initiator Processing of Message 1 The Initiator SHALL compose message_1 as follows: o The supported cipher suites and) = Expand( PRK, info, length ) where info is theorderCBOR encoding ofpreference MUST NOT be changed based on previous error messages. However, the list SUITES_I sent to the Responder MAY be truncated such that cipher suites which areinfo = [ edhoc_aead_id : int / tstr, transcript_hash : bstr, label : tstr, * context : any, length : uint, ] where * edhoc_aead_id is an int or tstr containing theleast preferred are omitted. The amountalgorithm identifier oftruncation MAY be changed between sessions, e.g. based on previous error messages (see next bullet), but all cipher suites which are more preferred thantheleast preferredEDHOC AEAD algorithm in the selected cipher suite encoded as defined inthe list MUST be included[I-D.ietf-cose-rfc8152bis-algs]. Note that a single fixed edhoc_aead_id is used in all invocations of EDHOC-KDF, including thelist. o The Initiator MUST select its most preferred cipher suite, conditioned on what it can assume to be supported by the Responder. If the Initiator previously received fromderivation of KEYSTREAM_2 and invocations of theResponder an error message with error code 2EDHOC-Exporter (see Section6.3) indicating cipher suites supported by the Responder which also are supported by4.3). * transcript_hash is a bstr set to one of theInitiator, thentranscript hashes TH_2, TH_3, or TH_4 as defined in Sections 5.3.1, 5.4.1, and 4.3. * label is a tstr set to theInitiator SHOULD selectname of themost preferred cipher suite of those (note that error messages are not authenticated and may be forged). o Generate an ephemeral ECDH key pair usingderived key, IV or MAC; i.e., "KEYSTREAM_2", "MAC_2", "K_3ae", "IV_3ae", or "MAC_3". * context is a CBOR sequence, i.e., zero or more encoded CBOR data items * length is thecurvelength of output keying material (OKM) in bytes The definition of Expand depends on the EDHOC hash algorithm of the selected ciphersuite and format it as a COSE_Key. Let G_X besuite: * if the'x' parameter ofEDHOC hash algorithm is SHA-2, then Expand( PRK, info, length ) = HKDF-Expand( PRK, info, length ) [RFC5869] * if theCOSE_Key. o Choose a connection identifier C_I and store it forEDHOC hash algorithm is SHAKE128, then Expand( PRK, info, length ) = KMAC128( PRK, info, L, "" ) * if the EDHOC hash algorithm is SHAKE256, then Expand( PRK, info, lengthof) = KMAC256( PRK, info, L, "" ) where L = 8*length, theprotocol. o Encode message_1 as a sequence of CBOR encoded data items as specifiedoutput length inSection 5.2.1 5.2.3. Responder Processing of Message 1bits. TheResponder SHALL process message_1keys, IVs and MACs are derived as follows:o Decode message_1 (see Appendix C.1). o Verify that the selected cipher suite* KEYSTREAM_2 issupportedderived using the transcript hash TH_2 andthat no prior cipher suite in SUITES_I is supported. o Pass EAD_1 tothesecurity application. If any processing step fails,pseudorandom key PRK_2e. * MAC_2 is derived using theResponder SHOULD send an EDHOC error message back, formatted as defined in Section 6,transcript hash TH_2 and thesession MUST be discontinued. Sending error messages is essential for debugging but MAY e.g. be skipped due to denial of service reasons, see Section 7. 5.3. EDHOC Message 2 5.3.1. Formatting of Message 2 message_2pseudorandom key PRK_3e2m. * K_3ae anddata_2 SHALL be CBOR Sequences (see Appendix C.1) as defined below message_2 = ( data_2, CIPHERTEXT_2 : bstr, ) data_2 = ( G_Y : bstr, C_R : bstr / int, ) where: o G_Y -IV_3ae are derived using theephemeral public key oftranscript hash TH_3 and theResponder o C_R - variable length connection identifier 5.3.2. Responder Processing of Message 2 The Responder SHALL compose message_2 as follows: o Generate an ephemeral ECDHpseudorandom keypair usingPRK_3e2m. IVs are only used if thecurve inEDHOC AEAD algorithm uses IVs. * MAC_3 is derived using theselected cipher suitetranscript hash TH_3 andformat it as a COSE_Key. Let G_Y be the 'x' parameter oftheCOSE_Key. o Choosepseudorandom key PRK_4x3m. KEYSTREAM_2, K_3ae, and IV_3ae do not use aconnection identifier C_Rcontext. MAC_2 andstore it for the length of the protocol. o ComputeMAC_3 use context as defined in Section 5.3.2 and Section 5.4.2, respectively. 4.3. EDHOC-Exporter Application keys and other application specific data can be derived using thetranscript hash TH_2EDHOC-Exporter interface defined as: EDHOC-Exporter(label, context, length) =H( H(message_1), data_2 )EDHOC-KDF(PRK_4x3m, TH_4, label, context, length) whereH()label is a registered tstr from thehash function in the selected cipher suite. The transcript hash TH_2EDHOC Exporter Label registry (Section 8.1), context is a CBORencoded bstr and the input tosequence defined by thehash functionapplication, and length is aCBOR Sequence. Note that H(message_1) can be computed and cached already inuint defined by theprocessing of message_1. o Computeapplication. The (label, context) pair must be unique, i.e., a (label, context) MUST NOT be used for two different purposes. However aninner COSE_Encrypt0application can re-derive the same key several times asdefinedlong as it is done inSection 5.3 of [I-D.ietf-cose-rfc8152bis-struct], with the EDHOC AEAD algorithma secure way. For example, in most encryption algorithms theselected cipher suite, K_2m, IV_2m, andsame (key, nonce) pair must not be reused. The context can for example be thefollowing parameters: * protected = << ID_CRED_R >> + ID_CRED_R - identifier to facilitate retrieval of CRED_R, see Section 3.5.4 * external_aad = << TH_2, CRED_R, ? EAD_2 >> + CRED_R -empty (zero-length) sequence or a single CBOR byte string. The transcript hash TH_4 is a CBOR encoded bstrcontaining the credential of the Responder, see Section 3.5.4 + EAD_2 = unprotected external authorization data, see Section 3.8 * plaintext = h'' COSE constructsand the input to theAEAD [RFC5116] as follows: * Key K = EDHOC-KDF( PRK_3e2m, TH_2, "K_2m", length ) * Nonce Nhash function is a CBOR Sequence. TH_4 =EDHOC-KDF( PRK_3e2m, TH_2, "IV_2m", lengthH( TH_3, CIPHERTEXT_3 )* Plaintext P = 0x (the empty string) * Associated data A = [ "Encrypt0", << ID_CRED_R >>, << TH_2, CRED_R, ? EAD_2 >> ] MAC_2where H() is the'ciphertext'hash function in the selected cipher suite. Examples of use of theinner COSE_Encrypt0. o IfEDHOC-Exporter are given in Section 5.5.2 and Appendix A. 4.4. EDHOC-KeyUpdate To provide forward secrecy in an even more efficient way than re- running EDHOC, EDHOC provides theResponder authenticates with a static Diffie-Hellman key (method equals 1 or 3), then Signature_or_MAC_2function EDHOC-KeyUpdate. When EDHOC-KeyUpdate isMAC_2. Ifcalled theResponder authenticates with a signature key (method equals 0 or 2), then Signature_or_MAC_2old PRK_4x3m is deleted and the'signature' of a COSE_Sign1 objectnew PRK_4x3m is calculated asdefined in Section 4.4a "hash" of[I-D.ietf-cose-rfc8152bis-struct] using the signature algorithm in the selected cipher suite,theprivate authenticationold keyofusing theResponder, andExtract function as illustrated by the followingparameters: * protected = << ID_CRED_R >> * external_aad = << TH_2, CRED_R, ? EAD_2 >> * payloadpseudocode: EDHOC-KeyUpdate( nonce ): PRK_4x3m =MAC_2 COSE constructs theExtract( nonce, PRK_4x3m ) The EDHOC-KeyUpdate takes a nonce as input tothe Signature Algorithm as: *guarantee that there are no short cycles. Thekey is the private authentication key ofInitiator and theResponder. * The message MResponder need tobe signed = [ "Signature1", << ID_CRED_R >>, << TH_2, CRED_R, ? EAD_2 >>, MAC_2 ] o CIPHERTEXT_2 is encrypted by usingagree on theExpand function as a binary additive stream cipher. * plaintext = ( ID_CRED_R / bstr / int, Signature_or_MAC_2, ? EAD_2 ) + Note that if ID_CRED_R containsnonce, which can e.g., be asingle 'kid2' parameter, i.e., ID_CRED_R = { 4 : kid_R }, only the byte stringcounter orinteger kid_R is conveyed in the plaintext encoded asabstr / int. * CIPHERTEXT_2 = plaintext XOR KEYSTREAM_2 o Encode message_2random number. While the KeyUpdate method provides forward secrecy it does not give asa sequence of CBOR encoded data itemsstrong security properties asspecified inre-running EDHOC, see Section5.3.1. 5.3.3. Initiator7. 5. Message Formatting and Processing This section specifies formatting ofMessage 2 The Initiator SHALL process message_2 as follows: o Decode message_2 (see Appendix C.1). o Retrieve the protocol state using the message correlation provided by the transport (e.g.,theCoAP Tokenmessages andthe 5-tuple as a client, or the prepended C_Iprocessing steps. Error messages are specified in Section 6. An EDHOC message is encoded as aserver). o Decrypt CIPHERTEXT_2, see Section 5.3.2. o Pass EAD_2sequence of CBOR data (CBOR Sequence, [RFC8742]). Additional optimizations are made to reduce message overhead. While EDHOC uses thesecurity application. o Verify that the identityCOSE_Key, COSE_Sign1, and COSE_Encrypt0 structures, only a subset of theResponderparameters isan allowed identity for this connection, see Section 3.5. o Verify Signature_or_MAC_2 using the algorithmincluded in theselected cipher suite.EDHOC messages, see Appendix C.3. Theverification process depends onunprotected COSE header in COSE_Sign1, and COSE_Encrypt0 (not included in themethod, see Section 5.3.2. If anyEDHOC message) MAY contain parameters (e.g., 'alg'). 5.1. Message Processing Outline This section outlines the message processingstep fails,of EDHOC. For each session, theInitiator SHOULD sendendpoints are assumed to keep anEDHOC error message back, formatted as defined in Section 6. Sending error messages is essentialassociated protocol state containing identifiers, keys, etc. used fordebugging but MAY e.g.be skipped if a session cannotsubsequent processing of protocol related data. The protocol state is assumed to befound or dueassociated todenial of service reasons, see Section 7. Ifanerror message is sent,applicability statement (Section 3.9) which provides thesession MUST be discontinued. 5.4. EDHOC Message 3 5.4.1. Formatting of Message 3 message_3context for how messages are transported, identified, and processed. EDHOC messages SHALL bea CBOR Sequence (see Appendix C.1) as defined below message_3 = ( CIPHERTEXT_3 : bstr, ) 5.4.2. Initiator Processing of Message 3processed according to the current protocol state. TheInitiator SHALL compose message_3 as follows: o Computefollowing steps are expected to be performed at reception of an EDHOC message: 1. Detect that an EDHOC message has been received, for example by means of port number, URI, or media type (Section 3.9). 2. Retrieve thetranscript hash TH_3 = H(TH_2, CIPHERTEXT_2) where H() isprotocol state according to thehash functionmessage correlation provided by the transport, see Section 3.4. If there is no protocol state, in theselected cipher suite.case of message_1, a new protocol state is created. Thetranscript hash TH_3Responder endpoint needs to make use of available Denial-of-Service mitigation (Section 7.5). 3. If the message received isa CBOR encoded bstr andan error message, then process according to Section 6, else process as theinputexpected next message according to thehash functionprotocol state. If the processing fails for some reason then, typically, an error message isa CBOR Sequence. Note that H(TH_2, CIPHERTEXT_2) can be computedsent, the protocol is discontinued, andcached alreadythe protocol state erased. Further details are provided in theprocessing of message_2. o Compute an inner COSE_Encrypt0 as definedfollowing subsections and in Section5.36. Different instances of[I-D.ietf-cose-rfc8152bis-struct], withtheEDHOC AEAD algorithmsame message MUST NOT be processed in one session. Note that processing will fail if theselected cipher suite, K_3m, IV_3m, and the following parameters: * protected = << ID_CRED_I >> + ID_CRED_I - identifier to facilitate retrieval of CRED_I, see Section 3.5.4 * external_aad = << TH_3, CRED_I, ? EAD_3 >> + CRED_I - bstr containingsame message appears a second time for EDHOC processing because thecredentialstate of theInitiator, see Section 3.5.4. + EAD_3 = protected external authorization data,protocol has moved on and now expects something else. This assumes that message duplication due to re-transmissions is handled by the transport protocol, see Section3.8 * plaintext = h'' COSE constructs the input to3.4. The case when theAEAD [RFC5116]transport does not support message deduplication is addressed in Appendix F. 5.2. EDHOC Message 1 5.2.1. Formatting of Message 1 message_1 SHALL be a CBOR Sequence (see Appendix C.1) asfollows: * Key Kdefined below message_1 =EDHOC-KDF( PRK_4x3m, TH_3, "K_3m", length( METHOD : int, SUITES_I : [ selected : suite, supported : 2* suite ] / suite, G_X : bstr, C_I : bstr / int, ? EAD_1 : ead, )* Nonce Nsuite =EDHOC-KDF( PRK_4x3m, TH_3, "IV_3m", length )int where: *Plaintext PMETHOD =0x (the empty string)0, 1, 2, or 3 (see Figure 4). *Associated data A = [ "Encrypt0", << ID_CRED_I >>, << TH_3, CRED_I, ? EAD_3 >> ] MAC_3 isSUITES_I - cipher suites which the'ciphertext'Initiator supports in order of (decreasing) preference. The list of supported cipher suites can be truncated at theinner COSE_Encrypt0. o If the Initiator authenticates with a static Diffie-Hellman key (method equals 2 or 3), then Signature_or_MAC_3end, as isMAC_3. Ifdetailed in theInitiator authenticates with a signature key (method equals 0 or 1), then Signature_or_MAC_3 is the 'signature' of a COSE_Sign1 object as defined inprocessing steps below and Section4.46.3. One of[I-D.ietf-cose-rfc8152bis-struct] usingthesignature algorithmsupported cipher suites is selected. The selected suite is the first suite in theselectedSUITES_I CBOR array. If a single supported ciphersuite,suite is conveyed, then that cipher suite is selected and SUITES_I is encoded as an int instead of an array. * G_X - theprivate authenticationephemeral public key of theInitiator, and the following parameters: * protected = << ID_CRED_I >>Initiator *external_aad = << TH_3, CRED_I, ? EAD_3 >>C_I - variable length connection identifier *payload = MAC_3 COSE constructs the input to the Signature Algorithm as:EAD_1 - unprotected external authorization data, see Section 3.8. 5.2.2. Initiator Processing of Message 1 The Initiator SHALL compose message_1 as follows: * Thekey issupported cipher suites and theprivate authentication keyorder of preference MUST NOT be changed based on previous error messages. However, theInitiator. * The message Mlist SUITES_I sent to the Responder MAY besigned = [ "Signature1", << ID_CRED_I >>, << TH_3, CRED_I, ? EAD_3 >>, MAC_3 ] o Compute an outer COSE_Encrypt0 as defined in Section 5.3truncated such that cipher suites which are the least preferred are omitted. The amount of[I-D.ietf-cose-rfc8152bis-struct], withtruncation MAY be changed between sessions, e.g., based on previous error messages (see next bullet), but all cipher suites which are more preferred than theEDHOC AEAD algorithmleast preferred cipher suite in theselected cipher suite, K_3ae, IV_3ae, andlist MUST be included in thefollowing parameters.list. * Theprotected header SHALLInitiator MUST select its most preferred cipher suite, conditioned on what it can assume to beempty. * external_aad = TH_3 * plaintext = ( ID_CRED_I / bstr / int, Signature_or_MAC_3, ? EAD_3 ) + Notesupported by the Responder. If the Initiator previously received from the Responder an error message with error code 2 (see Section 6.3) indicating cipher suites supported by the Responder which also are supported by the Initiator, then the Initiator SHOULD select the most preferred cipher suite of those (note thatif ID_CRED_I contains a single 'kid2' parameter, i.e., ID_CRED_I = { 4 : kid_I }, onlyerror messages are not authenticated and may be forged). * Generate an ephemeral ECDH key pair using thebyte string or integer kid_I is conveyedcurve in theplaintext encodedselected cipher suite and format it as abstr or int. COSE constructsCOSE_Key. Let G_X be theinput to'x' parameter of theAEAD [RFC5116] as follows: * Key K = EDHOC-KDF( PRK_3e2m, TH_3, "K_3ae", length ) * Nonce N = EDHOC-KDF( PRK_3e2m, TH_3, "IV_3ae", length ) * Plaintext P = ( ID_CRED_I / bstr / int, Signature_or_MAC_3, ? EAD_3 )COSE_Key. *Associated data A = [ "Encrypt0", h'', TH_3 ] CIPHERTEXT_3 isChoose a connection identifier C_I and store it for the'ciphertext'length of theouter COSE_Encrypt0. oprotocol. * Encodemessage_3message_1 as a sequence of CBOR encoded data items as specified in Section5.4.1. Pass the connection identifiers (C_I, C_R) and the application algorithms in5.2.1 5.2.3. Responder Processing of Message 1 The Responder SHALL process message_1 as follows: * Decode message_1 (see Appendix C.1). * Verify that the selected cipher suiteto the application. The application can now derive application keys using the EDHOC-Exporter interface. After sending message_3, the Initiatorisassuredsupported and that noother party than the Responder can compute the key PRK_4x3m (implicit key authentication). The Initiator can securely derive application keys and send protected application data. However,prior cipher suite in SUITES_I is supported. * Pass EAD_1 to theInitiator does not know thatsecurity application. If any processing step fails, the Responderhas actually computed the key PRK_4x3m and therefore the InitiatorSHOULDNOT permanently store the keying material PRK_4x3msend an EDHOC error message back, formatted as defined in Section 6, andTH_4, or derived application keys, until the Initiator is assured that the Responder has actually computedthekey PRK_4x3m (explicit key confirmation). Thissession MUST be discontinued. Sending error messages issimilar to waitingessential foracknowledgement (ACK) indebugging but MAY e.g., be skipped due to denial-of-service reasons, see Section 7. 5.3. EDHOC Message 2 5.3.1. Formatting of Message 2 message_2 SHALL be atransport protocol. Explicit key confirmation is e.g. assured whenCBOR Sequence (see Appendix C.1) as defined below message_2 = ( G_Y_CIPHERTEXT_2 : bstr, C_R : bstr / int, ) where: * G_Y_CIPHERTEXT_2 - theInitiator has verified an OSCORE message or message_4 fromconcatenation of G_Y, theResponder. 5.4.3.ephemeral public key of the Responder, and CIPHERTEXT_2 * C_R - variable length connection identifier 5.3.2. Responder Processing of Message32 The Responder SHALLprocess message_3compose message_2 as follows:o Decode message_3 (see Appendix C.1). o Retrieve the protocol state* Generate an ephemeral ECDH key pair using themessage correlation provided by the transport (e.g.,curve in theCoAP Tokenselected cipher suite andthe 5-tupleformat it as aclient, orCOSE_Key. Let G_Y be theprepended C_R as'x' parameter of the COSE_Key. * Choose aserver). o Decryptconnection identifier C_R andverifystore it for theouter COSE_Encrypt0 as defined in Section 5.3length of[I-D.ietf-cose-rfc8152bis-struct], withtheEDHOC AEAD algorithmprotocol. * Compute the transcript hash TH_2 = H( H(message_1), G_Y, C_R ) where H() is the hash function in the selected ciphersuite, K_3ae,suite. The transcript hash TH_2 is a CBOR encoded bstr andIV_3ae. o Pass EAD_3the input to thesecurity application. o Verifyhash function is a CBOR Sequence. Note that H(message_1) can be computed and cached already in theidentityprocessing of message_1. * Compute MAC_2 = EDHOC-KDF( PRK_3e2m, TH_2, "MAC_2", ( ID_CRED_R, CRED_R, ? EAD_2 ), mac_length ). If theInitiatorResponder authenticates with a static Diffie-Hellman key (method equals 1 or 3), then mac_length isan allowed identity for this connection, see Section 3.5. o Verify Signature_or_MAC_3 usingthealgorithm inEDHOC MAC length given by theselectedcipher suite.The verification process depends onIf themethod, see Section 5.4.2. o PassResponder authenticates with a signature key (method equals 0 or 2), then mac_length is equal to theconnection identifiers (C_I, C_R), andoutput size of theapplication algorithms inEDHOC hash algorithm given by theselectedciphersuitesuite. - ID_CRED_R - identifier to facilitate retrieval of CRED_R, see Section 3.5.4 - CRED_R - CBOR item containing thesecurity application. The application can now derive application keys usingcredential of theEDHOC-Exporter interface.Responder, see Section 3.5.4 - EAD_2 = unprotected external authorization data, see Section 3.8 * Ifany processing step fails,the ResponderSHOULD send an EDHOC error message back, formatted as defined in Section 6. Sending error messages is essential for debugging but MAY e.g.be skipped ifauthenticates with asession cannot be found or due to denial of service reasons, see Section 7. If an error message is sent, the session MUST be discontinued. After verifying message_3, the Responder is assured that the Initiator has calculated the key PRK_4x3m (explicitstatic Diffie-Hellman keyconfirmation) and that no other party than the Responder can compute the key. The Responder can securely send protected application data and store the keying material PRK_4x3m and TH_4. 5.5. EDHOC Message 4 This section specifies message_4 which is OPTIONAL to support. Key confirmation(method equals 1 or 3), then Signature_or_MAC_2 isnormally provided by sending an application message fromMAC_2. If the Responderto the Initiator protectedauthenticates with a signature keyderived with the EDHOC-Exporter, e.g., using OSCORE (see Appendix A). In deployments where no protected application message is sent from the Responder to the Initiator, the Responder MUST send message_4. Two examples of such deployments: 1. When EDHOC is only used for authentication and no application data is sent. 2. When application data(method equals 0 or 2), then Signature_or_MAC_2 isonly sent from the Initiator totheResponder. Further considerations are provided in Section 3.9. 5.5.1. Formatting of Message 4 message_4 SHALL be a CBOR Sequence (see Appendix C.1) as defined below message_4 = ( CIPHERTEXT_4 : bstr, ) 5.5.2. Responder Processing'signature' ofMessage 4 The Responder SHALL compose message_4 as follows: o ComputeaCOSE_Encrypt0COSE_Sign1 object as defined in Section5.34.4 of[I-D.ietf-cose-rfc8152bis-struct], with[I-D.ietf-cose-rfc8152bis-struct] using theEDHOC AEADsignature algorithm in the selected cipher suite,andthefollowing parameters. The protected header SHALL be empty. *private authentication key of the Responder, and the following parameters: - protected =h'' *<< ID_CRED_R >> - external_aad =TH_4 * plaintext = (<< TH_2, CRED_R, ?EAD_4 ) where EAD_4 is protected external authorization data, see Section 3.8.EAD_2 >> - payload = MAC_2 COSE constructs the input to theAEAD [RFC5116] as follows: * Key K = EDHOC-Exporter( "EDHOC_message_4_Key", h'', length ) * Nonce NSignature Algorithm as: - The key is the private authentication key of the Responder. - The message M to be signed =EDHOC-Exporter( "EDHOC_message_4_Nonce", h'', length )[ "Signature1", << ID_CRED_R >>, << TH_2, CRED_R, ? EAD_2 >>, MAC_2 ] *Plaintext PCIPHERTEXT_2 is encrypted by using the Expand function as a binary additive stream cipher. - plaintext = ( ID_CRED_R / bstr / int, Signature_or_MAC_2, ?EAD_4EAD_2 )* Associated data Ao Note that if ID_CRED_R contains a single 'kid' parameter, i.e., ID_CRED_R =[ "Encrypt0", h'', TH_4 ] CIPHERTEXT_4 is{ 4 : kid_R }, only the'ciphertext' ofbyte string or integer kid_R is conveyed in theCOSE_Encrypt0. oplaintext encoded as a bstr or int. - CIPHERTEXT_2 = plaintext XOR KEYSTREAM_2 * Encodemessage_4message_2 as a sequence of CBOR encoded data items as specified in Section5.5.1. 5.5.3.5.3.1. 5.3.3. Initiator Processing of Message42 The Initiator SHALL processmessage_4message_2 as follows:o* Decodemessage_4message_2 (see Appendix C.1).o* Retrieve the protocol state using the message correlation provided by the transport (e.g., the CoAP Token and the 5-tuple as a client, or the prepended C_I as a server).o* Decryptand verify the outer COSE_Encrypt0 as defined inCIPHERTEXT_2, see Section5.35.3.2. * Pass EAD_2 to the security application. * Verify that the identity of[I-D.ietf-cose-rfc8152bis-struct], withtheEDHOC AEADResponder is an allowed identity for this connection, see Section 3.5. * Verify Signature_or_MAC_2 using the algorithm in the selected ciphersuite, andsuite. The verification process depends on theparameters defined inmethod, see Section5.5.2. o Pass EAD_4 to the security application.5.3.2. If anyverificationprocessing stepfailsfails, the InitiatorMUSTSHOULD send an EDHOC error message back, formatted as defined in Section6, and the session MUST be discontinued.6.Error Handling This section defines the format for error messages. An EDHOCSending errormessage canmessages is essential for debugging but MAY e.g., besent by either endpoint asskipped if areply to any non-error EDHOC message. How errors at the EDHOC layer are transported depends on lower layers, which need to enable error messages tosession cannot besent and processed as intended. Errors in EDHOC are fatal. After sending an error message, the sender MUST discontinue the protocol. The receiver SHOULD treat an error message asfound or due to denial-of-service reasons, see Section 7. If anindication that the other party likely has discontinued the protocol. But as theerror message isnot authenticated, a received error message might also have been sent by an attacker and the receiver MAY therefore try to continuesent, theprotocol. errorsession MUST be discontinued. 5.4. EDHOC Message 3 5.4.1. Formatting of Message 3 message_3 SHALL be a CBOR Sequence (see Appendix C.1) as defined belowerrormessage_3 = (ERR_CODE : int, ERR_INFOCIPHERTEXT_3 :anybstr, )Figure 5: EDHOC Error5.4.2. Initiator Processing of Messagewhere: o ERR_CODE - error code encoded3 The Initiator SHALL compose message_3 asan integer.follows: * Compute the transcript hash TH_3 = H(TH_2, CIPHERTEXT_2) where H() is the hash function in the selected cipher suite. Thevalue 0transcript hash TH_3 isused for success, all other values (negative or positive) indicate errors. o ERR_INFO - error information. Contenta CBOR encoded bstr andencoding depend on error code. The remainder of this section specifiesthecurrently defined error codes, see Figure 6. Error codes 1 and 2 MUST be supported. Additional error codes and corresponding error information may be specified. +----------+---------------+----------------------------------------+ | ERR_CODE | ERR_INFO Type | Description | +==========+===============+========================================+ | 0 | any | Success | +----------+---------------+----------------------------------------+ | 1 | tstr | Unspecified | +----------+---------------+----------------------------------------+ | 2 | SUITES_R | Wrong selected cipher suite | +----------+---------------+----------------------------------------+ Figure 6: Error Codes and Error Information 6.1. Success Error code 0 MAY be used internally in an applicationinput toindicate success, e.g. in log files. ERR_INFO can contain any type of CBOR item. Error code 0 MUST NOT be used as part oftheEDHOC message exchange flow. 6.2. Unspecified Error code 1hash function isused for errors that do not have a specific error code defined. ERR_INFO MUST be a text string containingahuman- readable diagnostic message written in English. The diagnostic text message is mainly intended for software engineersCBOR Sequence. Note thatduring debugging need to interpret itH(TH_2, CIPHERTEXT_2) can be computed and cached already in thecontextprocessing of message_2. * Compute MAC_3 = EDHOC-KDF( PRK_4x3m, TH_3, "MAC_3", ( ID_CRED_I, CRED_I, ? EAD_3 ), mac_length ). If theEDHOC specification. The diagnostic message SHOULD be provided to the calling application where it SHOULD be logged. 6.3. Wrong Selected Cipher Suite Error code 2 MUST only be used inInitiator authenticates with aresponse to message_1 in casestatic Diffie-Hellman key (method equals 2 or 3), then mac_length is thecipher suite selectedEDHOC MAC length given by the cipher suite. If the Initiatoris not supported by the Responder,authenticates with a signature key (method equals 0 orif1), then mac_length is equal to theResponder supports a cipher suite more preferred byoutput size of theInitiator thanEDHOC hash algorithm given by theselectedciphersuite,suite. - ID_CRED_I - identifier to facilitate retrieval of CRED_I, see Section5.2.3. ERR_INFO is3.5.4 - CRED_I - CBOR item containing the credential oftype SUITES_R: SUITES_R : [ supported : 2* suite ] / suite IftheResponder does not supportInitiator, see Section 3.5.4 - EAD_3 = protected external authorization data, see Section 3.8 * If theselected cipher suite, then SUITES_R MUST include oneInitiator authenticates with a static Diffie-Hellman key (method equals 2 ormore supported cipher suites.3), then Signature_or_MAC_3 is MAC_3. If theResponder does not supportInitiator authenticates with a signature key (method equals 0 or 1), then Signature_or_MAC_3 is theselected cipher suite, but supports another cipher suite'signature' of a COSE_Sign1 object as defined inSUITES_I, then SUITES_R MUST includeSection 4.4 of [I-D.ietf-cose-rfc8152bis-struct] using thefirst supported cipher suitesignature algorithm inSUITES_I. 6.3.1. Cipher Suite Negotiation After receiving SUITES_R,theInitiator can determine whichselected ciphersuite to select forsuite, thenext EDHOC run withprivate authentication key of theResponder. IfInitiator, and theInitiator intendsfollowing parameters: - protected = << ID_CRED_I >> - external_aad = << TH_3, CRED_I, ? EAD_3 >> - payload = MAC_3 COSE constructs the input tocontacttheResponder inSignature Algorithm as: - The key is thefuture,private authentication key of theInitiator SHOULD remember which selected cipher suiteInitiator. - The message M touse until the next message_1 has been sent, otherwise the Initiator and Responder will likely run intobe signed = [ "Signature1", << ID_CRED_I >>, << TH_3, CRED_I, ? EAD_3 >>, MAC_3 ] * Compute aninfinite loop. After a successful runouter COSE_Encrypt0 as defined in Section 5.3 ofEDHOC,[I-D.ietf-cose-rfc8152bis-struct], with theInitiator MAY rememberEDHOC AEAD algorithm in the selected ciphersuite to use in future EDHOC runs.suite, K_3ae, IV_3ae, and the following parameters. The protected header SHALL be empty. - external_aad = TH_3 - plaintext = ( ID_CRED_I / bstr / int, Signature_or_MAC_3, ? EAD_3 ) o Note that if ID_CRED_I contains a single 'kid' parameter, i.e., ID_CRED_I = { 4 : kid_I }, only theInitiatorbyte string orResponderinteger kid_I isupdated with new cipher suite policies, any cached information may be outdated. 6.3.2. Examples Assume thatconveyed in theInitiator supportsplaintext encoded as a bstr or int. COSE constructs thefive cipher suites 5, 6, 7, 8, and 9 in decreasing order of preference. Figures 7 and 8 show examples of howinput to theInitiator can truncate SUITES_I and how SUITES_RAEAD [RFC5116] as follows: - Key K = EDHOC-KDF( PRK_3e2m, TH_3, "K_3ae", length ) - Nonce N = EDHOC-KDF( PRK_3e2m, TH_3, "IV_3ae", length ) - Plaintext P = ( ID_CRED_I / bstr / int, Signature_or_MAC_3, ? EAD_3 ) - Associated data A = [ "Encrypt0", h'', TH_3 ] CIPHERTEXT_3 isused by Responders to givetheInitiator information about'ciphertext' of thecipher suites thatouter COSE_Encrypt0. * Encode message_3 as a sequence of CBOR encoded data items as specified in Section 5.4.1. Pass theResponder supports. In the first example (Figure 7),connection identifiers (C_I, C_R) and theResponder supports cipher suite 6 but notapplication algorithms in theinitiallyselected cipher suite5. Initiator Responder | METHOD, SUITES_I = 5, G_X, C_I, EAD_1 | +------------------------------------------------------------------>| | message_1 | | | | DIAG_MSG, SUITES_R = 6 | |<------------------------------------------------------------------+ | error | | | | METHOD, SUITES_I = [6, 5, 6], G_X, C_I, EAD_1 | +------------------------------------------------------------------>| | message_1 | Figure 7: Example of Responder supporting suite 6 but not suite 5. In the second example (Figure 8), the Responder supports cipher suites 8 and 9 but not the more preferred (byto theInitiator) cipher suites 5, 6 or 7. To illustrateapplication. The application can now derive application keys using thenegotiation mechanics we letEDHOC-Exporter interface, see Section 4.3. After sending message_3, the Initiatorfirst make a guessis assured that no other party than the Respondersupports suite 6 but not suite 5. Sincecan compute theResponder supports neither 5 nor 6, it responds with an errorkey PRK_4x3m (implicit key authentication). The Initiator can securely derive application keys andSUITES_R, after whichsend protected application data. However, the Initiatorselects its most preferred supported suite. The order of cipher suites in SUITES_Rdoes notmatter. (Ifknow that the Responderhad supported suite 5, it would include it in SUITES_R ofhas actually computed theresponse,key PRK_4x3m andit would in that case have becometherefore theselected suite inInitiator SHOULD NOT permanently store the keying material PRK_4x3m and TH_4, or derived application keys, until thesecond message_1.)Initiator is assured that the Responder| METHOD, SUITES_I = [6, 5, 6], G_X, C_I, EAD_1 | +------------------------------------------------------------------>| | message_1 | | | | DIAG_MSG, SUITES_R = [9, 8] | |<------------------------------------------------------------------+ | error | | | | METHOD, SUITES_I = [8, 5, 6, 7, 8], G_X, C_I, EAD_1 | +------------------------------------------------------------------>| | message_1 | Figure 8: Examplehas actually computed the key PRK_4x3m (explicit key confirmation). This is similar to waiting for acknowledgement (ACK) in a transport protocol. Explicit key confirmation is e.g., assured when the Initiator has verified an OSCORE message or message_4 from the Responder. 5.4.3. Responder Processing of Message 3 The Respondersupporting suites 8SHALL process message_3 as follows: * Decode message_3 (see Appendix C.1). * Retrieve the protocol state using the message correlation provided by the transport (e.g., the CoAP Token and9 but not 5, 6the 5-tuple as a client, or7. Note thattheInitiator's list of supported cipher suites and order of preference is fixed (see Section 5.2.1prepended C_R as a server). * Decrypt and verify the outer COSE_Encrypt0 as defined in Section5.2.2). Furthermore,5.3 of [I-D.ietf-cose-rfc8152bis-struct], with theResponder shall only accept message_1 ifEDHOC AEAD algorithm in the selected ciphersuite issuite, K_3ae, and IV_3ae. * Pass EAD_3 to thefirst cipher suite in SUITES_Isecurity application. * Verify that theResponder supports (see Section 5.2.3). Followingidentity of the Initiator is an allowed identity for thisprocedure ensures thatconnection, see Section 3.5. * Verify Signature_or_MAC_3 using the algorithm in the selected ciphersuite issuite. The verification process depends on themost preferred (bymethod, see Section 5.4.2. * Pass theInitiator)connection identifiers (C_I, C_R), and the application algorithms in the selected cipher suitesupported by both parties. Ifto theselected cipher suite is notsecurity application. The application can now derive application keys using thefirst cipher suite whichEDHOC-Exporter interface. If any processing step fails, the Respondersupports in SUITES_I receivedSHOULD send an EDHOC error message back, formatted as defined inmessage_1, then Responder MUST discontinue the protocol,Section 6. Sending error messages is essential for debugging but MAY e.g., be skipped if a session cannot be found or due to denial-of-service reasons, see Section5.2.3.7. IfSUITES_I in message_1an error message ismanipulated thensent, theintegrity verification of message_2 containingsession MUST be discontinued. After verifying message_3, thetranscript hash TH_2 will fail andResponder is assured that the Initiatorwill discontinuehas calculated theprotocol. 7. Security Considerations 7.1. Security Properties EDHOC inherits its security properties fromkey PRK_4x3m (explicit key confirmation) and that no other party than thetheoretical SIGMA-I protocol [SIGMA]. UsingResponder can compute theterminology from [SIGMA], EDHOC provides perfect forward secrecy, mutual authentication with aliveness, consistency,key. The Responder can securely send protected application data andpeer awareness. As described in [SIGMA], peer awarenessstore the keying material PRK_4x3m and TH_4. 5.5. EDHOC Message 4 This section specifies message_4 which isprovidedOPTIONAL to support. Key confirmation is normally provided by sending an application message from theResponder, but notResponder to theInitiator. EDHOC protects the credential identifier of theInitiatoragainst active attacks andprotected with a key derived with thecredential identifier ofEDHOC-Exporter, e.g., using OSCORE (see Appendix A). In deployments where no protected application message is sent from the Responderagainst passive attacks. The roles should be assignedtoprotectthemost sensitive identity/identifier, typically that which is not possible to infer from routing information inInitiator, thelower layers. Compared to [SIGMA],Responder MUST send message_4. Two examples of such deployments: 1. When EDHOCadds an explicit method typeis only used for authentication andexpandsno application data is sent. 2. When application data is only sent from themessage authentication coverageInitiator toadditional elements suchthe Responder. Further considerations are provided in Section 3.9. 5.5.1. Formatting of Message 4 message_4 SHALL be a CBOR Sequence (see Appendix C.1) asalgorithms, external authorization data, and previous messages. This protects against an attacker replaying messages or injecting messages from another session. EDHOC also adds selectiondefined below message_4 = ( CIPHERTEXT_4 : bstr, ) 5.5.2. Responder Processing ofconnection identifiers and downgrade protected negotiationMessage 4 The Responder SHALL compose message_4 as follows: * Compute a COSE_Encrypt0 as defined in Section 5.3 ofcryptographic parameters, i.e. an attacker cannot affect[I-D.ietf-cose-rfc8152bis-struct], with thenegotiated parameters. A single session ofEDHOCdoes not include negotiation of cipher suites, but it enables the Responder to verify thatAEAD algorithm in the selected ciphersuite is the most preferred cipher suite by the Initiator which is supported by both the Initiatorsuite, and theResponder. As required by [RFC7258], IETF protocols need to mitigate pervasive monitoring when possible. One way to mitigate pervasive monitoringfollowing parameters. The protected header SHALL be empty. - protected = h'' - external_aad = TH_4 - plaintext = ( ? EAD_4 ) where EAD_4 is protected external authorization data, see Section 3.8. COSE constructs the input touse a key exchange that provides perfect forward secrecy. EDHOC therefore only supports methods with perfect forward secrecy. To limittheeffect of breaches, itAEAD [RFC5116] as follows: - Key K = EDHOC-Exporter( "EDHOC_message_4_Key", , length ) - Nonce N = EDHOC-Exporter( "EDHOC_message_4_Nonce", , length ) - Plaintext P = ( ? EAD_4 ) - Associated data A = [ "Encrypt0", h'', TH_4 ] CIPHERTEXT_4 isimportant to limittheuseciphertext ofsymmetrical group keys for bootstrapping. EDHOC therefore strives to maketheadditional cost of using raw public keys and self-signed certificates as smallCOSE_Encrypt0. * Encode message_4 aspossible. Raw public keys and self-signed certificates are notareplacement for a public key infrastructure, but SHOULD be used insteadsequence ofsymmetrical group keys for bootstrapping. CompromiseCBOR encoded data items as specified in Section 5.5.1. 5.5.3. Initiator Processing of Message 4 The Initiator SHALL process message_4 as follows: * Decode message_4 (see Appendix C.1). * Retrieve thelong-term keys (private signatureprotocol state using the message correlation provided by the transport (e.g., the CoAP Token and the 5-tuple as a client, orstatic DH keys) does not compromisethesecurity of completed EDHOC exchanges. Compromisingprepended C_I as a server). * Decrypt and verify theprivate authentication keys of one party lets an active attacker impersonate that compromised partyouter COSE_Encrypt0 as defined inEDHOC exchangesSection 5.3 of [I-D.ietf-cose-rfc8152bis-struct], withother parties, but does not lettheattacker impersonate other parties inEDHOCexchanges withAEAD algorithm in thecompromised party. Compromise ofselected cipher suite, and thelong-term keys does not enable a passive attackerparameters defined in Section 5.5.2. * Pass EAD_4 tocompromise future session keys. Compromise oftheHDKF input parameters (ECDH shared secret) leads to compromise of all session keys derived from that compromised shared secret. Compromise of one session key does not compromise othersecurity application. If any processing step fails, the Responder SHOULD send an EDHOC error message back, formatted as defined in Section 6. Sending error messages is essential for debugging but MAY e.g., be skipped if a sessionkeys. Compromise of PRK_4x3m leadscannot be found or due tocompromise of all exported keying material derived afterdenial-of-service reasons, see Section 7. If an error message is sent, thelast invocation ofsession MUST be discontinued. 6. Error Handling This section defines theEDHOC-KeyUpdate function.format for error messages. An EDHOCprovides a minimum of 64-bit security against online brute force attacks anderror message can be sent by either endpoint as aminimum of 128-bit security against offline brute force attacks. This is in line with IPsec, TLS, and COSE. To break 64-bit security against online brute force an attacker wouldreply to any non-error EDHOC message. How errors at the EDHOC layer are transported depends onaverage havelower layers, which need tosend 4.3 billionenable error messagesper second for 68 years, which is infeasibleto be sent and processed as intended. Errors inconstrained IoT radio technologies.EDHOC are fatal. After sendingmessage_3, the Initiator is assured that no other party thanan error message, theResponder can computesender MUST discontinue thekey PRK_4x3m (implicit key authentication).protocol. TheInitiator does however not knowreceiver SHOULD treat an error message as an indication that theResponderother party likely hasactually computed the key PRK_4x3m. While the Initiator can securely send protected application data, the Initiator SHOULD NOT permanently store the keying material PRK_4x3m and TH_4 until the Initiator is assured that the Responder has actually computeddiscontinued thekey PRK_4x3m (explicit key confirmation). Explicit key confirmation is e.g. assured whenprotocol. But as theInitiator has verified an OSCOREerror messageor message_4 from the Responder. After verifying message_3, the Responderisassured that the Initiator has calculated the key PRK_4x3m (explicit key confirmation) and that no other party than the Responder can compute the key. The Responder can securely send protected application data and store the keying material PRK_4x3m and TH_4. Key compromise impersonation (KCI): In EDHOC authenticated with signature keys, EDHOC provides KCI protection againstnot authenticated, a received error message might also have been sent by an attackerhaving access to the long term key orand theephemeral secret key. With static Diffie-Hellman key authentication, KCI protection would be provided against an attacker having accessreceiver MAY therefore try to continue thelong-term Diffie- Hellman key, but not toprotocol. error SHALL be a CBOR Sequence (see Appendix C.1) as defined below error = ( ERR_CODE : int, ERR_INFO : any, ) Figure 5: EDHOC Error Message where: * ERR_CODE - error code encoded as anattacker having access to the ephemeral secret key. Note that the term KCI has typically beeninteger. The value 0 is used forcompromise of long-term keys,success, all other values (negative or positive) indicate errors. * ERR_INFO - error information. Content andthat an attacker with access to the ephemeral secret key can only attack that specific protocol run. Repudiation: In EDHOC authenticated with signature keys, the Initiator could theoretically prove that the Responder performed a run of the protocol by presenting the private ephemeral key, and vice versa. Note that storing the private ephemeral keys violates the protocol requirements. With static Diffie-Hellman key authentication, both parties can always deny having participated in the protocol. Two earlier versions of EDHOC have been formally analyzed [Norrman20] [Bruni18] and the specification has been updated basedencoding depend onthe analysis. 7.2. Cryptographic Considerationserror code. Thesecurityremainder of this section specifies theSIGMA protocol requires the MAC tocurrently defined error codes, see Figure 6. Error codes 1 and 2 MUST beboundsupported. Additional error codes and corresponding error information may be specified. +----------+---------------+----------------------------------------+ | ERR_CODE | ERR_INFO Type | Description | +==========+===============+========================================+ | 0 | any | Success | +----------+---------------+----------------------------------------+ | 1 | tstr | Unspecified | +----------+---------------+----------------------------------------+ | 2 | SUITES_R | Wrong selected cipher suite | +----------+---------------+----------------------------------------+ Figure 6: Error Codes and Error Information 6.1. Success Error code 0 MAY be used internally in an application tothe identityindicate success, e.g., in log files. ERR_INFO can contain any type ofthe signer. Hence the message authenticating functionalityCBOR item. Error code 0 MUST NOT be used as part of theauthenticated encryption inEDHOC message exchange flow. 6.2. Unspecified Error code 1 iscritical: authenticated encryptionused for errors that do not have a specific error code defined. ERR_INFO MUSTNOTbereplaced by plain encryption only, even if authentication is provided at another level or throughadifferent mechanism. EDHOC implements SIGMA-I usingtext string containing aMAC-then- Sign approach. To reducehuman- readable diagnostic message written in English. The diagnostic text messageoverhead EDHOC does not use explicit nonces and instead rely on the ephemeral public keys to provide randomness to each session. A good amount of randomnessisimportantmainly intended forthe key generation, to provide liveness, andsoftware engineers that during debugging need toprotect against interleaving attacks. For this reason,interpret it in theephemeral keys MUST NOT be reused, and both parties SHALL generate fresh random ephemeral key pairs. As discussedcontext of the[SIGMA],EDHOC specification. The diagnostic message SHOULD be provided to theencryption of message_2 doescalling application where it SHOULD be logged. 6.3. Wrong Selected Cipher Suite Error code 2 MUST onlyneedbe used in a response toprotect against passive attacker as active attackers can always getmessage_1 in case theResponders identitycipher suite selected bysending their own message_1. EDHOC usestheExpand function (typically HKDF-Expand) as a binary additive stream cipher. HKDF-Expand provides better confidentiality than AES- CTR butInitiator is notoften used as it is slow on long messages, and most applications require both IND-CCA confidentiality as well as integrity protection. Forsupported by theencryption of message_2, any speed differenceResponder, or if the Responder supports a cipher suite more preferred by the Initiator than the selected cipher suite, see Section 5.2.3. ERR_INFO isnegligible, IND-CCAof type SUITES_R: SUITES_R : [ supported : 2* suite ] / suite If the Responder does notincrease security, and integrity is provided bysupport theinner MAC (and signature depending on method). The data ratesselected cipher suite, then SUITES_R MUST include one or more supported cipher suites. If the Responder does not support the selected cipher suite, but supports another cipher suite inmany IoT deployments are very limited. Given thatSUITES_I, then SUITES_R MUST include theapplication keys are protected as well asfirst supported cipher suite in SUITES_I. 6.3.1. Cipher Suite Negotiation After receiving SUITES_R, thelong-term authentication keys theyInitiator canoften be useddetermine which cipher suite to select foryears or even decades beforethecryptographic limits are reached.next EDHOC run with the Responder. If theapplication keys established through EDHOC needInitiator intends tobe renewed,contact thecommunicating parties can derive application keys with other labels or run EDHOC again. Requirement for howResponder in the future, the Initiator SHOULD remember which selected cipher suite tosecurely generate, validate, and processuse until theephermeral public keys depend onnext message_1 has been sent, otherwise theelliptic curve. For X25519Initiator andX448,Responder will likely run into an infinite loop. After a successful run of EDHOC, therequirements are definedInitiator MAY remember the selected cipher suite to use in[RFC7748]. For secp256r1, secp384r1, and secp521r1,future EDHOC runs. Note that if therequirements are definedInitiator or Responder is updated with new cipher suite policies, any cached information may be outdated. 6.3.2. Examples Assume that the Initiator supports the five cipher suites 5, 6, 7, 8, and 9 inSection 5decreasing order of[SP-800-56A]. For secp256r1, secp384r1,preference. Figures 7 andsecp521r1, at least partial public-key validation MUST be done. 7.3. Cipher Suites8 show examples of how the Initiator can truncate SUITES_I andCryptographic Algorithms For many constrained IoT devices ithow SUITES_R isproblematicused by Responders tosupport more than onegive the Initiator information about the ciphersuite. Existing devices can be expected to support either ECDSA or EdDSA. To enable as much interoperability as we can reasonably achieve, less constrained devices SHOULD implement bothsuites that the Responder supports. In the first example (Figure 7), the Responder supports cipher suite0 (AES-CCM-16-64-128, SHA-256, X25519, EdDSA, AES-CCM- 16-64-128, SHA-256) and6 but not the initially selected cipher suite2 (AES-CCM-16-64-128, SHA-256, P-256, ES256, AES-CCM-16-64-128, SHA-256). Constrained endpoints SHOULD implement cipher5. Initiator Responder | METHOD, SUITES_I = 5, G_X, C_I, EAD_1 | +------------------------------------------------------------------>| | message_1 | | | | DIAG_MSG, SUITES_R = 6 | |<------------------------------------------------------------------+ | error | | | | METHOD, SUITES_I = [6, 5, 6], G_X, C_I, EAD_1 | +------------------------------------------------------------------>| | message_1 | Figure 7: Example of Responder supporting suite0 or cipher6 but not suite2. Implementations only need to implement5. In thealgorithms needed for their supported methods. When using privatesecond example (Figure 8), the Responder supports ciphersuite or registering newsuites 8 and 9 but not the more preferred (by the Initiator) ciphersuites,suites 5, 6 or 7. To illustrate thechoice of key length used innegotiation mechanics we let thedifferent algorithms needs to be harmonized, so thatInitiator first make asufficient security level is maintained for certificates, EDHOC, andguess that theprotection of application data. The Initiator andResponder supports suite 6 but not suite 5. Since the Respondershould enforce a minimum security level. The hash algorithms SHA-1 and SHA-256/64 (256-bit Hash truncated to 64-bits) SHALL NOT be supported for use in EDHOC except for certificate identification with x5u and c5u. Note that secp256k1 is only defined for usesupports neither 5 nor 6, it responds withECDSAan error andnot for ECDH. 7.4. Unprotected Data TheSUITES_R, after which the Initiatorandselects its most preferred supported suite. The order of cipher suites in SUITES_R does not matter. (If the Respondermust make sure that unprotected data and metadata do not reveal any sensitive information. This also applies for encrypted data sent to an unauthenticated party. In particular,had supported suite 5, itapplies to EAD_1, ID_CRED_R, EAD_2,would include it in SUITES_R of the response, anderror messages. Usingit would in that case have become thesame EAD_1selected suite inseveral EDHOC sessions allows passive eavesdroppers to correlatethedifferent sessions. Another consideration issecond message_1.) Initiator Responder | METHOD, SUITES_I = [6, 5, 6], G_X, C_I, EAD_1 | +------------------------------------------------------------------>| | message_1 | | | | DIAG_MSG, SUITES_R = [9, 8] | |<------------------------------------------------------------------+ | error | | | | METHOD, SUITES_I = [8, 5, 6, 7, 8], G_X, C_I, EAD_1 | +------------------------------------------------------------------>| | message_1 | Figure 8: Example of Responder supporting suites 8 and 9 but not 5, 6 or 7. Note that the Initiator's list of supported cipher suitesmay potentially be used to identify the application. The Initiatorand order of preference is fixed (see Section 5.2.1 and Section 5.2.2). Furthermore, the Respondermust also make sureshall only accept message_1 if the selected cipher suite is the first cipher suite in SUITES_I thatunauthenticated data does not trigger any harmful actions. In particular,the Responder supports (see Section 5.2.3). Following thisapplies to EAD_1 and error messages. 7.5. Denial-of-Service EDHOC itself doesprocedure ensures that the selected cipher suite is the most preferred (by the Initiator) cipher suite supported by both parties. If the selected cipher suite is notprovide countermeasures against Denial-of- Service attacks. By sending a number of new or replayed message_1 an attacker may causetheResponder to allocate state, perform cryptographic operations, and amplify messages. To mitigate such attacks, an implementation SHOULD rely on lower layer mechanisms such asfirst cipher suite which theEcho optionResponder supports inCoAP [I-D.ietf-core-echo-request-tag] that forcesSUITES_I received in message_1, then Responder MUST discontinue theinitiator to demonstrate reachability at its apparent network address. An attacker can also send faked message_2, message_3, message_4, or errorprotocol, see Section 5.2.3. If SUITES_I inan attempt to trickmessage_1 is manipulated, then thereceiving party to send an error messageintegrity verification of message_2 containing the transcript hash TH_2 will fail and the Initiator will discontinue thesession.protocol. 7. Security Considerations 7.1. Security Properties EDHOCimplementations MAY evaluate if a received message is likely to have be forged by and attacker and ignore it without sending an error message or discontinuinginherits its security properties from thesession. 7.6. Implementation Considerations The availability of a secure random number generator is essential fortheoretical SIGMA-I protocol [SIGMA]. Using thesecurity of EDHOC. If no true random number generator is available, a truly random seed MUST be providedterminology froman external source and used[SIGMA], EDHOC provides forward secrecy, mutual authentication witha cryptographically secure pseudorandom number generator.aliveness, consistency, and peer awareness. Aseach pseudorandom number must only be used once, an implementation need to get a new truly random seed after reboot, or continuously store statedescribed innonvolatile memory, see ([RFC8613], Appendix B.1.1) for issues and solution approaches for writing[SIGMA], peer awareness is provided tononvolatile memory. Intentionally or unintentionally weak or predictable pseudorandom number generators can be abused or exploited for malicious purposes. [RFC8937] describes a way for security protocol implementationsthe Responder, but not toaugment their (pseudo)random number generators using a long-term private keysthe Initiator. EDHOC protects the credential identifier of the Initiator against active attacks anda deterministic signature function. This improves randomness from broken or otherwise subverted random number generators.the credential identifier of the Responder against passive attacks. Thesame idea canroles should beused with other secretsassigned to protect the most sensitive identity/identifier, typically that which is not possible to infer from routing information in the lower layers. Compared to [SIGMA], EDHOC adds an explicit method type andfunctionsexpands the message authentication coverage to additional elements such asa Diffie-Hellman function or a symmetric secretalgorithms, external authorization data, anda PRF like HMACprevious messages. This protects against an attacker replaying messages orKMAC. It is RECOMMENDED to not trust a single sourceinjecting messages from another session. EDHOC also adds selection ofrandomnessconnection identifiers andto not put unaugmented random numbers ondowngrade protected negotiation of cryptographic parameters, i.e., an attacker cannot affect thewire. If ECDSA is supported, "deterministic ECDSA" as specified in [RFC6979] MAY be used. Pure deterministic elliptic-curve signatures such as deterministic ECDSA and EdDSA have gained popularity over randomized ECDSA as their security do not depend on a sourcenegotiated parameters. A single session ofhigh- quality randomness. Recent research has however found that implementationsEDHOC does not include negotiation ofthese signature algorithms may be vulnerablecipher suites, but it enables the Responder tocertain side-channelverify that the selected cipher suite is the most preferred cipher suite by the Initiator which is supported by both the Initiator andfault injection attacks due to their determinism. See e.g. Section 1 of [I-D.mattsson-cfrg-det-sigs-with-noise] for a list of attack papers.the Responder. Assuggested in Section 6.1.2 of [I-D.ietf-cose-rfc8152bis-algs] this can be addressedrequired bycombining randomness and determinism. All private keys, symmetric keys, and IVs MUST be secret. Implementations should provide countermeasures[RFC7258], IETF protocols need toside-channel attacks such as timing attacks. Intermediate computed values such asmitigate pervasive monitoring when possible. EDHOC therefore only supports methods with ephemeralECDH keys and ECDH shared secrets MUST be deleted after key derivation is completed. The InitiatorDiffie-Hellman andthe Responder are responsibleprovides a KeyUpdate function forverifyinglightweight application protocol rekeying with forward secrecy, in theintegrity of certificates. The selectionsense that compromise oftrusted CAs should be done very carefully and certificate revocation should be supported. Thethe private authentication keysMUST be kept secret. The Initiatordoes not compromise past session keys, and compromise of a session key does not compromise past session keys. While theResponder are allowedKeyUpdate method can be used toselect the connection identifiers C_Imeet cryptographic limits andC_R, respectively, for the other party to use in the ongoingprovide partial protection against key leakage, it provides significantly weaker security properties than re-running EDHOCprotocol as well as in a subsequent application protocol (e.g. OSCORE [RFC8613]). The choicewith ephemeral Diffie-Hellman. Even with frequent use ofconnection identifier is not security critical inKeyUpdate, compromise of one session key compromises all future session keys, and an attacker therefore only needs to perform static key exfiltration [RFC7624]. Frequently re-running EDHOCbut intendedwith ephemeral Diffie-Hellman forces attackers tosimplify the retrievalperform dynamic key exfiltration instead of static key exfiltration [RFC7624]. In theright security context in combination with using short identifiers. Ifdynamic case, thewrong connection identifier ofattacker must have continuous interactions with theother partycollaborator, which isused inmore complicated and has aprotocol messagehigher risk profile than the static case. To limit the effect of breaches, itwill result inis important to limit thereceiving party not being ableuse of symmetrical group keys for bootstrapping. EDHOC therefore strives toretrievemake the additional cost of using raw public keys and self-signed certificates as small as possible. Raw public keys and self-signed certificates are not asecurity context (which will terminatereplacement for a public key infrastructure but SHOULD be used instead of symmetrical group keys for bootstrapping. Compromise of theprotocol)long-term keys (private signature orretrievestatic DH keys) does not compromise thewrongsecuritycontext (which also terminates the protocol asof completed EDHOC exchanges. Compromising themessage cannot be verified). If two nodes unintentionally initiate two simultaneousprivate authentication keys of one party lets an active attacker impersonate that compromised party in EDHOCmessageexchanges witheachothereven if they only want to complete a single EDHOC message exchange, they MAY terminateparties but does not let theexchangeattacker impersonate other parties in EDHOC exchanges with thelexicographically smallest G_X. Ifcompromised party. Compromise of thetwo G_X values are equal,long-term keys does not enable a passive attacker to compromise future session keys. Compromise of thereceived message_1 MUST be discardedHDKF input parameters (ECDH shared secret) leads tomitigate reflection attacks. Notecompromise of all session keys derived from thatin the casecompromised shared secret. Compromise oftwo simultaneous EDHOC exchanges where the nodes only completeoneand where the nodes have different preferred cipher suites, an attacker can affect whichsession key does not compromise other session keys. Compromise of PRK_4x3m leads to compromise of all exported keying material derived after thetwo nodes' preferred cipher suites will be used by blocking the other exchange. If supported bylast invocation of thedevice, itEDHOC-KeyUpdate function. EDHOC provides a minimum of 64-bit security against online brute force attacks and a minimum of 128-bit security against offline brute force attacks. This isRECOMMENDED that at least the long- term private keys are storedina Trusted Execution Environment (TEE)line with IPsec, TLS, andthat sensitive operations using these keys are performed inside the TEE.COSE. Toachieve even higherbreak 64-bit securityitagainst online brute force an attacker would on average have to send 4.3 billion messages per second for 68 years, which isRECOMMENDED thatinfeasible inadditional operations such as ephemeral key generation, all computations of shared secrets, and storage ofconstrained IoT radio technologies. After sending message_3, thepseudorandom keys (PRK) can be done insideInitiator is assured that no other party than theTEE.Responder can compute the key PRK_4x3m (implicit key authentication). Theuse of a TEE enforces that code withinInitiator does however not know thatenvironment cannot be tampered with,the Responder has actually computed the key PRK_4x3m. While the Initiator can securely send protected application data, the Initiator SHOULD NOT permanently store the keying material PRK_4x3m and TH_4 until the Initiator is assured thatany data used by such code cannot be readthe Responder has actually computed the key PRK_4x3m (explicit key confirmation). Explicit key confirmation is e.g., assured when the Initiator has verified an OSCORE message ortampered with by code outsidemessage_4 from the Responder. After verifying message_3, the Responder is assured thatenvironment. Notethe Initiator has calculated the key PRK_4x3m (explicit key confirmation) and thatnon-EDHOC code insideno other party than theTEE might still be able to read EDHOCResponder can compute the key. The Responder can securely send protected application data andtamper withstore the keying material PRK_4x3m and TH_4. Key compromise impersonation (KCI): In EDHOCcode, to protect against such attacksauthenticated with signature keys, EDHOCneeds to be in its own zone. To provide betterprovides KCI protection againstsome forms of physical attacks, sensitive EDHOC data should be stored insidean attacker having access to theSoClong-term key orencrypted and integrity protected when sent on a data bus (e.g. betweentheCPU and RAM or Flash). Secure boot canephemeral secret key. With static Diffie-Hellman key authentication, KCI protection would beusedprovided against an attacker having access toincreasethesecurity of code and data inlong-term Diffie- Hellman key, but not to an attacker having access to theRich Execution Environment (REE) by validatingephemeral secret key. Note that theREE image. 8. IANA Considerations 8.1. EDHOC Exporter Label IANAterm KCI hascreated a new registry titled "EDHOC Exporter Label" under the new heading "EDHOC". The registration procedure is "Expert Review". The columnstypically been used for compromise ofthe registry are Label, Description,long-term keys, andReference. All columns are text strings. The initial contents of the registry are: Label: EDHOC_message_4_Key Description: Key used to protect EDHOC message_4 Reference: [[this document]] Label: EDHOC_message_4_Nonce Description: Nonce usedthat an attacker with access toprotect EDHOC message_4 Reference: [[this document]] Label: OSCORE Master Secret Description: Derived OSCORE Master Secret Reference: [[this document]] Label: OSCORE Master Salt Description: Derived OSCORE Master Salt Reference: [[this document]] 8.2.the ephemeral secret key can only attack that specific protocol run. Repudiation: In EDHOCCipher Suites Registry IANA has created a new registry titled "EDHOC Cipher Suites" underauthenticated with signature keys, thenew heading "EDHOC". The registration procedure is "Expert Review". The columnsInitiator could theoretically prove that the Responder performed a run of theregistry are Value, Array, Description, and Reference, where Value is an integerprotocol by presenting the private ephemeral key, and vice versa. Note that storing theother columns are text strings. The initial contentsprivate ephemeral keys violates the protocol requirements. With static Diffie-Hellman key authentication, both parties can always deny having participated in the protocol. Two earlier versions of EDHOC have been formally analyzed [Norrman20] [Bruni18] and theregistry are: Value: -24 Algorithms: N/A Desc: Reserved for Private Use Reference: [[this document]] Value: -23 Algorithms: N/A Desc: Reserved for Private Use Reference: [[this document]] Value: -22 Algorithms: N/A Desc: Reserved for Private Use Reference: [[this document]] Value: -21 Algorithms: N/A Desc: Reserved for Private Use Reference: [[this document]] Value: 0 Array: 10, -16, 4, -8, 10, -16 Desc: AES-CCM-16-64-128, SHA-256, X25519, EdDSA, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] Value: 1 Array: 30, -16, 4, -8, 10, -16 Desc: AES-CCM-16-128-128, SHA-256, X25519, EdDSA, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] Value: 2 Array: 10, -16, 1, -7, 10, -16 Desc: AES-CCM-16-64-128, SHA-256, P-256, ES256, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] Value: 3 Array: 30, -16, 1, -7, 10, -16 Desc: AES-CCM-16-128-128, SHA-256, P-256, ES256, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] Value: 4 Array: 24, -16, 4, -8, 24, -16 Desc: ChaCha20/Poly1305, SHA-256, X25519, EdDSA, ChaCha20/Poly1305, SHA-256 Reference: [[this document]] Value: 5 Array: 24, -16, 1, -7, 24, -16 Desc: ChaCha20/Poly1305, SHA-256, P-256, ES256, ChaCha20/Poly1305, SHA-256 Reference: [[this document]] Value: 6 Array: 1, -16, 4, -7, 1, -16 Desc: A128GCM, SHA-256, X25519, ES256, A128GCM, SHA-256 Reference: [[this document]] Value: 24 Array: 3, -43, 2, -35, 3, -43 Desc: A256GCM, SHA-384, P-384, ES384, A256GCM, SHA-384 Reference: [[this document]] Value: 25 Array: 24, -45, 5, -8, 24, -45 Desc: ChaCha20/Poly1305, SHAKE256, X448, EdDSA, ChaCha20/Poly1305, SHAKE256 Reference: [[this document]] 8.3. EDHOC Method Type Registry IANA has created a new registry entitled "EDHOC Method Type" under the new heading "EDHOC". The registration procedure is "Expert Review". The columns of the registry are Value, Description, and Reference, where Value is an integer and the other columns are text strings. The initial contents of the registry is shown in Figure 4. 8.4. EDHOC Error Codes Registry IANA has created a new registry entitled "EDHOC Error Codes" under the new heading "EDHOC". The registration procedure is "Specification Required". The columns of the registry are ERR_CODE, ERR_INFO Type and Description, where ERR_CODE is an integer, ERR_INFO is a CDDL defined type, and Description is a text string. The initial contents of the registry is shown in Figure 6. 8.5. COSE Header Parameters Registry This document registers the following entries in the "COSE Header Parameters" registry under the "CBOR Object Signing and Encryption (COSE)" heading. The value of the 'cwt' header parameter is a CWT [RFC8392] or an unprotected CWT Claims Set [I-D.ietf-rats-uccs]. +-----------+-------+----------------+------------------------------+ | Name | Label | Value Type | Description | +===========+=======+================+==============================+ | cwt | TBD1 | COSE_Messages | A CBOR Web Token (CWT) or an | | | | / map | unprotected CWT Claims Set | +-----------+-------+----------------+------------------------------+ 8.6. COSE Header Parameters Registry IANA has added the COSE header parameter 'kid2' to the COSE Header Parameters registry. The kid2 parameter may point to a COSE key common parameter 'kid' or 'kid2'. The kid2 parameter can be used to identify a key stored in a "raw" COSE_Key, in a CWT, or in a certificate. The Value Reference for this item is empty and omitted from the table below. +------+-------+------------+----------------+-------------------+ | Name | Label | Value Type | Description | Reference | +------+-------+------------+----------------+-------------------+ | kid2 | TBD | bstr / int | Key identifier | [[This document]] | +------+-------+------------+----------------+-------------------+ 8.7. COSE Key Common Parameters Registry IANA has added the COSE key common parameter 'kid2' to the COSE Key Common Parameters registry. The Value Reference for this item is empty and omitted from the table below. +------+-------+------------+----------------+-------------------+ | Name | Label | Value Type | Description | Reference | +------+-------+------------+----------------+-------------------+ | kid2 | TBD | bstr / int | Key identifi- | [[This document]] | | | | | cation value - | | | | | | match to kid2 | | | | | | in message | | +------+-------+------------+----------------+-------------------+ 8.8. The Well-Known URI Registry IANA has added the well-known URI 'edhoc' to the Well-Known URIs registry. o URI suffix: edhoc o Change controller: IETF o Specification document(s): [[this document]] o Related information: None 8.9. Media Types Registry IANA has added the media type 'application/edhoc' to the Media Types registry. o Type name: application o Subtype name: edhoc o Required parameters: N/A o Optional parameters: N/A o Encoding considerations: binary o Security considerations: See Section 7 of this document. o Interoperability considerations: N/A o Published specification: [[this document]] (this document) o Applications that use this media type: To be identified o Fragment identifier considerations: N/A o Additional information: * Magic number(s): N/A * File extension(s): N/A * Macintosh file type code(s): N/A o Person & email address to contact for further information: See "Authors' Addresses" section. o Intended usage: COMMON o Restrictions on usage: N/A o Author: See "Authors' Addresses" section. o Change Controller: IESG 8.10. CoAP Content-Formats Registry IANA has added the media type 'application/edhoc' to the CoAP Content-Formats registry. o Media Type: application/edhoc o Encoding: o ID: TBD42 o Reference: [[this document]] 8.11. EDHOC External Authorization Data IANA has created a new registry entitled "EDHOC External Authorization Data" under the new heading "EDHOC". The registration procedure is "Expert Review". The columns of the registry are Value, Description, and Reference, where Value is an integer and the other columns are text strings. 8.12. Expert Review Instructions The IANA Registries established in this document is defined as "Expert Review". 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. Expert reviewers should take into consideration the following points: o Clarity and correctness of registrations. Experts are expected to check the clarity of purpose and use of the requested entries. Expert needs to make sure the values of algorithms are taken from the right registry, when that's required. Expert should consider requesting an opinion on the correctness of registered parameters from relevant IETF working groups. Encodings that do not meet these objective of clarity and completeness should not be registered. o Experts should take into account the expected usage of fields when approving point assignment. 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. o Specifications are recommended. When specifications are not provided, the description provided needs to have sufficient information to verify the points above. 9. References 9.1. Normative References [I-D.ietf-core-echo-request-tag] Amsuess, C., Mattsson, J. P., and G. Selander, "CoAP: Echo, Request-Tag, and Token Processing", draft-ietf-core- echo-request-tag-12 (work in progress), February 2021. [I-D.ietf-cose-rfc8152bis-algs] Schaad, J., "CBOR Object Signing and Encryption (COSE): Initial Algorithms", draft-ietf-cose-rfc8152bis-algs-12 (work in progress), September 2020. [I-D.ietf-cose-rfc8152bis-struct] Schaad, J., "CBOR Object Signing and Encryption (COSE): Structures and Process", draft-ietf-cose-rfc8152bis- struct-15 (work in progress), February 2021. [I-D.ietf-cose-x509] Schaad, J., "CBOR Object Signing and Encryption (COSE): Header parameters for carrying and referencing X.509 certificates", draft-ietf-cose-x509-08 (work in progress), December 2020. [I-D.ietf-lake-reqs] Vucinic, M., Selander, G., Mattsson, J. P., and D. Garcia- Carrillo, "Requirements for a Lightweight AKE for OSCORE", draft-ietf-lake-reqs-04 (work in progress), June 2020. [I-D.ietf-rats-uccs] Birkholz, H., O'Donoghue, J., Cam-Winget, N., and C. Bormann, "A CBOR Tag for Unprotected CWT Claims Sets", draft-ietf-rats-uccs-00 (work in progress), May 2021. [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>. [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, <https://www.rfc-editor.org/info/rfc5116>. [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand Key Derivation Function (HKDF)", RFC 5869, DOI 10.17487/RFC5869, May 2010, <https://www.rfc-editor.org/info/rfc5869>. [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic Curve Cryptography Algorithms", RFC 6090, DOI 10.17487/RFC6090, February 2011, <https://www.rfc-editor.org/info/rfc6090>. [RFC6979] Pornin, T., "Deterministic Usage of the Digital Signature Algorithm (DSA) and Elliptic Curve Digital Signature Algorithm (ECDSA)", RFC 6979, DOI 10.17487/RFC6979, August 2013, <https://www.rfc-editor.org/info/rfc6979>. [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>. [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>. [RFC7959] Bormann, C. and Z. Shelby, Ed., "Block-Wise Transfers in the Constrained Application Protocol (CoAP)", RFC 7959, DOI 10.17487/RFC7959, August 2016, <https://www.rfc-editor.org/info/rfc7959>. [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>. [RFC8376] Farrell, S., Ed., "Low-Power Wide Area Network (LPWAN) Overview", RFC 8376, DOI 10.17487/RFC8376, May 2018, <https://www.rfc-editor.org/info/rfc8376>. [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>. [RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, June 2019, <https://www.rfc-editor.org/info/rfc8610>. [RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, "Object Security for Constrained RESTful Environments (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, <https://www.rfc-editor.org/info/rfc8613>. [RFC8724] Minaburo, A., Toutain, L., Gomez, C., Barthel, D., and JC. Zuniga, "SCHC: Generic Framework for Static Context Header Compression and Fragmentation", RFC 8724, DOI 10.17487/RFC8724, April 2020, <https://www.rfc-editor.org/info/rfc8724>. [RFC8742] Bormann, C., "Concise Binary Object Representation (CBOR) Sequences", RFC 8742, DOI 10.17487/RFC8742, February 2020, <https://www.rfc-editor.org/info/rfc8742>. [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", STD 94, RFC 8949, DOI 10.17487/RFC8949, December 2020, <https://www.rfc-editor.org/info/rfc8949>. 9.2. Informative References [Bruni18] Bruni, A., Sahl Joergensen, T., Groenbech Petersen, T., and C. Schuermann, "Formal Verification of Ephemeral Diffie-Hellman Over COSE (EDHOC)", November 2018, <https://www.springerprofessional.de/en/formal- verification-of-ephemeral-diffie-hellman-over-cose- edhoc/16284348>. [CborMe] Bormann, C., "CBOR Playground", May 2018, <http://cbor.me/>. [CNSA] (Placeholder), ., "Commercial National Security Algorithm Suite", August 2015, <https://apps.nsa.gov/iaarchive/programs/iad-initiatives/ cnsa-suite.cfm>. [I-D.ietf-core-oscore-edhoc] Palombini, F., Tiloca, M., Hoeglund, R., Hristozov, S., and G. Selander, "Combining EDHOC and OSCORE", draft-ietf- core-oscore-edhoc-00 (work in progress), April 2021. [I-D.ietf-core-resource-directory] Amsuess, C., Shelby, Z., Koster, M., Bormann, C., and P. V. D. Stok, "CoRE Resource Directory", draft-ietf-core- resource-directory-28 (work in progress), March 2021. [I-D.ietf-cose-cbor-encoded-cert] Raza, S., Hoeglund, J., Selander, G., Mattsson, J. P., and M. Furuhed, "CBOR Encoded X.509 Certificates (C509 Certificates)", draft-ietf-cose-cbor-encoded-cert-00 (work in progress), April 2021. [I-D.ietf-lwig-security-protocol-comparison] Mattsson, J. P., Palombini, F., and M. Vucinic, "Comparison of CoAP Security Protocols", draft-ietf-lwig- security-protocol-comparison-05 (work in progress), November 2020. [I-D.ietf-tls-dtls13] Rescorla, E., Tschofenig, H., and N. Modadugu, "The Datagram Transport Layer Security (DTLS) Protocol Version 1.3", draft-ietf-tls-dtls13-43 (work in progress), April 2021. [I-D.mattsson-cfrg-det-sigs-with-noise] Mattsson, J. P., Thormarker, E., and S. Ruohomaa, "Deterministic ECDSA and EdDSA Signatures with Additional Randomness", draft-mattsson-cfrg-det-sigs-with-noise-02 (work in progress), March 2020. [I-D.selander-ace-ake-authz] Selander, G., Mattsson, J. P., Vucinic, M., Richardson, M., and A. Schellenbaum, "Lightweight Authorization for Authenticated Key Exchange.", draft-selander-ace-ake- authz-02 (work in progress), November 2020. [Norrman20] Norrman, K., Sundararajan, V., and A. Bruni, "Formal Analysis of EDHOC Key Establishment for Constrained IoT Devices", September 2020, <https://arxiv.org/abs/2007.11427>. [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for Constrained-Node Networks", RFC 7228, DOI 10.17487/RFC7228, May 2014, <https://www.rfc-editor.org/info/rfc7228>. [RFC7258] Farrell, S. and H. Tschofenig, "Pervasive Monitoring Is an Attack", BCP 188, RFC 7258, DOI 10.17487/RFC7258, May 2014, <https://www.rfc-editor.org/info/rfc7258>. [RFC7296] Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. Kivinen, "Internet Key Exchange Protocol Version 2 (IKEv2)", STD 79, RFC 7296, DOI 10.17487/RFC7296, October 2014, <https://www.rfc-editor.org/info/rfc7296>. [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, <https://www.rfc-editor.org/info/rfc8446>. [RFC8937] Cremers, C., Garratt, L., Smyshlyaev, S., Sullivan, N., and C. Wood, "Randomness Improvements for Security Protocols", RFC 8937, DOI 10.17487/RFC8937, October 2020, <https://www.rfc-editor.org/info/rfc8937>. [SECG] "Standards for Efficient Cryptography 1 (SEC 1)", May 2009, <https://www.secg.org/sec1-v2.pdf>. [SIGMA] Krawczyk, H., "SIGMA - The 'SIGn-and-MAc' Approach to Authenticated Diffie-Hellman and Its Use in the IKE- Protocols (Long version)", June 2003, <http://webee.technion.ac.il/~hugo/sigma-pdf.pdf>. [SP-800-56A] Barker, E., Chen, L., Roginsky, A., Vassilev, A., and R. Davis, "Recommendation for Pair-Wise Key-Establishment Schemes Using Discrete Logarithm Cryptography", NIST Special Publication 800-56A Revision 3, April 2018, <https://doi.org/10.6028/NIST.SP.800-56Ar3>. Appendix A. Use with OSCORE and Transfer over CoAP This sppendix describes how to select EDHOC connection identifiers and derive an OSCORE security context when OSCORE is used with EDHOC, and how to transfer EDHOC messages over CoAP. A.1. Selecting EDHOC Connection Identifier This section specifies a rule for converting from EDHOC connection identifier to OSCORE Sender/Recipient ID. (An identifier is Sender ID or Recipient ID depending on from which endpoint is the point of view, see Section 3.1 of [RFC8613].) o If the EDHOC connection identifier is numeric, i.e. encoded as a CBOR integer on the wire, it is converted to a (naturally byte- string shaped) OSCORE Sender/Recipient ID equal to its CBOR encoded form. For example, a numeric C_R equal to 10 (0x0A in CBOR encoding) is converted to a (typically client) Sender ID equal to 0x0A, while a numeric C_I equal to -12 (0x2B in CBOR encoding) is converted to a (typically client) Sender ID equal to 0x2B. o If the EDHOC connection identifier is byte-valued, hence encoded as a CBOR byte string on the wire, it is converted to an OSCORE Sender/Recipient ID equal to the byte string. For example, a byte-string valued C_R equal to 0xFF (0x41FF in CBOR encoding) is converted to a (typically client) Sender ID equal to 0xFF. Two EDHOC connection identifiers are called "equivalent" if and only if, by applying the conversion above, they both result in the same OSCORE Sender/Recipient ID. For example, the two EDHOC connection identifiers with CBOR encoding 0x0A (numeric) and 0x410A (byte- valued) are equivalent since they both result in the same OSCORE Sender/Recipient ID 0x0A. When EDHOC is used to establish an OSCORE security context, the connection identifiers C_I and C_R MUST NOT be equivalent. Furthermore, in case of multiple OSCORE security contexts with potentially different endpoints, to facilitate retrieval of the correct OSCORE security context, an endpoint SHOULD select an EDHOC connection identifier that when converted to OSCORE Recipient ID does not coincide with its other Recipient IDs. A.2. Deriving the OSCORE Security Context This section specifies how to use EDHOC output to derive the OSCORE security context. After successful processing of EDHOC message_3, Client and Server derive Security Context parameters for OSCORE as follows (see Section 3.2 of [RFC8613]): o The Master Secret and Master Salt are derived by using the EDHOC- Exporter interface, see Section 4.1. The EDHOC Exporter Labels for deriving the OSCORE Master Secret and the OSCORE Master Salt, are "OSCORE Master Secret" and "OSCORE Master Salt", respectively. The context parameter is h'' (0x40), the empty CBOR byte string. By default, key_length is the key length (in bytes) of the application AEAD Algorithm of the selected cipher suite for the EDHOC session. Also by default, salt_length has value 8. The Initiator and Responder MAY agree out-of-band on a longer key_length than the default and on a different salt_length. Master Secret = EDHOC-Exporter( "OSCORE Master Secret", h'', key_length ) Master Salt = EDHOC-Exporter( "OSCORE Master Salt", h'', salt_length ) o The AEAD Algorithm is the application AEAD algorithm of the selected cipher suite for the EDHOC session. o The HKDF Algorithm is the one based on the application hash algorithm of the selected cipher suite for the EDHOC session. For example, if SHA-256 is the application hash algorithm of the selected ciphersuite, HKDF SHA-256 is used as HKDF Algorithm in the OSCORE Security Context. o In case the Client is Initiator and the Server is Responder, the Client's OSCORE Sender ID and the Server's OSCORE Sender ID are determined from the EDHOC connection identifiers C_R and C_I for the EDHOC session, respectively, by applying the conversion in Appendix A.1. The reverse applies in case the Client is the Responder and the Server is the Initiator. Client and Server use the parameters above to establish an OSCORE Security Context, as per Section 3.2.1 of [RFC8613]. From then on, Client and Server retrieve the OSCORE protocol state using the Recipient ID, and optionally other transport information such as the 5-tuple. A.3. Transferring EDHOC over CoAP This section specifies one instance for how EDHOC can be transferred as an exchange of CoAP [RFC7252] messages. CoAP is a reliable transport that can preserve packet ordering and handle message duplication. CoAP can also perform fragmentation and protect against denial of service attacks. According to this specification, EDHOC messages are carried in Confirmable messages, which is beneficial especially if fragmentation is used. By default, the CoAP client is the Initiator and the CoAP server is the Responder, but the roles SHOULD be chosen to protect the most sensitive identity, see Section 7. According to this specification, EDHOC is transferred in POST requests and 2.04 (Changed) responses to the Uri-Path: "/.well-known/edhoc". An application may define its own path that can be discovered, e.g., using resource directory [I-D.ietf-core-resource-directory]. By default, the message flow is as follows: EDHOC message_1 is sent in the payload of a POST request from the client to the server's resource for EDHOC. EDHOC message_2 or the EDHOC error message is sent from the server to the client in the payload of a 2.04 (Changed) response. EDHOC message_3 or the EDHOC error message is sent from the client to the server's resource in the payload of a POST request. If needed, an EDHOC error message is sent from the server to the client in the payload of a 2.04 (Changed) response. Alternatively, if EDHOC message_4 is used, it is sent from the server to the client in the payload of a 2.04 (Changed) response analogously to message_2. In order to correlate a message received from a client to a message previously sent by the server, messages sent by the client are prepended with the CBOR serialization of the connection identifier which the server has chosen. This applies independently of if the CoAP server is Responder or Initiator. For the default case when the server is Responder, the prepended connection identifier is C_R, and C_I if the server is Initiator. If message_1 is sent to the server, the CBOR simple value "null" (0xf6) is sent in its place (given that the server has not selected C_R yet). These identifiers are encoded in CBOR and thus self-delimiting. They are sent in front of the actual EDHOC message, and only the part of the body following the identifier is used for EDHOC processing. Consequently, the application/edhoc media type does not apply to these messages; their media type is unnamed. An example of a successful EDHOC exchange using CoAP is shown in Figure 9. In this case the CoAP Token enables correlation on the Initiator side, and the prepended C_R enables correlation on the Responder (server) side. Client Server | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Payload: null, EDHOC message_1 | | |<---------+ Header: 2.04 Changed | 2.04 | Content-Format: application/edhoc | | Payload: EDHOC message_2 | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Payload: C_R, EDHOC message_3 | | |<---------+ Header: 2.04 Changed | 2.04 | | | Figure 9: Transferring EDHOC in CoAP when the Initiator is CoAP Client The exchange in Figure 9 protects the client identity against active attackers and the server identity against passive attackers. An alternative exchange that protects the server identity against active attackers and the client identity against passive attackers is shown in Figure 10. In this case the CoAP Token enables the Responder to correlate message_2 and message_3, and the prepended C_I enables correlation on the Initiator (server) side. If EDHOC message_4 is used, C_I is prepended, and it is transported with CoAP in the payload of a POST request with a 2.04 (Changed) response. Client Server | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | |<---------+ Header: 2.04 Changed | 2.04 | Content-Format: application/edhoc | | Payload: EDHOC message_1 | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Payload: C_I, EDHOC message_2 | | |<---------+ Header: 2.04 Changed | 2.04 | Content-Format: application/edhoc | | Payload: EDHOC message_3 | | Figure 10: Transferring EDHOC in CoAP when the Initiator is CoAP Server To protect against denial-of-service attacks, the CoAP server MAY respond to the first POST request with a 4.01 (Unauthorized) containing an Echo option [I-D.ietf-core-echo-request-tag]. This forces the initiator to demonstrate its reachability at its apparent network address. If message fragmentation is needed, the EDHOC messages may be fragmented using the CoAP Block-Wise Transfer mechanism [RFC7959]. EDHOC does not restrict how error messages are transported with CoAP, as long as the appropriate error message can to be transported in response to a message that failed (see Section 6). A.3.1. Transferring EDHOC and OSCORE over CoAP A method for combining EDHOC and OSCORE protocols in two round-trips is specified in [I-D.ietf-core-oscore-edhoc]. When using EDHOC over CoAP for establishing an OSCORE Security Context, EDHOC error messages sent as CoAP responses MUST be error responses, i.e., they MUST specify a CoAP error response code. In particular, it is RECOMMENDED that such error responses have response code either 4.00 (Bad Request) in case of client error (e.g., due to a malformed EDHOC message), or 5.00 (Internal Server Error) in case of server error (e.g., due to failure in deriving EDHOC key material). Appendix B. Compact Representation As described in Section 4.2 of [RFC6090] the x-coordinate of an elliptic curve public key is a suitable representative for the entire point whenever scalar multiplication is used as a one-way function. One example is ECDH with compact output, where only the x-coordinate of the computed value is used as the shared secret. This section defines a format for compact representation based on the Elliptic-Curve-Point-to-Octet-String Conversion defined in Section 2.3.3 of [SECG]. Using the notation from [SECG], the output is an octet string of length ceil( (log2 q) / 8 ). See [SECG] for a definition of q, M, X, xp, and ~yp. The steps in Section 2.3.3 of [SECG] are replaced by: 1. Convert the field element xp to an octet string X of length ceil( (log2 q) / 8 ) octets using the conversion routine specified in Section 2.3.5 of [SECG]. 2. Output M = X The encoding of the point at infinity is not supported. Compact representation does not change any requirements on validation. If a y-coordinate is required for validation or compatibily with APIs the value ~yp SHALL be set to zero. For such use, the compact representation can be transformed into the SECG point compressed format by prepending it with the single byte 0x02 (i.e. M = 0x02 || X). Using compact representation have some security benefits. An implementation does not need to check that the point is not the point at infinity (the identity element). Similarly, as not even the sign of the y-coordinate is encoded, compact representation trivially avoids so called "benign malleability" attacks where an attacker changes the sign, see [SECG]. Appendix C. Use of CBOR, CDDL and COSE in EDHOC This Appendix is intended to simplify for implementors not familiar with CBOR [RFC8949], CDDL [RFC8610], COSE [I-D.ietf-cose-rfc8152bis-struct], and HKDF [RFC5869]. C.1. CBOR and CDDL The Concise Binary Object Representation (CBOR) [RFC8949] is a data format designed for small code size and small message size. CBOR builds on the JSON data model but extends it by e.g. encoding binary data directly without base64 conversion. In addition to the binary CBOR encoding, CBOR also has a diagnostic notation that is readable and editable by humans. The Concise Data Definition Language (CDDL) [RFC8610] provides a way to express structures for protocol messages and APIs that use CBOR. [RFC8610] also extends the diagnostic notation. CBOR data items are encoded to or decoded from byte strings using a type-length-value encoding scheme, where the three highest order bits of the initial byte contain information about the major type. CBOR supports several different types of data items, in addition to integers (int, uint), simple values (e.g. null), byte strings (bstr), and text strings (tstr), CBOR also supports arrays [] of data items, maps {} of pairs of data items, and sequences [RFC8742] of data items. Some examples are given below. For a complete specification and more examples, see [RFC8949] and [RFC8610]. We recommend implementors to get used to CBOR by using the CBOR playground [CborMe]. Diagnostic Encoded Type ------------------------------------------------------------------ 1 0x01 unsigned integer 24 0x1818 unsigned integer -24 0x37 negative integer -25 0x3818 negative integer null 0xf6 simple value h'12cd' 0x4212cd byte string '12cd' 0x4431326364 byte string "12cd" 0x6431326364 text string { 4 : h'cd' } 0xa10441cd map << 1, 2, null >> 0x430102f6 byte string [ 1, 2, null ] 0x830102f6 array ( 1, 2, null ) 0x0102f6 sequence 1, 2, null 0x0102f6 sequence ------------------------------------------------------------------ C.2. CDDL Definitions This sections compiles the CDDL definitions for ease of reference. suite = int SUITES_R : [ supported : 2* suite ] / suite message_1 = ( METHOD : int, SUITES_I : [ selected : suite, supported : 2* suite ] / suite, G_X : bstr, C_I : bstr / int, ? EAD ; EAD_1 ) message_2 = ( data_2, CIPHERTEXT_2 : bstr, ) data_2 = ( G_Y : bstr, C_R : bstr / int, ) message_3 = ( CIPHERTEXT_3 : bstr, ) message_4 = ( CIPHERTEXT_4 : bstr, ) error = ( ERR_CODE : int, ERR_INFO : any ) info = [ edhoc_aead_id : int / tstr, transcript_hash : bstr, label : tstr, length : uint ] C.3. COSE CBOR Object Signing and Encryption (COSE) [I-D.ietf-cose-rfc8152bis-struct] describes how to create and process signatures, message authentication codes, and encryption using CBOR. COSE buildsspecification has been updated based onJOSE, but is adapted to allow more efficient processing in constrained devices. EDHOC makes use of COSE_Key, COSE_Encrypt0, and COSE_Sign1 objects. Appendix D. Test Vectors NOTE 0. These test vectors are compatible with versions -05 and -06 ofthespecification. This appendix provides detailed test vectors to ease implementation and ensure interoperability. In addition to hexadecimal, all CBOR data items and sequences are given in CBOR diagnostic notation.analysis. 7.2. Cryptographic Considerations Thetest vectors use the default mapping to CoAP where the Initiator acts as CoAP client (this meansSIGMA protocol requires thatcorr = 1). A more extensive test vector suite covering more combinations of authentication method used between Initiator and Responder and related code to generate them can be found at https://github.com/ lake-wg/edhoc/tree/master/test-vectors-05. NOTE 1. In the previous and current test vectors the same name is used for certain byte strings and their CBOR bstr encodings. For example the transcript hash TH_2 is used to denote boththeoutputencryption ofthe hash functionmessage_3 provides confidentiality against active attackers and EDHOC message_4 relies on theinput intouse of authenticated encryption. Hence thekey derivation function, whereasmessage authenticating functionality of thelatterauthenticated encryption in EDHOC is critical: authenticated encryption MUST NOT be replaced by plain encryption only, even if authentication is provided at another level or through aCBOR bstr encodingdifferent mechanism. To reduce message overhead EDHOC does not use explicit nonces and instead rely on the ephemeral public keys to provide randomness to each session. A good amount of randomness is important for theformer. Some attempts are madekey generation, toclarify that inprovide liveness, and to protect against interleaving attacks. For thisAppendix (e.g. using "CBOR encoded"/"CBOR unencoded"). NOTE 2. If not clear fromreason, thecontext, remember that CBOR sequences and CBOR arrays assume CBOR encoded data items as elements. D.1. Test Vectors for EDHOC Authenticated with Signature Keys (x5t) EDHOC with signature authenticationephemeral keys MUST NOT be reused, andX.509 certificates is used. In this test vector,both parties SHALL generate fresh random ephemeral key pairs. As discussed, thehash value 'x5t' is used[SIGMA], the encryption of message_2 does only need toidentifyprotect against passive attacker as active attackers can always get thecertificate. The optional C_1 in message_1 is omitted. No external authorization data is sent inResponders identity by sending their own message_1. EDHOC uses themessage exchange. method (Signature Authentication) 0 CoAPExpand function (typically HKDF-Expand) as a binary additive stream cipher. HKDF-Expand provides better confidentiality than AES- CTR but is not often used astransport and the Initiator acts as CoAP client: corr (the Initiator can correlate message_1 and message_2) 1 From there, METHOD_CORR has the following value: METHOD_CORR (4 * method + corr) (int) 1 The Initiator indicates only one cipher suite init is slow on long messages, and most applications require both IND-CCA confidentiality as well as integrity protection. For the(potentially truncated) listencryption ofcipher suites. Supported Cipher Suites (1 byte) 00 The Initiator selected the indicated cipher suite. Selected Cipher Suite (int) 0 Cipher suite 0message_2, any speed difference issupportednegligible, IND-CCA does not increase security, and integrity is provided byboththeInitiatorinner MAC (and signature depending on method). Requirement for how to securely generate, validate, and process theResponder, see Section 3.6. D.1.1. Message_1 The Initiator generates its ephemeral key pair. X (Initiator's ephemeral private key) (32 bytes) 8f 78 1a 09 53 72 f8 5b 6d 9f 61 09 ae 42 26 11 73 4d 7d bf a0 06 9a 2d f2 93 5b b2 e0 53 bf 35 G_X (Initiator'sephemeral publickey, CBOR unencoded) (32 bytes) 89 8f f7 9a 02 06 7a 16 ea 1e cc b9 0f a5 22 46 f5 aa 4d d6 ec 07 6b ba 02 59 d9 04 b7 ec 8b 0c The Initiator chooses a connection identifier C_I: Connection identifier chosen by Initiator (1 byte) 09 Note that since C_I is a byte string inkeys depend on theinterval h'00' to h'2f', it is encoded aselliptic curve. For X25519 and X448, thecorresponding integer subtracted by 24. Thus 0x09 = 09, 9 - 24 = -15,requirements are defined in [RFC7748]. For secp256r1, secp384r1, and-15secp521r1, the requirements are defined inCBOR encodingSection 5 of [SP-800-56A]. For secp256r1, secp384r1, and secp521r1, at least partial public-key validation MUST be done. 7.3. Cipher Suites and Cryptographic Algorithms For many constrained IoT devices it isequalproblematic to0x2e. C_I (1 byte) 2e Since no external authorization data is sent: EAD_1 (0 bytes) The list of supportedsupport more than one ciphersuites needssuite. Existing devices can be expected tocontain the selectedsupport either ECDSA or EdDSA. To enable as much interoperability as we can reasonably achieve, less constrained devices SHOULD implement both ciphersuite. The initiator truncates the list of supportedsuite 0 (AES-CCM-16-64-128, SHA-256, X25519, EdDSA, AES-CCM- 16-64-128, SHA-256) and cipher suite 2 (AES-CCM-16-64-128, SHA-256, P-256, ES256, AES-CCM-16-64-128, SHA-256). Constrained endpoints SHOULD implement ciphersuites to onesuite 0 or cipher suiteonly. In this case there is2. Implementations onlyoneneed to implement the algorithms needed for their supported methods. When using private cipher suiteindicated, 00. Because one single selectedor registering new ciphersuite is conveyed, it is encoded as an int instead of an array: SUITES_I (int) 0 message_1 is constructed assuites, theCBOR Sequencechoice of key length used in thedata items above encoded as CBOR. In CBOR diagnostic notation: message_1 = ( 1, 0, h'898FF79A02067A16EA1ECCB90FA52246F5AA4DD6EC076BBA0259D904B7EC8B0C', -15 ) Which asdifferent algorithms needs to be harmonized, so that aCBOR encoded data item is: message_1 (CBOR Sequence) (37 bytes) 01 00 58 20 89 8f f7 9a 02 06 7a 16 ea 1e cc b9 0f a5 22 46 f5 aa 4d d6 ec 07 6b ba 02 59 d9 04 b7 ec 8b 0c 2e D.1.2. Message_2 Since METHOD_CORR mod 4 equals 1, C_Isufficient security level isomitted from data_2.maintained for certificates, EDHOC, and the protection of application data. TheResponder generatesInitiator and thefollowing ephemeral key pair. Y (Responder's ephemeral private key) (32 bytes) fd 8c d8 77 c9 ea 38 6e 6a f3 4f f7 e6 06 c4 b6 4c a8 31 c8 ba 33 13 4f d4 cd 71 67 ca ba ec da G_Y (Responder's ephemeral public key, CBOR unencoded) (32 bytes) 71 a3 d5 99 c2 1d a1 89 02 a1 ae a8 10 b2 b6 38 2c cd 8d 5f 9b f0 19 52 81 75 4c 5e bc af 30 1e From G_XResponder should enforce a minimum security level. The hash algorithms SHA-1 andY or from G_YSHA-256/64 (256-bit Hash truncated to 64-bits) SHALL NOT be supported for use in EDHOC except for certificate identification with x5u andX the ECDH shared secretc5u. Note that secp256k1 iscomputed: G_XY (ECDH shared secret) (32 bytes) 2b b7 fa 6e 13 5b c3 35 d0 22 d6 34 cb fb 14 b3 f5 82 f3 e2 e3 af b2 b3 15 04 91 49 5c 61 78 2b The keyonly defined for use with ECDSA andnoncenot forcalculatingECDH. 7.4. Unprotected Data The Initiator and the'ciphertext' are calculated as follows, as specifiedResponder must make sure that unprotected data and metadata do not reveal any sensitive information. This also applies for encrypted data sent to an unauthenticated party. In particular, it applies to EAD_1, ID_CRED_R, EAD_2, and error messages. Using the same EAD_1 inSection 4. HKDF SHA-256several EDHOC sessions allows passive eavesdroppers to correlate the different sessions. Another consideration is that theHKDF used (as defined bylist of supported ciphersuite 0). PRK_2e = HMAC-SHA-256(salt, G_XY) Salt issuites may potentially be used to identify theempty byte string. salt (0 bytes) From there, PRK_2e is computed: PRK_2e (32 bytes) ec 62 92 a0 67 f1 37 fc 7f 59 62 9d 22 6f bf c4 e0 68 89 49 f6 62 a9 7f d8 2f be b7 99 71 39 4aapplication. TheResponder's sign/verify key pair is the following: SK_R (Responder's private authentication key) (32 bytes) df 69 27 4d 71 32 96 e2 46 30 63 65 37 2b 46 83 ce d5 38 1b fc ad cd 44 0a 24 c3 91 d2 fe db 94 PK_R (Responder's public authentication key) (32 bytes) db d9 dc 8c d0 3f b7 c3 91 35 11 46 2b b2 38 16 47 7c 6b d8 d6 6e f5 a1 a0 70 ac 85 4e d7 3f d2 Since neither theInitiatornorand the Responderauthenticates with a static Diffie-Hellman key, PRK_3e2m = PRK_2e PRK_3e2m (32 bytes) ec 62 92 a0 67 f1 37 fc 7f 59 62 9d 22 6f bf c4 e0 68 89 49 f6 62 a9 7f d8 2f be b7 99 71 39 4a The Responder chooses a connection identifier C_R. Connection identifier chosen by Responder (1 byte) 00 Notemust also make sure thatsince C_R isunauthenticated data does not trigger any harmful actions. In particular, this applies to EAD_1 and error messages. 7.5. Denial-of-Service EDHOC itself does not provide countermeasures against Denial-of- Service attacks. By sending abyte string innumber of new or replayed message_1 an attacker may cause theinterval h'00'Responder toh'2f', it is encodedallocate state, perform cryptographic operations, and amplify messages. To mitigate such attacks, an implementation SHOULD rely on lower layer mechanisms such as thecorresponding integer subtracted by 24. Thus 0x00 = 0, 0 - 24 = -24, and -24Echo option inCBOR encodingCoAP [I-D.ietf-core-echo-request-tag] that forces the initiator to demonstrate reachability at its apparent network address. An attacker can also send faked message_2, message_3, message_4, or error in an attempt to trick the receiving party to send an error message and discontinue the session. EDHOC implementations MAY evaluate if a received message isequallikely to0x37. C_R (1 byte) 37 Data_2have been forged by and attacker and ignore it without sending an error message or discontinuing the session. 7.6. Implementation Considerations The availability of a secure random number generator isconstructed asessential for theCBOR Sequencesecurity ofG_YEDHOC. If no true random number generator is available, a truly random seed MUST be provided from an external source andC_R, encoded as CBOR byte strings. The CBOR diagnostic notation is: data_2 = ( h'71a3d599c21da18902a1aea810b2b6382ccd8d5f9bf0195281754c5ebcaf301e', -24 ) Which asused with aCBOR encoded data item is: data_2 (CBOR Sequence) (35 bytes) 58 20 71 a3 d5 99 c2 1d a1 89 02 a1 ae a8 10 b2 b6 38 2c cd 8d 5f 9b f0 19 52 81 75 4c 5e bc af 30 1e 37 From data_2cryptographically secure pseudorandom number generator. As each pseudorandom number must only be used once, an implementation needs to get a new truly random seed after reboot, or continuously store state in nonvolatile memory, see ([RFC8613], Appendix B.1.1) for issues andmessage_1, compute the inputsolution approaches for writing tothe transcript hash TH_2 = H( H(message_1), data_2 ), asnonvolatile memory. Intentionally or unintentionally weak or predictable pseudorandom number generators can be abused or exploited for malicious purposes. [RFC8937] describes aCBOR Sequence of these 2 data items. Inputway for security protocol implementations tocalculate TH_2 (CBOR Sequence) (72 bytes) 01 00 58 20 89 8f f7 9a 02 06 7a 16 ea 1e cc b9 0f a5 22 46 f5 aa 4d d6 ec 07 6b ba 02 59 d9 04 b7 ec 8b 0c 2e 58 20 71 a3 d5 99 c2 1d a1 89 02 a1 ae a8 10 b2 b6 38 2c cd 8d 5f 9b f0 19 52 81 75 4c 5e bc af 30 1e 37 Andaugment their (pseudo)random number generators using a long-term private key and a deterministic signature function. This improves randomness fromthere, compute the transcript hash TH_2 = SHA-256( H(message_1), data_2 ) TH_2 (CBOR unencoded) (32 bytes) 86 4e 32 b3 6a 7b 5f 21 f1 9e 99 f0 c6 6d 91 1e 0a ce 99 72 d3 76 d2 c2 c1 53 c1 7f 8e 96 29 ffbroken or otherwise subverted random number generators. TheResponder's subject namesame idea can be used with other secrets and functions such as a Diffie-Hellman function or a symmetric secret and a PRF like HMAC or KMAC. It isthe empty string: Responder's subject name (text string) "" In this versionRECOMMENDED to not trust a single source of randomness and to not put unaugmented random numbers on thetest vectors CRED_Rwire. If ECDSA is supported, "deterministic ECDSA" as specified in [RFC6979] MAY be used. Pure deterministic elliptic-curve signatures such as deterministic ECDSA and EdDSA have gained popularity over randomized ECDSA as their security do not depend on aDER encoded X.509 certificate, but a stringsource ofrandom bytes. CRED_R (CBOR unencoded) (100 bytes) c7 88 37 00 16 b8 96 5b db 20 74 bf f8 2e 5a 20 e0 9b ec 21 f8 40 6e 86 44 2b 87 ec 3f f2 45 b7 0a 47 62 4d c9 cd c6 82 4b 2a 4c 52 e9 5e c9 d6 b0 53 4b 71 c2 b4 9e 4b f9 03 15 00 ce e6 86 99 79 c2 97 bb 5a 8b 38 1e 98 db 71 41 08 41 5e 5c 50 db 78 97 4c 27 15 79 b0 16 33 a3 ef 62 71 be 5c 22 5e b2 CRED_R is defined tohigh- quality randomness. Recent research has however found that implementations of these signature algorithms may bethe CBOR bstr containing the credentialvulnerable to certain side-channel and fault injection attacks due to their determinism. See e.g., Section 1 ofthe Responder. CRED_R (102 bytes) 58 64 c7 88 37 00 16 b8 96 5b db 20 74 bf f8 2e 5a 20 e0 9b ec 21 f8 40 6e 86 44 2b 87 ec 3f f2 45 b7 0a 47 62 4d c9 cd c6 82 4b 2a 4c 52 e9 5e c9 d6 b0 53 4b 71 c2 b4 9e 4b f9 03 15 00 ce e6 86 99 79 c2 97 bb 5a 8b 38 1e 98 db 71 41 08 41 5e 5c 50 db 78 97 4c 27 15 79 b0 16 33 a3 ef 62 71 be 5c 22 5e b2 And because certificates are identified by[I-D.mattsson-cfrg-det-sigs-with-noise] for ahash value with the 'x5t' parameter, ID_CRED_R is the following: ID_CRED_R = { 34 : COSE_CertHash }. Inlist of attack papers. As suggested in Section 6.1.2 of [I-D.ietf-cose-rfc8152bis-algs] thisexample, the hash algorithm used is SHA-2 256-bit with hash truncated to 64-bits (value -15). The hash value is calculated over the CBOR unencoded CRED_R. The CBOR diagnostic notation is: ID_CRED_R = { 34: [-15, h'6844078A53F312F5'] } which when encoded as a CBOR map becomes: ID_CRED_R (14 bytes) a1 18 22 82 2e 48 68 44 07 8a 53 f3 12 f5 Since no external authorization data is sent: EAD_2 (0 bytes) The plaintext is definedcan be addressed by combining randomness and determinism. All private keys, symmetric keys, and IVs MUST be secret. Implementations should provide countermeasures to side-channel attacks such asthe empty string: P_2m (0 bytes) The Enc_structure is definedtiming attacks. Intermediate computed values such asfollows: [ "Encrypt0", << ID_CRED_R >>, << TH_2, CRED_R >> ], indicating that ID_CRED_Rephemeral ECDH keys and ECDH shared secrets MUST be deleted after key derivation isencoded as a CBOR byte string,completed. The Initiator andthattheconcatenation ofResponder are responsible for verifying theCBOR byte strings TH_2integrity of certificates. The selection of trusted CAs should be done very carefully andCRED_R is wrapped as a CBOR bstr.certificate revocation should be supported. TheCBOR diagnostic notation isprivate authentication keys MUST be kept secret. The Initiator and thefollowing: A_2m = [ "Encrypt0", h'A11822822E486844078A53F312F5', h'5820864E32B36A7B5F21F19E99F0C66D911E0ACE9972D376D2C2C153C17F8E9629FF 5864C788370016B8965BDB2074BFF82E5A20E09BEC21F8406E86442B87EC3FF245B70A 47624DC9CDC6824B2A4C52E95EC9D6B0534B71C2B49E4BF9031500CEE6869979C297BB 5A8B381E98DB714108415E5C50DB78974C271579B01633A3EF6271BE5C225EB2' ] Which encodesResponder are allowed to select thefollowing byte stringconnection identifiers C_I and C_R, respectively, for the other party tobe useduse in the ongoing EDHOC protocol asAdditional Authenticated Data: A_2m (CBOR-encoded) (163 bytes) 83 68 45 6e 63 72 79 70 74 30 4e a1 18 22 82 2e 48 68 44 07 8a 53 f3 12 f5 58 88 58 20 86 4e 32 b3 6a 7b 5f 21 f1 9e 99 f0 c6 6d 91 1e 0a ce 99 72 d3 76 d2 c2 c1 53 c1 7f 8e 96 29 ff 58 64 c7 88 37 00 16 b8 96 5b db 20 74 bf f8 2e 5a 20 e0 9b ec 21 f8 40 6e 86 44 2b 87 ec 3f f2 45 b7 0a 47 62 4d c9 cd c6 82 4b 2a 4c 52 e9 5e c9 d6 b0 53 4b 71 c2 b4 9e 4b f9 03 15 00 ce e6 86 99 79 c2 97 bb 5a 8b 38 1e 98 db 71 41 08 41 5e 5c 50 db 78 97 4c 27 15 79 b0 16 33 a3 ef 62 71 be 5c 22 5e b2 info for K_2m is definedwell asfollowsinCBOR diagnostic notation: info for K_2m = [ 10, h'864E32B36A7B5F21F19E99F0C66D911E0ACE9972D376D2C2C153C17F8E9629FF', "K_2m", 16 ] Which asaCBOR encoded data item is: info for K_2m (CBOR-encoded) (42 bytes) 84 0a 58 20 86 4e 32 b3 6a 7b 5f 21 f1 9e 99 f0 c6 6d 91 1e 0a ce 99 72 d3 76 d2 c2 c1 53 c1 7f 8e 96 29 ff 64 4b 5f 32 6d 10 From these parameters, K_2m is computed. Key K_2m is the outputsubsequent application protocol (e.g., OSCORE [RFC8613]). The choice ofHKDF-Expand(PRK_3e2m, info, L), where Lconnection identifier is not security critical in EDHOC but intended to simplify thelengthretrieval ofK_2m, so 16 bytes. K_2m (16 bytes) 80 cc a7 49 ab 58 f5 69 ca 35 da ee 05 be d1 94 info for IV_2m is defined as follows,the right security context inCBOR diagnostic notation (10 iscombination with using short identifiers. If theCOSE algorithm no.wrong connection identifier of theAEAD algorithmother party is used in a protocol message it will result in theselected cipher suite 0): info for IV_2m = [ 10, h'864E32B36A7B5F21F19E99F0C66D911E0ACE9972D376D2C2C153C17F8E9629FF', "IV_2m", 13 ] Whichreceiving party not being able to retrieve a security context (which will terminate the protocol) or retrieve the wrong security context (which also terminates the protocol as the message cannot be verified). If two nodes unintentionally initiate two simultaneous EDHOC message exchanges with each other even if they only want to complete aCBOR encoded data item is: info for IV_2m (CBOR-encoded) (43 bytes) 84 0a 58 20 86 4e 32 b3 6a 7b 5f 21 f1 9e 99 f0 c6 6d 91 1e 0a ce 99 72 d3 76 d2 c2 c1 53 c1 7f 8e 96 29 ff 65 49 56 5f 32 6d 0d From these parameters, IV_2m is computed. IV_2m issingle EDHOC message exchange, they MAY terminate theoutputexchange with the lexicographically smallest G_X. If the two G_X values are equal, the received message_1 MUST be discarded to mitigate reflection attacks. Note that in the case ofHKDF-Expand(PRK_3e2m, info, L),two simultaneous EDHOC exchanges whereL isthelengthnodes only complete one and where the nodes have different preferred cipher suites, an attacker can affect which ofIV_2m, so 13 bytes. IV_2m (13 bytes) c8 1e 1a 95 cc 93 b3 36 69 6e d5 02 55 Finally, COSE_Encrypt0 is computed fromtheparameters above. o protected header = CBOR-encoded ID_CRED_R o external_aad = A_2m o empty plaintext = P_2m MAC_2 (CBOR unencoded) (8 bytes) fa bb a4 7e 56 71 a1 82 To computetwo nodes' preferred cipher suites will be used by blocking theSignature_or_MAC_2,other exchange. If supported by thekeydevice, it is RECOMMENDED that at least the long- term privateauthenticationkeys are stored in a Trusted Execution Environment (TEE) and that sensitive operations using these keys are performed inside the TEE. To achieve even higher security, it is RECOMMENDED that in additional operations such as ephemeral key generation, all computations of shared secrets, and storage of theResponderpseudorandom keys (PRK) can be done inside the TEE. The use of a TEE enforces that code within that environment cannot be tampered with, and that any data used by such code cannot be read or tampered with by code outside that environment. Note that non-EDHOC code inside themessage M_2TEE might still be able to read EDHOC data and tamper with EDHOC code, to protect against such attacks EDHOC needs to besigned = [ "Signature1", << ID_CRED_R >>, << TH_2, CRED_R, ? EAD_2 >>, MAC_2 ]. ID_CRED_R is encoded as a CBOR byte string, the concatenationin its own zone. To provide better protection against some forms of physical attacks, sensitive EDHOC data should be stored inside theCBOR byte strings TH_2 and CRED_R is wrapped as a CBOR bstr,SoC or encrypted andMAC_2 is encoded as a CBOR bstr. M_2 = [ "Signature1", h'A11822822E486844078A53F312F5', h'5820864E32B36A7B5F21F19E99F0C66D911E0ACE9972D376D2C2C153C17F8E9629F F5864C788370016B8965BDB2074BFF82E5A20E09BEC21F8406E86442B87EC3FF245B7 0A47624DC9CDC6824B2A4C52E95EC9D6B0534B71C2B49E4BF9031500CEE6869979C29 7BB5A8B381E98DB714108415E5C50DB78974C271579B01633A3EF6271BE5C225EB2', h'FABBA47E5671A182' ] Which asintegrity protected when sent on aCBOR encodeddataitem is: M_2 (174 bytes) 84 6a 53 69 67 6e 61 74 75 72 65 31 4e a1 18 22 82 2e 48 68 44 07 8a 53 f3 12 f5 58 88 58 20 86 4e 32 b3 6a 7b 5f 21 f1 9e 99 f0 c6 6d 91 1e 0a ce 99 72 d3 76 d2 c2 c1 53 c1 7f 8e 96 29 ff 58 64 c7 88 37 00 16 b8 96 5b db 20 74 bf f8 2e 5a 20 e0 9b ec 21 f8 40 6e 86 44 2b 87 ec 3f f2 45 b7 0a 47 62 4d c9 cd c6 82 4b 2a 4c 52 e9 5e c9 d6 b0 53 4b 71 c2 b4 9e 4b f9 03 15 00 ce e6 86 99 79 c2 97 bb 5a 8b 38 1e 98 db 71 41 08 41 5e 5c 50 db 78 97 4c 27 15 79 b0 16 33 a3 ef 62 71 be 5c 22 5e b2 48 fa bb a4 7e 56 71 a1 82 Sincebus (e.g., between themethod = 0, Signature_or_MAC_2 is a signature. The algorithm with selected cipher suite 0 is Ed25519CPU and RAM or Flash). Secure boot can be used to increase theoutput is 64 bytes. Signature_or_MAC_2 (CBOR unencoded) (64 bytes) 1f 17 00 6a 98 48 c9 77 cb bd ca a7 57 b6 fd 46 82 c8 17 39 e1 5c 99 37 c2 1c f5 e9 a0 e6 03 9f 54 fd 2a 6c 3a 11 18 f2 b9 d8 eb cd 48 23 48 b9 9c 3e d7 ed 1b d9 80 6c 93 c8 90 68 e8 36 b4 0f CIPHERTEXT_2 issecurity of code and data in the Rich Execution Environment (REE) by validating the REE image. 8. IANA Considerations 8.1. EDHOC Exporter Label IANA has created a new registry titled "EDHOC Exporter Label" under theciphertext resulting from XOR between plaintext and KEYSTREAM_2 whichnew heading "EDHOC". The registration procedure isderived from TH_2 and the pseudorandom key PRK_2e. o plaintext = CBOR Sequence"Expert Review". The columns of theitems ID_CRED_Rregistry are Label, Description, andSignature_or_MAC_2 encoded as CBOR byte strings, in this order (EAD_2 is empty).Reference. All columns are text strings. Theplaintextinitial contents of the registry are: Label: EDHOC_message_4_Key Description: Key used to protect EDHOC message_4 Reference: [[this document]] Label: EDHOC_message_4_Nonce Description: Nonce used to protect EDHOC message_4 Reference: [[this document]] Label: OSCORE Master Secret Description: Derived OSCORE Master Secret Reference: [[this document]] Label: OSCORE Master Salt Description: Derived OSCORE Master Salt Reference: [[this document]] 8.2. EDHOC Cipher Suites Registry IANA has created a new registry titled "EDHOC Cipher Suites" under the new heading "EDHOC". The registration procedure is "Expert Review". The columns of thefollowing: P_2e (CBOR Sequence) (80 bytes) a1 18 22 82 2e 48 68 44 07 8a 53 f3 12 f5 58 40 1f 17 00 6a 98 48 c9 77 cb bd ca a7 57 b6 fd 46 82 c8 17 39 e1 5c 99 37 c2 1c f5 e9 a0 e6 03 9f 54 fd 2a 6c 3a 11 18 f2 b9 d8 eb cd 48 23 48 b9 9c 3e d7 ed 1b d9 80 6c 93 c8 90 68 e8 36 b4 0f KEYSTREAM_2 = HKDF-Expand( PRK_2e, info, length ),registry are Value, Array, Description, and Reference, wherelengthValue is an integer and thelengthother columns are text strings. The initial contents of theplaintext, so 80. inforegistry are: Value: -24 Algorithms: N/A Desc: Reserved forKEYSTREAM_2 = [Private Use Reference: [[this document]] Value: -23 Algorithms: N/A Desc: Reserved for Private Use Reference: [[this document]] Value: -22 Algorithms: N/A Desc: Reserved for Private Use Reference: [[this document]] Value: -21 Algorithms: N/A Desc: Reserved for Private Use Reference: [[this document]] Value: 0 Array: 10, -16, 4, -8, 10,h'864E32B36A7B5F21F19E99F0C66D911E0ACE9972D376D2C2C153C17F8E9629FF', "KEYSTREAM_2", 80 ] Which as a CBOR encoded data item is: info for KEYSTREAM_2 (CBOR-encoded) (50 bytes) 84 0a 58 20 86 4e 32 b3 6a 7b 5f 21 f1 9e 99 f0 c6 6d 91 1e 0a ce 99 72 d3 76 d2 c2 c1 53 c1 7f 8e 96 29 ff 6b 4b 45 59 53 54 52 45 41 4d 5f 32 18 50 From there, KEYSTREAM_2 is computed: KEYSTREAM_2 (80 bytes) ae ea 8e af 50 cf c6 70 09 da e8 2d 8d 85 b0 e7 60 91 bf 0f 07 0b 79 53 6c 83 23 dc 3d 9d 61 13 10 35 94 63 f4 4b 12 4b ea b3 a1 9d 09 93 82 d7 30 80 17 f4 92 62 06 e4 f5 44 9b 9f c9-16 Desc: AES-CCM-16-64-128, SHA-256, X25519, EdDSA, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] Value: 1 Array: 30, -16, 4, -8, 10, -16 Desc: AES-CCM-16-128-128, SHA-256, X25519, EdDSA, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] Value: 2 Array: 10, -16, 1, -7, 10, -16 Desc: AES-CCM-16-64-128, SHA-256, P-256, ES256, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] Value: 3 Array: 30, -16, 1, -7, 10, -16 Desc: AES-CCM-16-128-128, SHA-256, P-256, ES256, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] Value: 4 Array: 24, -16, 4, -8, 24, -16 Desc: ChaCha20/Poly1305, SHA-256, X25519, EdDSA, ChaCha20/Poly1305, SHA-256 Reference: [[this document]] Value: 5 Array: 24, -16, 1, -7, 24, -16 Desc: ChaCha20/Poly1305, SHA-256, P-256, ES256, ChaCha20/Poly1305, SHA-256 Reference: [[this document]] Value: 6 Array: 1, -16, 4, -7, 1, -16 Desc: A128GCM, SHA-256, X25519, ES256, A128GCM, SHA-256 Reference: [[this document]] Value: 24bc b6 bd 78 ec 45 0a 66 83 fb 8a 2f 5f 92 4f c4 40 4f Using the parameters above,Array: 3, -43, 2, -35, 3, -43 Desc: A256GCM, SHA-384, P-384, ES384, A256GCM, SHA-384 Reference: [[this document]] Value: 25 Array: 24, -45, 5, -8, 24, -45 Desc: ChaCha20/Poly1305, SHAKE256, X448, EdDSA, ChaCha20/Poly1305, SHAKE256 Reference: [[this document]] 8.3. EDHOC Method Type Registry IANA has created a new registry entitled "EDHOC Method Type" under theciphertext CIPHERTEXT_2 can be computed: CIPHERTEXT_2 (CBOR unencoded) (80 bytes) 0f f2 ac 2d 7e 87 ae 34 0e 50 bb de 9f 70 e8 a7 7f 86 bf 65 9f 43 b0 24 a7 3e e9 7b 6a 2b 9c 55 92 fd 83 5a 15 17 8b 7c 28 af 54 74 a9 75 81 48 64 7d 3d 98 a8 73 1e 16 4c 9c 70 52 81 07 f4 0f 21 46 3b a8 11 bf 03 97 19 e7 cf fa a7 f2 f4 40 message_2new heading "EDHOC". The registration procedure isthe CBOR Sequence"Expert Review". The columns ofdata_2the registry are Value, Description, andCIPHERTEXT_2,Reference, where Value is an integer and the other columns are text strings. The initial contents of the registry are shown inthis order: message_2 = ( data_2, h'0FF2AC2D7E87AE340E50BBDE9F70E8A77F86BF659F43B024A73EE97B6A2B9C5592FD 835A15178B7C28AF5474A9758148647D3D98A8731E164C9C70528107F40F21463BA811 BF039719E7CFFAA7F2F440' ) Which asFigure 4. 8.4. EDHOC Error Codes Registry IANA has created aCBOR encoded data item is: message_2 (CBOR Sequence) (117 bytes) 58 20 71 a3 d5 99 c2 1d a1 89 02 a1 ae a8 10 b2 b6 38 2c cd 8d 5f 9b f0 19 52 81 75 4c 5e bc af 30 1e 37 58 50 0f f2 ac 2d 7e 87 ae 34 0e 50 bb de 9f 70 e8 a7 7f 86 bf 65 9f 43 b0 24 a7 3e e9 7b 6a 2b 9c 55 92 fd 83 5a 15 17 8b 7c 28 af 54 74 a9 75 81 48 64 7d 3d 98 a8 73 1e 16 4c 9c 70 52 81 07 f4 0f 21 46 3b a8 11 bf 03 97 19 e7 cf fa a7 f2 f4 40 D.1.3. Message_3 Since corr equals 1, C_Rnew registry entitled "EDHOC Error Codes" under the new heading "EDHOC". The registration procedure isnot omitted from data_3."Specification Required". TheInitiator's sign/verify key paircolumns of the registry are ERR_CODE, ERR_INFO Type and Description, where ERR_CODE is an integer, ERR_INFO is a CDDL defined type, and Description is a text string. The initial contents of thefollowing: SK_I (Initiator's private authentication key) (32 bytes) 2f fc e7 a0 b2 b8 25 d3 97 d0 cb 54 f7 46 e3 da 3f 27 59 6e e0 6b 53 71 48 1d c0 e0 12 bc 34 d7 PK_I (Responder's public authentication key) (32 bytes) 38 e5 d5 45 63 c2 b6 a4 ba 26 f3 01 5f 61 bb 70 6e 5c 2e fd b5 56 d2 e1 69 0b 97 fc 3c 6d e1 49 HKDF SHA-256registry are shown in Figure 6. 8.5. COSE Header Parameters Registry This document registers the following entries in the "COSE Header Parameters" registry under the "CBOR Object Signing and Encryption (COSE)" heading. The value of the 'cwt' header parameter is a CWT [RFC8392] or an Unprotected CWT Claims Set, see Section 1.5. +-----------+-------+----------------+------------------------------+ | Name | Label | Value Type | Description | +===========+=======+================+==============================+ | cwt | TBD1 | COSE_Messages | A CBOR Web Token (CWT) or an | | | | / map | Unprotected CWT Claims Set | +-----------+-------+----------------+------------------------------+ 8.6. COSE Header Parameters Registry IANA has extended theHKDF used (as defined by cipher suite 0). PRK_4x3m = HMAC-SHA-256 (PRK_3e2m, G_IY) PRK_4x3m (32 bytes) ec 62 92 a0 67 f1 37 fc 7f 59 62 9d 22 6f bf c4 e0 68 89 49 f6 62 a9 7f d8 2f be b7 99 71 39 4a data 3Value Type of the COSE Header Parameter 'kid' to also allow the Value Type int. The resulting Value Type isequalbstr / int. The 'kid' parameter can be used toC_R. data_3 (CBOR Sequence) (1 byte) 37 From data_3, CIPHERTEXT_2,identify a key stored in a UCCS, in a CWT, or in a public key certificate. (The Value Registry for this item is empty andTH_2, computeomitted from theinput totable below.) +------+-------+------------+----------------+-------------------+ | Name | Label | Value Type | Description | Reference | +------+-------+------------+----------------+-------------------+ | kid | 4 | bstr / int | Key identifier | [RFC9052] | | | | | | [[This document]] | +------+-------+------------+----------------+-------------------+ 8.7. COSE Key Common Parameters Registry IANA has extended thetranscript hash TH_3 = H( H(TH_2 , CIPHERTEXT_2), data_3), as a CBOR SequenceValue Type of2 data items. Inputthe COSE Key Common Parameter 'kid' tocalculate TH_3 (CBOR Sequence) (117 bytes) 58 20 86 4e 32 b3 6a 7b 5f 21 f1 9e 99 f0 c6 6d 91 1e 0a ce 99 72 d3 76 d2 c2 c1 53 c1 7f 8e 96 29 ff 58 50 0f f2 ac 2d 7e 87 ae 34 0e 50 bb de 9f 70 e8 a7 7f 86 bf 65 9f 43 b0 24 a7 3e e9 7b 6a 2b 9c 55 92 fd 83 5a 15 17 8b 7c 28 af 54 74 a9 75 81 48 64 7d 3d 98 a8 73 1e 16 4c 9c 70 52 81 07 f4 0f 21 46 3b a8 11 bf 03 97 19 e7 cf fa a7 f2 f4 40 37 Andthe COSE Key Value Type int. The resulting Value Type is bstr / int. (The Value Registry for this item is empty and omitted fromthere, computethetranscript hash TH_3 = SHA-256( H(TH_2 , CIPHERTEXT_2), data_3) TH_3 (CBOR unencoded) (32 bytes) f2 4d 18 ca fc e3 74 d4 e3 73 63 29 c1 52 ab 3a ea 9c 7c 0f 65 0c 30 70 b6 f5 1e 68 e2 ae bb 60table below.) +------+-------+------------+----------------+-------------------+ | Name | Label | Value Type | Description | Reference | +------+-------+------------+----------------+-------------------+ | kid | 2 | bstr / int | Key identifi- | [RFC9052] | | | | | cation value - | [[This document]] | | | | | match to kid | | | | | | in message | | +------+-------+------------+----------------+-------------------+ 8.8. TheInitiator's subject name isWell-Known URI Registry IANA has added theempty string: Initiator's subject name (text string) "" In this version ofwell-known URI "edhoc" to thetest vectors CRED_I is not a DER encoded X.509 certificate, but a string of random bytes. CRED_I (CBOR unencoded) (101 bytes) 54 13 20 4c 3e bc 34 28 a6 cf 57 e2 4c 9d ef 59 65 17 70 44 9b ce 7e c6 56 1e 52 43 3a a5 5e 71 f1 fa 34 b2 2a 9c a4 a1 e1 29 24 ea e1 d1 76 60 88 09 84 49 cb 84 8f fc 79 5f 88 af c4 9c be 8a fd d1 ba 00 9f 21 67 5e 8f 6c 77 a4 a2 c3 01 95 60 1f 6f 0a 08 52 97 8b d4 3d 28 20 7d 44 48 65 02 ff 7b dd a6 CRED_I is definedWell-Known URIs registry. * URI suffix: edhoc * Change controller: IETF * Specification document(s): [[this document]] * Related information: None 8.9. Media Types Registry IANA has added the media type "application/edhoc" to the Media Types registry. * Type name: application * Subtype name: edhoc * Required parameters: N/A * Optional parameters: N/A * Encoding considerations: binary * Security considerations: See Section 7 of this document. * Interoperability considerations: N/A * Published specification: [[this document]] (this document) * Applications that use this media type: To be identified * Fragment identifier considerations: N/A * Additional information: - Magic number(s): N/A - File extension(s): N/A - Macintosh file type code(s): N/A * Person & email address to contact for further information: See "Authors' Addresses" section. * Intended usage: COMMON * Restrictions on usage: N/A * Author: See "Authors' Addresses" section. * Change Controller: IESG 8.10. CoAP Content-Formats Registry IANA has added theCBOR bstr containingmedia type "application/edhoc" to the CoAP Content-Formats registry. * Media Type: application/edhoc * Encoding: * ID: TBD42 * Reference: [[this document]] 8.11. EDHOC External Authorization Data IANA has created a new registry entitled "EDHOC External Authorization Data" under thecredentialnew heading "EDHOC". The registration procedure is "Expert Review". The columns of theInitiator. CRED_I (103 bytes) 58 65 54 13 20 4c 3e bc 34 28 a6 cf 57 e2 4c 9d ef 59 65 17 70 44 9b ce 7e c6 56 1e 52 43 3a a5 5e 71 f1 fa 34 b2 2a 9c a4 a1 e1 29 24 ea e1 d1 76 60 88 09 84 49 cb 84 8f fc 79 5f 88 af c4 9c be 8a fd d1 ba 00 9f 21 67 5e 8f 6c 77 a4 a2 c3 01 95 60 1f 6f 0a 08 52 97 8b d4 3d 28 20 7d 44 48 65 02 ff 7b dd a6 And because certificatesregistry areidentified by a hash value with the 'x5t' parameter, ID_CRED_IValue, Description, and Reference, where Value is an integer and thefollowing: ID_CRED_I = { 34 : COSE_CertHash }. In this example, the hash algorithm used is SHA-2 256-bit with hash truncated to 64-bits (value -15).other columns are text strings. 8.12. Expert Review Instructions Thehash valueIANA Registries established in this document iscalculated overdefined as "Expert Review". This section gives some general guidelines for what theCBOR unencoded CRED_I. ID_CRED_I = { 34: [-15, h'705D5845F36FC6A6'] } which when encodedexperts should be looking for, but they are being designated as experts for aCBOR map becomes: ID_CRED_I (14 bytes) a1 18 22 82 2e 48 70 5d 58 45 f3 6f c6 a6 Since no external authorization data is exchanged: EAD_3 (0 bytes) The plaintextreason so they should be given substantial latitude. Expert reviewers should take into consideration the following points: * Clarity and correctness of registrations. Experts are expected to check theCOSE_Encrypt isclarity of purpose and use of theempty string: P_3m (0 bytes) The associated data isrequested entries. Expert needs to make sure thefollowing: [ "Encrypt0", << ID_CRED_I >>, << TH_3, CRED_I, ? EAD_3 >> ]. A_3m (CBOR-encoded) (164 bytes) 83 68 45 6e 63 72 79 70 74 30 4e a1 18 22 82 2e 48 70 5d 58 45 f3 6f c6 a6 58 89 58 20 f2 4d 18 ca fc e3 74 d4 e3 73 63 29 c1 52 ab 3a ea 9c 7c 0f 65 0c 30 70 b6 f5 1e 68 e2 ae bb 60 58 65 54 13 20 4c 3e bc 34 28 a6 cf 57 e2 4c 9d ef 59 65 17 70 44 9b ce 7e c6 56 1e 52 43 3a a5 5e 71 f1 fa 34 b2 2a 9c a4 a1 e1 29 24 ea e1 d1 76 60 88 09 84 49 cb 84 8f fc 79 5f 88 af c4 9c be 8a fd d1 ba 00 9f 21 67 5e 8f 6c 77 a4 a2 c3 01 95 60 1f 6f 0a 08 52 97 8b d4 3d 28 20 7d 44 48 65 02 ff 7b dd a6 Info for K_3mvalues of algorithms are taken from the right registry, when that iscomputed as follows: info for K_3m = [ 10, h'F24D18CAFCE374D4E3736329C152AB3AEA9C7C0F650C3070B6F51E68E2AEBB60', "K_3m", 16 ] Which as a CBOR encoded data item is: info for K_3m (CBOR-encoded) (42 bytes) 84 0a 58 20 f2 4d 18 ca fc e3 74 d4 e3 73 63 29 c1 52 ab 3a ea 9c 7c 0f 65 0c 30 70 b6 f5 1e 68 e2 ae bb 60 64 4b 5f 33 6d 10 Fromrequired. Expert should consider requesting an opinion on the correctness of registered parameters from relevant IETF working groups. Encodings that do not meet theseparameters, K_3m is computed. Key K_3m isobjective of clarity and completeness should not be registered. * Experts should take into account theoutputexpected usage of fields when approving point assignment. The length ofHKDF-Expand(PRK_4x3m, info, L), where L isthe encoded value should be weighed against how many code points of that length are left, the size ofK_2m, so 16 bytes. K_3m (16 bytes) 83 a9 c3 88 02 91 2e 7f 8f 0d 2b 84 14 d1 e5 2c Nonce IV_3m isdevice it will be used on, and theoutputnumber ofHKDF-Expand(PRK_4x3m, info, L), where L = 13 bytes. Info for IV_3m is defined as follows: infocode points left that encode to that size. * Specifications are recommended. When specifications are not provided, the description provided needs to have sufficient information to verify the points above. 9. References 9.1. Normative References [I-D.ietf-core-echo-request-tag] Amsüss, C., Mattsson, J. P., and G. Selander, "CoAP: Echo, Request-Tag, and Token Processing", Work in Progress, Internet-Draft, draft-ietf-core-echo-request-tag-13, 12 July 2021, <https://www.ietf.org/archive/id/draft-ietf- core-echo-request-tag-13.txt>. [I-D.ietf-cose-rfc8152bis-algs] Schaad, J., "CBOR Object Signing and Encryption (COSE): Initial Algorithms", Work in Progress, Internet-Draft, draft-ietf-cose-rfc8152bis-algs-12, 24 September 2020, <https://www.ietf.org/archive/id/draft-ietf-cose- rfc8152bis-algs-12.txt>. [I-D.ietf-cose-rfc8152bis-struct] Schaad, J., "CBOR Object Signing and Encryption (COSE): Structures and Process", Work in Progress, Internet-Draft, draft-ietf-cose-rfc8152bis-struct-15, 1 February 2021, <https://www.ietf.org/archive/id/draft-ietf-cose- rfc8152bis-struct-15.txt>. [I-D.ietf-cose-x509] Schaad, J., "CBOR Object Signing and Encryption (COSE): Header parameters forIV_3m = [ 10, h'F24D18CAFCE374D4E3736329C152AB3AEA9C7C0F650C3070B6F51E68E2AEBB60', "IV_3m", 13 ] Which as a CBOR encoded data item is: infocarrying and referencing X.509 certificates", Work in Progress, Internet-Draft, draft- ietf-cose-x509-08, 14 December 2020, <https://www.ietf.org/internet-drafts/draft-ietf-cose- x509-08.txt>. [RFC2119] Bradner, S., "Key words forIV_3m (CBOR-encoded) (43 bytes) 84 0a 58 20 f2 4d 18 ca fc e3 74 d4 e3 73 63 29 c1 52 ab 3a ea 9c 7c 0f 65 0c 30 70 b6 f5 1e 68 e2 ae bb 60 65 49 56 5f 33 6d 0d From these parameters, IV_3m is computed: IV_3m (13 bytes) 9c 83 9c 0e e8 36 42 50 5a 8e 1c 9f b2 MAC_3 is the 'ciphertext' of the COSE_Encrypt0: MAC_3 (CBOR unencoded) (8 bytes) 2f a1 e3 9e ae 7d 5f 8d Since the method = 0, Signature_or_MAC_3 is a signature. The algorithm with selected cipher suite 0 is Ed25519. o The message M_3use in RFCs tobe signed = [ "Signature1", << ID_CRED_I >>, << TH_3, CRED_I >>, MAC_3 ], i.e. ID_CRED_I encoded as CBOR bstr, the concatenation of the CBOR byte strings TH_3Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>. [RFC5116] McGrew, D., "An Interface andCRED_I wrapped as a CBOR bstr,Algorithms for Authenticated Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, <https://www.rfc-editor.org/info/rfc5116>. [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., Housley, R., andMAC_3 encoded as a CBOR bstr. o The signing key is the private authentication key of the Initiator. M_3 = [ "Signature1", h'A11822822E48705D5845F36FC6A6', h'5820F24D18CAFCE374D4E3736329C152AB3AEA9C7C0F650C3070B6F51E68E2AEBB6 058655413204C3EBC3428A6CF57E24C9DEF59651770449BCE7EC6561E52433AA55E71 F1FA34B22A9CA4A1E12924EAE1D1766088098449CB848FFC795F88AFC49CBE8AFDD1B A009F21675E8F6C77A4A2C30195601F6F0A0852978BD43D28207D44486502FF7BDD A6', h'2FA1E39EAE7D5F8D'] Which as a CBOR encoded data item is: M_3 (175 bytes) 84 6a 53 69 67 6e 61 74 75 72 65 31 4e a1 18 22 82 2e 48 70 5d 58 45 f3 6f c6 a6 58 89 58 20 f2 4d 18 ca fc e3 74 d4 e3 73 63 29 c1 52 ab 3a ea 9c 7c 0f 65 0c 30 70 b6 f5 1e 68 e2 ae bb 60 58 65 54 13 20 4c 3e bc 34 28 a6 cf 57 e2 4c 9d ef 59 65 17 70 44 9b ce 7e c6 56 1e 52 43 3a a5 5e 71 f1 fa 34 b2 2a 9c a4 a1 e1 29 24 ea e1 d1 76 60 88 09 84 49 cb 84 8f fc 79 5f 88 af c4 9c be 8a fd d1 ba 00 9f 21 67 5e 8f 6c 77 a4 a2 c3 01 95 60 1f 6f 0a 08 52 97 8b d4 3d 28 20 7d 44 48 65 02 ff 7b dd a6 48 2f a1 e3 9e ae 7d 5f 8d From there, the 64 byte signature can be computed: Signature_or_MAC_3 (CBOR unencoded) (64 bytes) ab 9f 7b bd eb c4 eb f8 a3 d3 04 17 9b cc a3 9d 9c 8a 76 73 65 76 fb 3c 32 d2 fa c7 e2 59 34 e5 33 dc c7 02 2e 4d 68 61 c8 f5 fe cb e9 2d 17 4e b2 be af 0a 59 a4 15 84 37 2f 43 2e 6b f4 7b 04 Finally,W. Polk, "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, <https://www.rfc-editor.org/info/rfc5280>. [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand Key Derivation Function (HKDF)", RFC 5869, DOI 10.17487/RFC5869, May 2010, <https://www.rfc-editor.org/info/rfc5869>. [RFC6090] McGrew, D., Igoe, K., and M. Salter, "Fundamental Elliptic Curve Cryptography Algorithms", RFC 6090, DOI 10.17487/RFC6090, February 2011, <https://www.rfc-editor.org/info/rfc6090>. [RFC6979] Pornin, T., "Deterministic Usage of theouter COSE_Encrypt0 is computed. The plaintext isDigital Signature Algorithm (DSA) and Elliptic Curve Digital Signature Algorithm (ECDSA)", RFC 6979, DOI 10.17487/RFC6979, August 2013, <https://www.rfc-editor.org/info/rfc6979>. [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>. [RFC7624] Barnes, R., Schneier, B., Jennings, C., Hardie, T., Trammell, B., Huitema, C., and D. Borkmann, "Confidentiality in theCBOR SequenceFace of Pervasive Surveillance: A Threat Model and Problem Statement", RFC 7624, DOI 10.17487/RFC7624, August 2015, <https://www.rfc-editor.org/info/rfc7624>. [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>. [RFC7959] Bormann, C. and Z. Shelby, Ed., "Block-Wise Transfers in theitems ID_CRED_IConstrained Application Protocol (CoAP)", RFC 7959, DOI 10.17487/RFC7959, August 2016, <https://www.rfc-editor.org/info/rfc7959>. [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>. [RFC8376] Farrell, S., Ed., "Low-Power Wide Area Network (LPWAN) Overview", RFC 8376, DOI 10.17487/RFC8376, May 2018, <https://www.rfc-editor.org/info/rfc8376>. [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>. [RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, June 2019, <https://www.rfc-editor.org/info/rfc8610>. [RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, "Object Security for Constrained RESTful Environments (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, <https://www.rfc-editor.org/info/rfc8613>. [RFC8724] Minaburo, A., Toutain, L., Gomez, C., Barthel, D., and JC. Zúñiga, "SCHC: Generic Framework for Static Context Header Compression and Fragmentation", RFC 8724, DOI 10.17487/RFC8724, April 2020, <https://www.rfc-editor.org/info/rfc8724>. [RFC8742] Bormann, C., "Concise Binary Object Representation (CBOR) Sequences", RFC 8742, DOI 10.17487/RFC8742, February 2020, <https://www.rfc-editor.org/info/rfc8742>. [RFC8747] Jones, M., Seitz, L., Selander, G., Erdtman, S., andthe CBOR encoded Signature_or_MAC_3, in this order (EAD_3 is empty). P_3ae (CBOR Sequence) (80 bytes) a1 18 22 82 2e 48 70 5d 58 45 f3 6f c6 a6 58 40 ab 9f 7b bd eb c4 eb f8 a3 d3 04 17 9b cc a3 9d 9c 8a 76 73 65 76 fb 3c 32 d2 fa c7 e2 59 34 e5 33 dc c7 02 2e 4d 68 61 c8 f5 fe cb e9 2d 17 4e b2 be af 0a 59 a4 15 84 37 2f 43 2e 6b f4 7b 04 The Associated data A is the following: Associated data A = [ "Encrypt0", h'', TH_3 ] A_3ae (CBOR-encoded) (45 bytes) 83 68 45 6e 63 72 79 70 74 30 40 58 20 f2 4d 18 ca fc e3 74 d4 e3 73 63 29 c1 52 ab 3a ea 9c 7c 0f 65 0c 30 70 b6 f5 1e 68 e2 ae bb 60H. Tschofenig, "Proof-of-Possession KeyK_3ae is the output of HKDF-Expand(PRK_3e2m, info, L). info is defined as follows: infoSemantics forK_3ae = [ 10, h'F24D18CAFCE374D4E3736329C152AB3AEA9C7C0F650C3070B6F51E68E2AEBB60', "K_3ae", 16 ] Which as aCBORencoded data item is: info for K_3ae (CBOR-encoded) (43 bytes) 84 0a 58 20 f2 4d 18 ca fc e3 74 d4 e3 73 63 29 c1 52 ab 3a ea 9c 7c 0f 65 0c 30 70 b6 f5 1e 68 e2 ae bb 60 65 4b 5f 33 61 65 10 L is the length of K_3ae, so 16 bytes. From these parameters, K_3ae is computed: K_3ae (16 bytes) b8 79 9f e3 d1 50 4f d8 eb 22 c4 72 62 cd bb 05 Nonce IV_3ae is the outputWeb Tokens (CWTs)", RFC 8747, DOI 10.17487/RFC8747, March 2020, <https://www.rfc-editor.org/info/rfc8747>. [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", STD 94, RFC 8949, DOI 10.17487/RFC8949, December 2020, <https://www.rfc-editor.org/info/rfc8949>. 9.2. Informative References [Bruni18] Bruni, A., Sahl Jørgensen, T., Grønbech Petersen, T., and C. Schürmann, "Formal Verification ofHKDF-Expand(PRK_3e2m, info, L). info is defined as follows: infoEphemeral Diffie- Hellman Over COSE (EDHOC)", November 2018, <https://www.springerprofessional.de/en/formal- verification-of-ephemeral-diffie-hellman-over-cose- edhoc/16284348>. [CborMe] Bormann, C., "CBOR Playground", May 2018, <http://cbor.me/>. [CNSA] (Placeholder), ., "Commercial National Security Algorithm Suite", August 2015, <https://apps.nsa.gov/iaarchive/programs/iad-initiatives/ cnsa-suite.cfm>. [I-D.ietf-core-oscore-edhoc] Palombini, F., Tiloca, M., Hoeglund, R., Hristozov, S., and G. Selander, "Combining EDHOC and OSCORE", Work in Progress, Internet-Draft, draft-ietf-core-oscore-edhoc-01, 12 July 2021, <https://www.ietf.org/archive/id/draft-ietf- core-oscore-edhoc-01.txt>. [I-D.ietf-core-resource-directory] Amsüss, C., Shelby, Z., Koster, M., Bormann, C., and P. V. D. Stok, "CoRE Resource Directory", Work in Progress, Internet-Draft, draft-ietf-core-resource-directory-28, 7 March 2021, <https://www.ietf.org/archive/id/draft-ietf- core-resource-directory-28.txt>. [I-D.ietf-cose-cbor-encoded-cert] Mattsson, J. P., Selander, G., Raza, S., Höglund, J., and M. Furuhed, "CBOR Encoded X.509 Certificates (C509 Certificates)", Work in Progress, Internet-Draft, draft- ietf-cose-cbor-encoded-cert-02, 12 July 2021, <https://www.ietf.org/archive/id/draft-ietf-cose-cbor- encoded-cert-02.txt>. [I-D.ietf-lake-reqs] Vucinic, M., Selander, G., Mattsson, J. P., and D. Garcia- Carrillo, "Requirements forIV_3ae = [ 10, h'F24D18CAFCE374D4E3736329C152AB3AEA9C7C0F650C3070B6F51E68E2AEBB60', "IV_3ae", 13 ] Which asaCBOR encoded data item is: infoLightweight AKE forIV_3ae (CBOR-encoded) (44 bytes) 84 0a 58 20 f2 4d 18 ca fc e3 74 d4 e3 73 63 29 c1 52 ab 3a ea 9c 7c 0f 65 0c 30 70 b6 f5 1e 68 e2 ae bb 60 66 49 56 5f 33 61 65 0d L is the length of IV_3ae, so 13 bytes. From these parameters, IV_3ae is computed: IV_3ae (13 bytes) 74 c7 de 41 b8 4a 5b b7 19 0a 85 98 dc Using the parameters above, the 'ciphertext' CIPHERTEXT_3 can be computed: CIPHERTEXT_3 (CBOR unencoded) (88 bytes) f5 f6 de bd 82 14 05 1c d5 83 c8 40 96 c4 80 1d eb f3 5b 15 36 3d d1 6e bd 85 30 df dc fb 34 fc d2 eb 6c ad 1d ac 66 a4 79 fb 38 de aa f1 d3 0a 7e 68 17 a2 2a b0 4f 3d 5b 1e 97 2a 0d 13 ea 86 c6 6b 60 51 4c 96 57 ea 89 c5 7b 04 01 ed c5 aa 8b bc ab 81 3c c5 d6 e7 From the parameter above, message_3 is computed, as the CBOR SequenceOSCORE", Work in Progress, Internet-Draft, draft-ietf-lake-reqs-04, 8 June 2020, <https://www.ietf.org/archive/id/draft-ietf- lake-reqs-04.txt>. [I-D.ietf-lwig-security-protocol-comparison] Mattsson, J. P., Palombini, F., and M. Vucinic, "Comparison ofthe following CBOR encoded data items: (C_R, CIPHERTEXT_3). message_3 = ( -24, h'F5F6DEBD8214051CD583C84096C4801DEBF35B15363DD16EBD8530DFDCFB34FCD2EB 6CAD1DAC66A479FB38DEAAF1D30A7E6817A22AB04F3D5B1E972A0D13EA86C66B60514C 9657EA89C57B0401EDC5AA8BBCAB813CC5D6E7' ) Which encodes to the following byte string: message_3 (CBOR Sequence) (91 bytes) 37 58 58 f5 f6 de bd 82 14 05 1c d5 83 c8 40 96 c4 80 1d eb f3 5b 15 36 3d d1 6e bd 85 30 df dc fb 34 fc d2 eb 6c ad 1d ac 66 a4 79 fb 38 de aa f1 d3 0a 7e 68 17 a2 2a b0 4f 3d 5b 1e 97 2a 0d 13 ea 86 c6 6b 60 51 4c 96 57 ea 89 c5 7b 04 01 ed c5 aa 8b bc ab 81 3c c5 d6 e7 D.1.4. OSCORECoAP SecurityContext Derivation From here, the InitiatorProtocols", Work in Progress, Internet-Draft, draft-ietf-lwig-security-protocol- comparison-05, 2 November 2020, <https://www.ietf.org/archive/id/draft-ietf-lwig-security- protocol-comparison-05.txt>. [I-D.ietf-rats-uccs] Birkholz, H., O'Donoghue, J., Cam-Winget, N., andthe Responder can derive an OSCOREC. Bormann, "A CBOR Tag for Unprotected CWT Claims Sets", Work in Progress, Internet-Draft, draft-ietf-rats-uccs-01, 12 July 2021, <https://www.ietf.org/archive/id/draft-ietf- rats-uccs-01.txt>. [I-D.ietf-tls-dtls13] Rescorla, E., Tschofenig, H., and N. Modadugu, "The Datagram Transport Layer SecurityContext, using the EDHOC-Exporter interface. From TH_3(DTLS) Protocol Version 1.3", Work in Progress, Internet-Draft, draft-ietf-tls- dtls13-43, 30 April 2021, <https://www.ietf.org/internet- drafts/draft-ietf-tls-dtls13-43.txt>. [I-D.mattsson-cfrg-det-sigs-with-noise] Mattsson, J. P., Thormarker, E., and S. Ruohomaa, "Deterministic ECDSA and EdDSA Signatures with Additional Randomness", Work in Progress, Internet-Draft, draft- mattsson-cfrg-det-sigs-with-noise-02, 11 March 2020, <https://www.ietf.org/archive/id/draft-mattsson-cfrg-det- sigs-with-noise-02.txt>. [I-D.selander-ace-ake-authz] Selander, G., Mattsson, J. P., Vucinic, M., Richardson, M., and A. Schellenbaum, "Lightweight Authorization for Authenticated Key Exchange.", Work in Progress, Internet- Draft, draft-selander-ace-ake-authz-03, 4 May 2021, <https://www.ietf.org/archive/id/draft-selander-ace-ake- authz-03.txt>. [Norrman20] Norrman, K., Sundararajan, V., andCIPHERTEXT_3, compute the input to the transcript hash TH_4 = H( TH_3, CIPHERTEXT_3 ), as a CBOR SequenceA. Bruni, "Formal Analysis ofthese 2 data items. Input to calculate TH_4 (CBOR Sequence) (124 bytes) 58 20 f2 4d 18 ca fc e3 74 d4 e3 73 63 29 c1 52 ab 3a ea 9c 7c 0f 65 0c 30 70 b6 f5 1e 68 e2 ae bb 60 58 58 f5 f6 de bd 82 14 05 1c d5 83 c8 40 96 c4 80 1d eb f3 5b 15 36 3d d1 6e bd 85 30 df dc fb 34 fc d2 eb 6c ad 1d ac 66 a4 79 fb 38 de aa f1 d3 0a 7e 68 17 a2 2a b0 4f 3d 5b 1e 97 2a 0d 13 ea 86 c6 6b 60 51 4c 96 57 ea 89 c5 7b 04 01 ed c5 aa 8b bc ab 81 3c c5 d6 e7 And from there, compute the transcript hash TH_4 = SHA-256(TH_3 , CIPHERTEXT_4) TH_4 (CBOR unencoded) (32 bytes) 3b 69 a6 7f ec 7e 73 6c c1 a9 52 6c da 00 02 d4 09 f5 b9 ea 0a 2b e9 60 51 a6 e3 0d 93 05 fd 51 The Master Secret and Master Salt are derived as follows: Master Secret = EDHOC-Exporter( "OSCORE Master Secret", 16 ) = EDHOC- KDF(PRK_4x3m, TH_4, "OSCORE Master Secret", 16) = HKDF-Expand( PRK_4x3m, info_ms, 16 ) Master Salt = EDHOC-Exporter( "OSCORE Master Salt", 8 ) = EDHOC- KDF(PRK_4x3m, TH_4, "OSCORE Master Salt", 8) = HKDF-Expand( PRK_4x3m, info_salt, 8 ) info_msEDHOC Key Establishment forOSCORE Master Secret is defined as follows: info_ms = [ 10, h'3B69A67FEC7E736CC1A9526CDA0002D409F5B9EA0A2BE96051A6E30D9305FD51', "OSCORE Master Secret", 16 ] Which as a CBOR encoded data item is: info_msConstrained IoT Devices", September 2020, <https://arxiv.org/abs/2007.11427>. [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology forOSCORE Master Secret (CBOR-encoded) (58 bytes) 84 0a 58 20 3b 69 a6 7f ec 7e 73 6c c1 a9 52 6c da 00 02 d4 09 f5 b9 ea 0a 2b e9 60 51 a6 e3 0d 93 05 fd 51 74 4f 53 43 4f 52 45 20 4d 61 73 74 65 72 20 53 65 63 72 65 74 10 info_saltConstrained-Node Networks", RFC 7228, DOI 10.17487/RFC7228, May 2014, <https://www.rfc-editor.org/info/rfc7228>. [RFC7258] Farrell, S. and H. Tschofenig, "Pervasive Monitoring Is an Attack", BCP 188, RFC 7258, DOI 10.17487/RFC7258, May 2014, <https://www.rfc-editor.org/info/rfc7258>. [RFC7296] Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. Kivinen, "Internet Key Exchange Protocol Version 2 (IKEv2)", STD 79, RFC 7296, DOI 10.17487/RFC7296, October 2014, <https://www.rfc-editor.org/info/rfc7296>. [RFC8446] Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10.17487/RFC8446, August 2018, <https://www.rfc-editor.org/info/rfc8446>. [RFC8937] Cremers, C., Garratt, L., Smyshlyaev, S., Sullivan, N., and C. Wood, "Randomness Improvements forOSCORE Master Salt is defined as follows: info_salt = [ 10, h'3B69A67FEC7E736CC1A9526CDA0002D409F5B9EA0A2BE96051A6E30D9305FD51', "OSCORE Master Salt", 8 ] Which as a CBOR encoded data item is: infoSecurity Protocols", RFC 8937, DOI 10.17487/RFC8937, October 2020, <https://www.rfc-editor.org/info/rfc8937>. [SECG] "Standards forOSCORE Master Salt (CBOR-encoded) (56 Bytes) 84 0a 58 20 3b 69 a6 7f ec 7e 73 6c c1 a9 52 6c da 00 02 d4 09 f5 b9 ea 0a 2b e9 60 51 a6 e3 0d 93 05 fd 51 72 4f 53 43 4f 52 45 20 4d 61 73 74 65 72 20 53 61 6c 74 08 From these parameters, OSCORE Master SecretEfficient Cryptography 1 (SEC 1)", May 2009, <https://www.secg.org/sec1-v2.pdf>. [SIGMA] Krawczyk, H., "SIGMA - The 'SIGn-and-MAc' Approach to Authenticated Diffie-Hellman and Its Use in the IKE- Protocols (Long version)", June 2003, <http://webee.technion.ac.il/~hugo/sigma-pdf.pdf>. [SP-800-56A] Barker, E., Chen, L., Roginsky, A., Vassilev, A., and R. Davis, "Recommendation for Pair-Wise Key-Establishment Schemes Using Discrete Logarithm Cryptography", NIST Special Publication 800-56A Revision 3, April 2018, <https://doi.org/10.6028/NIST.SP.800-56Ar3>. Appendix A. Use with OSCOREMaster Salt are computed: OSCORE Master Secret (16 bytes) 96 aa 88 ce 86 5e ba 1f fa f3 89 64 13 2c c4 42and Transfer over CoAP This appendix describes how to select EDHOC connection identifiers and derive an OSCOREMaster Salt (8 bytes) 5e c3 ee 41 7c fb ba e9 The client'ssecurity context when OSCORESender IDisC_Rused with EDHOC, andthe server'show to transfer EDHOC messages over CoAP. A.1. Selecting EDHOC Connection Identifier This section specifies a rule for converting from EDHOC connection identifier to OSCORESender IDSender/Recipient ID. (An identifier isC_I. Client's OSCORESender ID(1 byte) 00 Server's OSCORE Senderor Recipient ID(1 byte) 09 The AEAD Algorithm and the hash algorithm are the application AEAD and hash algorithms independing on from which endpoint is the point of view, see Section 3.1 of [RFC8613].) * If theselected cipher suite. OSCORE AEAD Algorithm (int) 10 OSCORE Hash Algorithm (int) -16 D.2. Test Vectors for EDHOC Authenticated with Static Diffie-Hellman KeysEDHOCwith static Diffie-Hellman keys and raw public keysconnection identifier isused. In this test vector,numeric, i.e., encoded as akey identifierCBOR integer on the wire, it isusedconverted toidentify the raw public key. The optional C_1a (naturally byte- string shaped) OSCORE Sender/Recipient ID equal to its CBOR encoded form. For example, a numeric C_R equal to 10 (0x0A inmessage_1 is omitted. No external authorization dataCBOR encoding) issentconverted to a (typically client) Sender ID equal to 0x0A, while a numeric C_I equal to -12 (0x2B inthe message exchange. method (Static DH Based Authentication) 3 CoAPCBOR encoding) isused as transport and the Initiator acts as CoAP client: corr (the Initiator can correlate message_1 and message_2) 1 From there, METHOD_CORR has the following value: METHOD_CORR (4converted to a (typically client) Sender ID equal to 0x2B. *method + corr) (int) 13 The Initiator indicates only one cipher suite in the (potentially truncated) list of cipher suites. Supported Cipher Suites (1 byte) 00 The Initiator selected the indicated cipher suite. Selected Cipher Suite (int) 0 Cipher suite 0 is supported by both the Initiator andIf theResponder, see Section 3.6. D.2.1. Message_1 The Initiator generates its ephemeral key pair. X (Initiator's ephemeral private key) (32 bytes) ae 11 a0 db 86 3c 02 27 e5 39 92 fe b8 f5 92 4c 50 d0 a7 ba 6e ea b4 ad 1f f2 45 72 f4 f5 7c fa G_X (Initiator's ephemeral public key, CBOR unencoded) (32 bytes) 8d 3e f5 6d 1b 75 0a 43 51 d6 8a c2 50 a0 e8 83 79 0e fc 80 a5 38 a4 44 ee 9e 2b 57 e2 44 1a 7c The Initiator chooses aEDHOC connection identifierC_I: Connection identifier chosen by Initiator (1 byte) 16 Note that since C_Iis byte-valued, hence encoded as a CBOR byte stringinon theinterval h'00' to h'2f',wire, it isencoded asconverted to an OSCORE Sender/Recipient ID equal to thecorresponding integer - 24, i.e. 0x16 = 22, 22 - 24 = -2, and -2byte string. For example, a byte-string valued C_R equal to 0xFF (0x41FF in CBORencodingencoding) is converted to a (typically client) Sender ID equal to0x21. C_I (1 byte) 21 Since no external authorization data is sent: EAD_1 (0 bytes) Since0xFF. Two EDHOC connection identifiers are called "equivalent" if and only if, by applying thelist of supported cipher suites needs to containconversion above, they both result in theselected cipher suite,same OSCORE Sender/Recipient ID. For example, theinitiator truncatestwo EDHOC connection identifiers with CBOR encoding 0x0A (numeric) and 0x410A (byte- valued) are equivalent since they both result in thelist of supported cipher suites to one cipher suite only, 00. Because one single selected cipher suite is conveyed, itsame OSCORE Sender/Recipient ID 0x0A. When EDHOC isencoded as an int instead ofused to establish anarray: SUITES_I (int) 0 message_1 is constructed asOSCORE security context, theCBOR Sequenceconnection identifiers C_I and C_R MUST NOT be equivalent. Furthermore, in case of multiple OSCORE security contexts with potentially different endpoints, to facilitate retrieval of thedata items above encoded as CBOR. In CBOR diagnostic notation: message_1 = ( 13, 0, h'8D3EF56D1B750A4351D68AC250A0E883790EFC80A538A444EE9E2B57E2441A7C', -2 ) Which as a CBOR encoded data item is: message_1 (CBOR Sequence) (37 bytes) 0d 00 58 20 8d 3e f5 6d 1b 75 0a 43 51 d6 8a c2 50 a0 e8 83 79 0e fc 80 a5 38 a4 44 ee 9e 2b 57 e2 44 1a 7c 21 D.2.2. Message_2 Since METHOD_CORR mod 4 equals 1, C_I is omitted from data_2. The Responder generatescorrect OSCORE security context, an endpoint SHOULD select an EDHOC connection identifier that when converted to OSCORE Recipient ID does not coincide with its other Recipient IDs. A.2. Deriving thefollowing ephemeral key pair. Y (Responder's ephemeral private key) (32 bytes) c6 46 cd dc 58 12 6e 18 10 5f 01 ce 35 05 6e 5e bc 35 f4 d4 cc 51 07 49 a3 a5 e0 69 c1 16 16 9a G_Y (Responder's ephemeral public key, CBOR unencoded) (32 bytes) 52 fb a0 bd c8 d9 53 dd 86 ce 1a b2 fd 7c 05 a4 65 8c 7c 30 af db fc 33 01 04 70 69 45 1b af 35 From G_XOSCORE Security Context This section specifies how to use EDHOC output to derive the OSCORE security context. After successful processing of EDHOC message_3, Client andY or from G_YServer derive Security Context parameters for OSCORE as follows (see Section 3.2 of [RFC8613]): * The Master Secret andXMaster Salt are derived by using theECDH shared secret is computed: G_XY (ECDH shared secret) (32 bytes) de fc 2f 35 69 10 9b 3d 1f a4 a7 3d c5 e2 fe b9 e1 15 0d 90 c2 5e e2 f0 66 c2 d8 85 f4 f8 ac 4eEDHOC- Exporter interface, see Section 4.3. Thekey and nonceEDHOC Exporter Labels forcalculatingderiving the'ciphertext'OSCORE Master Secret and the OSCORE Master Salt, arecalculated as follows, as specified in Section 4. HKDF SHA-256"OSCORE Master Secret" and "OSCORE Master Salt", respectively. The context parameter is h'' (0x40), theHKDF used (as defined byempty CBOR byte string. By default, key_length is the key length (in bytes) of the application AEAD Algorithm of the selected cipher suite0). PRK_2efor the EDHOC session. Also by default, salt_length has value 8. The Initiator and Responder MAY agree out-of-band on a longer key_length than the default and on a different salt_length. Master Secret =HMAC-SHA-256(salt, G_XY)EDHOC-Exporter( "OSCORE Master Secret", , key_length ) Master Salt = EDHOC-Exporter( "OSCORE Master Salt", , salt_length ) * The AEAD Algorithm is theempty byte string. salt (0 bytes) From there, PRK_2e is computed: PRK_2e (32 bytes) 93 9f cb 05 6d 2e 41 4f 1b ec 61 04 61 99 c2 c7 63 d2 7f 0c 3d 15 fa 16 71 fa 13 4e 0d c5 a0 4dapplication AEAD algorithm of the selected cipher suite for the EDHOC session. * TheResponder's static Diffie-Hellman key pairHKDF Algorithm is thefollowing: R (Responder's private authentication key) (32 bytes) bb 50 1a ac 67 b9 a9 5f 97 e0 ed ed 6b 82 a6 62 93 4f bb fc 7a d1 b7 4c 1f ca d6 6a 07 94 22 d0 G_R (Responder's public authentication key) (32 bytes) a3 ff 26 35 95 be b3 77 d1 a0 ce 1d 04 da d2 d4 09 66 ac 6b cb 62 20 51 b8 46 59 18 4d 5d 9a 32 Sinceone based on the application hash algorithm of the selected cipher suite for the EDHOC session. For example, if SHA-256 is theResponder authenticates with a static Diffie-Hellman key, PRK_3e2m = HKDF-Extract( PRK_2e, G_RX ), where G_RXapplication hash algorithm of the selected ciphersuite, HKDF SHA-256 is used as HKDF Algorithm in theECDH shared secret calculated from G_R and X, or G_XOSCORE Security Context. * In case the Client is Initiator andR. FromtheResponder's authentication keyServer is Responder, the Client's OSCORE Sender ID and theInitiator's ephemeral key (see Appendix D.2.1),Server's OSCORE Sender ID are determined from theECDH shared secret G_RX is calculated. G_RX (ECDH shared secret) (32 bytes) 21 c7 ef f4 fb 69 fa 4b 67 97 d0 58 84 31 5d 84 11 a3 fd a5 4f 6d ad a6 1d 4f cd 85 e7 90 66 68 PRK_3e2m (32 bytes) 75 07 7c 69 1e 35 01 2d 48 bc 24 c8 4f 2b ab 89 f5 2f ac 03 fe dd 81 3e 43 8c 93 b1 0b 39 93 07 The Responder chooses aEDHOC connectionidentifier C_R. Connection identifier chosen by Responder (1 byte) 00 Note that sinceidentifiers C_Ris a byte stringand C_I for the EDHOC session, respectively, by applying the conversion in Appendix A.1. The reverse applies in case theinterval h'00' to h'2f', itClient isencoded asthecorresponding integer - 24, i.e. 0x00 = 0, 0 - 24 = -24,Responder and-24 in CBOR encoding is equal to 0x37. C_R (1 byte) 37 Data_2the Server isconstructed astheCBOR Sequence of G_YInitiator. Client andC_R. data_2 = ( h'52FBA0BDC8D953DD86CE1AB2FD7C05A4658C7C30AFDBFC3301047069451BAF35', -24 ) WhichServer use the parameters above to establish an OSCORE Security Context, asa CBOR encoded data item is: data_2 (CBOR Sequence) (35 bytes) 58 20 52 fb a0 bd c8 d9 53 dd 86 ce 1a b2 fd 7c 05 a4 65 8c 7c 30 af db fc 33 01 04 70 69 45 1b af 35 37per Section 3.2.1 of [RFC8613]. Fromdata_2then on, Client andmessage_1, computeServer retrieve theinput toOSCORE protocol state using thetranscript hash TH_2 = H( H(message_1), data_2 ),Recipient ID, and optionally other transport information such as the 5-tuple. A.3. Transferring EDHOC over CoAP This section specifies one instance for how EDHOC can be transferred asa CBOR Sequencean exchange ofthese 2 data items. InputCoAP [RFC7252] messages. CoAP is a reliable transport that can preserve packet ordering and handle message duplication. CoAP can also perform fragmentation and protect against denial-of-service attacks. According tocalculate TH_2 (CBOR Sequence) (72 bytes) 0d 00 58 20 8d 3e f5 6d 1b 75 0a 43 51 d6 8a c2 50 a0 e8 83 79 0e fc 80 a5 38 a4 44 ee 9e 2b 57 e2 44 1a 7c 21 58 20 52 fb a0 bd c8 d9 53 dd 86 ce 1a b2 fd 7c 05 a4 65 8c 7c 30 af db fc 33 01 04 70 69 45 1b af 35 37 And from there, compute the transcript hash TH_2 = SHA-256( H(message_1), data_2 ) TH_2 (CBOR unencoded) (32 bytes) de cf d6 4a 36 67 64 0a 02 33 b0 4a a8 aa 91 f6 89 56 b8 a5 36 d0 cf 8c 73 a6 e8 a7 c3 62 1e 26 The Responder's subject namethis specification, EDHOC messages are carried in Confirmable messages, which is beneficial especially if fragmentation is used. By default, theempty string: Responder's subject name (text string) "" ID_CRED_RCoAP client is thefollowing: ID_CRED_R = { 4: h'05' } ID_CRED_R (4 bytes) a1 04 41 05 CRED_RInitiator and the CoAP server is thefollowing COSE_Key: { 1: 1, -1: 4, -2: h'A3FF263595BEB377D1A0CE1D04DAD2D40966AC6BCB622051B84659184D5D9A32, "subject name": "" } Which encodes toResponder, but thefollowing byte string: CRED_R (54 bytes) a4 01 01 20 04 21 58 20 a3 ff 26 35 95roles SHOULD beb3 77 d1 a0 ce 1d 04 da d2 d4 09 66 ac 6b cb 62 20 51 b8 46 59 18 4d 5d 9a 32 6c 73 75 62 6a 65 63 74 20 6e 61 6d 65 60 Since no external authorization data is sent: EAD_2 (0 bytes) The plaintextchosen to protect the most sensitive identity, see Section 7. According to this specification, EDHOC isdefined astransferred in POST requests and 2.04 (Changed) responses to theempty string: P_2m (0 bytes) The Enc_structureUri-Path: "/.well-known/edhoc". An application may define its own path that can be discovered, e.g., using resource directory [I-D.ietf-core-resource-directory]. By default, the message flow isdefinedas follows:[ "Encrypt0", << ID_CRED_R >>, << TH_2, CRED_R >> ], so ID_CRED_REDHOC message_1 is sent in the payload of a POST request from the client to the server's resource for EDHOC. EDHOC message_2 or the EDHOC error message isencoded as a CBOR bstr, andsent from theconcatenationserver to the client in the payload of a 2.04 (Changed) response. EDHOC message_3 or theCBOR byte strings TH_2 and CRED_REDHOC error message iswrappedsent from the client to the server's resource in the payload of aCBOR bstr. A_2m = [ "Encrypt0", h'A1044105', h'5820DECFD64A3667640A0233B04AA8AA91F68956B8A536D0CF8C73A6E8A7C3621E2 6A401012004215820A3FF263595BEB377D1A0CE1D04DAD2D40966AC6BCB622051B846 59184D5D9A326C7375626A656374206E616D6560' ] Which encodes toPOST request. If needed, an EDHOC error message is sent from thefollowing byte stringserver tobe used as Additional Authenticated Data: A_2m (CBOR-encoded) (105 bytes) 83 68 45 6e 63 72 79 70 74 30 44 a1 04 41 05 58 58 58 20 de cf d6 4a 36 67 64 0a 02 33 b0 4a a8 aa 91 f6 89 56 b8 a5 36 d0 cf 8c 73 a6 e8 a7 c3 62 1e 26 a4 01 01 20 04 21 58 20 a3 ff 26 35 95 be b3 77 d1 a0 ce 1d 04 da d2 d4 09 66 ac 6b cb 62 20 51 b8 46 59 18 4d 5d 9a 32 6c 73 75 62 6a 65 63 74 20 6e 61 6d 65 60 info for K_2m is defined as follows: info for K_2m = [ 10, h'DECFD64A3667640A0233B04AA8AA91F68956B8A536D0CF8C73A6E8A7C3621E26', "K_2m", 16 ] Which asthe client in the payload of aCBOR encoded data item is: info for K_2m (CBOR-encoded) (42 bytes) 84 0a 58 20 de cf d6 4a 36 67 64 0a 02 33 b0 4a a8 aa 91 f6 89 56 b8 a5 36 d0 cf 8c 73 a6 e8 a7 c3 62 1e 26 64 4b 5f 32 6d 10 From these parameters, K_2m2.04 (Changed) response. Alternatively, if EDHOC message_4 iscomputed. Key K_2mused, it is sent from theoutput of HKDF-Expand(PRK_3e2m, info, L), where L isserver to thelengthclient in the payload ofK_2m, so 16 bytes. K_2m (16 bytes) 4e cd ef ba d8 06 81 8b 62 51 b9 d7 86 78 bc 76 info for IV_2m is defined as follows: info for IV_2m = [ 10, h'A51C76463E8AE58FD3B8DC5EDE1E27143CC92D223EACD9E5FF6E3FAC876658A5', "IV_2m", 13 ] Which asa 2.04 (Changed) response analogously to message_2. In order to correlate a message received from a client to a message previously sent by the server, messages sent by the client are prepended with the CBORencoded data item is: info for IV_2m (CBOR-encoded) (43 bytes) 84 0a 58 20 de cf d6 4a 36 67 64 0a 02 33 b0 4a a8 aa 91 f6 89 56 b8 a5 36 d0 cf 8c 73 a6 e8 a7 c3 62 1e 26 65 49 56 5f 32 6d 0d From these parameters, IV_2mserialization of the connection identifier which the server has chosen. This applies independently of if the CoAP server iscomputed. IV_2mResponder or Initiator. For the default case when the server is Responder, theoutput of HKDF-Expand(PRK_3e2m, info, L), where Lprepended connection identifier is C_R, and C_I if thelength of IV_2m, so 13 bytes. IV_2m (13 bytes) e9 b8 e4 b1 bd 02 f4 9a 82 0d d3 53 4f Finally, COSE_Encrypt0server iscomputed fromInitiator. If message_1 is sent to theparameters above. o protected header = CBOR-encoded ID_CRED_R o external_aad = A_2m o empty plaintext = P_2m MAC_2server, the CBOR simple value "true" (0xf5) is sent in its place (given that the'ciphertext'server has not selected C_R yet). These identifiers are encoded in CBOR and thus self-delimiting. They are sent in front of theCOSE_Encrypt0 with empty plaintext. In caseactual EDHOC message, and only the part ofcipher suite 0theAEAD is AES-CCM truncated to 8 bytes: MAC_2 (CBOR unencoded) (8 bytes) 42 e7 99 78 43 1e 6b 8f Since method = 2, Signature_or_MAC_2 is MAC_2: Signature_or_MAC_2 (CBOR unencoded) (8 bytes) 42 e7 99 78 43 1e 6b 8f CIPHERTEXT_2 isbody following theciphertext resulting from XOR between plaintext and KEYSTREAM_2 whichidentifier isderived from TH_2 andused for EDHOC processing. Consequently, thepseudorandom key PRK_2e. The plaintextapplication/edhoc media type does not apply to these messages; their media type isthe CBOR Sequenceunnamed. An example of a successful EDHOC exchange using CoAP is shown in Figure 9. In this case theitems ID_CRED_RCoAP Token enables correlation on the Initiator side, and theCBOR encoded Signature_or_MAC_2,prepended C_R enables correlation on the Responder (server) side. Client Server | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Payload: true, EDHOC message_1 | | |<---------+ Header: 2.04 Changed | 2.04 | Content-Format: application/edhoc | | Payload: EDHOC message_2 | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Payload: C_R, EDHOC message_3 | | |<---------+ Header: 2.04 Changed | 2.04 | | | Figure 9: Transferring EDHOC inthis order (EAD_2 is empty). Note that since ID_CRED_R contains a single 'kid' parameter, i.e., ID_CRED_R = { 4 : kid_R }, onlyCoAP when thebyte string kid_RInitiator isconveyedCoAP Client The exchange in Figure 9 protects theplaintext encoded as a bstr_identifier. kid_R is encoded as the corresponding integer - 24, i.e. 0x05 = 5, 5 - 24 = -19,client identity against active attackers and-19 in CBOR encoding is equal to 0x32. The plaintext is the following: P_2e (CBOR Sequence) (10 bytes) 32 48 42 e7 99 78 43 1e 6b 8f KEYSTREAM_2 = HKDF-Expand( PRK_2e, info, length ), where length is the length oftheplaintext, so 10. info for KEYSTREAM_2 = [ 10, h'DECFD64A3667640A0233B04AA8AA91F68956B8A536D0CF8C73A6E8A7C3621E26', "KEYSTREAM_2", 10 ] Which as a CBOR encoded data item is: info for KEYSTREAM_2 (CBOR-encoded) (49 bytes) 84 0a 58 20 de cf d6 4a 36 67 64 0a 02 33 b0 4a a8 aa 91 f6 89 56 b8 a5 36 d0 cf 8c 73 a6 e8 a7 c3 62 1e 26 6b 4b 45 59 53 54 52 45 41 4d 5f 32 0a From there, KEYSTREAM_2 is computed: KEYSTREAM_2 (10 bytes) 91 b9 ff ba 9b f5 5a d1 57 16 Usingserver identity against passive attackers. An alternative exchange that protects theparameters above,server identity against active attackers and theciphertext CIPHERTEXT_2 can be computed: CIPHERTEXT_2 (CBOR unencoded) (10 bytes) a3 f1 bd 5d 02 8d 19 cf 3c 99 message_2client identity against passive attackers isthe CBOR Sequence of data_2 and CIPHERTEXT_2,shown in Figure 10. In thisorder: message_2 = ( data_2, h'A3F1BD5D028D19CF3C99' ) Which as a CBOR encoded data item is: message_2 (CBOR Sequence) (46 bytes) 58 20 52 fb a0 bd c8 d9 53 dd 86 ce 1a b2 fd 7c 05 a4 65 8c 7c 30 af db fc 33 01 04 70 69 45 1b af 35 37 4a a3 f1 bd 5d 02 8d 19 cf 3c 99 D.2.3. Message_3 Since corr equals 1, C_R is not omitted from data_3. The Initiator's static Diffie-Hellman key pair is the following: I (Initiator's private authentication key) (32 bytes) 2b be a6 55 c2 33 71 c3 29 cf bd 3b 1f 02 c6 c0 62 03 38 37 b8 b5 90 99 a4 43 6f 66 60 81 b0 8e G_I (Initiator's public authentication key, CBOR unencoded) (32 bytes) 2c 44 0c c1 21 f8 d7 f2 4c 3b 0e 41 ae da fe 9c aa 4f 4e 7a bb 83 5e c3 0f 1d e8 8a db 96 ff 71 HKDF SHA-256 iscase theHKDF used (as defined by cipher suite 0). FromCoAP Token enables theInitiator's authentication keyResponder to correlate message_2 and message_3, and theResponder's ephemeral key (see Appendix D.2.2),prepended C_I enables correlation on theECDH shared secret G_IYInitiator (server) side. If EDHOC message_4 iscalculated. G_IY (ECDH shared secret) (32 bytes) cb ff 8c d3 4a 81 df ec 4c b6 5d 9a 57 2e bd 09 64 45 0c 78 56 3d a4 98 1d 80 d3 6c 8b 1a 75 2a PRK_4x3m = HMAC-SHA-256 (PRK_3e2m, G_IY). PRK_4x3m (32 bytes) 02 56 2f 1f 01 78 5c 0a a5 f5 94 64 0c 49 cb f6 9f 72 2e 9e 6c 57 83 7d 8e 15 79 ec 45 fe 64 7a data 3used, C_I isequal to C_R. data_3 (CBOR Sequence) (1 byte) 37 From data_3, CIPHERTEXT_2,prepended, andTH_2, compute the input toit is transported with CoAP in thetranscript hash TH_3 = H( H(TH_2 , CIPHERTEXT_2), data_3), as a CBOR Sequencepayload ofthese 2 data items. Input to calculate TH_3 (CBOR Sequence) (46 bytes) 58 20 de cf d6 4a 36 67 64 0a 02 33 b0 4a a8 aa 91 f6 89 56 b8 a5 36 d0 cf 8c 73 a6 e8 a7 c3 62 1e 26 4a a3 f1 bd 5d 02 8d 19 cf 3c 99 37 And from there, compute the transcript hash TH_3 = SHA-256( H(TH_2 , CIPHERTEXT_2), data_3) TH_3 (CBOR unencoded) (32 bytes) b6 cd 80 4f c4 b9 d7 ca c5 02 ab d7 7c da 74 e4 1c b0 11 82 d7 cb 8b 84 db 03 ff a5 83 a3 5f cb The initiator's subject name isa POST request with a 2.04 (Changed) response. Client Server | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | |<---------+ Header: 2.04 Changed | 2.04 | Content-Format: application/edhoc | | Payload: EDHOC message_1 | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Payload: C_I, EDHOC message_2 | | |<---------+ Header: 2.04 Changed | 2.04 | Content-Format: application/edhoc | | Payload: EDHOC message_3 | | Figure 10: Transferring EDHOC in CoAP when theempty string: Initiator's subject name (text string) "" And its credential is: ID_CRED_I = { 4: h'23' } ID_CRED_I (4 bytes) a1 04 41 23 CRED_IInitiator is CoAP Server To protect against denial-of-service attacks, thefollowing COSE_Key: { 1:1, -1:4, -2:h'2C440CC121F8D7F24C3B0E41AEDAFE9CAA4F4E7ABB835EC30F1DE88ADB96FF71', "subject name":"" } Which encodesCoAP server MAY respond to thefollowing byte string: CRED_I (54 bytes) a4 01 01 20 04 21 58 20 2c 44 0c c1 21 f8 d7 f2 4c 3b 0e 41 ae da fe 9c aa 4f 4e 7a bb 83 5e c3 0f 1d e8 8a db 96 ff 71 6c 73 75 62 6a 65 63 74 20 6e 61 6d 65 60 Since no external authorization data is exchanged: EAD_3 (0 bytes) The plaintext offirst POST request with a 4.01 (Unauthorized) containing an Echo option [I-D.ietf-core-echo-request-tag]. This forces theCOSE_Encryptinitiator to demonstrate its reachability at its apparent network address. If message fragmentation is needed, theempty string: P_3m (0 bytes) The associated data isEDHOC messages may be fragmented using thefollowing: [ "Encrypt0", << ID_CRED_I >>, << TH_3, CRED_I, ? EAD_3 >> ]. A_3m (CBOR-encoded) (105 bytes) 83 68 45 6e 63 72 79 70 74 30 44 a1 04 41 23 58 58 58 20 b6 cd 80 4f c4 b9 d7 ca c5 02 ab d7 7c da 74 e4 1c b0 11 82 d7 cb 8b 84 db 03 ff a5 83 a3 5f cb a4 01 01 20 04 21 58 20 2c 44 0c c1 21 f8 d7 f2 4c 3b 0e 41 ae da fe 9c aa 4f 4e 7a bb 83 5e c3 0f 1d e8 8a db 96 ff 71 6c 73 75 62 6a 65 63 74 20 6e 61 6d 65 60 Info for K_3m is computedCoAP Block-Wise Transfer mechanism [RFC7959]. EDHOC does not restrict how error messages are transported with CoAP, asfollows: info for K_3m = [ 10, h'B6CD804FC4B9D7CAC502ABD77CDA74E41CB01182D7CB8B84DB03FFA583A35FCB', "K_3m", 16 ] Whichlong as the appropriate error message can to be transported in response to aCBOR encoded data item is: infomessage that failed (see Section 6). EDHOC error messages transported with CoAP are carried in the payload. A.3.1. Transferring EDHOC and OSCORE over CoAP When using EDHOC over CoAP forK_3m (CBOR-encoded) (42 bytes) 84 0a 58 20 b6 cd 80 4f c4 b9 d7 ca c5 02 ab d7 7c da 74 e4 1c b0 11 82 d7 cb 8b 84 db 03 ff a5 83 a3 5f cb 64 4b 5f 33 6d 10 From these parameters, K_3mestablishing an OSCORE Security Context, EDHOC error messages sent as CoAP responses MUST be sent in the payload of error responses, i.e., they MUST specify a CoAP error response code. In particular, it iscomputed. Key K_3mRECOMMENDED that such error responses have response code either 4.00 (Bad Request) in case of client error (e.g., due to a malformed EDHOC message), or 5.00 (Internal Server Error) in case of server error (e.g., due to failure in deriving EDHOC key material). The Content-Format of the error response MUST be set to application/edhoc. A method for combining EDHOC and OSCORE protocols in two round-trips is specified in [I-D.ietf-core-oscore-edhoc]. Appendix B. Compact Representation As described in Section 4.2 of [RFC6090] theoutputx-coordinate ofHKDF-Expand(PRK_4x3m, info, L), where Lan elliptic curve public key is a suitable representative for thelength of K_2m, so 16 bytes. K_3m (16 bytes) 02 c7 e7 93 89 9d 90 d1 28 28 10 26 96 94 c9 58 Nonce IV_3mentire point whenever scalar multiplication is used as a one-way function. One example is ECDH with compact output, where only theoutputx-coordinate ofHKDF-Expand(PRK_4x3m, info, L), where L = 13 bytes. Info for IV_3mthe computed value isdefined as follows: info for IV_3m = [ 10, h'B6CD804FC4B9D7CAC502ABD77CDA74E41CB01182D7CB8B84DB03FFA583A35FCB', "IV_3m", 13 ] Whichused as the shared secret. This section defines aCBOR encoded data item is: infoformat forIV_3m (CBOR-encoded) (43 bytes) 84 0a 58 20 b6 cd 80 4f c4 b9 d7 ca c5 02 ab d7 7c da 74 e4 1c b0 11 82 d7 cb 8b 84 db 03 ff a5 83 a3 5f cb 65 49 56 5f 33 6d 0d From these parameters, IV_3m is computed: IV_3m (13 bytes) 0d a7 cc 3a 6f 9a b2 48 52 ce 8b 37 a6 MAC_3 iscompact representation based on the'ciphertext'Elliptic-Curve-Point-to-Octet-String Conversion defined in Section 2.3.3 of [SECG]. Using theCOSE_Encrypt0 with empty plaintext. In case of cipher suite 0notation from [SECG], theAEADoutput isAES-CCM truncatedan octet string of length ceil( (log2 q) / 8 ). See [SECG] for a definition of q, M, X, xp, and ~yp. The steps in Section 2.3.3 of [SECG] are replaced by: 1. Convert the field element xp to an octet string X of length ceil( (log2 q) / 8bytes: MAC_3 (CBOR unencoded) (8 bytes) ee 59 8e a6 61 17 dc c3 Since method) octets using the conversion routine specified in Section 2.3.5 of [SECG]. 2. Output M =3, Signature_or_MAC_3 is MAC_3: Signature_or_MAC_3 (CBOR unencoded) (8 bytes) ee 59 8e a6 61 17 dc c3 Finally,X The encoding of theouter COSE_Encrypt0point at infinity iscomputed. The plaintextnot supported. Compact representation does not change any requirements on validation. If a y-coordinate is required for validation or compatibily with APIs theCBOR Sequence ofvalue ~yp SHALL be set to zero. For such use, the compact representation can be transformed into theitems ID_CRED_I andSECG point compressed format by prepending it with theCBOR encoded Signature_or_MAC_3, in this order (EAD_3 is empty). Note that since ID_CRED_I contains asingle'kid' parameter, i.e., ID_CRED_Ibyte 0x02 (i.e., M ={ 4 : kid_I }, only0x02 || X). Using compact representation have some security benefits. An implementation does not need to check that thebyte string kid_Ipoint isconveyed innot theplaintext encodedpoint at infinity (the identity element). Similarly, asa bstr_identifier. kid_Inot even the sign of the y-coordinate isencoded asencoded, compact representation trivially avoids so called "benign malleability" attacks where an attacker changes thecorresponding integer - 24, i.e. 0x23 = 35, 35 - 24 = 11,sign, see [SECG]. Appendix C. Use of CBOR, CDDL and11COSE inCBOR encodingEDHOC This Appendix isequalintended to0x0b. P_3ae (CBOR Sequence) (10 bytes) 0b 48 ee 59 8e a6 61 17 dc c3simplify for implementors not familiar with CBOR [RFC8949], CDDL [RFC8610], COSE [I-D.ietf-cose-rfc8152bis-struct], and HKDF [RFC5869]. C.1. CBOR and CDDL TheAssociated data A is the following: Associated data A = [ "Encrypt0", h'', TH_3 ] A_3ae (CBOR-encoded) (45 bytes) 83 68 45 6e 63 72 79 70 74 30 40 58 20 b6 cd 80 4f c4 b9 d7 ca c5 02 ab d7 7c da 74 e4 1c b0 11 82 d7 cb 8b 84 db 03 ff a5 83 a3 5f cb Key K_3ae is the output of HKDF-Expand(PRK_3e2m, info, L). infoConcise Binary Object Representation (CBOR) [RFC8949] isdefined as follows: info for K_3ae = [ 10, h'B6CD804FC4B9D7CAC502ABD77CDA74E41CB01182D7CB8B84DB03FFA583A35FCB', "K_3ae", 16 ] Which asaCBOR encodeddataitem is: infoformat designed forK_3ae (CBOR-encoded) (43 bytes) 84 0a 58 20 b6 cd 80 4f c4 b9 d7 ca c5 02 ab d7 7c da 74 e4 1c b0 11 82 d7 cb 8b 84 db 03 ff a5 83 a3 5f cb 65 4b 5f 33 61 65 10 L issmall code size and small message size. CBOR builds on thelength of K_3ae, so 16 bytes. From these parameters, K_3ae is computed: K_3ae (16 bytes) 6b a4 c8 83 1d e3 ae 23 e9 8e f7 35 08 d0 95 86 Nonce IV_3ae isJSON data model but extends it by e.g., encoding binary data directly without base64 conversion. In addition to theoutput of HKDF-Expand(PRK_3e2m, info, L). infobinary CBOR encoding, CBOR also has a diagnostic notation that isdefined as follows: info for IV_3ae = [ 10, h'97D8AD42334833EB25B960A5EB0704505F89671A0168AA1115FAF92D9E67EF04', "IV_3ae", 13 ] Which asreadable and editable by humans. The Concise Data Definition Language (CDDL) [RFC8610] provides a way to express structures for protocol messages and APIs that use CBOR. [RFC8610] also extends the diagnostic notation. CBORencodeddataitem is: info for IV_3ae (CBOR-encoded) (44 bytes) 84 0a 58 20 b6 cd 80 4f c4 b9 d7 ca c5 02 ab d7 7c da 74 e4 1c b0 11 82 d7 cb 8b 84 db 03 ff a5 83 a3 5f cb 66 49 56 5f 33 61 65 0d L isitems are encoded to or decoded from byte strings using a type-length-value encoding scheme, where thelengththree highest order bits ofIV_3ae, so 13 bytes. From these parameters, IV_3ae is computed: IV_3ae (13 bytes) 6c 6d 0f e1 1e 9a 1a f3 7b 87 84 55 10 Using the parameters above, the 'ciphertext' CIPHERTEXT_3 can be computed: CIPHERTEXT_3 (CBOR unencoded) (18 bytes) d5 53 5f 31 47 e8 5f 1c fa cd 9e 78 ab f9 e0 a8 1b bf Fromtheparameter above, message_3 is computed, asinitial byte contain information about the major type. CBORSequencesupports several different types of data items, in addition to integers (int, uint), simple values, byte strings (bstr), and text strings (tstr), CBOR also supports arrays [] of data items, maps {} of pairs of data items, and sequences [RFC8742] of data items. Some examples are given below. For a complete specification and more examples, see [RFC8949] and [RFC8610]. We recommend implementors to get used to CBOR by using thefollowing items: (C_R, CIPHERTEXT_3). message_3 =CBOR playground [CborMe]. Diagnostic Encoded Type ------------------------------------------------------------------ 1 0x01 unsigned integer 24 0x1818 unsigned integer -24 0x37 negative integer -25 0x3818 negative integer true 0xf5 simple value h'12cd' 0x4212cd byte string '12cd' 0x4431326364 byte string "12cd" 0x6431326364 text string { 4 : h'cd' } 0xa10441cd map << 1, 2, true >> 0x430102f5 byte string [ 1, 2, true ] 0x830102f5 array (-24, h'D5535F3147E85F1CFACD9E78ABF9E0A81BBF'1, 2, true )Which encodes to the following byte string: message_3 (CBOR Sequence) (20 bytes) 37 52 d5 53 5f 31 47 e8 5f 1c fa cd 9e 78 ab f9 e0 a8 1b bf D.2.4. OSCORE Security Context Derivation From here, the Initiator and the Responder can derive an OSCORE Security Context, using the EDHOC-Exporter interface. From TH_3 and CIPHERTEXT_3, compute the input to0x0102f5 sequence 1, 2, true 0x0102f5 sequence ------------------------------------------------------------------ C.2. CDDL Definitions This sections compiles thetranscript hash TH_4 = H( TH_3, CIPHERTEXT_3 ), as a CBOR SequenceCDDL definitions for ease ofthese 2 data items. Input to calculate TH_4 (CBOR Sequence) (53 bytes) 58 20 b6 cd 80 4f c4 b9 d7 ca c5 02 ab d7 7c da 74 e4 1c b0 11 82 d7 cb 8b 84 db 03 ff a5 83 a3 5f cb 52 d5 53 5f 31 47 e8 5f 1c fa cd 9e 78 ab f9 e0 a8 1b bf And from there, compute the transcript hash TH_4reference. suite =SHA-256(TH_3 , CIPHERTEXT_4) TH_4 (CBOR unencoded) (32 bytes) 7c cf de dc 2c 10 ca 03 56 e9 57 b9 f6 a5 92 e0 fa 74 db 2a b5 4f 59 24 40 96 f9 a2 ac 56 d2 07 The Master Secret and Master Salt are derived as follows: Master Secretint ead =EDHOC-Exporter( "OSCORE Master Secret", 161* ( type : int, ext_authz_data : any, ) message_1 =EDHOC- KDF(PRK_4x3m, TH_4, "OSCORE Master Secret", 16) = HKDF-Expand( PRK_4x3m, info_ms, 16( METHOD : int, SUITES_I : [ selected : suite, supported : 2* suite ] / suite, G_X : bstr, C_I : bstr / int, ? EAD_1 : ead, )Master Saltmessage_2 =EDHOC-Exporter( "OSCORE Master Salt", 8( G_Y_CIPHERTEXT_2 : bstr, C_R : bstr / int, ) message_3 =EDHOC- KDF(PRK_4x3m, TH_4, "OSCORE Master Salt", 8) = HKDF-Expand( PRK_4x3m, info_salt, 8( CIPHERTEXT_3 : bstr, )info_ms for OSCORE Master Secret is defined as follows: info_msmessage_4 = ( CIPHERTEXT_4 : bstr, ) SUITES_R : [10, h'7CCFDEDC2C10CA0356E957B9F6A592E0FA74DB2AB54F59244096F9A2AC56D207', "OSCORE Master Secret", 16 ] Which as a CBOR encoded data item is: info_ms for OSCORE Master Secret (CBOR-encoded) (58 bytes) 84 0a 58 20 7c cf de dc 2c 10 ca 03 56 e9 57 b9 f6 a5 92 e0 fa 74 db 2a b5 4f 59 24 40 96 f9 a2 ac 56 d2 07 74 4f 53 43 4f 52 45 20 4d 61 73 74 65 72 20 53 65 63 72 65 74 10 info_salt for OSCORE Master Salt is defined as follows: info_saltsupported : 2* suite ] / suite error = ( ERR_CODE : int, ERR_INFO : any, ) info = [10, h'7CCFDEDC2C10CA0356E957B9F6A592E0FA74DB2AB54F59244096F9A2AC56D207', "OSCORE Master Salt", 8edhoc_aead_id : int / tstr, transcript_hash : bstr, label : tstr, * context : any, length : uint, ]Which as aC.3. COSE CBORencodedObject Signing and Encryption (COSE) [I-D.ietf-cose-rfc8152bis-struct] describes how to create and process signatures, message authentication codes, and encryption using CBOR. COSE builds on JOSE, but is adapted to allow more efficient processing in constrained devices. EDHOC makes use of COSE_Key, COSE_Encrypt0, and COSE_Sign1 objects in the message processing: * ECDH ephemeral public keys of type EC2 or OKP in message_1 and message_2 consist of the COSE_Key parameter named 'x', see Section 7.1 and 7.2 of [I-D.ietf-cose-rfc8152bis-algs] * Certain ciphertexts in message_2 and message_3 consist of a subset of the single recipient encrypted dataitem is: info for OSCORE Master Salt (CBOR-encoded) (56 Bytes) 84 0a 58 20 7c cf de dc 2c 10 ca 03 56 e9 57 b9 f6 a5 92 e0 fa 74 db 2a b5 4f 59 24 40 96 f9 a2 ac 56 d2 07 72 4f 53 43 4f 52 45 20 4d 61 73 74 65 72 20 53 61 6c 74 08 From these parameters, OSCORE Master Secretobject COSE_Encrypt0, which is described in Sections 5.2-5.3 of [I-D.ietf-cose-rfc8152bis-struct]. The ciphertext is computed over the plaintext andOSCORE Master Salt are computed: OSCORE Master Secret (16 bytes) c3 4a 50 6d 0e bf bd 17 03 04 86 13 5f 9c b3 50 OSCORE Master Salt (8 bytes) c2 24 34 9d 9b 34 ca 8cassociated data, using an encryption key and a nonce. Theclient's OSCORE Sender IDassociated data isC_Ran Enc_structure consisting of protected headers and externally supplied data (external_aad). * Signatures in message_2 of method 0 and 2, and in message_3 of method 0 and 1, consist of a subset of theserver's OSCORE Sender IDsingle signer data object COSE_Sign1, which isC_I. Client's OSCORE Sender ID (1 byte) 00 Server's OSCORE Sender ID (1 byte) 16described in Sections 4.2-4.4 of [I-D.ietf-cose-rfc8152bis-struct]. TheAEAD Algorithmsignature is computed over a Sig_structure containing payload, protected headers andthe hash algorithm are the application AEADexternally supplied data (external_aad) using a private signature key andhash algorithms inverified using theselected cipher suite. OSCORE AEAD Algorithm (int) 10 OSCORE Hash Algorithm (int) -16corresponding public signature key. Appendix D. Test Vectors TBD Appendix E. Applicability Template This appendix containsana rudimentary example of an applicability statement, see Section 3.9. For use of EDHOC in the XX protocol, the following assumptions aremade onmade: 1. Transfer in CoAP as specified in Appendix A.3 with requests expected by theparameters: oCoAP server (= Responder) at /app1-edh, no Content-Format needed. 2. METHOD = 1 (I uses signature key, R uses static DH key.)o EDHOC requests are expected by the server at /app1-edh, no Content-Format needed. o3. CRED_I is an IEEE 802.1AR IDevID encoded as a C509Certificatecertificate of type 0 [I-D.ietf-cose-cbor-encoded-cert]. * R acquires CRED_I out-of-band, indicated inEAD_1EAD_1. * ID_CRED_I = {4: h''} is akid'kid' with value empty bytestring ostring. 4. CRED_R is aCOSE_KeyUCCS of type OKP as specified in Section3.5.4.3.5.2. * The CBOR map has parameters 1 (kty), -1 (crv), and -2 (x-coordinate).o* ID_CRED_R = CRED_Ro5. External authorization data is defined and processed as specified in [I-D.selander-ace-ake-authz]. 6. EUI-64 used as identity of endpoint. 7. No use of message_4: the application sends protected messages from R to I.o External authorization data is defined and processed as specified in [I-D.selander-ace-ake-authz].Appendix F. EDHOC Message Deduplication EDHOC by default assumes that message duplication is handled by the transport, in this section exemplified with CoAP. Deduplication of CoAP messages is described in Section 4.5 of [RFC7252]. This handles the case when the same Confirmable (CON) message is received multiple times due to missing acknowledgement on CoAP messaging layer. The recommended processing in [RFC7252] is that the duplicate message is acknowledged (ACK), but the received message is only processed once by the CoAP stack. Message deduplication is resource demanding and therefore not supported in all CoAP implementations. Since EDHOC is targeting constrained environments, it is desirable that EDHOC can optionally support transport layers which does not handle message duplication. Special care is needed to avoid issues with duplicate messages, see Section 5.1. The guiding principle here is similar to the deduplication processing on CoAP messaging layer: a received duplicate EDHOC message SHALL NOT result in a response consisting of another instance of the next EDHOC message. The result MAY be that a duplicate EDHOC response is sent, provided it is still relevant with respect the current protocol state. In any case, the received message MUST NOT be processed more than once in the same EDHOC session. This is called "EDHOC message deduplication". An EDHOC implementation MAY store the previously sent EDHOC message to be able to resend it. An EDHOC implementation MAY keep the protocol state to be able to recreate the previously sent EDHOC message and resend it. The previous message or protocol state MUST NOT be kept longer than what is required for retransmission, for example, in the case of CoAP transport, no longer than the EXCHANGE_LIFETIME (see Section 4.8.2 of [RFC7252]). Note that the requirements in Section 5.1 still apply because duplicate messages are not processed by the EDHOC state machine:o* EDHOC messages SHALL be processed according to the current protocol state.o* Different instances of the same message MUST NOT be processed in one session. Appendix G. Transports Not Natively Providing Correlation Protocols that do not natively provide full correlation between a series of messages can send the C_I and C_R identifiers along as needed. The transport over CoAP (Appendix A.3) can serve as a blueprint for other server-client protocols: The client prepends the C_x which the server selected (or, for message1, a sentinel null value which is not a valid C_x) to any request1, the CBOR simple value 'true' which is not a valid C_x) to any request message it sends. The server does not send any such indicator, as responses are matched to request by the client-server protocol design. Protocols that do not provide any correlation at all can prescribe prepending of the peer's chosen C_x to all messages. Appendix H. Change Log RFC Editor: Please remove this appendix. Main changes: * From -08 to -09: - G_Y and CIPHERTEXT_2 are now included in one CBOR bstr - MAC_2 and MAC_3 are now generated with EDHOC-KDF - Info field "context" is now general and explicit in EDHOC-KDF - Restructured Section 4, Key Derivation - Added EDHOC MAC length to cipher suite for use with static DH - More details on the use of CWT and UCCS - Restructured and clarified Section 3.5, Authentication Parameters - Replaced 'kid2' with extension of 'kid' - EAD encoding now supports multiple ead types in one message - Clarified EAD type - Updated messageit sends. The server does not send any such indicator, as responses are matched to request bysizes - Replaced "perfect forward secrecy" with "forward secrecy" - Updated security considerations - Replaced prepended 'null' with 'true' in theclient-server protocol design. Protocols that do not provide any correlation at all can prescribe prependingCoAP transport of message_1 - Updated CDDL definitions - Expanded on thepeer's chosen C_x to all messages. Appendix H. Change Log Main changes: ouse of COSE * From -07 to -08:*- Prepended C_x moved from the EDHOC protocol itself to the transport mapping*- METHOD_CORR renamed to METHOD, corr removed*- Removed bstr_identifier and use bstr / int instead; C_x can now be int without any implied bstr semantics*- Defined COSE header parameter 'kid2' with value type bstr / int for use with ID_CRED_x*- Updated message sizes*- New cipher suites with AES-GCM and ChaCha20 / Poly1305*- Changed from one- to two-byte identifier of CNSA compliant suite*- Separate sections on transport and connection id with further sub-structure*- Moved back key derivation for OSCORE from draft-ietf-core- oscore-edhoc*- OSCORE and CoAP specific processing moved to new appendix*- Message 4 section moved to message processing sectiono* From -06 to -07:*- Changed transcript hash definition for TH_2 and TH_3*- Removed "EDHOC signature algorithm curve" from cipher suite*- New IANA registry "EDHOC Exporter Label"*- New application defined parameter "context" in EDHOC-Exporter*- Changed normative language for failure from MUST to SHOULD send error*- Made error codes non-negative and 0 for success*- Added detail on success error code*- Aligned terminology "protocol instance" -> "session"*- New appendix on compact EC point representation*- Added detail on use of ephemeral public keys*- Moved key derivation for OSCORE to draft-ietf-core-oscore-edhoc*- Additional security considerations*- Renamed "Auxililary Data" as "External Authorization Data"*- Added encrypted EAD_4 to message_4o* From -05 to -06:*- New section 5.2 "Message Processing Outline"*- Optional inital byte C_1 = null in message_1*- New format of error messages, table of error codes, IANA registry*- Change of recommendation transport of error in CoAP*- Merge of content in 3.7 and appendix C into new section 3.7 "Applicability Statement"*- Requiring use of deterministic CBOR*- New section on message deduplication*- New appendix containin all CDDL definitions*- New appendix with change log*- Removed section "Other Documents Referencing EDHOC"*- Clarifications based on review commentso* From -04 to -05:*- EDHOC-Rekey-FS -> EDHOC-KeyUpdate*- Clarification of cipher suite negotiation*- Updated security considerations*- Updated test vectors*- Updated applicability statement templateo* From -03 to -04:*- Restructure of section 1*- Added references to C509 Certificates*- Change in CIPHERTEXT_2 -> plaintext XOR KEYSTREAM_2 (test vector not updated)*- "K_2e", "IV_2e" -> KEYSTREAM_2*- Specified optional message 4*- EDHOC-Exporter-FS -> EDHOC-Rekey-FS*- Less constrained devices SHOULD implement both suite 0 and 2*- Clarification of error message*- Added exporter interface test vectoro* From -02 to -03:*- Rearrangements of section 3 and beginning of section 4*- Key derivation new section 4*- Cipher suites 4 and 5 added*- EDHOC-EXPORTER-FS - generate a new PRK_4x3m from an old one*- Change in CIPHERTEXT_2 -> COSE_Encrypt0 without tag (no change to test vector)*- Clarification of error message*- New appendix C applicability statemento* From -01 to -02:*- New section 1.2 Use of EDHOC*- Clarification of identities*- New section 4.3 clarifying bstr_identifier*- Updated security considerations*- Updated text on cipher suite negotiation and key confirmation*- Test vector for static DHo* From -00 to -01:*- Removed PSK method*- Removed references to certificate by value Acknowledgments The authors want to thank Christian Amsuess, Alessandro Bruni, Karthikeyan Bhargavan, Timothy Claeys, Martin Disch, Theis Groenbech Petersen, Dan Harkins, Klaus Hartke, Russ Housley, Stefan Hristozov, Alexandros Krontiris, Ilari Liusvaara, Karl Norrman, Salvador Perez, Eric Rescorla, Michael Richardson, Thorvald Sahl Joergensen, Jim Schaad, Carsten Schuermann, Ludwig Seitz, Stanislav Smyshlyaev, Valery Smyslov, Peter van der Stok, Rene Struik, Vaishnavi Sundararajan, Erik Thormarker, Marco Tiloca, Michel Veillette, and Malisa Vucinic for reviewing and commenting on intermediate versions of the draft. We are especially indebted to Jim Schaad for his continuous reviewing and implementation of different versions of the draft. Work on this document has in part been supported by the H2020 project SIFIS-Home (grant agreement 952652). Authors' AddressesGoeranGöran Selander Ericsson AB SE-164 80 Stockholm Sweden Email: goran.selander@ericsson.com JohnPreussPreuß Mattsson Ericsson AB SE-164 80 Stockholm Sweden Email: john.mattsson@ericsson.com Francesca Palombini Ericsson AB SE-164 80 Stockholm Sweden Email: francesca.palombini@ericsson.com