ACE Working Group | G. Selander |
Internet-Draft | J. Mattsson |
Intended status: Standards Track | F. Palombini |
Expires: September 6, 2018 | Ericsson AB |
March 05, 2018 |
Ephemeral Diffie-Hellman Over COSE (EDHOC)
draft-selander-ace-cose-ecdhe-08
This document specifies Ephemeral Diffie-Hellman Over COSE (EDHOC), a compact, and lightweight authenticated Diffie-Hellman key exchange with ephemeral keys that can be used over any layer. EDHOC messages are encoded with CBOR and COSE, allowing reuse of existing libraries.
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 on September 6, 2018.
Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
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 protocol needs to work on 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 messages at the application layer suitable for constrained devices, is provided by CBOR Object Signing and Encryption (COSE) [RFC8152]), which builds on the Concise Binary Object Representation (CBOR) [RFC7049].
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), an authenticated ECDH protocol using CBOR and COSE objects. 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 certificates (Cert). 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]. This document also specifies the derivation of shared key material.
The ECDH exchange and the key derivation follow [SIGMA], NIST SP-800-56a [SP-800-56a], and HKDF [RFC5869]. CBOR [RFC7049] and COSE [RFC8152] are used to implement these standards.
This document use the same informational CBOR Data Definition Language (CDDL) [I-D.ietf-cbor-cddl] grammar as COSE (see Section 1.3 of [RFC8152]). A vertical bar | denotes byte string concatenation.
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC2119]. These words may also appear in this document in lowercase, absent their normative meanings.
SIGMA (SIGn-and-MAc) is a family of theoretical protocols with a large number of variants [SIGMA]. Like IKEv2 and TLS 1.3, EDHOC is built on a variant of the SIGMA protocol which provide identity protection, and like TLS 1.3, EDHOC implements the SIGMA-I variant as Sign-then-MAC. The SIGMA-I protocol using an AEAD algorithm is shown in Figure 1.
Party U Party V | E_U | +------------------------------------------------------>| | | | E_V, Enc(K_2; ID_V, Sig(V; E_U, E_V);) | |<------------------------------------------------------+ | | | Enc(K_3; ID_U, Sig(U; E_V, E_U);) | +------------------------------------------------------>| | |
Figure 1: AEAD variant of the SIGMA-I protocol
The parties exchanging messages are called “U” and “V”. They exchange identities and ephemeral public keys, compute the shared secret, and derive the keying material. The messages are signed, MACed, and encrypted.
As described in Appendix B of [SIGMA], in order to create a “full-fledged” protocol some additional protocol elements are needed. EDHOC adds:
EDHOC also makes the following additions:
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 and COSE libraries. EDHOC does not put any requirement on the lower layers and can therefore be also be used e.g. in environments without IP.
This paper is organized as follows: Section 3 specifies general properties of EDHOC, including formatting of the ephemeral public keys and key derivation, Section 4 specifies EDHOC with asymmetric key authentication, Section 5 specifies EDHOC with symmetric key authentication, and Appendix A provides a wealth of test vectors to ease implementation and ensure interoperability.
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. All EDHOC messages consists of a CBOR array where the first element is an int specifying the message type (MSG_TYPE). After creating EDHOC message_3, Party U can derive the traffic key (master secret) and protected application data can therefore be sent in parallel with EDHOC message_3. The application data may be protected using the negotiated AEAD algorithm and the explicit session identifiers S_U and S_V. EDHOC may be used with the media type application/edhoc defined in Section 7.
Party U Party V | | | ------------------ EDHOC message_1 -----------------> | | | | <----------------- EDHOC message_2 ------------------ | | | | ------------------ EDHOC message_3 -----------------> | | | | <----------- Protected Application Data ------------> | | |
Figure 2: EDHOC message flow
The EDHOC message exchange may be authenticated using pre-shared keys (PSK), raw public keys (RPK), or certificates (Cert). EDHOC assumes the existence of mechanisms (certification authority, manual distribution, etc.) for binding identities with authentication keys (public or pre-shared). EDHOC with symmetric key authentication is very similar to EDHOC with asymmetric key authentication, the difference being that information is only MACed, not signed.
EDHOC also allows opaque application data (APP_1, APP_2, APP_3) to be sent in the respective messages. APP_1 is unprotected, APP_2 is protected (encrypted and integrity protected), and APP_3 is protected and mutually authenticated. When EDHOC is used with asymmetric key authentication APP_2 is sent to an unauthenticated party, but with symmetric key authentication APP_2 is mutually authenticated.
The ECDH ephemeral public key SHALL be formatted as a COSE_Key of type EC2 or OKP according to section 13.1 and 13.2 of [RFC8152]. The curve X25519 is mandatory to implement. For Elliptic Curve Keys of type EC2, compact representation and compact output as per [RFC6090] SHALL be used, i.e. the ‘y’ parameter SHALL NOT be present in the The COSE_Key object. COSE [RFC8152] always use compact output for Elliptic Curve Keys of type EC2.
Key and IV derivation SHALL be done as specified in Section 11.1 of [RFC8152] with the following input:
where exchange_hash, in non-CDDL notation, is:
exchange_hash = H( H( message_1 | message_2 ) | message_3 ) |
---|---|---|
where H() is the hash function in HKDF_V.
For message_i the key, called K_i, SHALL be derived using other = aad_i, where i = 2 or 3. The key SHALL be derived using AlgorithmID set to the integer value of the negotiated AEAD (AEAD_V), and keyDataLength equal to the key length of AEAD_V.
If the AEAD algorithm requires an IV, then IV_i for message_i SHALL be derived using other = aad_i, where i = 2 or 3. The IV SHALL be derived using AlgorithmID = “IV-GENERATION” as specified in section 12.1.2. of [RFC8152], and keyDataLength equal to the IV length of AEAD_V.
Application specific traffic keys and other data SHALL be derived using other = exchange_hash. AlgorithmID SHALL be a tstr defined by the application and SHALL be different for different data being derived (an example is given in Appendix C.2). keyDataLength is set to the length of the data being derived.
EDHOC supports authentication with raw public keys (RPK) and certificates (Cert) with the requirements that:
ID_U and ID_V SHALL either contain the credential used for authentication (e.g. x5bag or x5chain) or uniquely identify the credential used for authentication (e.g. x5t), see [I-D.schaad-cose-x509]. Party U and V MAY retrieve the other party’s credential out of band. Optionally, ID_U and ID_V are complemented with the additional parameters HINT_ID_U and HINT_ID_V containing information about how to retrieve the credential of Party U and Party V, respectively (e.g. x5u), see [I-D.schaad-cose-x509].
Party U and Party V MAY use different type of credentials, e.g. one uses RPK and the other uses Cert. Party U and Party V MAY use different signature algorithms.
EDHOC with asymmetric key authentication is illustrated in Figure 3.
Party U Party V | S_U, N_U, E_U, ALG_1, APP_1 | +--------------------------------------------------------------------->| | message_1 | | | |S_U, S_V, N_V, E_V, ALG_2, Enc(K_2; Sig(V; ID_V, aad_2, APP_2); aad_2)| |<---------------------------------------------------------------------+ | message_2 | | | | S_V, Enc(K_3; Sig(U; ID_U, aad_3, APP_3); aad_3) | +--------------------------------------------------------------------->| | message_3 |
Figure 3: EDHOC with asymmetric key authentication.
For EDHOC authenticated with asymmetric keys, the COSE algorithms ECDH-SS + HKDF-256, AES-CCM-64-64-128, and EdDSA are mandatory to implement.
message_1 SHALL be a CBOR array as defined below
message_1 = [ MSG_TYPE : int, S_U : bstr, N_U : bstr, E_U : serialized_COSE_Key, ECDH-Curves_U : alg_array, HKDFs_U : alg_array, AEADs_U : alg_array, SIGs_V : alg_array, SIGs_U : alg_array, ? APP_1 : bstr ] serialized_COSE_Key = bstr .cbor COSE_Key alg_array = [ + alg : int / tstr ]
where:
Party U SHALL compose message_1 as follows:
Party V SHALL process message_1 as follows:
If any verification step fails, Party V MUST send an EDHOC error message back, formatted as defined in Section 6.1, and the protocol MUST be discontinued. If V does not support the ECDH curve used in E_U, but supports another ECDH curves in ECDH-Curves_U, then the error message MUST include the following diagnostic payload describing the first supported ECDH curve in ECDH-Curves_U:
ERR_MSG = "Curve not supported; X" where X is the first curve in ECDH-Curves_U that V supports, encoded as in Table 22 of {{RFC8152}}.
message_2 SHALL be a CBOR array as defined below
message_2 = [ data_2, COSE_ENC_2 : COSE_Encrypt0 ] data_2 = ( MSG_TYPE : int, S_U : bstr, S_V : bstr, N_V : bstr, E_V : serialized_COSE_Key, HKDF_V : int / tstr, AEAD_V : int / tstr, SIG_V : int / tstr, SIG_U : int / tstr ) aad_2 : bstr
where aad_2, in non-CDDL notation, is:
aad_2 = H( message_1 | [ data_2 ] )
where:
Party V SHALL compose message_2 as follows:
Party U SHALL process message_2 as follows:
If any verification step fails, Party U MUST send an EDHOC error message back, formatted as defined in Section 6.1, and the protocol MUST be discontinued.
message_3 SHALL be a CBOR array as defined below
message_3 = [ data_3, COSE_ENC_3 : COSE_Encrypt0 ] data_3 = ( MSG_TYPE : int, S_V : bstr ) aad_3 : bstr
where aad_3, in non-CDDL notation, is:
aad_3 = H( H( message_1 | message_2 ) | [ data_3 ] )
where:
Party U SHALL compose message_3 as follows:
Party V SHALL process message_3 as follows:
If any verification step fails, Party V MUST send an EDHOC error message back, formatted as defined in Section 6.1, and the protocol MUST be discontinued.
EDHOC supports authentication with pre-shared keys. Party U and V are assumed to have a pre-shared uniformly random key (PSK) with the requirement that:
KID may optionally contain information about how to retrieve the PSK.
EDHOC with symmetric key authentication is illustrated in Figure 4.
Party U Party V | S_U, N_U, E_U, ALG_1, KID, APP_1 | +------------------------------------------------------------------>| | message_1 | | | | S_U, S_V, N_V, E_V, ALG_2, Enc(K_2; APP_2; aad_2) | |<------------------------------------------------------------------+ | message_2 | | | | S_V, Enc(K_3; APP_3; aad_3) | +------------------------------------------------------------------>| | message_3 |
Figure 4: EDHOC with symmetric key authentication.
For EDHOC authenticated with symmetric keys, the COSE algorithms ECDH-SS + HKDF-256 and AES-CCM-64-64-128 are mandatory to implement.
message_1 SHALL be a CBOR array as defined below
message_1 = [ data_1 ] data_1 = ( MSG_TYPE : int, S_U : bstr, N_U : bstr, E_U : serialized_COSE_Key, ECDH-Curves_U : alg_array, HKDFs_U : alg_array, AEADs_U : alg_array, KID : bstr, ? APP_1 : bstr ) serialized_COSE_Key = bstr .cbor COSE_Key alg_array = [ + alg : int / tstr ]
where:
Party U SHALL compose message_1 as follows:
Party V SHALL process message_1 as follows:
If any verification step fails, Party V MUST send an EDHOC error message back, formatted as defined in Section 6.1, and the protocol MUST be discontinued. If V does not support the ECDH curve used in E_U, but supports another ECDH curves in ECDH-Curves_U, then the error message SHOULD include a diagnostic payload describing the first supported ECDH curve in ECDH-Curves_U.
message_2 SHALL be a CBOR array as defined below
message_2 = [ data_2, COSE_ENC_2 : COSE_Encrypt0 ] data_2 = ( MSG_TYPE : int, S_U : bstr, S_V : bstr, N_V : bstr, E_V : serialized_COSE_Key, HKDF_V : int / tstr, AEAD_V : int / tstr ) aad_2 : bstr
where aad_2, in non-CDDL notation, is:
aad_2 = H( message_1 | [ data_2 ] )
where:
Party V SHALL compose message_2 as follows:
Party U SHALL process message_2 as follows:
If any verification step fails, Party U MUST send an EDHOC error message back, formatted as defined in Section 6.1, and the protocol MUST be discontinued.
message_3 SHALL be a CBOR array as defined below
message_3 = [ data_3, COSE_ENC_3 : COSE_Encrypt0 ] data_3 = ( MSG_TYPE : int, S_V : bstr ) aad_3 : bstr
where aad_3, in non-CDDL notation, is:
aad_3 = H( H( message_1 | message_2 ) | [ data_3 ] )
where:
Party U SHALL compose message_3 as follows:
Party V SHALL process message_3 as follows:
If any verification step fails, Party V MUST send an EDHOC error message back, formatted as defined in Section 6.1, and the protocol MUST be discontinued.
This section defines a message format for an EDHOC error message, used during the protocol. This is an error on EDHOC level and is independent of the lower layers used. An advantage of using such a construction is to avoid issues created by usage of cross protocol proxies (e.g. UDP to TCP).
error SHALL be a CBOR array as defined below
error = [ MSG_TYPE : int, ? ERR_MSG : tstr ]
where:
IANA has added the well-known URI ‘edhoc’ in the Well-Known URIs registry.
URI suffix: edhoc
Change controller: IETF
Specification document(s): [[this document]]
Related information: None
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: Göran Selander <goran.selander@ericsson.com> Intended usage: COMMON Restrictions on usage: N/A Author: Göran Selander <goran.selander@ericsson.com> Change Controller: IESG
EDHOC builds on the SIGMA-I family of theoretical protocols that provides perfect forward secrecy and identity protection with a minimal number of messages. The encryption algorithm of the SIGMA-I protocol provides identity protection, but the security of the protocol requires the MAC to cover 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 adds an explicit message type and expands the message authentication coverage to additional elements such as algorithms, application data, and previous messages. EDHOC uses the same Sign-then-MAC approach as TLS 1.3.
EDHOC does not include negotiation of parameters related to the ephemeral key, but it enables Party V to verify that the ECDH curve used in the protocol is the most preferred curve by U which is supported by both U and V.
Party U and V 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 APP_1 and APP_2 in the asymmetric case, and APP_1 and KID in the symmetric case. The communicating parties may therefore anonymize KID.
Using the same KID or unprotected application data in several EDHOC sessions allows passive eavesdroppers to correlate the different sessions. Another consideration is that the list of supported algorithms may be used to identify the application.
Party U and V are allowed to select the session identifiers S_U and S_V, respectively, for the other party to use in the ongoing EDHOC protocol as well as in a subsequent traffic protection protocol (e.g. OSCORE [I-D.ietf-core-object-security]). The choice of session identifier is not security critical but intended to simplify the retrieval of the right security context in combination with using short identifiers. If the wrong session 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 terminate the protocol) or retrieving the wrong security context (which also terminates the protocol as the message cannot be verified).
Party U and V must make sure that unprotected data does not trigger any harmful actions. In particular, this applies to APP_1 in the asymmetric case, and APP_1 and KID in the symmetric case. Party V should be aware that replays of EDHOC message_1 cannot be detected unless previous nonces are stored.
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. If ECDSA is supported, “deterministic ECDSA” as specified in RFC6979 is RECOMMENDED.
Nonces MUST NOT be reused, both parties MUST generate fresh random nonces.
Ephemeral keys SHOULD NOT be reused, both parties SHOULD generate fresh random ephemeral key pairs. Party V MAY reuse the ephemeral key to limit the effect of certain DoS attacks. For example, to reduce processing costs in the case of repeated uncompleted protocol runs, party V MAY pre-compute its ephemeral key E_V and reuse it for a small number of concurrent EDHOC executions, for example until a number of EDHOC protocol instances has been successfully completed, which triggers party V to pre-compute a new ephemeral key E_V to use with subsequent protocol runs.
The referenced processing instructions in [SP-800-56a] must be complied with, including deleting the intermediate computed values along with any ephemeral ECDH secrets after the key derivation is completed.
Party U and V 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 choice of key length used in the different algorithms needs to be harmonized, so that a sufficient security level is maintained for certificates, EDHOC, and the protection of application data. Party U and V should enforce a minimum security level.
Note that, depending on the application, the keys established through the EDHOC protocol will need to be renewed, in which case the communicating parties need to run the protocol again.
Implementations should provide countermeasures to side-channel attacks such as timing attacks.
The authors want to thank Dan Harkins, Ilari Liusvaara, Jim Schaad and Ludwig Seitz for reviewing intermediate versions of the draft and contributing concrete proposals incorporated in this version. We are especially indebted to Jim Schaad for his continuous reviewing and implementation of different versions of the draft.
TODO: This section should be after Appendices and before Authors’ addresses according to RFC7322.
TODO: This section needs to be updated.
An application using EDHOC with symmetric keys may have a security policy to change the PSK as a result of successfully completing the EDHOC protocol. In this case, the old PSK SHALL be replaced with a new PSK derived using other = exchange_hash, AlgorithmID = “EDHOC PSK Chaining” and keyDataLength equal to the key length of AEAD_V, see Section 3.2.
EDHOC can be transferred as an exchange of CoAP [RFC7252] messages, with the CoAP client as party U and the CoAP server as party V. By default EDHOC is sent 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].
In practice, 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 successful EDHOC exchange using CoAP is shown in Figure 5.
Client Server | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Content-Type: application/edhoc | | Payload: EDHOC message_1 | | |<---------+ Header: 2.04 Changed | 2.04 | Content-Type: application/edhoc | | Payload: EDHOC message_2 | | +--------->| Header: POST (Code=0.02) | POST | Uri-Path: "/.well-known/edhoc" | | Content-Type: application/edhoc | | Payload: EDHOC message_3 | | |<---------+ Header: 2.04 Changed | 2.04 | | |
Figure 5: Transferring EDHOC in CoAP
When EDHOC is use to derive parameters for OSCORE [I-D.ietf-core-object-security], the parties must make sure that the EDHOC session identifiers are unique Recipient IDs in OSCORE. In case that the CoAP client is party U and the CoAP server is party V: