ACE Working Group | G. Selander |
Internet-Draft | J. Mattsson |
Intended status: Standards Track | F. Palombini |
Expires: April 24, 2017 | Ericsson AB |
October 21, 2016 |
Ephemeral Diffie-Hellman Over COSE (EDHOC)
draft-selander-ace-cose-ecdhe-03
This document specifies authenticated Diffie-Hellman key exchange with ephemeral keys, embedded in messages encoded with CBOR and using the CBOR Object Signing and Encryption (COSE) format.
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 http://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 April 24, 2017.
Copyright (c) 2016 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 (http://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]. IoT devices may be constrained in various ways, including memory, storage, processing capacity, and energy [RFC7228]. A method for protecting individual messages at application layer suitable for constrained devices, is provided by COSE [I-D.ietf-cose-msg]), which builds on CBOR [RFC7049].
In order for a communication session to provide forward secrecy, the communicating parties can run a Diffie-Hellman (DH) key exchange protocol with ephemeral keys, from which shared key material can be derived. This document specifies authenticated DH protocols using CBOR and COSE objects. The DH key exchange messages may be authenticated using either pre-shared keys (PSK), raw public keys (RPK) or X.509 certificates (Cert). Authentication is based on credentials established out of band, or from a trusted third party, such as an Authorization Server as specified by [I-D.ietf-ace-oauth-authz]. This document also specifies the derivation of shared key material.
The DH exchange and the key derviation follow [SIGMA], SP-800-56a [SP-800-56a] and HKDF [RFC5869], and make use of the data structures of COSE which are aligned with these standards.
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.
The parties exchanging messages are called “party U” and “party V”, and the ECDH ephemeral public keys of U and V are denoted “E_U” and “E_V”, respectively. The messages in the authenticated message exchange are called “message_1”, “message_2”, and “message_3”.
TBD
This section gives an overview of EDHOC, together with Section 4.3 and Section 5.3, which explains how the messages are processed, while Section 4.1 and Section 5.1 focus on the detailed message formats embedded as CBOR objects, and Section 4.2, Section 5.2, and Section 6 specify the key derivation.
EDHOC is built on the SIGMA family of protocols, with the basic protocol specified in Section 5, here in variant (ii) as in Section 5.4, of [SIGMA], see Figure 1.
Party U Party V | | | | | E_U | +------------------------------------------------------>| | | | E_V, ID_V, Sig(V; Mac(Km; E_U, E_V, ID_V)) | |<------------------------------------------------------+ | | | ID_U, Sig(U; Mac(Km; E_V, E_U, ID_U)) | +------------------------------------------------------>| | |
Figure 1: The basic SIGMA protocol
U and V exchange identities and ephemeral public keys E_U, E_V. They compute the shared secret and derive the keying material. The messages are signed and MAC:ed according to the SIGMA protocol:
The protocol used with PSK is based on the basic SIGMA protocol. The underlying scheme for asymmetric keys is the SIGMA-I protocol as specified in Section 5.2, with variant (ii) in Section 5.4, of [SIGMA], see Figure 2. This protocol adds encryption which is required for identity protection in the asymmetric key case:
Party U Party V | | | | | E_U | +------------------------------------------------------>| | | | E_V, Enc(Ke; ID_V, Sig(V; Mac(Km; E_U, E_V, ID_V))) | |<------------------------------------------------------+ | | | Enc(Ke; ID_U, Sig(U; Mac(Km; E_V, E_U, ID_U))) | +------------------------------------------------------>| | |
Figure 2: The SIGMA-I protocol
The protocols are detailed further in the following sections.
This section defines the formatting of the ephemeral public keys E_U and E_V.
The ECDH ephemeral public key SHALL be formatted as a COSE_Key with the following fields and values (see [I-D.ietf-cose-msg]):
TODO: Consider replacing P-256 with Curve25519 as mandatory
In this section we assume that the protocol messages are authenticated with asymmetric keys. Both the scenarios where the parties use raw public keys (RPK) and X.509 certificates (Cert) are supported.
ID_U and ID_V may be public key certificates [SIGMA], which we then denote as C_U and C_V, respectively.
The pre-established credentials may thus be the public keys of U at V, and of V at U. Alternatively, a pre-established public key of a Certificate Authority (CA) may be used as trust anchor for verification of received certificate.
The protocol is based on SIGMA-I (Section 2). As described in Appendix B of [SIGMA], in order to create a “full-fledge” protocol some additional protocol elements are needed:
EDHOC makes the following additions to this scheme (see Figure 3):
Party U Party V | | | N_U, E_U, Alg_U | +---------------------------------------------------------------> | | message_1 | | | | | | N_U, N_V, E_V, Alg_V, Enc(K_VE; ID_V, Sig(V; Mac(K_VM; prot_2)))| | <---------------------------------------------------------------+ | message_2 | | | | | | N_U, N_V, Enc(K_UE; ID_U, Sig(U; Mac(K_UM; prot_3))) | +---------------------------------------------------------------> | | message_3 | | | where prot_2 = N_U, N_V, E_V, Alg_V, ID_V and prot_3 = N_U, N_V, E_U, Alg_U, ID_U
Figure 3: EDHOC with asymmetric keys.
This section details the format for the objects used. Examples are provided for each object in Appendix A.
Note that * identifies fields that do not exist in COSE structures ([I-D.ietf-cose-msg]), and are thus defined in this document.
This section defines the formatting of message_1.
message_1 is a CBOR array object containing:
message_1 = [ N_U : bstr, E_U : COSE_Key, ALG_U : alg_arr ] alg_arr = [ ECDH_arr : alg_array, AEAD_arr : alg_array, SIG_arr : alg_array, MAC_arr : alg_array ] alg_array = [ + alg : bstr/int ]
In case of asymmetric keys, message_2 SHALL have the COSE_Encrypt structure [I-D.ietf-cose-msg] with the following fields and values:
nonce-array = [ N_U: bstr, N_V: bstr ]
The plaintext for message_2 SHALL have the COSE_Sign1 structure [I-D.ietf-cose-msg] with the following fields and values:
The payload for COSE_Sign1 SHALL have the COSE_MAC0 structure [I-D.ietf-cose-msg] with the following fields and values:
payl_2_rpk = [ N_U: bstr, N_V: bstr, E_V: COSE_Key, ID_V: bstr ]
payl_2_cert = [ N_U: bstr, N_V: bstr, E_V: COSE_Key, C_V: bstr ]
In case of asymmetric keys, message_3 SHALL have the COSE_Encrypt0 structure [I-D.ietf-cose-msg] with the following fields and values:
The plaintext for message_3 SHALL have the COSE_Sign1 structure [I-D.ietf-cose-msg] with the following fields and values:
The payload for COSE_Sign1 SHALL have the COSE_MAC0 structure [I-D.ietf-cose-msg] with the following fields and values:
payl_3_rpk = [ N_V : bstr, N_U : bstr, E_U : COSE_Key, ALG_U : alg_arr, ID_V : bstr ]
payl_3_cert = [ N_V : bstr, N_U : bstr, E_U : COSE_Key, ALG_U : alg_arr, C_V : bstr ]
It is described in this section how the keys for encryption (K_UE, K_VE) and MAC (K_UM, K_VM) are derived.
Party U and Party V SHALL derive K_UE, K_VE, K_UM, and K_VM from the information available in message_1 and message_2 through the key exchange, as described in this section.
The key derivation is identical to Section 11 of [I-D.ietf-cose-msg], using HKDF [RFC5869] agreed as part of the ECDH ES w/ HKDF negociation during the message exchange.
The context information COSE_KDF_Context is defined as follows:
The key derivation is done using the following context information COSE_KDF_Context for asymmetric keys:
COSE_KDF_Context = [ AlgorithmID : AEAD / MAC, PartyUInfo : [ PartyInfo_U ], PartyVInfo : [ PartyInfo_V ], SuppPubInfo : [ keyDataLength : uint, ; length protected : bstr, ; zero length bstr other : bstr ; Hash(message_1 || unprotected of COSE_Encrypt (message_2) || "PartyU"/"PartyV") ] ]
PartyInfo_U = ( nonce : N_U ) PartyInfo_V = ( nonce : N_V )
Using the different combination of these parameters creates the four keys K_UE, K_UM, K_VE and K_VM when raw public keys or certificates are used.
For example, to derive K_UE while asymmetric keys are used, the context MUST include:
Party U and V are assumed to have pre-established credentials as described in Section 4.
Party U processes message_1 for party V as follows:
Party V processes the received message_1 as follows:
Party V composes message_2 for party U as follows:
Party U processes the received message_2 as follows:
Party U composes message_3 for party V as follows:
Party V processes the received message_3 as follows:
In this section we assume that the protocol messages are authenticated with pre-shared symmetric keys.
Parties U and V are assumed to have a pre-shared uniformly random key, PSK. The value of the key identifier kid_psk SHALL be unique for U and V.
The protocol is based on the basic SIGMA protocol (Section 2), but the signatures Sig(U; . ), Sig(V; . ) are replaced with message authentication codes MAC(K_UMP; . ), MAC(K_VMP; . ), respectively. K_UMP and K_VMP are computationally independent keys, associated to U and V, respectively, and derived from PSK. Also, party U needs to send kid_psk in message_1 to indicate what PSK that V should use (kid_psk). In this case identity protection is achieved by anonymizing the kid_psk (Section 7).
For a specific pre-shared key (and corresponding kid-psk):
Since kid-psk is unique, only one additional pre-established bit is needed to identify the parties.
As in the asymmetric case, some additional protocol elements are added to the final protocol:
Party U Party V | | | N_U, E_U, Kid, Alg_U | +---------------------------------------------------------------> | | message_1 | | | | | | N_U, N_V, E_V, Kid, ID_V, Alg_V, Mac(K_VMP; Mac(K_VM; prot_2)) | | <---------------------------------------------------------------+ | message_2 | | | | | | N_U, N_V, Kid, ID_U, Mac(K_UMP; Mac(K_UM; prot_3)) | +---------------------------------------------------------------> | | message_3 | | | where prot_2 = N_U, N_V, E_V, Kid, ID_V, Alg_V and prot_3 = N_U, N_V, E_U, Kid, ID_U, Alg_U
Figure 4: EDHOC with symmetric keys.
This section details the format for the objects used. Examples are provided for each object in Appendix A.
Note that * identifies fields that do not exist in COSE structures ([I-D.ietf-cose-msg]), and are thus defined in this document.
This section defines the formatting of message_1.
message_1 is a CBOR array object containing:
message_1 = [ N_U : bstr, E_U : COSE_Key, kid_psk: bstr, ALG_U : alg_arr ] alg_arr = [ ECDH_arr : alg_array, AEAD_arr : alg_array, MAC_arr : alg_array ] alg_array = [ + alg : bstr/int ]
In case of pre-shared key, message_2 SHALL have the COSE_MAC structure [I-D.ietf-cose-msg] with the following fields and values:
nonce-array = [ N_U: bstr, N_V: bstr ]
The payload for message_2 SHALL have the COSE_MAC0 structure [I-D.ietf-cose-msg] with the following fields and values:
payl_2_psk = [ N_U: bstr, N_V: bstr, E_V: COSE_Key, KID: bstr, ; has value kid_psk ID_V: bstr, ALG_V: alg_arr ]
In case of symmetric keys, message_3 SHALL have the COSE_MAC0 structure [I-D.ietf-cose-msg] with the following fields and values:
The payload for message_3 SHALL have the COSE_MAC0 structure [I-D.ietf-cose-msg] with the following fields and values:
payl_3_psk = [ N_U: bstr, N_V: bstr, E_U: COSE_Key, KID: bstr, ; has value kid_psk ID_V: bstr, ALG_U : alg_arr ]
It is described in this section how the keys for MAC (K_UM, K_VM, K_UMP, K_VMP) are derived.
Party U and Party V SHALL derive K_UM, K_VM, K_UMP and K_VMP from the information available in message_1 and message_2 through the key exchange, as described in this section.
The key derivation is identical to Section 4.2, with 3 differences: * to derive K_UM and K_VM, the secret SHALL be the ECDH shared secret as defined in Section 12.4.1 of [I-D.ietf-cose-msg], where the computed secret is specified in section 5.7.1.2 of [SP-800-56a] * to derive K_UMP and K_VMP, the secret SHALL be the pre-shared key * The COSE_KDF_Context SHALL be the serialized COSE_KDF_Context defined in the next paragraph.
The context information COSE_KDF_Context is defined as follows:
The key derivation is done using the following context information COSE_KDF_Context for asymmetric keys:
COSE_KDF_Context = [ AlgorithmID : AEAD / MAC, PartyUInfo : [ PartyInfo_U_psk ], PartyVInfo : [ PartyInfo_V_psk ], SuppPubInfo : [ keyDataLength : uint, ; length protected : bstr, ; zero length bstr other : bstr ; Hash(message_1 || COSE Headers message_2 || "PartyU"/"PartyV") ] ]
PartyInfo_U_psk = ( nonce : N_U ) PartyInfo_V_psk = ( nonce : N_V identity: ID_V )
In practice, the difference in deriving K_UM or K_VM is in the SuppPubInfo string: to derive K_UM the context MUST include “PartyU”, while to derive K_VM the context MUST include “PartyV”.
Party U and V are assumed to have pre-established credentials as described in Section 5.
Party U processes message_1 for party V as follows:
Party V processes the received message_1 as follows:
Party V composes message_2 for party U as follows:
Party U processes the received message_2 as follows:
Party U composes message_3 for party V as follows:
Party V processes the received message_3 as follows:
It is described in this section how the traffic secret for further communication is derived, based on the messages exchanged.
Party U and Party V SHALL derive the traffic secret (base_key) from the information available in message_1, message_2 and message_3 through the key exchange, as described in this section.
The key derivation is identical to Section 11 of [I-D.ietf-cose-msg], using HKDF [RFC5869] agreed as part of the ECDH ES w/ HKDF negociation during the message exchange.
The context information COSE_KDF_Context is defined as follows:
The key derivation is done using the following context information COSE_KDF_Context:
COSE_KDF_Context = [ AlgorithmID : AEAD, PartyUInfo : [ PartyInfo_U ], PartyVInfo : [ PartyInfo_V ], SuppPubInfo : [ keyDataLength : uint, ; length protected : bstr, ; zero length bstr other : bstr ; Hash(message_1 || message_2 || message_3) ] ]
PartyInfo_U = ( nonce : N_U, identity: ID_U / C_U ) PartyInfo_V = ( nonce : N_V, identity: ID_V / C_V )
An example of key derivation for the traffic secret is given in TODO.
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.
The choice of key length used in the different algorithms needs to be harmonized, so that right security level is maintained throughout the calculations.
TODO: Expand on the security considerations in a future version of the draft
TODO
The authors wants to thank Ilari Liusvaara, Jim Schaad and Ludwig Seitz for reviewing previous versions of the draft.
[I-D.ietf-cose-msg] | Schaad, J., "CBOR Object Signing and Encryption (COSE)", Internet-Draft draft-ietf-cose-msg-20, October 2016. |
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
[RFC7049] | Bormann, C. and P. Hoffman, "Concise Binary Object Representation (CBOR)", RFC 7049, DOI 10.17487/RFC7049, October 2013. |
[SIGMA] | Krawczyk, H., "SIGMA - The 'SIGn-and-MAc' Approach to Authenticated Diffie-Hellman and Its Use in the IKE-Protocols", Advances in Cryptology - CRYPTO 2003, 23rd Annual International Cryptology Conference, Santa Barbara, California, USA, August 17-21, 2003, Proceedings, August 2003. |
[SP-800-56a] | Barker, E., Chen, L., Roginsky, A. and M. Smid, "Recommendation for Pair-Wise Key Establishment Schemes Using Discrete Logarithm Cryptography", NIST Special Publication 800-56A, May 2013. |
An example of COSE_Key structure, representing an ECDH public key, is given in Figure 5, using CBOR’s diagnostic notation. In this example, the ephemeral key is identified by a 4 bytes ‘kid’.
/ ephemeral / -1:{ / kty / 1:2, / kid / 2:h'78f67901', / crv / -1:1, / x / -2:h'98f50a4ff6c05861c8860d13a638ea56c3f5ad7590b bfbf054e1c7b4d91d6280', / y / -3:true }
Figure 5: Example of an ECDH public key formatted as a COSE_Key
The equivalent CBOR encoding is: h’a120a50102024478f67901200121582098f50a4ff6c05861c8860d13a638ea56c3f5ad7590bbfbf054e1c7b4d91d628022f5’, which has a size of 51 bytes.
More examples TBD
The DH key exchange specified in this document can be implemented as a CoAP [RFC7252] message exchange with the CoAP client as party U and the CoAP server as party V. EDHOC and OSCOAP [I-D.ietf-core-object-security] could be run in sequence embedded in a 2-round trip message exchange, where the base_key used in OSCOAP is obtained from EDHOC.
A strawman is sketched here. The CoAP client makes the following request:
The CoAP server performs the verifications of the protocol as specified in this document. If successful, then the server provides the following response:
The CoAP client verifies the message_2 as specified in this document. If successful, the client generates the OSCOAP request, and includes message_3 in the unprotected part of the COSE Headers of the OSCOAP COSE object.