--- 1/draft-ietf-lake-edhoc-00.txt 2020-08-02 08:13:17.825911760 -0700 +++ 2/draft-ietf-lake-edhoc-01.txt 2020-08-02 08:13:17.941914714 -0700 @@ -1,19 +1,19 @@ Network Working Group G. Selander Internet-Draft J. Mattsson Intended status: Standards Track F. Palombini -Expires: January 7, 2021 Ericsson AB - July 06, 2020 +Expires: February 3, 2021 Ericsson AB + August 02, 2020 Ephemeral Diffie-Hellman Over COSE (EDHOC) - draft-ietf-lake-edhoc-00 + draft-ietf-lake-edhoc-01 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, perfect forward 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 @@ -27,21 +27,21 @@ 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 on January 7, 2021. + This Internet-Draft will expire on February 3, 2021. Copyright Notice Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents @@ -64,55 +64,50 @@ 3.4. Cipher Suites . . . . . . . . . . . . . . . . . . . . . . 10 3.5. Communication/Negotiation of Protocol Features . . . . . 11 3.6. Auxiliary Data . . . . . . . . . . . . . . . . . . . . . 12 3.7. Ephemeral Public Keys . . . . . . . . . . . . . . . . . . 12 3.8. Key Derivation . . . . . . . . . . . . . . . . . . . . . 12 4. EDHOC Authenticated with Asymmetric Keys . . . . . . . . . . 15 4.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 15 4.2. EDHOC Message 1 . . . . . . . . . . . . . . . . . . . . . 17 4.3. EDHOC Message 2 . . . . . . . . . . . . . . . . . . . . . 19 4.4. EDHOC Message 3 . . . . . . . . . . . . . . . . . . . . . 22 - 5. EDHOC Authenticated with Symmetric Keys . . . . . . . . . . . 25 - 5.1. Overview . . . . . . . . . . . . . . . . . . . . . . . . 25 - 5.2. EDHOC Message 1 . . . . . . . . . . . . . . . . . . . . . 26 - 5.3. EDHOC Message 2 . . . . . . . . . . . . . . . . . . . . . 27 - 5.4. EDHOC Message 3 . . . . . . . . . . . . . . . . . . . . . 28 - 6. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 28 - 6.1. EDHOC Error Message . . . . . . . . . . . . . . . . . . . 28 - 7. Transferring EDHOC and Deriving an OSCORE Context . . . . . . 30 - 7.1. Transferring EDHOC in CoAP . . . . . . . . . . . . . . . 30 - 8. Security Considerations . . . . . . . . . . . . . . . . . . . 33 - 8.1. Security Properties . . . . . . . . . . . . . . . . . . . 33 - 8.2. Cryptographic Considerations . . . . . . . . . . . . . . 34 - 8.3. Cipher Suites . . . . . . . . . . . . . . . . . . . . . . 35 - 8.4. Unprotected Data . . . . . . . . . . . . . . . . . . . . 35 - 8.5. Denial-of-Service . . . . . . . . . . . . . . . . . . . . 36 - 8.6. Implementation Considerations . . . . . . . . . . . . . . 36 - 8.7. Other Documents Referencing EDHOC . . . . . . . . . . . . 37 - 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 37 - 9.1. EDHOC Cipher Suites Registry . . . . . . . . . . . . . . 37 - 9.2. EDHOC Method Type Registry . . . . . . . . . . . . . . . 38 - 9.3. The Well-Known URI Registry . . . . . . . . . . . . . . . 39 - 9.4. Media Types Registry . . . . . . . . . . . . . . . . . . 39 - 9.5. CoAP Content-Formats Registry . . . . . . . . . . . . . . 40 - 9.6. Expert Review Instructions . . . . . . . . . . . . . . . 40 - 10. References . . . . . . . . . . . . . . . . . . . . . . . . . 41 - 10.1. Normative References . . . . . . . . . . . . . . . . . . 41 - 10.2. Informative References . . . . . . . . . . . . . . . . . 42 - Appendix A. Use of CBOR, CDDL and COSE in EDHOC . . . . . . . . 45 - A.1. CBOR and CDDL . . . . . . . . . . . . . . . . . . . . . . 45 - A.2. COSE . . . . . . . . . . . . . . . . . . . . . . . . . . 46 - Appendix B. Test Vectors . . . . . . . . . . . . . . . . . . . . 46 + 5. Error Handling . . . . . . . . . . . . . . . . . . . . . . . 25 + 5.1. EDHOC Error Message . . . . . . . . . . . . . . . . . . . 25 + 6. Transferring EDHOC and Deriving an OSCORE Context . . . . . . 27 + 6.1. Transferring EDHOC in CoAP . . . . . . . . . . . . . . . 27 + 7. Security Considerations . . . . . . . . . . . . . . . . . . . 30 + 7.1. Security Properties . . . . . . . . . . . . . . . . . . . 30 + 7.2. Cryptographic Considerations . . . . . . . . . . . . . . 31 + 7.3. Cipher Suites . . . . . . . . . . . . . . . . . . . . . . 32 + 7.4. Unprotected Data . . . . . . . . . . . . . . . . . . . . 32 + 7.5. Denial-of-Service . . . . . . . . . . . . . . . . . . . . 32 + 7.6. Implementation Considerations . . . . . . . . . . . . . . 33 + 7.7. Other Documents Referencing EDHOC . . . . . . . . . . . . 34 + 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 34 + 8.1. EDHOC Cipher Suites Registry . . . . . . . . . . . . . . 34 + 8.2. EDHOC Method Type Registry . . . . . . . . . . . . . . . 35 + 8.3. The Well-Known URI Registry . . . . . . . . . . . . . . . 35 + 8.4. Media Types Registry . . . . . . . . . . . . . . . . . . 36 + 8.5. CoAP Content-Formats Registry . . . . . . . . . . . . . . 37 + 8.6. Expert Review Instructions . . . . . . . . . . . . . . . 37 + 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 37 + 9.1. Normative References . . . . . . . . . . . . . . . . . . 37 + 9.2. Informative References . . . . . . . . . . . . . . . . . 39 + Appendix A. Use of CBOR, CDDL and COSE in EDHOC . . . . . . . . 42 + A.1. CBOR and CDDL . . . . . . . . . . . . . . . . . . . . . . 42 + A.2. COSE . . . . . . . . . . . . . . . . . . . . . . . . . . 43 + Appendix B. Test Vectors . . . . . . . . . . . . . . . . . . . . 43 B.1. Test Vectors for EDHOC Authenticated with Signature Keys - (x5t) . . . . . . . . . . . . . . . . . . . . . . . . . . 46 - Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 60 - Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 60 + (x5t) . . . . . . . . . . . . . . . . . . . . . . . . . . 43 + Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 57 + Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 57 1. Introduction Security at the application layer provides an attractive option for protecting Internet of Things (IoT) deployments, for example where transport layer security is not sufficient [I-D.hartke-core-e2e-security-reqs] or where the protection needs to work over a variety of underlying protocols. IoT devices may be constrained in various ways, including memory, storage, processing capacity, and energy [RFC7228]. A method for protecting individual @@ -124,74 +119,77 @@ the Constrained Application Protocol (CoAP), using COSE. In order for a communication session to provide forward secrecy, the communicating parties can run an Elliptic Curve Diffie-Hellman (ECDH) key exchange protocol with ephemeral keys, from which shared key material can be derived. This document specifies Ephemeral Diffie- Hellman Over COSE (EDHOC), a lightweight key exchange protocol providing perfect forward secrecy and identity protection. Authentication is based on credentials established out of band, e.g. from a trusted third party, such as an Authorization Server as - specified by [I-D.ietf-ace-oauth-authz]. EDHOC supports - authentication using pre-shared keys (PSK), raw public keys (RPK), - and public key certificates. After successful completion of the - EDHOC protocol, application keys and other application specific data - can be derived using the EDHOC-Exporter interface. A main use case - for EDHOC is to establish an OSCORE security context. EDHOC uses - COSE for cryptography, CBOR for encoding, and CoAP for transport. By - reusing existing libraries, the additional code footprint can be kept - very low. Note that this document focuses on authentication and key - establishment: for integration with authorization of resource access, - refer to [I-D.ietf-ace-oscore-profile]. + specified by [I-D.ietf-ace-oauth-authz]. The construction provided + by EDHOC can be applied to authenticate raw public keys (RPK) and + public key certificates. This version of the protocol is focusing on + RPK and certificates by reference which is the initial focus for the + LAKE WG (see Section 2.2 of [I-D.ietf-lake-reqs]). - EDHOC is designed to work in highly constrained scenarios making it - especially suitable for network technologies such as Cellular IoT, - 6TiSCH [I-D.ietf-6tisch-dtsecurity-zerotouch-join], and LoRaWAN - [LoRa1][LoRa2]. These network technologies are characterized by - their low throughput, low power consumption, and small frame sizes. - Compared to the DTLS 1.3 handshake [I-D.ietf-tls-dtls13] with ECDH - and connection ID, the number of bytes in EDHOC + CoAP is less than - 1/4 when PSK authentication is used and less than 1/6 when RPK + After successful completion of the EDHOC protocol, application keys + and other application specific data can be derived using the EDHOC- + Exporter interface. A main use case for EDHOC is to establish an + OSCORE security context. EDHOC uses COSE for cryptography, CBOR for + encoding, and CoAP for transport. By reusing existing libraries, the + additional code footprint can be kept very low. Note that this + document focuses on authentication and key establishment: for + integration with authorization of resource access, refer to + [I-D.ietf-ace-oscore-profile]. + + 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. Compared to the DTLS 1.3 + handshake [I-D.ietf-tls-dtls13] with ECDH 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]. Typical message sizes - for EDHOC with pre-shared keys, raw public keys with static Diffie- - Hellman keys, and two different ways to identify X.509 certificates - with signature keys are shown in Figure 1. Further reductions of - message sizes are possible by eliding redundant length indications. + [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' + [RFC8152], and X.509 signature certificates identified by a hash + value using 'x5t' [I-D.ietf-cose-x509]. Further reductions of + message sizes are possible, for example by eliding redundant length + indications. - ===================================================================== - PSK RPK x5t x5chain - --------------------------------------------------------------------- - message_1 38 37 37 37 - message_2 44 46 117 110 + Certificate - message_3 10 20 91 84 + Certificate - --------------------------------------------------------------------- - Total 92 103 245 231 + Certificates - ===================================================================== + ================================= + kid x5t + --------------------------------- + message_1 37 37 + message_2 46 117 + message_3 20 91 + ---------------------------------- + Total 103 245 + ================================= - Figure 1: Typical message sizes in bytes + Figure 1: Example of message sizes in bytes. The ECDH exchange and the key derivation follow known protocol constructions such as [SIGMA], NIST SP-800-56A [SP-800-56A], and HKDF [RFC5869]. CBOR [RFC7049] and COSE [RFC8152] are used to implement these standards. The use of COSE provides crypto agility and enables use of future algorithms and headers designed for constrained IoT. This document is organized as follows: Section 2 describes how EDHOC authenticated with digital signatures builds on SIGMA-I, Section 3 specifies general properties of EDHOC, including message flow, formatting of the ephemeral public keys, and key derivation, Section 4 specifies EDHOC with signature key and static Diffie- - Hellman key authentication, Section 5 specifies EDHOC with symmetric - key authentication, Section 6 specifies the EDHOC error message, and - Section 7 describes how EDHOC can be transferred in CoAP and used to - establish an OSCORE security context. + Hellman key authentication, Section 5 specifies the EDHOC error + message, and Section 6 describes how EDHOC can be transferred in CoAP + and used to establish an OSCORE security context. 1.1. Rationale for EDHOC Many constrained IoT systems today do not use any security at all, and when they do, they often do not follow best practices. One reason is that many current security protocols are not designed with constrained IoT in mind. Constrained IoT systems often deal with personal information, valuable business data, and actuators interacting with the physical world. Not only do such systems need security and privacy, they often need end-to-end protection with @@ -233,30 +231,30 @@ 1.2. 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 [RFC7049], CBOR Sequences [RFC8742], COSE + [RFC8152], and CDDL [RFC8610]. The Concise Data Definition Language (CDDL) is used to express CBOR data structures [RFC7049]. Examples of CBOR and CDDL are provided in Appendix A.1. 2. Background EDHOC specifies different authentication methods of the Diffie- - Hellman key exchange: digital signatures, static Diffie-Hellman keys - and symmetric keys. This section outlines the digital signature - based method. + Hellman key exchange: digital signatures and static Diffie-Hellman + keys. This section outlines the digital signature based method. 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 provide 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. @@ -329,37 +327,36 @@ given in Appendix B. 3. EDHOC Overview EDHOC consists of three messages (message_1, message_2, message_3) that maps directly to the three messages in SIGMA-I, plus an EDHOC error message. EDHOC messages are CBOR Sequences [RFC8742], where the first data item (METHOD_CORR) of message_1 is an int specifying the method and the correlation properties of the transport used, see Section 3.1. The method specifies the authentication methods used - (signature, static DH, symmetric), see Section 9.2. An - implementation may support only Initiator or Responder. 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. + (signature, static DH), see Section 8.2. An implementation may + support only Initiator or Responder. 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. While EDHOC uses the COSE_Key, COSE_Sign1, and COSE_Encrypt0 structures, only a subset of the parameters is included in the EDHOC messages. The unprotected COSE header in COSE_Sign1, and COSE_Encrypt0 (not included in the EDHOC message) MAY contain parameters (e.g. 'alg'). After creating EDHOC message_3, the Initiator can derive symmetric application keys, and application protected data can therefore be sent in parallel with EDHOC message_3. The application may protect data using the algorithms (AEAD, hash, etc.) in the selected cipher suite and the connection identifiers (C_I, C_R). EDHOC may be used with the media type - application/edhoc defined in Section 9. + application/edhoc defined in Section 8. Initiator Responder | | | ------------------ EDHOC message_1 -----------------> | | | | <----------------- EDHOC message_2 ------------------ | | | | ------------------ EDHOC message_3 -----------------> | | | | <----------- Application Protected Data ------------> | @@ -369,21 +366,21 @@ 3.1. Transport and Message Correlation Cryptographically, EDHOC does not put requirements on the lower layers. EDHOC is not bound to a particular transport layer, and can be used in environments without IP. The transport is responsible to handle message loss, reordering, message duplication, fragmentation, and denial of service protection, where necessary. The Initiator and the Responder need to have agreed on a transport to be used for EDHOC. It is recommended to transport EDHOC in CoAP payloads, see - Section 7. + Section 6. EDHOC includes connection identifiers (C_I, C_R) to correlate messages. The connection identifiers C_I and C_R do not have any cryptographic purpose in EDHOC. They contain information facilitating retrieval of the protocol state and may therefore be very short. The connection identifier MAY be used with an application protocol (e.g. OSCORE) for which EDHOC establishes keys, in which case the connection identifiers SHALL adhere to the requirements for that protocol. Each party choses a connection identifier it desires the other party to use in outgoing messages. @@ -396,35 +393,35 @@ o corr = 1, the transport provides a correlation mechanism that enables the Responder to correlate message_2 and message_1. o corr = 2, the transport provides a correlation mechanism that enables the Initiator to correlate message_3 and message_2. o corr = 3, the transport provides a correlation mechanism that enables both parties to correlate all three messages. For example, if the key exchange is transported over CoAP, the CoAP - Token can be used to correlate messages, see Section 7.1. + Token can be used to correlate messages, see Section 6.1. 3.2. Authentication Keys and Identities - The EDHOC message exchange may be authenticated using pre-shared keys - (PSK), raw public keys (RPK), or public key certificates. The - certificates and RPKs can contain signature keys or static Diffie- - Hellman keys. In X.509 certificates, signature keys typically have - key usage "digitalSignature" and Diffie-Hellman keys typically have - key usage "keyAgreement". EDHOC assumes the existence of mechanisms + The EDHOC message exchange may be authenticated using raw public keys + (RPK) or public key certificates. The certificates and RPKs can + contain signature keys or static Diffie-Hellman keys. In X.509 + certificates, signature keys typically have key usage + "digitalSignature" and Diffie-Hellman keys typically have key usage + "keyAgreement". EDHOC assumes the existence of mechanisms (certification authority, trusted third party, manual distribution, - etc.) for distributing authentication keys (public or pre-shared) and - identities. Policies are set based on the identity of the other - party, and parties typically only allow connections from a small - restricted set of identities. + etc.) for distributing authentication keys and identities. Policies + are set based on the identity of the other party, and parties + typically only allow connections from a small restricted set of + identities. o When a Public Key Infrastructure (PKI) is used, the trust anchor is a Certification Authority (CA) certificate, and the identity is the subject whose unique name (e.g. a domain name, NAI, or EUI) is included in the other party's certificate. Before running EDHOC each party needs at least one CA public key certificate, or just the public key, and a set of identities it is allowed to communicate with. Any validated public-key certificate with an allowed subject name is accepted. EDHOC provides proof that the other party possesses the private authentication key corresponding @@ -443,26 +440,20 @@ including 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 containing the public authentication key and the subject name, see Figure 2. Before running EDHOC, each party need a set of public authentication keys/unique associated subject names it is allowed to communicate with. EDHOC provides proof that the other party possesses the private authentication key corresponding to the public authentication key. - o When pre-shared keys are used the information about the other - party is carried in the PSK identifier field of the protocol, - ID_PSK. The purpose of ID_PSK is to facilitate retrieval of the - pre-shared key, which is used to authenticate and assert trust. - In this case no other identities or trust anchors are used. - 3.3. Identifiers One byte connection and credential identifiers are realistic in many scenarios as most constrained devices only have a few keys and connections. In cases where a node only has one connection or key, the identifiers may even be the empty byte string. 3.4. Cipher Suites EDHOC cipher suites consist of an ordered set of COSE algorithms: an @@ -505,21 +496,21 @@ o The Initiator proposes a cipher suite (see Section 3.4), and the Responder either accepts or rejects, and may make a counter proposal. o The Initiator decides on the correlation parameter corr (see Section 3.1). This is typically given by the transport which the Initiator and the Responder have agreed on beforehand. The Responder either accepts or rejects. - o The Initiator decides on the method parameter, see Section 9.2. + o The Initiator decides on the method parameter, see Section 8.2. The Responder either accepts or rejects. o The Initiator and the Responder decide on the representation of the identifier of their respective credentials, ID_CRED_I and ID_CRED_R. The decision is reflected by the label used in the CBOR map, see for example Section 4.1. 3.6. Auxiliary Data In order to reduce round trips and number of messages, and in some @@ -564,40 +555,36 @@ PRK = HKDF-Extract( salt, IKM ) PRK_2e is used to derive key and IV to encrypt message_2. PRK_3e2m is used to derive keys and IVs produce a MAC in message_2 and to encrypt message_3. PRK_4x3m is used to derive keys and IVs produce a MAC in message_3 and to derive application specific data. PRK_2e is derived with the following input: - o The salt SHALL be the PSK when EDHOC is authenticated with - symmetric keys, and the empty byte string when EDHOC is - authenticated with asymmetric keys (signature or static DH). The - PSK is used as 'salt' to simplify implementation. Note that - [RFC5869] specifies that if the salt is not provided, it is set to - a string of zeros (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. + o The salt SHALL be the empty byte string. Note that [RFC5869] + specifies that if the salt is not provided, it is set to a string + of zeros (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. o The input keying material (IKM) SHALL be the ECDH shared secret G_XY (calculated from G_X and Y or G_Y and X) as defined in Section 12.4.1 of [RFC8152]. Example: Assuming the use of SHA-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) in the asymmetric case and - salt = PSK in the symmetric case. + where salt = 0x (the empty byte string). The pseudorandom keys PRK_3e2m and PRK_4x3m are defined as follow: o If the Reponder authenticates with a static Diffie-Hellman key, then PRK_3e2m = HKDF-Extract( PRK_2e, G_RX ), where G_RX is the ECDH shared secret calculated from G_R and X, or G_X and R, else PRK_3e2m = PRK_2e. o If the Initiator authenticates with a static Diffie-Hellman key, then PRK_4x3m = HKDF-Extract( PRK_3e2m, G_IY ), where G_IY is the @@ -632,68 +618,55 @@ identifier of the EDHOC AEAD algorithm in the selected cipher suite encoded as defined in [RFC8152]. Note that a single fixed edhoc_aead_id is used in all invocations of EDHOC-KDF, including the derivation of K_2e and invocations of the EDHOC-Exporter. o transcript_hash is a bstr set to one of the transcript hashes TH_2, TH_3, or TH_4 as defined in Sections 4.3.1, 4.4.1, and 3.8.1. o label is a tstr set to the name of the derived key or IV, i.e. - "K_2m", "IV_2m", "K_2e", "K_2ae", "IV_2ae", "K_3m", "IV_3m", - "K_3ae", or "IV_2ae". + "K_2m", "IV_2m", "K_2e", "K_3m", "IV_3m", "K_3ae", or "IV_3ae". o length is the length of output keying material (OKM) in bytes - K_2ae and IV_2ae 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_3 and the pseudorandom key PRK_4x3m. IVs are only - used if the EDHOC AEAD algorithm uses IVs. + 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_3 and the pseudorandom + key PRK_4x3m. IVs are only used if the EDHOC AEAD algorithm uses + IVs. 3.8.1. EDHOC-Exporter Interface Application keys and other application specific data can be derived using the EDHOC-Exporter interface defined as: EDHOC-Exporter(label, length) = EDHOC-KDF(PRK_4x3m, TH_4, label, length) - where label is a tstr defined by the application and length is an - uint defined by the application. The label SHALL be different for - each different exporter value. The transcript hash TH_4 is a CBOR - encoded bstr and the input to the hash function is a CBOR Sequence. + where label is a tstr defined by the application and length is a uint + defined by the application. The label SHALL be different for each + different exporter value. The transcript hash TH_4 is a CBOR encoded + bstr and the input to the hash function is a CBOR Sequence. TH_4 = H( TH_3, CIPHERTEXT_3 ) where H() is the hash function in the selected cipher suite. Example - use of the EDHOC-Exporter is given in Sections 3.8.2 and 7.1.1. - -3.8.2. EDHOC PSK Chaining - - An application using EDHOC may want to derive new PSKs to use for - authentication in future EDHOC exchanges. In this case, the new PSK - and the ID_PSK 'kid_value' parameter SHOULD be derived as follows - where length is the key length (in bytes) of the EDHOC AEAD - Algorithm. - - PSK = EDHOC-Exporter( "EDHOC Chaining PSK", length ) - kid_psk = EDHOC-Exporter( "EDHOC Chaining kid_psk", 4 ) + use of the EDHOC-Exporter is given in Sections 6.1.1. 4. EDHOC Authenticated with Asymmetric Keys 4.1. Overview This section specifies authentication method = 0, 1, 2, and 3, see - Section 9.2. EDHOC supports authentication with signature or static + Section 8.2. EDHOC supports authentication with signature or static Diffie-Hellman keys in the form of raw public keys (RPK) and public key certificates with the requirements that: o Only the Responder SHALL have access to the Responder's private authentication key, o Only the Initiator SHALL have access to the Initiator's private authentication key, o The Initiator is able to retrieve the Responder's public @@ -707,89 +680,80 @@ Section 3.1 of [RFC8152]). ID_CRED_I and ID_CRED_R need to contain parameters that can identify a public authentication key. In the following paragraph we give some examples of possible COSE header parameters used. Raw public keys are most optimally stored as COSE_Key objects and identified with a 'kid' parameter: o ID_CRED_x = { 4 : kid_x }, where kid_x : bstr, for x = I or R. - Public key certificates can be identified in different ways. Several - header parameters for identifying X.509 certificates are defined in - [I-D.ietf-cose-x509]: - - o by a bag of certificates with the 'x5bag' parameter; or - - * ID_CRED_x = { 32 : COSE_X509 }, for x = I or R, - - o by a certificate chain with the 'x5chain' parameter; - - * ID_CRED_x = { 33 : COSE_X509 }, for x = I or R, + Public key certificates can be identified in different ways. Header + parameters for identifying X.509 certificates are defined in + [I-D.ietf-cose-x509], for example: o by a hash value with the 'x5t' parameter; * ID_CRED_x = { 34 : COSE_CertHash }, for x = I or R, o by a URL with the 'x5u' parameter; * ID_CRED_x = { 35 : uri }, for x = I or R, - In the first two examples, ID_CRED_I and ID_CRED_R contain the actual - credential used for authentication. The purpose of ID_CRED_I and - ID_CRED_R is to facilitate retrieval of a public authentication key - and when they do not contain the actual credential, they may be very - short. It is RECOMMENDED that they uniquely identify the public - authentication key as the recipient may otherwise have to try several - keys. ID_CRED_I and ID_CRED_R are transported in the ciphertext, see - Section 4.3.2 and Section 4.4.2. + The purpose of ID_CRED_I and ID_CRED_R is to facilitate retrieval of + a public authentication key and when they do not contain the actual + credential, they may be very short. ID_CRED_I and ID_CRED_R MAY + contain the actual credential used for authentication. It is + RECOMMENDED that they uniquely identify the public authentication key + as the recipient may otherwise have to try several keys. ID_CRED_I + and ID_CRED_R are transported in the ciphertext, see Section 4.3.2 + and Section 4.4.2. The authentication key MUST be a signature key or static Diffie- Hellman key. The Initiator and the Responder MAY use different types of authentication keys, e.g. one uses a signature key and the other uses a static Diffie-Hellman key. When using a signature key, the authentication is provided by a signature. When using a static Diffie-Hellman key the authentication is provided by a Message Authentication Code (MAC) computed from an ephemeral-static ECDH shared secret which enables significant reductions in message sizes. The MAC is implemented with an AEAD algorithm. When using a static Diffie-Hellman keys the Initiator's and Responder's private authentication keys are called I and R, respectively, and the public authentication keys are called G_I and G_R, respectively. The actual credentials CRED_I and CRED_R are signed or MAC:ed by the Initiator and the Responder respectively, see Section 4.4.1 and Section 4.3.1. The Initiator and the Responder MAY use different types of credentials, e.g. one uses RPK and the other uses certificate. When the credential is a certificate, CRED_x is end- entity certificate (i.e. not the certificate chain) encoded as a CBOR - bstr. When the credential is a COSE_Key, CREX_x is a CBOR map only + bstr. When the credential is a COSE_Key, CRED_x is a CBOR map only contains specific fields from the COSE_Key. For COSE_Keys of type OKP the CBOR map SHALL only include the parameters 1 (kty), -1 (crv), and -2 (x-coordinate). For COSE_Keys of type EC2 the CBOR map SHALL only include the parameters 1 (kty), -1 (crv), -2 (x-coordinate), and -3 (y-coordinate). If the parties have agreed on an identity besides the public key, the indentity is included in the CBOR map with the label "subject name", otherwise the subject name is the empty text string. The parameters SHALL be encoded in decreasing order with int labels first and text string labels last. An example of CRED_x when - the RPK contains a X25519 static Diffie-Hellman key and the parties + the RPK contains an X25519 static Diffie-Hellman key and the parties have agreed on an EUI-64 identity is shown below: CRED_x = { 1: 1, -1: 4, -2: h'b1a3e89460e88d3a8d54211dc95f0b90 3ff205eb71912d6db8f4af980d2db83a', "subject name" : "42-50-31-FF-EF-37-32-39" } - Initiator Responder | METHOD_CORR, SUITES_I, G_X, C_I, AD_1 | +------------------------------------------------------------------>| | message_1 | | | | C_I, G_Y, C_R, Enc(K_2e; ID_CRED_R, Signature_or_MAC_2, AD_2) | |<------------------------------------------------------------------+ | message_2 | | | | C_R, AEAD(K_3ae; ID_CRED_I, Signature_or_MAC_3, AD_3) | @@ -797,35 +761,36 @@ | message_3 | Figure 4: Overview of EDHOC with asymmetric key authentication. 4.2. EDHOC Message 1 4.2.1. Formatting of Message 1 message_1 SHALL be a CBOR Sequence (see Appendix A.1) as defined below + message_1 = ( METHOD_CORR : int, SUITES_I : [ selected : suite, supported : 2* suite ] / suite, G_X : bstr, C_I : bstr_identifier, ? AD_1 : bstr, ) suite = int - bstr_identifier = bsrt / int + bstr_identifier = bstr / int where: o METHOD_CORR = 4 * method + corr, where method = 0, 1, 2, or 3 (see - Section 9.2) and the correlation parameter corr is chosen based on + Section 8.2) and the correlation parameter corr is chosen based on the transport and determines which connection identifiers that are omitted (see Section 3.1). o SUITES_I - cipher suites which the Initiator supports in order of (decreasing) preference. The list of supported cipher suites can be truncated at the end, as is detailed in the processing steps below. One of the supported cipher suites is selected. If a single supported cipher suite is conveyed then that cipher suite is selected and the selected cipher suite is encoded as an int instead of an array. @@ -875,21 +840,21 @@ The Responder SHALL process message_1 as follows: o Decode message_1 (see Appendix A.1). o Verify that the selected cipher suite is supported and that no prior cipher suites in SUITES_I are supported. o Pass AD_1 to the security application. If any verification step fails, the Initiator MUST send an EDHOC - error message back, formatted as defined in Section 6, and the + error message back, formatted as defined in Section 5, and the protocol MUST be discontinued. If V does not support the selected 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 in SUITES_I, then SUITES_R MUST include the first supported cipher suite in SUITES_I. 4.3. EDHOC Message 2 4.3.1. Formatting of Message 2 @@ -1022,21 +987,21 @@ o Verify that the identity of the Responder is among the allowed identities for this connection. o Verify Signature_or_MAC_2 using the algorithm in the selected cipher suite. The verification process depends on the method, see Section 4.3.2. o Pass AD_2 to the security application. If any verification step fails, the Responder MUST send an EDHOC - error message back, formatted as defined in Section 6, and the + error message back, formatted as defined in Section 5, and the protocol MUST be discontinued. 4.4. EDHOC Message 3 4.4.1. Formatting of Message 3 message_3 and data_3 SHALL be CBOR Sequences (see Appendix A.1) as defined below message_3 = ( @@ -1169,155 +1135,26 @@ o Verify Signature_or_MAC_3 using the algorithm in the selected cipher suite. The verification process depends on the method, see Section 4.4.2. o Pass AD_3, the connection identifiers (C_I, C_R), and the application algorithms in the selected cipher suite to the security application. The application can now derive application keys using the EDHOC-Exporter interface. If any verification step fails, the Responder MUST send an EDHOC - error message back, formatted as defined in Section 6, and the + error message back, formatted as defined in Section 5, and the protocol MUST be discontinued. -5. EDHOC Authenticated with Symmetric Keys - -5.1. Overview - - EDHOC supports authentication with pre-shared keys (authentication - method = 4, see Section 9.2). The Initiator and the Responder are - assumed to have a pre-shared key (PSK) with a good amount of - randomness and the requirement that: - - o Only the Initiator and the Responder SHALL have access to the PSK, - - o The Responder is able to retrieve the PSK using ID_PSK. - - where the identifier ID_PSK is a COSE header_map (i.e. a CBOR map - containing COSE Common Header Parameters, see [RFC8152]) containing - COSE header parameter that can identify a pre-shared key. Pre-shared - keys are typically stored as COSE_Key objects and identified with a - 'kid' parameter (see [RFC8152]): - - o ID_PSK = { 4 : kid_psk } , where kid_psk : bstr - - The purpose of ID_PSK is to facilitate retrieval of the PSK and in - the case a 'kid' parameter is used it may be very short. It is - RECOMMENDED that it uniquely identify the PSK as the recipient may - otherwise have to try several keys. - - EDHOC with symmetric key authentication is illustrated in Figure 5. - - Initiator Responder - | METHOD_CORR, SUITES_I, G_X, C_I, ID_PSK, AD_1 | - +------------------------------------------------------------------>| - | message_1 | - | | - | C_I, G_Y, C_R, AEAD(K_2ae; TH_2, AD_2) | - |<------------------------------------------------------------------+ - | message_2 | - | | - | C_R, AEAD(K_3ae; TH_3, AD_3) | - +------------------------------------------------------------------>| - | message_3 | - - Figure 5: Overview of EDHOC with symmetric key authentication. - - EDHOC with symmetric key authentication is very similar to EDHOC with - asymmetric authentication. In the following subsections the - differences compared to EDHOC with asymmetric authentication are - described. - -5.2. EDHOC Message 1 - -5.2.1. Formatting of Message 1 - - message_1 SHALL be a CBOR Sequence (see Appendix A.1) as defined - below - message_1 = ( - METHOD_CORR : int, - SUITES_I : [ selected : suite, supported : 2* suite ] / suite, - G_X : bstr, - C_I : bstr_identifier, - ID_PSK : header_map / bstr_identifier, - ? AD_1 : bstr, - ) - - where: - - o METHOD_CORR = 4 * method + corr, where method = 4 and the - connection parameter corr is chosen based on the transport and - determines which connection identifiers that are omitted (see - Section 3.1). - - o ID_PSK - identifier to facilitate retrieval of the pre-shared key. - If ID_PSK contains a single 'kid' parameter, i.e., ID_PSK = { 4 : - kid_psk }, only the byte string kid_psk is conveyed encoded as an - bstr_identifier. - -5.3. EDHOC Message 2 - -5.3.1. Processing of Message 2 - - o Signature_or_MAC_2 is not used. - - o The outer COSE_Encrypt0 is computed as defined in Section 5.3 of - [RFC8152], with the EDHOC AEAD algorithm in the selected cipher - suite, K_2ae, IV_2ae, and the following parameters. The protected - header SHALL be empty. - - * plaintext = ? AD_2 - - + AD_2 = bstr containing opaque unprotected auxiliary data - - * external_aad = TH_2 - - COSE constructs the input to the AEAD [RFC5116] as follows: - - * Key K = EDHOC-KDF( PRK_2e, TH_2, "K_2ae", length ) - - * Nonce N = EDHOC-KDF( PRK_2e, TH_2, "IV_2ae", length ) - - * Plaintext P = ? AD_2 - - * Associated data A = [ "Encrypt0", h'', TH_2 ] - -5.4. EDHOC Message 3 - -5.4.1. Processing of Message 3 - - o Signature_or_MAC_3 is not used. - - o COSE_Encrypt0 is computed as defined in Section 5.3 of [RFC8152], - with the EDHOC AEAD algorithm in the selected cipher suite, K_3ae, - IV_3ae, and the following parameters. The protected header SHALL - be empty. - - * plaintext = ? AD_3 - - + AD_3 = bstr containing opaque protected auxiliary data - - * external_aad = TH_3 - - COSE constructs the input to the AEAD [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 = ? AD_3 - - * Associated data A = [ "Encrypt0", h'', TH_3 ] - -6. Error Handling +5. Error Handling -6.1. EDHOC Error Message +5.1. EDHOC Error Message This section defines a message format for the EDHOC error message, used during the protocol. An EDHOC error message can be sent by both parties as a reply to any non-error EDHOC message. After sending an error message, the protocol MUST be discontinued. Errors at the EDHOC layer are sent as normal successful messages in the lower layers (e.g. CoAP POST and 2.04 Changed). An advantage of using such a construction is to avoid issues created by usage of cross protocol proxies (e.g. UDP to TCP). @@ -1338,102 +1176,102 @@ o ERR_MSG - text string containing the diagnostic payload, defined in the same way as in Section 5.5.2 of [RFC7252]. ERR_MSG MAY be a 0-length text string. o SUITES_R - cipher suites from SUITES_I or the EDHOC cipher suites registry that the Responder supports. SUITES_R MUST only be included in replies to message_1. If a single supported cipher suite is conveyed then the supported cipher suite is encoded as an int instead of an array. -6.1.1. Example Use of EDHOC Error Message with SUITES_R +5.1.1. Example Use of EDHOC Error Message with SUITES_R Assuming that the Initiator supports the five cipher suites 5, 6, 7, - 8, and 9 in decreasing order of preference, Figures 6 and 7 show + 8, and 9 in decreasing order of preference, Figures 5 and 6 show examples of how the Responder can truncate SUITES_I and how SUITES_R is used by the Responder to give the Initiator information about the - cipher suites that the Responder supports. In Figure 6, the + cipher suites that the Responder supports. In Figure 5, the Responder supports cipher suite 6 but not the selected cipher suite 5. Initiator Responder | METHOD_CORR, SUITES_I = [5, 5, 6, 7], G_X, C_I, AD_1 | +------------------------------------------------------------------>| | message_1 | | | | C_I, ERR_MSG, SUITES_R = 6 | |<------------------------------------------------------------------+ | error | | | | METHOD_CORR, SUITES_I = [6, 5, 6], G_X, C_I, AD_1 | +------------------------------------------------------------------>| | message_1 | - Figure 6: Example use of error message with SUITES_R. + Figure 5: Example use of error message with SUITES_R. - In Figure 7, the Responder supports cipher suite 7 but not cipher + In Figure 6, the Responder supports cipher suite 7 but not cipher suites 5 and 6. Initiator Responder | METHOD_CORR, SUITES_I = [5, 5, 6], G_X, C_I, AD_1 | +------------------------------------------------------------------>| | message_1 | | | | C_I, ERR_MSG, SUITES_R = [7, 9] | |<------------------------------------------------------------------+ | error | | | | METHOD_CORR, SUITES_I = [7, 5, 6, 7], G_X, C_I, AD_1 | +------------------------------------------------------------------>| | message_1 | - Figure 7: Example use of error message with SUITES_R. + Figure 6: Example use of error message with SUITES_R. As the Initiator's list of supported cipher suites and order of preference is fixed, and the Responder only accepts message_1 if the selected cipher suite is the first cipher suite in SUITES_I that the Responder supports, the parties can verify that the selected cipher suite is the most preferred (by the Initiator) cipher suite supported by both parties. If the selected cipher suite is not the first cipher suite in SUITES_I that the Responder supports, the Responder will discontinue the protocol. -7. Transferring EDHOC and Deriving an OSCORE Context +6. Transferring EDHOC and Deriving an OSCORE Context -7.1. Transferring EDHOC in CoAP +6.1. Transferring EDHOC in CoAP It is recommended to transport EDHOC 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. It is recommended to carry the EDHOC messages in Confirmable messages, 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 8. By default, EDHOC is transferred + sensitive identity, see Section 7. By default, EDHOC is transferred in POST requests and 2.04 (Changed) responses to the Uri-Path: "/.well-known/edhoc", but 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. An example of a successful EDHOC exchange using CoAP is shown in - Figure 8. In this case the CoAP Token enables the Initiator to + Figure 7. In this case the CoAP Token enables the Initiator to correlate message_1 and message_2 so the correlation parameter corr = 1. Client Server | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Content-Format: application/edhoc | | Payload: EDHOC message_1 | | @@ -1443,27 +1281,27 @@ | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Content-Format: application/edhoc | | Payload: EDHOC message_3 | | |<---------+ Header: 2.04 Changed | 2.04 | | | - Figure 8: Transferring EDHOC in CoAP + Figure 7: Transferring EDHOC in CoAP - The exchange in Figure 8 protects the client identity against active + The exchange in Figure 7 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 9. In this case the CoAP Token enables the Responder to + in Figure 8. In this case the CoAP Token enables the Responder to correlate message_2 and message_3 so the correlation parameter corr = 2. Client Server | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | |<---------+ Header: 2.04 Changed | 2.04 | Content-Format: application/edhoc @@ -1472,31 +1310,31 @@ +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Content-Format: application/edhoc | | Payload: EDHOC message_2 | | |<---------+ Header: 2.04 Changed | 2.04 | Content-Format: application/edhoc | | Payload: EDHOC message_3 | | - Figure 9: Transferring EDHOC in CoAP + Figure 8: Transferring EDHOC in CoAP 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]. -7.1.1. Deriving an OSCORE Context from EDHOC +6.1.1. Deriving an OSCORE Context from EDHOC When EDHOC is used to derive parameters for OSCORE [RFC8613], the parties make sure that the EDHOC connection identifiers are unique, i.e. C_R MUST NOT be equal to C_I. The CoAP client and server MUST be able to retrieve the OSCORE protocol state using its chosen connection identifier and optionally other information such as the 5-tuple. In case that the CoAP client is the Initiator and the CoAP server is the Responder: o The client's OSCORE Sender ID is C_R and the server's OSCORE @@ -1505,41 +1343,35 @@ o The AEAD Algorithm and the hash algorithm are the application AEAD and hash algorithms in the selected cipher suite. o The Master Secret and Master Salt are derived as follows where length is the key length (in bytes) of the application AEAD Algorithm. Master Secret = EDHOC-Exporter( "OSCORE Master Secret", length ) Master Salt = EDHOC-Exporter( "OSCORE Master Salt", 8 ) -8. Security Considerations +7. Security Considerations -8.1. Security Properties +7.1. Security Properties EDHOC inherits its security properties from the theoretical SIGMA-I protocol [SIGMA]. Using the terminology from [SIGMA], EDHOC provides perfect forward secrecy, mutual authentication with aliveness, consistency, peer awareness. As described in [SIGMA], peer awareness is provided to the Responder, but not to the Initiator. - When a Public Key Infrastructure (PKI) is used, EDHOC provides - identity protection of the Initiator against active attacks and - identity protection of the Responder against passive attacks. When - PKI is not used (kid, x5t) the identity is not sent on the wire and - EDHOC with asymmetric authentication protects the credential - identifier of the Initiator against active attacks and the credential - identifier of the Responder against passive attacks. The roles - should be assigned to protect the most sensitive identity/identifier, - typically that which is not possible to infer from routing - information in the lower layers. EDHOC with symmetric authentication - does not offer protection of the PSK identifier ID_PSK. + EDHOC protects the credential identifier of the Initiator against + active attacks and the credential identifier of the Responder against + passive attacks. The roles should be assigned 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 and expands the message authentication coverage to additional elements such as algorithms, auxiliary data, and previous messages. This protects against an attacker replaying messages or injecting messages from another session. EDHOC also adds negotiation of connection identifiers and downgrade protected negotiation of cryptographic parameters, i.e. an attacker cannot affect the negotiated parameters. A single session of EDHOC @@ -1553,57 +1385,50 @@ is to use a key exchange that provides perfect forward secrecy. EDHOC therefore only supports methods with perfect forward secrecy. To limit the effect of breaches, it is important to limit the use of symmetrical group keys for bootstrapping. EDHOC therefore strives to make 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 a replacement for a public key infrastructure, but SHOULD be used instead of symmetrical group keys for bootstrapping. - Compromise of the long-term keys (PSK or private authentication keys) - does not compromise the security of completed EDHOC exchanges. + Compromise of the long-term keys (private signature or static DH + keys) does not compromise the security of completed EDHOC exchanges. Compromising the private authentication keys of one party lets an active attacker impersonate that compromised party in EDHOC exchanges with other parties, but does not let the attacker impersonate other - parties in EDHOC exchanges with the compromised party. Compromising - the PSK lets an active attacker impersonate the Initiator in EDHOC - exchanges with the Responder and impersonate the Responder in EDHOC - exchanges with the Initiator. Compromise of the long-term keys does - not enable a passive attacker to compromise future session keys. - Compromise of the HDKF input parameters (ECDH shared secret and/or - PSK) leads to compromise of all session keys derived from that - compromised shared secret. Compromise of one session key does not - compromise other session keys. + parties in EDHOC exchanges with the compromised party. Compromise of + the long-term keys does not enable a passive attacker to compromise + future session keys. Compromise of the HDKF 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 other session keys. Key compromise impersonation (KCI): In EDHOC authenticated with signature keys, EDHOC provides KCI protection against an attacker - having access to the long term key or the ephemeral secret key. In - EDHOC authenticated with symmetric keys, EDHOC provides KCI - protection against an attacker having access to the ephemeral secret - key, but not against an attacker having access to the long-term PSK. - With static Diffie-Hellman key authentication, KCI protection would - be provided against an attacker having access to the long-term - Diffie-Hellman key, but not to an attacker having access to the - ephemeral secret key. Note that the term KCI has typically been used - for compromise of long-term keys, and that an attacker with access to - the ephemeral secret key can only attack that specific protocol run. + having access to the long term key or the ephemeral secret key. With + static Diffie-Hellman key authentication, KCI protection would be + provided against an attacker having access to the long-term Diffie- + Hellman key, but not to an attacker having access to the ephemeral + secret key. Note that the term KCI has typically been used for + compromise of long-term keys, and that an attacker with access to the + ephemeral secret key can only attack that specific protocol run. Repudiation: In EDHOC authenticated with signature keys, Party U could theoretically prove that Party V 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 or PSK - authentication, both parties can always deny having participated in - the protocol. + requirements. With static Diffie-Hellman key authentication, both + parties can always deny having participated in the protocol. -8.2. Cryptographic Considerations +7.2. Cryptographic Considerations The security of the SIGMA protocol requires the MAC to be bound to the identity of the signer. Hence the message authenticating functionality of the authenticated 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 a different mechanism. EDHOC implements SIGMA-I using the same Sign- then-MAC approach as TLS 1.3. To reduce message overhead EDHOC does not use explicit nonces and @@ -1619,63 +1444,60 @@ Initiator and the Responder should enforce a minimum security level. The data rates in many IoT deployments are very limited. Given that the application keys are protected as well as the long-term authentication keys they can often be used for years or even decades before the cryptographic limits are reached. If the application keys established through EDHOC need to be renewed, the communicating parties can derive application keys with other labels or run EDHOC again. -8.3. Cipher Suites +7.3. Cipher Suites Cipher suite number 0 (AES-CCM-16-64-128, SHA-256, X25519, EdDSA, Ed25519, AES-CCM-16-64-128, SHA-256) is mandatory to implement. Implementations only need to implement the algorithms needed for their supported methods. For many constrained IoT devices it is problematic to support more than one cipher suites, so some deployments with P-256 may not support the mandatory cipher suite. This is not a problem for local deployments. The HMAC algorithm HMAC 256/64 (HMAC w/ SHA-256 truncated to 64 bits) SHALL NOT be supported for use in EDHOC. -8.4. Unprotected Data +7.4. Unprotected Data The Initiator and the Responder 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 AD_1, ID_CRED_R, AD_2, and ERR_MSG in the - asymmetric case, and ID_PSK, AD_1, and ERR_MSG in the symmetric case. - Using the same ID_PSK or AD_1 in several EDHOC sessions allows - passive eavesdroppers to correlate the different sessions. The - communicating parties may therefore anonymize ID_PSK. Another - consideration is that the list of supported cipher suites may be used - to identify the application. + particular, it applies to AD_1, ID_CRED_R, AD_2, and ERR_MSG. Using + the same AD_1 in several EDHOC sessions allows passive eavesdroppers + to correlate the different sessions. Another consideration is that + the list of supported cipher suites may potentially be used to + identify the application. The Initiator and the Responder must also make sure that unauthenticated data does not trigger any harmful actions. In - particular, this applies to AD_1 and ERR_MSG in the asymmetric case, - and ID_PSK, AD_1, and ERR_MSG in the symmetric case. + particular, this applies to AD_1 and ERR_MSG. -8.5. Denial-of-Service +7.5. Denial-of-Service EDHOC itself does not provide countermeasures against Denial-of- Service attacks. By sending a number of new or replayed message_1 an attacker may cause the Responder to allocate state, perform cryptographic operations, and amplify messages. To mitigate such attacks, an implementation SHOULD rely on lower layer mechanisms such as the Echo option in CoAP [I-D.ietf-core-echo-request-tag] that forces the initiator to demonstrate reachability at its apparent network address. -8.6. Implementation Considerations +7.6. Implementation Considerations The availability of a secure pseudorandom number generator and truly random seeds are essential for the security of EDHOC. If no true random number generator is available, a truly random seed must be provided from an external source. As each pseudorandom number must only be used once, an implementation need to get a new truly random seed after reboot, or continuously store state in nonvolatile memory, see ([RFC8613], Appendix B.1.1) for issues and solution approaches for writing to nonvolatile memory. If ECDSA is supported, "deterministic ECDSA" as specified in [RFC6979] is RECOMMENDED. @@ -1685,22 +1507,21 @@ along with any ephemeral ECDH secrets after the key derivation is completed. The ECDH shared secret, keys, and IVs MUST be secret. Implementations should provide countermeasures to side-channel attacks such as timing attacks. Depending on the selected curve, the parties should perform various validations of each other's public keys, see e.g. Section 5 of [SP-800-56A]. The Initiator and the Responder are responsible for verifying the integrity of certificates. The selection of trusted CAs should be done very carefully and certificate revocation should be supported. - The private authentication keys and the PSK (even though it is used - as salt) MUST be kept secret. + The private authentication keys MUST be kept secret. The Initiator and the Responder are allowed to select the connection identifiers C_I and C_R, respectively, for the other party to use in the ongoing EDHOC protocol as well as in a subsequent application protocol (e.g. OSCORE [RFC8613]). The choice of connection identifier is not security critical in EDHOC but intended to simplify the retrieval of the right security context in combination with using short identifiers. If the wrong connection identifier of the other party is used in a protocol message it will result in the receiving party not being able to retrieve a security context (which will @@ -1713,32 +1534,32 @@ If two nodes unintentionally initiate two simultaneous EDHOC message exchanges with each other even if they only want to complete a single EDHOC message exchange, they MAY terminate the exchange 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 of two simultaneous EDHOC exchanges where the nodes only complete one and where the nodes have different preferred cipher suites, an attacker can affect which of the two nodes' preferred cipher suites will be used by blocking the other exchange. -8.7. Other Documents Referencing EDHOC +7.7. Other Documents Referencing EDHOC EDHOC has been analyzed in several other documents. A formal verification of EDHOC was done in [SSR18], an analysis of EDHOC for certificate enrollment was done in [Kron18], the use of EDHOC in LoRaWAN is analyzed in [LoRa1] and [LoRa2], the use of EDHOC in IoT bootstrapping is analyzed in [Perez18], and the use of EDHOC in 6TiSCH is described in [I-D.ietf-6tisch-dtsecurity-zerotouch-join]. -9. IANA Considerations +8. IANA Considerations -9.1. EDHOC Cipher Suites Registry +8.1. 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 the registry are Value, Array, Description, and Reference, where Value is an integer and the other columns are text strings. The initial contents of the registry are: Value: -24 Algorithms: N/A Desc: Reserved for Private Use @@ -1765,54 +1586,53 @@ Desc: AES-CCM-16-64-128, SHA-256, P-256, ES256, P-256, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] Value: 3 Array: 30, 5, 1, -7, 1, 10, 5 Desc: AES-CCM-16-128-128, SHA-256, P-256, ES256, P-256, AES-CCM-16-64-128, SHA-256 Reference: [[this document]] -9.2. EDHOC Method Type Registry +8.2. EDHOC Method Type Registry IANA has created a new registry titled "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 are: +-------+-------------------+-------------------+-------------------+ | 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]] | - | 4 | PSK | PSK | [[this document]] | +-------+-------------------+-------------------+-------------------+ - Figure 10: Method Types + Figure 9: Method Types -9.3. The Well-Known URI Registry +8.3. 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 -9.4. Media Types Registry +8.4. 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 @@ -1842,34 +1662,34 @@ "Authors' Addresses" section. o Intended usage: COMMON o Restrictions on usage: N/A o Author: See "Authors' Addresses" section. o Change Controller: IESG -9.5. CoAP Content-Formats Registry +8.5. 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]] -9.6. Expert Review Instructions +8.6. 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. @@ -1883,35 +1703,40 @@ 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. -10. References +9. References -10.1. Normative References +9.1. Normative References [I-D.ietf-core-echo-request-tag] Amsuess, C., Mattsson, J., and G. Selander, "CoAP: Echo, Request-Tag, and Token Processing", draft-ietf-core-echo- - request-tag-09 (work in progress), March 2020. + request-tag-10 (work in progress), July 2020. [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-06 (work in progress), March 2020. + [I-D.ietf-lake-reqs] + Vucinic, M., Selander, G., Mattsson, J., and D. Garcia- + Carillo, "Requirements for a Lightweight AKE for OSCORE", + draft-ietf-lake-reqs-04 (work in progress), June 2020. + [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC5116] McGrew, D., "An Interface and Algorithms for Authenticated Encryption", RFC 5116, DOI 10.17487/RFC5116, January 2008, . [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand @@ -1948,36 +1773,40 @@ . [RFC8152] Schaad, J., "CBOR Object Signing and Encryption (COSE)", RFC 8152, DOI 10.17487/RFC8152, July 2017, . [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, . + [RFC8376] Farrell, S., Ed., "Low-Power Wide Area Network (LPWAN) + Overview", RFC 8376, DOI 10.17487/RFC8376, May 2018, + . + [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, . [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, . [RFC8742] Bormann, C., "Concise Binary Object Representation (CBOR) Sequences", RFC 8742, DOI 10.17487/RFC8742, February 2020, . -10.2. Informative References +9.2. Informative References [CborMe] Bormann, C., "CBOR Playground", May 2018, . [I-D.hartke-core-e2e-security-reqs] Selander, G., Palombini, F., and K. Hartke, "Requirements for CoAP End-To-End Security", draft-hartke-core-e2e- security-reqs-03 (work in progress), July 2017. [I-D.ietf-6tisch-dtsecurity-zerotouch-join] @@ -1994,21 +1823,21 @@ [I-D.ietf-ace-oscore-profile] Palombini, F., Seitz, L., Selander, G., and M. Gunnarsson, "OSCORE profile of the Authentication and Authorization for Constrained Environments Framework", draft-ietf-ace- oscore-profile-11 (work in progress), June 2020. [I-D.ietf-core-resource-directory] Shelby, Z., Koster, M., Bormann, C., Stok, P., and C. Amsuess, "CoRE Resource Directory", draft-ietf-core- - resource-directory-24 (work in progress), March 2020. + resource-directory-25 (work in progress), July 2020. [I-D.ietf-lwig-security-protocol-comparison] Mattsson, J., Palombini, F., and M. Vucinic, "Comparison of CoAP Security Protocols", draft-ietf-lwig-security- protocol-comparison-04 (work in progress), March 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-38 (work in progress), May @@ -2131,21 +1960,21 @@ ( 1, 2, null ) 0x0102f6 sequence 1, 2, null 0x0102f6 sequence ------------------------------------------------------------------ A.2. COSE CBOR Object Signing and Encryption (COSE) [RFC8152] 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, COSE_Sign1, and COSE_KDF_Context objects. + COSE_Key, COSE_Encrypt0, and COSE_Sign1 objects. Appendix B. Test Vectors 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. The test vectors use the default mapping to CoAP where the Initiator acts as CoAP client (this means that corr = 1). A more extensive test vector suite covering more combinations of @@ -2155,21 +1984,21 @@ . B.1. Test Vectors for EDHOC Authenticated with Signature Keys (x5t) EDHOC with signature authentication and X.509 certificates is used. In this test vector, the hash value 'x5t' is used to identify the certificate. method (Signature Authentication) 0 - CoaP is used as transport and the Initiator acts as CoAP client: + CoAP is used 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 (4 * method + corr) (int) 1 No unprotected opaque auxiliary data is sent in the message @@ -2180,21 +2009,21 @@ Supported Cipher Suites (4 bytes) 00 01 02 03 The cipher suite selected by the Initiator is the most preferred: Selected Cipher Suite (int) 0 The mandatory-to-implement cipher suite 0 is supported by both the - Initiator and the Responder, see Section 8.3. + Initiator and the Responder, see Section 7.3. B.1.1. Message_1 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's ephemeral public key) (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 @@ -2250,35 +2079,35 @@ 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 key and nonce for calculating the ciphertext are calculated as follows, as specified in Section 3.8. HKDF SHA-256 is the HKDF used (as defined by cipher suite 0). PRK_2e = HMAC-SHA-256(salt, G_XY) - Since this is the asymmetric case, salt is the empty byte string. + Salt is the empty 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 4a SK_R (Responders'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 - Since neither the Initiator nor the Responder authanticates with a + Since neither the Initiator nor the Responder authenticates 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 bytes) 13 @@ -2396,21 +2225,21 @@ K_2m (16 bytes) b7 48 6a 94 a3 6c f6 9e 67 3f c4 57 55 ee 6b 95 info for IV_2m is defined as follows: info for K_2m = [ 10, h'B0DC6C1BA0BAE6E2888610FA0B27BFC52E311A47B9CAFB609DE4F6A1760D6CF7', - " "IV_2m", + "IV_2m", 13 ] Which as a CBOR encoded data item is: info for IV_2m (CBOR-encoded) (43 bytes) 84 0a 58 20 b0 dc 6c 1b a0 ba e6 e2 88 86 10 fa 0b 27 bf c5 2e 31 1a 47 b9 ca fb 60 9d e4 f6 a1 76 0d 6c f7 65 49 56 5f 32 6d 0d From these parameters, IV_2m is computed. IV_2m is the output of @@ -2548,21 +2377,21 @@ 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 3 is equal to C_R. data_3 (CBOR Sequence) (1 bytes) 13 From data_3, CIPHERTEXT_2, and TH_2, compute the input to the - transcript hash TH_2 = H(TH_2 , CIPHERTEXT_2, data_3), as a CBOR + transcript hash TH_3 = H(TH_2 , CIPHERTEXT_2, data_3), as a CBOR Sequence of these 3 data items. Input to calculate TH_3 (CBOR Sequence) (117 bytes) 58 20 b0 dc 6c 1b a0 ba e6 e2 88 86 10 fa 0b 27 bf c5 2e 31 1a 47 b9 ca fb 60 9d e4 f6 a1 76 0d 6c f7 58 50 99 d5 38 01 a7 25 bf d6 a4 e7 1d 04 84 b7 55 ec 38 3d f7 7a 91 6e c0 db c0 2b ba 7c 21 a2 00 80 7b 4f 58 5f 72 8b 67 1a d6 78 a4 3a ac d3 3b 78 eb d5 66 cd 00 4f c6 f1 d4 06 f0 1d 97 04 e7 05 b2 15 52 a9 eb 28 ea 31 6a b6 50 37 d7 17 86 2e 13 And from there, compute the transcript hash TH_3 = SHA-256(TH_2 ,