idnits 2.17.1 draft-palombini-core-oscore-edhoc-02.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- No issues found here. Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year -- The document date (February 19, 2021) is 1162 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Outdated reference: A later version (-23) exists of draft-ietf-lake-edhoc-03 Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 1 comment (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CoRE Working Group F. Palombini 3 Internet-Draft Ericsson 4 Intended status: Standards Track M. Tiloca 5 Expires: August 23, 2021 R. Hoeglund 6 RISE AB 7 S. Hristozov 8 Fraunhofer AISEC 9 G. Selander 10 Ericsson 11 February 19, 2021 13 Combining EDHOC and OSCORE 14 draft-palombini-core-oscore-edhoc-02 16 Abstract 18 This document defines an optimization approach for combining the 19 lightweight authenticated key exchange protocol EDHOC run over CoAP 20 with the first subsequent OSCORE transaction. This combination 21 reduces the number of round trips required to set up an OSCORE 22 Security Context and to complete an OSCORE transaction using that 23 Security Context. 25 Status of This Memo 27 This Internet-Draft is submitted in full conformance with the 28 provisions of BCP 78 and BCP 79. 30 Internet-Drafts are working documents of the Internet Engineering 31 Task Force (IETF). Note that other groups may also distribute 32 working documents as Internet-Drafts. The list of current Internet- 33 Drafts is at https://datatracker.ietf.org/drafts/current/. 35 Internet-Drafts are draft documents valid for a maximum of six months 36 and may be updated, replaced, or obsoleted by other documents at any 37 time. It is inappropriate to use Internet-Drafts as reference 38 material or to cite them other than as "work in progress." 40 This Internet-Draft will expire on August 23, 2021. 42 Copyright Notice 44 Copyright (c) 2021 IETF Trust and the persons identified as the 45 document authors. All rights reserved. 47 This document is subject to BCP 78 and the IETF Trust's Legal 48 Provisions Relating to IETF Documents 49 (https://trustee.ietf.org/license-info) in effect on the date of 50 publication of this document. Please review these documents 51 carefully, as they describe your rights and restrictions with respect 52 to this document. Code Components extracted from this document must 53 include Simplified BSD License text as described in Section 4.e of 54 the Trust Legal Provisions and are provided without warranty as 55 described in the Simplified BSD License. 57 Table of Contents 59 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 60 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 3 61 2. Background . . . . . . . . . . . . . . . . . . . . . . . . . 3 62 3. EDHOC Option . . . . . . . . . . . . . . . . . . . . . . . . 5 63 4. EDHOC Combined with OSCORE . . . . . . . . . . . . . . . . . 6 64 4.1. Client Processing . . . . . . . . . . . . . . . . . . . . 6 65 4.2. Server Processing . . . . . . . . . . . . . . . . . . . . 7 66 5. Example of EDHOC + OSCORE Request . . . . . . . . . . . . . . 9 67 6. Security Considerations . . . . . . . . . . . . . . . . . . . 10 68 7. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 10 69 7.1. CoAP Option Numbers Registry . . . . . . . . . . . . . . 10 70 8. Normative References . . . . . . . . . . . . . . . . . . . . 10 71 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 11 72 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 11 74 1. Introduction 76 This document defines an optimization approach to combine the 77 lightweight authenticated key exchange protocol EDHOC 78 [I-D.ietf-lake-edhoc], when running over CoAP [RFC7252], with the 79 first subsequent OSCORE [RFC8613] transaction. 81 This allows for a minimum number of round trips necessary to setup 82 the OSCORE Security Context and complete an OSCORE transaction, for 83 example when an IoT device gets configured in a network for the first 84 time. 86 This optimization is desirable, since the number of protocol round 87 trips impacts the minimum number of flights, which in turn can have a 88 substantial impact on the latency of conveying the first OSCORE 89 request, when using certain radio technologies. 91 Without this optimization, it is not possible, not even in theory, to 92 achieve the minimum number of flights. This optimization makes it 93 possible also in practice, since the last message of the EDHOC 94 protocol can be made relatively small (see Section 1 of 95 [I-D.ietf-lake-edhoc]), thus allowing additional OSCORE protected 96 CoAP data within target MTU sizes. 98 1.1. Terminology 100 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 101 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 102 "OPTIONAL" in this document are to be interpreted as described in 103 BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all 104 capitals, as shown here. 106 The reader is expected to be familiar with terms and concepts defined 107 in CoAP [RFC7252], CBOR [RFC8949], CBOR sequences [RFC8742], OSCORE 108 [RFC8613] and EDHOC [I-D.ietf-lake-edhoc]. 110 2. Background 112 EDHOC is a 3-message key exchange protocol. Section 7.2 of 113 [I-D.ietf-lake-edhoc] specifies how to transport EDHOC over CoAP: the 114 EDHOC data (referred to as "EDHOC messages") are transported in the 115 payload of CoAP requests and responses. 117 This draft deals with the case of the Initiator acting as CoAP Client 118 and the Responder acting as CoAP Server; instead, the case of the 119 Initiator acting as CoAP Server cannot be optimized by using this 120 approach. 122 That is, the CoAP Client sends a POST request containing EDHOC 123 message_1 to a reserved resource at the CoAP Server. This triggers 124 the EDHOC exchange on the CoAP Server, which replies with a 2.04 125 (Changed) Response containing EDHOC message_2. Finally, the CoAP 126 Client sends EDHOC message_3, as a CoAP POST request to the same 127 resource used for EDHOC message_1. The Content-Format of these CoAP 128 messages may be set to "application/edhoc". 130 After this exchange takes place, and after successful verifications 131 specified in the EDHOC protocol, the Client and Server derive the 132 OSCORE Security Context, as specified in Section 7.2.1 of 133 [I-D.ietf-lake-edhoc]. Then, they are ready to use OSCORE. 135 This sequential way of running EDHOC and then OSCORE is specified in 136 Figure 1. As shown in the figure, this mechanism takes 3 round trips 137 to complete. 139 CoAP Client CoAP Server 140 | ------------- EDHOC message_1 ------------> | 141 | | 142 | <------------ EDHOC message_2 ------------- | 143 | | 144 EDHOC verification | 145 | | 146 | ------------- EDHOC message_3 ------------> | 147 | | 148 | EDHOC verification 149 | + 150 OSCORE Sec Ctx OSCORE Sec Ctx 151 Derivation Derivation 152 | | 153 | ------------- OSCORE Request -------------> | 154 | | 155 | <------------ OSCORE Response ------------- | 156 | | 158 Figure 1: EDHOC and OSCORE run sequentially 160 The number of roundtrips can be minimized as follows. Already after 161 receiving EDHOC message_2 and before sending EDHOC message_3, the 162 CoAP Client has all the information needed to derive the OSCORE 163 Security Context. 165 This means that the Client can potentially send at the same time both 166 EDHOC message_3 and the subsequent OSCORE Request. On a semantic 167 level, this approach practically requires to send two separate REST 168 requests at the same time. 170 The high level message flow of running EDHOC and OSCORE combined is 171 shown in Figure 2. 173 Defining the specific details of how to transport the data and of 174 their processing order is the goal of this specification, as defined 175 in Section 4. 177 CoAP Client CoAP Server 178 | ------------- EDHOC message_1 ------------> | 179 | | 180 | <------------ EDHOC message_2 ------------- | 181 | | 182 EDHOC verification | 183 + | 184 OSCORE Sec Ctx | 185 Derivation | 186 | | 187 | ---- EDHOC message_3 + OSCORE Request ----> | 188 | | 189 | EDHOC verification 190 | + 191 | OSCORE Sec Ctx 192 | Derivation 193 | | 194 | <------------ OSCORE Response ------------- | 195 | | 197 Figure 2: EDHOC and OSCORE combined 199 3. EDHOC Option 201 This section defines the EDHOC Option, used in a CoAP request to 202 signal that the request combines EDHOC message_3 and OSCORE protected 203 data. 205 The EDHOC Option has the properties summarized in Figure 3, which 206 extends Table 4 of [RFC7252]. The option is Critical, Safe-to- 207 Forward, and part of the Cache-Key. The option MUST occur at most 208 once and is always empty. If any value is sent, the value is simply 209 ignored. The option is intended only for CoAP requests and is of 210 Class U for OSCORE [RFC8613]. 212 +-------+---+---+---+---+-------+--------+--------+---------+ 213 | No. | C | U | N | R | Name | Format | Length | Default | 214 +-------+---+---+---+---+-------+--------+--------+---------+ 215 | TBD13 | x | | | | EDHOC | Empty | 0 | (none) | 216 +-------+---+---+---+---+-------+--------+--------+---------+ 217 C=Critical, U=Unsafe, N=NoCacheKey, R=Repeatable 219 Figure 3: The EDHOC Option. 221 The presence of this option means that the message payload contains 222 also EDHOC data, that must be extracted and processed as defined in 223 Section 4.2, before the rest of the message can be processed. 225 Figure 4 shows the format of a CoAP message containing both the EDHOC 226 data and the OSCORE ciphertext, using the newly defined EDHOC option 227 for signalling. 229 0 1 2 3 230 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 231 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 232 |Ver| T | TKL | Code | Message ID | 233 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 234 | Token (if any, TKL bytes) ... 235 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 236 | OSCORE option | EDHOC option | other options (if any) ... 237 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 238 |1 1 1 1 1 1 1 1| Payload 239 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 241 Figure 4: CoAP message for EDHOC and OSCORE combined - signalled with 242 the EDHOC Option 244 4. EDHOC Combined with OSCORE 246 The approach defined in this specification consists of sending EDHOC 247 message_3 inside an OSCORE protected CoAP message. 249 The resulting EDHOC + OSCORE request is in practice the OSCORE 250 Request from Figure 1, sent to a protected resource and with the 251 correct CoAP method and options, with the addition that it also 252 transports EDHOC message_3. 254 Since EDHOC message_3 may be too large to be included in a CoAP 255 Option, e.g. if containing a large public key certificate chain, it 256 has to be transported through the CoAP payload. 258 The use of this approach is explicitly signalled by including an 259 EDHOC Option (see Section 3) in the EDHOC + OSCORE request. 261 4.1. Client Processing 263 The Client prepares an EDHOC + OSCORE request as follows. 265 1. Compose EDHOC message_3 as per Section 5.4.2 of 266 [I-D.ietf-lake-edhoc]. 268 Since the Client is the EDHOC Initiator and the used Correlation 269 Method is 1 (see Section 3.2.4 of [I-D.ietf-lake-edhoc]), the 270 EDHOC message_3 always includes the Connection Identifier C_R and 271 CIPHERTEXT_3. Note that C_R is the OSCORE Sender ID of the 272 Client, encoded as a bstr_identifier (see Section 5.1 of 273 [I-D.ietf-lake-edhoc]). 275 2. Encrypt the original CoAP request as per Section 8.1 of 276 [RFC8613], using the new OSCORE Security Context established 277 after receiving EDHOC message_2. 279 Note that the OSCORE ciphertext is not computed over EDHOC 280 message_3, which is not protected by OSCORE. That is, the result 281 of this step is the OSCORE Request as in Figure 1. 283 3. Build a CBOR sequence [RFC8742] composed of two CBOR byte strings 284 in the following order. 286 * The first CBOR byte string is the CIPHERTEXT_3 of the EDHOC 287 message_3 resulting from step 3. 289 * The second CBOR byte string has as value the OSCORE ciphertext 290 of the OSCORE protected CoAP request resulting from step 2. 292 4. Compose the EDHOC + OSCORE request, as the OSCORE protected CoAP 293 request resulting from step 2, where the payload is replaced with 294 the CBOR sequence built at step 3. 296 5. Signal the usage of this approach within the EDHOC + OSCORE 297 request, by including the new EDHOC Option defined in Section 3. 299 4.2. Server Processing 301 When receiving an EDHOC + OSCORE request, the Server performs the 302 following steps. 304 1. Check the presence of the EDHOC option defined in Section 3, to 305 determine that the received request is an EDHOC + OSCORE request. 306 If this is the case, the Server continues with the steps defined 307 below. 309 2. Extract CIPHERTEXT_3 from the payload of the EDHOC + OSCORE 310 request, as the first CBOR byte string in the CBOR sequence. 312 3. Rebuild EDHOC message_3, as a CBOR sequence composed of two CBOR 313 byte strings in the following order. 315 * The first CBOR byte string is the 'kid' of the Client 316 indicated in the OSCORE option of the EDHOC + OSCORE request, 317 encoded as a bstr_identifier (see Section 5.1 of 318 [I-D.ietf-lake-edhoc]). 320 * The second CBOR byte string is the CIPHERTEXT_3 retrieved at 321 step 2. 323 4. Perform the EDHOC processing on the EDHOC message_3 rebuilt at 324 step 3, including verifications, and the OSCORE Security Context 325 derivation, as per Section 5.4.3 and Section 7.2.1 of 326 [I-D.ietf-lake-edhoc], respectively. 328 5. Extract the OSCORE ciphertext from the payload of the EDHOC + 329 OSCORE request, as the value of the second CBOR byte string in 330 the CBOR sequence. 332 6. Rebuild the OSCORE protected CoAP request as the EDHOC + OSCORE 333 request, where the payload is replaced with the OSCORE ciphertext 334 resulting from step 5. 336 7. Decrypt and verify the OSCORE protected CoAP request resulting 337 from step 6, as per Section 8.2 of [RFC8613], by using the new 338 OSCORE Security Context established at step 4. 340 8. Process the CoAP request resulting from step 7. 342 If steps 4 (EDHOC processing) and 7 (OSCORE processing) are both 343 successfully completed, the Server MUST reply with an OSCORE 344 protected response, in order for the Client to achieve key 345 confirmation (see Section 5.4.2 of [I-D.ietf-lake-edhoc]). The usage 346 of EDHOC message_4 as defined in Section 7.1 of [I-D.ietf-lake-edhoc] 347 is not applicable to the approach defined in this specification. 349 If step 4 (EDHOC processing) fails, the server discontinues the 350 protocol as per Section 5.4.3 of [I-D.ietf-lake-edhoc] and sends an 351 EDHOC error message, formatted as defined in Section 6.1 of 352 [I-D.ietf-lake-edhoc]. In particular, the CoAP response conveying 353 the EDHOC error message: 355 o MUST have Content-Format set to application/edhoc defined in 356 Section 9.5 of [I-D.ietf-lake-edhoc]. 358 o MUST specify a CoAP error response code, i.e. 4.00 (Bad Request) 359 in case of client error (e.g. due to a malformed EDHOC message_3), 360 or 5.00 (Internal Server Error) in case of server error (e.g. due 361 to failure in deriving EDHOC key material). 363 If step 4 (EDHOC processing) is successfully completed but step 7 364 (OSCORE processing) fails, the same OSCORE error handling applies as 365 defined in Section 8.2 of [RFC8613]. 367 5. Example of EDHOC + OSCORE Request 369 An example based on the OSCORE test vector from Appendix C.4 of 370 [RFC8613] and the EDHOC test vector from Appendix B.2 of 371 [I-D.ietf-lake-edhoc] is given in Figure 5. In particular, the 372 example assumes that: 374 o The used OSCORE Partial IV is 0, consistently with the first 375 request protected with the new OSCORE Security Context. 377 o The OSCORE Sender ID of the Client is 0x20. This corresponds to 378 the EDHOC Connection Identifier C_R, which is encoded as the 379 bstr_identifier 0x08 in EDHOC message_3. 381 o The EDHOC option is registered with CoAP option number 13. 383 o OSCORE option value: 0x090020 (3 bytes) 385 o EDHOC option value: - (0 bytes) 387 o C_R: 0x20 (1 byte) 389 o CIPHERTEXT_3: 0x5253c3991999a5ffb86921e99b607c067770e0 390 (19 bytes) 392 o EDHOC message_3: 0x08 5253c3991999a5ffb86921e99b607c067770e0 393 (20 bytes) 395 o OSCORE ciphertext: 0x612f1092f1776f1c1668b3825e (13 bytes) 397 From there: 399 o Protected CoAP request (OSCORE message): 401 0x44025d1f ; CoAP 4-byte header 402 00003974 ; Token 403 39 6c6f63616c686f7374 ; Uri-Host Option: "localhost" 404 63 090020 ; OSCORE Option 405 40 ; EDHOC Option 406 ff 5253c3991999a5ffb86921e99b607c067770e0 407 4d612f1092f1776f1c1668b3825e 408 (57 bytes) 410 Figure 5: Example of CoAP message with EDHOC and OSCORE combined 412 6. Security Considerations 414 The same security considerations from OSCORE [RFC8613] and EDHOC 415 [I-D.ietf-lake-edhoc] hold for this document. 417 TODO (more considerations) 419 7. IANA Considerations 421 This document has the following actions for IANA. 423 7.1. CoAP Option Numbers Registry 425 IANA is asked to enter the following option numbers to the "CoAP 426 Option Numbers" registry defined in [RFC7252] within the "CoRE 427 Parameters" registry. 429 [ 431 The CoAP option numbers 13 and 21 are both consistent with the 432 properties of the EDHOC Option defined in Section 3, and they both 433 allow the EDHOC Option to always result in an overall size of 1 byte. 434 This is because: 436 o The EDHOC option is always empty, i.e. with zero-length value; and 438 o Since the OSCORE option with option number 9 is always present in 439 the CoAP request, the EDHOC option would be encoded with a maximum 440 delta of 4 or 12, depending on its option number being 13 or 21. 442 At the time of writing, the CoAP option numbers 13 and 21 are both 443 unassigned in the "CoAP Option Numbers" registry, as first available 444 and consistent option numbers for the EDHOC option. 446 ] 448 +--------+-------+-------------------+ 449 | Number | Name | Reference | 450 +--------+-------+-------------------+ 451 | TBD13 | EDHOC | [[this document]] | 452 +--------+-------+-------------------+ 454 8. Normative References 456 [I-D.ietf-lake-edhoc] 457 Selander, G., Mattsson, J., and F. Palombini, "Ephemeral 458 Diffie-Hellman Over COSE (EDHOC)", draft-ietf-lake- 459 edhoc-03 (work in progress), December 2020. 461 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 462 Requirement Levels", BCP 14, RFC 2119, 463 DOI 10.17487/RFC2119, March 1997, 464 . 466 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 467 Application Protocol (CoAP)", RFC 7252, 468 DOI 10.17487/RFC7252, June 2014, 469 . 471 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 472 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 473 May 2017, . 475 [RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, 476 "Object Security for Constrained RESTful Environments 477 (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, 478 . 480 [RFC8742] Bormann, C., "Concise Binary Object Representation (CBOR) 481 Sequences", RFC 8742, DOI 10.17487/RFC8742, February 2020, 482 . 484 [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object 485 Representation (CBOR)", STD 94, RFC 8949, 486 DOI 10.17487/RFC8949, December 2020, 487 . 489 Acknowledgments 491 The authors sincerely thank Christian Amsuess, Klaus Hartke, Jim 492 Schaad and Malisa Vucinic for their feedback and comments in the 493 discussion leading up to this draft. 495 The work on this document has been partly supported by VINNOVA and 496 the Celtic-Next project CRITISEC; and by the H2020 project SIFIS-Home 497 (Grant agreement 952652). 499 Authors' Addresses 501 Francesca Palombini 502 Ericsson 504 Email: francesca.palombini@ericsson.com 505 Marco Tiloca 506 RISE AB 507 Isafjordsgatan 22 508 Kista SE-16440 Stockholm 509 Sweden 511 Email: marco.tiloca@ri.se 513 Rikard Hoeglund 514 RISE AB 515 Isafjordsgatan 22 516 Kista SE-16440 Stockholm 517 Sweden 519 Email: rikard.hoglund@ri.se 521 Stefan Hristozov 522 Fraunhofer AISEC 524 Email: stefan.hristozov@aisec.fraunhofer.de 526 Goeran Selander 527 Ericsson 529 Email: goran.selander@ericsson.com