idnits 2.17.1 draft-ietf-lwig-crypto-sensors-00.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 (September 4, 2016) is 2788 days in the past. Is this intentional? Checking references for intended status: Informational ---------------------------------------------------------------------------- == Outdated reference: A later version (-28) exists of draft-ietf-core-resource-directory-08 -- Obsolete informational reference (is this intentional?): RFC 5246 (Obsoleted by RFC 8446) -- Obsolete informational reference (is this intentional?): RFC 6347 (Obsoleted by RFC 9147) Summary: 0 errors (**), 0 flaws (~~), 2 warnings (==), 3 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 Light-Weight Implementation Guidance M. Sethi 3 Internet-Draft J. Arkko 4 Intended status: Informational A. Keranen 5 Expires: March 8, 2017 Ericsson 6 H. Back 7 Comptel 8 September 4, 2016 10 Practical Considerations and Implementation Experiences in Securing 11 Smart Object Networks 12 draft-ietf-lwig-crypto-sensors-00 14 Abstract 16 This memo describes challenges associated with securing smart object 17 devices in constrained implementations and environments. The memo 18 describes a possible deployment model suitable for these 19 environments, discusses the availability of cryptographic libraries 20 for small devices, presents some preliminary experiences in 21 implementing small devices using those libraries, and discusses 22 trade-offs involving different types of approaches. 24 Status of This Memo 26 This Internet-Draft is submitted in full conformance with the 27 provisions of BCP 78 and BCP 79. 29 Internet-Drafts are working documents of the Internet Engineering 30 Task Force (IETF). Note that other groups may also distribute 31 working documents as Internet-Drafts. The list of current Internet- 32 Drafts is at http://datatracker.ietf.org/drafts/current/. 34 Internet-Drafts are draft documents valid for a maximum of six months 35 and may be updated, replaced, or obsoleted by other documents at any 36 time. It is inappropriate to use Internet-Drafts as reference 37 material or to cite them other than as "work in progress." 39 This Internet-Draft will expire on March 8, 2017. 41 Copyright Notice 43 Copyright (c) 2016 IETF Trust and the persons identified as the 44 document authors. All rights reserved. 46 This document is subject to BCP 78 and the IETF Trust's Legal 47 Provisions Relating to IETF Documents 48 (http://trustee.ietf.org/license-info) in effect on the date of 49 publication of this document. Please review these documents 50 carefully, as they describe your rights and restrictions with respect 51 to this document. Code Components extracted from this document must 52 include Simplified BSD License text as described in Section 4.e of 53 the Trust Legal Provisions and are provided without warranty as 54 described in the Simplified BSD License. 56 Table of Contents 58 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 59 2. Related Work . . . . . . . . . . . . . . . . . . . . . . . . 3 60 3. Challenges . . . . . . . . . . . . . . . . . . . . . . . . . 4 61 4. Proposed Deployment Model . . . . . . . . . . . . . . . . . . 5 62 5. Provisioning . . . . . . . . . . . . . . . . . . . . . . . . 5 63 6. Protocol Architecture . . . . . . . . . . . . . . . . . . . . 8 64 7. Code Availability . . . . . . . . . . . . . . . . . . . . . . 8 65 8. Implementation Experiences . . . . . . . . . . . . . . . . . 10 66 9. Example Application . . . . . . . . . . . . . . . . . . . . . 16 67 10. Design Trade-Offs . . . . . . . . . . . . . . . . . . . . . . 20 68 11. Feasibility . . . . . . . . . . . . . . . . . . . . . . . . . 20 69 12. Freshness . . . . . . . . . . . . . . . . . . . . . . . . . . 21 70 13. Layering . . . . . . . . . . . . . . . . . . . . . . . . . . 23 71 14. Symmetric vs. Asymmetric Crypto . . . . . . . . . . . . . . . 25 72 15. Security Considerations . . . . . . . . . . . . . . . . . . . 25 73 16. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 26 74 17. Informative references . . . . . . . . . . . . . . . . . . . 26 75 Appendix A. Acknowledgments . . . . . . . . . . . . . . . . . . 31 76 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 31 78 1. Introduction 80 This memo describes challenges associated with securing smart object 81 devices in constrained implementations and environments (see 82 Section 3). 84 Secondly, Section 4 discusses a deployment model that the authors are 85 considering for constrained environments. The model requires minimal 86 amount of configuration, and we believe it is a natural fit with the 87 typical communication practices smart object networking environments. 89 Thirdly, Section 7 discusses the availability of cryptographic 90 libraries. Section 8 presents some experiences in implementing small 91 devices using those libraries, including information about achievable 92 code sizes and speeds on typical hardware. 94 Finally, Section 10 discusses trade-offs involving different types of 95 security approaches. 97 2. Related Work 99 Constrained Application Protocol (CoAP) [RFC7252] is a light-weight 100 protocol designed to be used in machine-to-machine applications such 101 as smart energy and building automation. Our discussion uses this 102 protocol as an example, but the conclusions may apply to other 103 similar protocols. CoAP base specification [RFC7252] outlines how to 104 use DTLS [RFC6347] and IKEv2 [RFC7296] for securing the protocol. 105 DTLS can be applied with group keys, pairwise shared keys, or with 106 certificates. The security model in all cases is mutual 107 authentication, so while there is some commonality to HTTP in 108 verifying the server identity, in practice the models are quite 109 different. The specification says little about how DTLS keys are 110 managed. The IPsec mode is described with regards to the protocol 111 requirements, noting that small implementations of IKEv2 exist 112 [RFC7815]. However, the specification is silent on policy and other 113 aspects that are normally necessary in order to implement 114 interoperable use of IPsec in any environment [RFC5406]. 116 [RFC6574] gives an overview of the security discussions at the March 117 2011 IAB workshop on smart objects. The workshop recommended that 118 additional work is needed in developing suitable credential 119 management mechanisms (perhaps something similar to the Bluetooth 120 pairing mechanism), understanding the implementability of standard 121 security mechanisms in small devices and additional research in the 122 area of lightweight cryptographic primitives. 124 [I-D.moskowitz-hip-dex] defines a light-weight version of the HIP 125 protocol for low-power nodes. This version uses a fixed set of 126 algorithms, Elliptic Curve Cryptography (ECC), and eliminates hash 127 functions. The protocol still operates based on host identities, and 128 runs end-to-end between hosts, protecting IP layer communications. 129 [RFC6078] describes an extension of HIP that can be used to send 130 upper layer protocol messages without running the usual HIP base 131 exchange at all. 133 [I-D.daniel-6lowpan-security-analysis] makes a comprehensive analysis 134 of security issues related to 6LoWPAN networks, but its findings also 135 apply more generally for all low-powered networks. Some of the 136 issues this document discusses include the need to minimize the 137 number of transmitted bits and simplify implementations, threats in 138 the smart object networking environments, and the suitability of 139 6LoWPAN security mechanisms, IPsec, and key management protocols for 140 implementation in these environments. 142 [I-D.garcia-core-security] discusses the overall security problem for 143 Internet of Things devices. It also discusses various solutions, 144 including IKEv2/IPsec [RFC7296], TLS/SSL [RFC5246], DTLS [RFC6347], 145 HIP [RFC7401] [I-D.moskowitz-hip-dex], PANA [RFC5191], and EAP 146 [RFC3748]. The draft also discusses various operational scenarios, 147 bootstrapping mechanisms, and challenges associated with implementing 148 security mechanisms in these environments. 150 3. Challenges 152 This section discusses three challenges: implementation difficulties, 153 practical provisioning problems, and layering and communication 154 models. 156 The most often discussed issues in the security for the Internet of 157 Things relate to implementation difficulties. The desire to build 158 small, battery-operated, and inexpensive devices drives the creation 159 of devices with a limited protocol and application suite. Some of 160 the typical limitations include running CoAP instead of HTTP, limited 161 support for security mechanisms, limited processing power for long 162 key lengths, sleep schedule that does not allow communication at all 163 times, and so on. In addition, the devices typically have very 164 limited support for configuration, making it hard to set up secrets 165 and trust anchors. 167 The implementation difficulties are important, but they should not be 168 overemphasized. It is important to select the right security 169 mechanisms and avoid duplicated or unnecessary functionality. But at 170 the end of the day, if strong cryptographic security is needed, the 171 implementations have to support that. Also, the use of the most 172 lightweight algorithms and cryptographic primitives is useful, but 173 should not be the only consideration in the design. Interoperability 174 is also important, and often other parts of the system, such as key 175 management protocols or certificate formats are heavier to implement 176 than the algorithms themselves. 178 The second challenge relates to practical provisioning problems. 179 These are perhaps the most fundamental and difficult issue, and 180 unfortunately often neglected in the design. There are several 181 problems in the provisioning and management of smart object networks: 183 o Small devices have no natural user interface for configuration 184 that would be required for the installation of shared secrets and 185 other security-related parameters. Typically, there is no 186 keyboard, no display, and there may not even be buttons to press. 187 Some devices may only have one interface, the interface to the 188 network. 190 o Manual configuration is rarely, if at all, possible, as the 191 necessary skills are missing in typical installation environments 192 (such as in family homes). 194 o There may be a large number of devices. Configuration tasks that 195 may be acceptable when performed for one device may become 196 unacceptable with dozens or hundreds of devices. 198 o Network configurations evolve over the lifetime of the devices, as 199 additional devices are introduced or addresses change. Various 200 central nodes may also receive more frequent updates than 201 individual devices such as sensors embedded in building materials. 203 Finally, layering and communication models present difficulties for 204 straightforward use of the most obvious security mechanisms. Smart 205 object networks typically pass information through multiple 206 participating nodes [I-D.arkko-core-sleepy-sensors] and end-to-end 207 security for IP or transport layers may not fit such communication 208 models very well. The primary reasons for needing middleboxes 209 relates to the need to accommodate for sleeping nodes as well to 210 enable the implementation of nodes that store or aggregate 211 information. 213 4. Proposed Deployment Model 215 [I-D.arkko-core-security-arch] recognizes the provisioning model as 216 the driver of what kind of security architecture is useful. This 217 section re-introduces this model briefly here in order to facilitate 218 the discussion of the various design alternatives later. 220 The basis of the proposed architecture are self-generated secure 221 identities, similar to Cryptographically Generated Addresses (CGAs) 222 [RFC3972] or Host Identity Tags (HITs) [RFC7401]. That is, we assume 223 the following holds: 225 I = h(P|O) 227 where I is the secure identity of the device, h is a hash function, P 228 is the public key from a key pair generated by the device, and O is 229 optional other information. 231 5. Provisioning 233 As provisioning security credentials, shared secrets, and policy 234 information is difficult, the provisioning model is based only on the 235 secure identities. A typical network installation involves physical 236 placement of a number of devices while noting the identities of these 237 devices. This list of short identifiers can then be fed to a central 238 server as a list of authorized devices. Secure communications can 239 then commence with the devices, at least as far as information from 240 from the devices to the server is concerned, which is what is needed 241 for sensor networks. 243 The above architecture is a perfect fit for sensor networks where 244 information flows from large number of devices to small number of 245 servers. But it is not sufficient alone for other types of 246 applications. For instance, in actuator applications a large number 247 of devices need to take commands from somewhere else. In such 248 applications it is necessary to secure that the commands come from an 249 authorized source. This can be supported, with some additional 250 provisioning effort and optional pairing protocols. The basic 251 provisioning approach is as described earlier, but in addition there 252 must be something that informs the devices of the identity of the 253 trusted server(s). There are multiple ways to provide this 254 information. One simple approach is to feed the identities of the 255 trusted server(s) to devices at installation time. This requires 256 either a separate user interface, local connection (such as USB), or 257 using the network interface of the device for configuration. In any 258 case, as with sensor networks the amount of configuration information 259 is minimized: just one short identity value needs to be fed in. Not 260 both an identity and a certificate. Not shared secrets that must be 261 kept confidential. An even simpler provisioning approach is that the 262 devices in the device group trust each other. Then no configuration 263 is needed at installation time. When both peers know the expected 264 cryptographic identity of the other peer off-line, secure 265 communications can commence. Alternatively, various pairing schemes 266 can be employed. Note that these schemes can benefit from the 267 already secure identifiers on the device side. For instance, the 268 server can send a pairing message to each device after their initial 269 power-on and before they have been paired with anyone, encrypted with 270 the public key of the device. As with all pairing schemes that do 271 not employ a shared secret or the secure dentity of both parties, 272 there are some remaining vulnerabilities that may or may not be 273 acceptable for the application in question. In any case, the secure 274 identities help again in ensuring that the operations are as simple 275 as possible. Only identities need to be communicated to the devices, 276 not certificates, not shared secrets or IPsec policy rules. 278 Where necessary, the information collected at installation time may 279 also include other parameters relevant to the application, such as 280 the location or purpose of the devices. This would enable the server 281 to know, for instance, that a particular device is the temperature 282 sensor for the kitchen. 284 Collecting the identity information at installation time can be 285 arranged in a number of ways. The authors have employed a simple but 286 not completely secure method where the last few digits of the 287 identity are printed on a tiny device just a few millimeters across. 288 Alternatively, the packaging for the device may include the full 289 identity (typically 32 hex digits), retrieved from the device at 290 manufacturing time. This identity can be read, for instance, by a 291 bar code reader carried by the installation personnel. (Note that 292 the identities are not secret, the security of the system is not 293 dependent on the identity information leaking to others. The real 294 owner of an identity can always prove its ownership with the private 295 key which never leaves the device.) Finally, the device may use its 296 wired network interface or proximity-based communications, such as 297 Near-Field Communications (NFC) or Radio-Frequency Identity tags 298 (RFIDs). Such interfaces allow secure communication of the device 299 identity to an information gathering device at installation time. 301 No matter what the method of information collection is, this 302 provisioning model minimizes the effort required to set up the 303 security. Each device generates its own identity in a random, secure 304 key generation process. The identities are self-securing in the 305 sense that if you know the identity of the peer you want to 306 communicate with, messages from the peer can be signed by the peer's 307 private key and it is trivial to verify that the message came from 308 the expected peer. There is no need to configure an identity and 309 certificate of that identity separately. There is no need to 310 configure a group secret or a shared secret. There is no need to 311 configure a trust anchor. In addition, the identities are typically 312 collected anyway for application purposes (such as identifying which 313 sensor is in which room). Under most circumstances there is actually 314 no additional configuration effort from provisioning security. 316 Groups of devices can be managed through single identifiers as well. 317 In these deployment cases it is also possible to configure the 318 identity of an entire group of devices, rather than registering the 319 individual devices. For instance, many installations employ a kit of 320 devices bought from the same manufacturer in one package. It is easy 321 to provide an identity for such a set of devices as follows: 323 Idev = h(Pdev|Potherdev1|Potherdev2|...|Potherdevn) 325 Igrp = h(Pdev1|Pdev2|...|Pdevm) 327 where Idev is the identity of an individual device, Pdev is the 328 public key of that device, and Potherdevi are the public keys of 329 other devices in the group. Now, we can define the secure identity 330 of the group (Igrp) as a hash of all the public keys of the devices 331 in the group (Pdevi). 333 The installation personnel can scan the identity of the group from 334 the box that the kit came in, and this identity can be stored in a 335 server that is expected to receive information from the nodes. Later 336 when the individual devices contact this server, they will be able to 337 show that they are part of the group, as they can reveal their own 338 public key and the public keys of the other devices. Devices that do 339 not belong to the kit can not claim to be in the group, because the 340 group identity would change if any new keys were added to Igrp. 342 6. Protocol Architecture 344 As noted above, the starting point of the architecture is that nodes 345 self-generate secure identities which are then communicated out-of- 346 band to the peers that need to know what devices to trust. To 347 support this model in a protocol architecture, we also need to use 348 these secure identities to implement secure messaging between the 349 peers, explain how the system can respond to different types of 350 attacks such as replay attempts, and decide at what protocol layer 351 and endpoints the architecture should use. 353 The deployment itself is suitable for a variety of design choices 354 regarding layering and protocol mechanisms. 355 [I-D.arkko-core-security-arch] was mostly focused on employing end- 356 to-end data object security as opposed to hop-by-hop security. But 357 other approaches are possible. For instance, HIP in its 358 opportunistic mode could be used to implement largely the same 359 functionality at the IP layer. However, it is our belief that the 360 right layer for this solution is at the application layer. More 361 specifically, in the data formats transported in the payload part of 362 CoAP. This approach provides the following benefits: 364 o Ability for intermediaries to act as caches to support different 365 sleep schedules, without the security model being impacted. 367 o Ability for intermediaries to be built to perform aggregation, 368 filtering, storage and other actions, again without impacting the 369 security of the data being transmitted or stored. 371 o Ability to operate in the presence of traditional middleboxes, 372 such as a protocol translators or even NATs (not that we recommend 373 their use in these environments). 375 However, as we will see later there are also some technical 376 implications, namely that link, network, and transport layer 377 solutions are more likely to be able to benefit from sessions where 378 the cost of expensive operations can be amortized over multiple data 379 transmissions. While this is not impossible in data object security 380 solutions either, it is not the typical arrangement either. 382 7. Code Availability 384 For implementing public key cryptography on resource constrained 385 environments, we chose Arduino Uno board [arduino-uno] as the test 386 platform. Arduino Uno has an ATmega328 microcontroller, an 8-bit 387 processor with a clock speed of 16 MHz, 2 kB of SRAM, and 32 kB of 388 flash memory. 390 For selecting potential asymmetric cryptographic libraries, we did an 391 extensive survey and came up with a set of possible code sources, and 392 performed an initial analysis of how well they fit the Arduino 393 environment. Note that the results are preliminary, and could easily 394 be affected in any direction by implementation bugs, configuration 395 errors, and other mistakes. Please verify the numbers before relying 396 on them for building something. No significant effort was done to 397 optimize ROM memory usage beyond what the libraries provided 398 themselves, so those numbers should be taken as upper limits. 400 Here is the set of libraries we found: 402 o AvrCryptolib [avr-cryptolib]: This library provides a variety of 403 different symmetric key algorithms such as DES/Triple DES/AES etc. 404 and RSA as an asymmetric key algorithm. We stripped down the 405 library to use only the required RSA components and used a 406 separate SHA-256 implementation from the original AvrCrypto-Lib 407 library [avr-crypto-lib]. Parts of SHA-256 and RSA algorithm 408 implementations were written in AVR-8 bit assembly language to 409 reduce the size and optimize the performance. The library also 410 takes advantage of the fact that Arduino boards allow the 411 programmer to directly address the flash memory to access constant 412 data which can save the amount of SRAM used during execution. 414 o Relic-Toolkit [relic-toolkit]: This library is written entirely in 415 C and provides a highly flexible and customizable implementation 416 of a large variety of cryptographic algorithms. This not only 417 includes RSA and ECC, but also pairing based asymmetric 418 cryptography, Boneh-Lynn-Schacham, Boneh-Boyen short signatures 419 and many more. The toolkit provides an option to build only the 420 desired components for the required platform. While building the 421 library, it is possible to select a variety mathematical 422 optimizations that can be combined to obtain the desired 423 performance (as a general thumb rule, faster implementations 424 require more SRAM and flash). It includes a multi precision 425 integer math module which can be customized to use different bit- 426 length words. 428 o TinyECC [tinyecc]: TinyECC was designed for using Elliptic Curve 429 based public key cryptography on sensor networks. It is written 430 in nesC programming language and as such is designed for specific 431 use on TinyOS. However, the library can be ported to standard C99 432 either with hacked tool-chains or manually rewriting parts of the 433 code. This allows for the library to be used on platforms that do 434 not have TinyOS running on them. The library includes a wide 435 variety of mathematical optimizations such as sliding window, 436 Barrett reduction for verification, precomputation, etc. It also 437 has one of the smallest memory footprints among the set of 438 Elliptic Curve libraries surveyed so far. However, an advantage 439 of Relic over TinyECC is that it can do curves over binary fields 440 in addition to prime fields. 442 o Wiselib [wiselib]: Wiselib is a generic library written for sensor 443 networks containing a wide variety of algorithms. While the 444 stable version contains algorithms for routing only, the test 445 version includes many more algorithms including algorithms for 446 cryptography, localization , topology management and many more. 447 The library was designed with the idea of making it easy to 448 interface the library with operating systems like iSense and 449 Contiki. However, since the library is written entirely in C++ 450 with a template based model similar to Boost/CGAL, it can be used 451 on any platform directly without using any of the operating system 452 interfaces provided. This approach was taken by the authors to 453 test the code on Arduino Uno. The structure of the code is similar 454 to TinyECC and like TinyECC it implements elliptic curves over 455 prime fields only. In order to make the code platform 456 independent, no assembly level optimizations were incorporated. 457 Since efficiency was not an important goal for the authors of the 458 library while designing, many well known theoretical performance 459 enhancement features were also not incorporated. Like the relic- 460 toolkit, Wiselib is also Lesser GPL licensed. 462 o MatrixSSL [matrix-ssl]: This library provides a low footprint 463 implementation of several cryptographic algorithms including RSA 464 and ECC (with a commercial license). However, the library in the 465 original form takes about 50 kB of ROM which is not suitable for 466 our hardware requirements. Moreover, it is intended for 32-bit 467 systems and the API includes functions for SSL communication 468 rather than just signing data with private keys. 470 This is by no ways an exhaustive list and there exist other 471 cryptographic libraries targeting resource-constrained devices. 473 8. Implementation Experiences 475 We have summarized the initial results of RSA private key performance 476 using AvrCryptolib in Table 1. All results are from a single run 477 since repeating the test did not change (or had only minimal impact 478 on) the results. The keys were generated separately and were hard 479 coded into the program. All keys were generated with the value of 480 the public exponent as 3. The performance of signing with private 481 key was faster for smaller key lengths as was expected. However the 482 increase in the execution time was considerable when the key size was 483 2048 bits. It is important to note that two different sets of 484 experiments were performed for each key length. In the first case, 485 the keys were loaded into the SRAM from the ROM (flash) before they 486 were used by any of the functions. However, in the second case, the 487 keys were addressed directly in the ROM. As was expected, the second 488 case used less SRAM but lead to longer execution time. 490 More importantly, any RSA key size less than 2,048-bit should be 491 considered legacy and insecure. The performance measurements for 492 these keys are provided here for reference only. 494 +--------+--------------+--------------+-------------+--------------+ 495 | Key | Execution | Memory | Execution | Memory | 496 | length | time (ms); | footprint | time (ms); | footprint | 497 | (bits) | key in SRAM | (bytes); key | key in ROM | (bytes); key | 498 | | | in SRAM | | in ROM | 499 +--------+--------------+--------------+-------------+--------------+ 500 | 64 | 64 | 40 | 69 | 32 | 501 | 128 | 434 | 80 | 460 | 64 | 502 | 512 | 25,076 | 320 | 27348 | 256 | 503 | 1,024 | 199688 | 640 | 218367 | 512 | 504 | 2,048 | 1587567 | 1,280 | 1740258 | 1,024 | 505 +--------+--------------+--------------+-------------+--------------+ 507 RSA private key operation performance 509 Table 1 511 The code size was less than 3.6 kB for all the test cases with scope 512 for further reduction. It is also worth noting that the 513 implementation performs basic exponentiation and multiplication 514 operations without using any mathematical optimizations such as 515 Montgomery multiplication, optimized squaring, etc. as described in 516 [rsa-high-speed]. With more SRAM, we believe that 1024/2048-bit 517 operations can be performed in much less time as has been shown in 518 [rsa-8bit]. 2048-bit RSA is nonetheless possible with about 1 kB of 519 SRAM as is seen in Table 1. 521 In Table 2 we present the results obtained by manually porting 522 TinyECC into C99 standard and running ECDSA signature algorithm on 523 the Arduino Uno board. TinyECC supports a variety of SEC 2 524 recommended Elliptic Curve domain parameters. The execution time and 525 memory footprint are shown next to each of the curve parameters. 526 SHA-1 hashing algorithm included in the library was used in each of 527 the cases. The measurements reflect the performance of elliptic 528 curve signing only and not the SHA-1 hashing algorithm. SHA-1 is now 529 known to be insecure and should not be used in real deployments. It 530 is clearly observable that for similar security levels, Elliptic 531 Curve public key cryptography outperforms RSA. These results were 532 obtained by turning on all the optimizations. These optimizations 533 include - Curve Specific Optimizations for modular reduction (NIST 534 and SEC 2 field primes were chosen as pseudo-Mersenne primes), 535 Sliding Window for faster scalar multiplication, Hybrid squaring 536 procedure written in assembly and Weighted projective Coordinate 537 system for efficient scalar point addition, doubling and 538 multiplication. We did not use optimizations like Shamir Trick and 539 Sliding Window as they are only useful for signature verification and 540 tend to slow down the signature generation by precomputing values (we 541 were only interested in fast signature generation). There is still 542 some scope for optimization as not all the assembly code provided 543 with the library could be ported to Arduino directly. Re-writing 544 these procedures in compatible assembly would further enhance the 545 performance. 547 +-------------+---------------+-----------------+-------------------+ 548 | Curve | Execution | Memory | Comparable RSA | 549 | parameters | time (ms) | Footprint | key length | 550 | | | (bytes) | | 551 +-------------+---------------+-----------------+-------------------+ 552 | 128r1 | 1858 | 776 | 704 | 553 | 128r2 | 2002 | 776 | 704 | 554 | 160k1 | 2228 | 892 | 1024 | 555 | 160r1 | 2250 | 892 | 1024 | 556 | 160r2 | 2467 | 892 | 1024 | 557 | 192k1 | 3425 | 1008 | 1536 | 558 | 192r1 | 3578 | 1008 | 1536 | 559 +-------------+---------------+-----------------+-------------------+ 561 ECDSA signature performance with TinyECC 563 Table 2 565 We also performed experiments by removing the assembly code for 566 hybrid multiplication and squaring thus using a C only form of the 567 library. This gives us an idea of the performance that can be 568 achieved with TinyECC on any platform regardless of what kind of OS 569 and assembly instruction set available. The memory footprint remains 570 the same with our without assembly code. The tables contain the 571 maximum RAM that is used when all the possible optimizations are on. 572 If however, the amount of RAM available is smaller in size, some of 573 the optimizations can be turned off to reduce the memory consumption 574 accordingly. 576 +-------------+---------------+-----------------+-------------------+ 577 | Curve | Execution | Memory | Comparable RSA | 578 | parameters | time (ms) | Footprint | key length | 579 | | | (bytes) | | 580 +-------------+---------------+-----------------+-------------------+ 581 | 128r1 | 2741 | 776 | 704 | 582 | 128r2 | 3086 | 776 | 704 | 583 | 160k1 | 3795 | 892 | 1024 | 584 | 160r1 | 3841 | 892 | 1024 | 585 | 160r2 | 4118 | 892 | 1024 | 586 | 192k1 | 6091 | 1008 | 1536 | 587 | 192r1 | 6217 | 1008 | 1536 | 588 +-------------+---------------+-----------------+-------------------+ 590 ECDSA signature performance with TinyECC (No assembly optimizations) 592 Table 3 594 Table 4 documents the performance of Wiselib. Since there were no 595 optimizations that could be turned on or off, we have only one set of 596 results. By default Wiselib only supports some of the standard SEC 2 597 Elliptic curves. But it is easy to change the domain parameters and 598 obtain results for for all the 128, 160 and 192-bit SEC 2 Elliptic 599 curves. SHA-1 algorithm provided in the library was used. The 600 measurements reflect the performance of elliptic curve signing only 601 and not the SHA-1 hashing algorithm. SHA-1 is now known to be 602 insecure and should not be used in real deployments. The ROM size 603 for all the experiments was less than 16 kB. 605 +-------------+---------------+-----------------+-------------------+ 606 | Curve | Execution | Memory | Comparable RSA | 607 | parameters | time (ms) | Footprint | key length | 608 | | | (bytes) | | 609 +-------------+---------------+-----------------+-------------------+ 610 | 128r1 | 5615 | 732 | 704 | 611 | 128r2 | 5615 | 732 | 704 | 612 | 160k1 | 10957 | 842 | 1024 | 613 | 160r1 | 10972 | 842 | 1024 | 614 | 160r2 | 10971 | 842 | 1024 | 615 | 192k1 | 18814 | 952 | 1536 | 616 | 192r1 | 18825 | 952 | 1536 | 617 +-------------+---------------+-----------------+-------------------+ 619 ECDSA signature performance with Wiselib 621 Table 4 623 For testing the relic-toolkit we used a different board because it 624 required more RAM/ROM and we were unable to perform experiments with 625 it on Arduino Uno. We decided to use the Arduino Mega which has the 626 same 8-bit architecture like the Arduino Uno but has a much larger 627 RAM/ROM for testing relic-toolkit. Again, SHA-1 hashing algorithm 628 included in the library was used in each of the cases. The 629 measurements reflect the performance of elliptic curve signing only 630 and not the SHA-1 hashing algorithm. SHA-1 is now known to be 631 insecure and should not be used in real deployments. The library 632 does provide several alternatives with such as SHA-256. 634 The relic-toolkit supports Koblitz curves over prime as well as 635 binary fields. We have experimented with Koblitz curves over binary 636 fields only. We do not run our experiments with all the curves 637 available in the library since the aim of this work is not prove 638 which curves perform the fastest, and rather show that asymmetric 639 crypto is possible on resource-constrained devices. 641 The results from relic-toolkit are documented in two separate tables 642 shown in Table 5 and Table 6. The first set of results were 643 performed with the library configured for high speed performance with 644 no consideration given to the amount of memory used. For the second 645 set, the library was configured for low memory usage irrespective of 646 the execution time required by different curves. By turning on/off 647 optimizations included in the library, a trade-off between memory and 648 execution time between these values can be achieved. 650 +-----------------+--------------+----------------+-----------------+ 651 | Curve | Execution | Memory | Comparable RSA | 652 | parameters | time (ms) | Footprint | key length | 653 | | | (bytes) | | 654 +-----------------+--------------+----------------+-----------------+ 655 | NIST K163 | 261 | 2,804 | 1024 | 656 | (assembly math) | | | | 657 | NIST K163 | 932 | 2750 | 1024 | 658 | NIST B163 | 2243 | 2444 | 1024 | 659 | NIST K233 | 1736 | 3675 | 2048 | 660 | NIST B233 | 4471 | 3261 | 2048 | 661 +-----------------+--------------+----------------+-----------------+ 663 ECDSA signature performance with relic-toolkit (Fast) 665 Table 5 667 +-----------------+--------------+----------------+-----------------+ 668 | Curve | Execution | Memory | Comparable RSA | 669 | parameters | time (ms) | Footprint | key length | 670 | | | (bytes) | | 671 +-----------------+--------------+----------------+-----------------+ 672 | NIST K163 | 592 | 2087 | 1024 | 673 | (assembly math) | | | | 674 | NIST K163 | 2950 | 2215 | 1024 | 675 | NIST B163 | 3213 | 2071 | 1024 | 676 | NIST K233 | 6450 | 2935 | 2048 | 677 | NIST B233 | 6100 | 2737 | 2048 | 678 +-----------------+--------------+----------------+-----------------+ 680 ECDSA signature performance with relic-toolkit (Low Memory) 682 Table 6 684 It is important to note the following points about the elliptic curve 685 measurements: 687 o As with the RSA measurements, curves giving less that 112-bit 688 security are insecure and considered as legacy. The measurements 689 are only provided for reference. 691 o The arduino board only provides pseudo random numbers with the 692 random() function call. In order to create private keys with a 693 better quality of random number, we can use a true random number 694 generator like the one provided by TrueRandom library 695 [truerandom], or create the keys separately on a system with a 696 true random number generator and then use them directly in the 697 code. 699 o For measuring the memory footprint of all the ECC libraries, we 700 used the Avrora simulator [avrora]. Only stack memory was used to 701 easily track the RAM consumption. 703 At the time of performing these measurements and study, it was 704 unclear which exact elliptic curve(s) would be selected by the IETF 705 community for use with resource-constrained devices. However now, 706 [RFC7748] defines two elliptic curves over prime fields (Curve25519 707 and Curve448) that offer a high level of practical security for 708 Diffie-Hellman key exchange. Correspondingly, there is ongoing work 709 to specify elliptic curve signature schemes with Edwards-curve 710 Digital Signature Algorithm (EdDSA). [I-D.irtf-cfrg-eddsa] specifies 711 the recommended parameters for the edwards25519 and edwards448 712 curves. From these, curve25519 (for elliptic curve Diffie-Hellman 713 key exchange) and edwards25519 (for elliptic curve digital 714 signatures) are especially suitable for resource-constrained devices. 716 We found that the NaCl [nacl] and MicoNaCl [micronacl] libraries 717 provide highly efficient implementations of Diffie-Hellman key 718 exchange with curve25519. The results have shown that these 719 libraries with curve25519 outperform other elliptic curves that 720 provide similar levels of security. Hutter and Schwabe [naclavr] 721 also show that signing of data using the curve Ed25519 from the NaCl 722 library needs only 23,216,241 cycles on the same microcontroller that 723 we used for our evaluations (Arduino Mega ATmega2560). This 724 corresponds to about 1,4510 milliseconds of execution time. When 725 compared to the results for other curves and libraries that offer 726 similar level of security (such as NIST B233, NIST K233), this 727 implementation far outperforms all others. As such, it is recommend 728 that the IETF community uses these curves for protocol specification 729 and implementations. 731 A summary library ROM use is shown in Table 7. 733 +-------------------------+---------------------------+ 734 | Library | ROM Footprint (Kilobytes) | 735 +-------------------------+---------------------------+ 736 | AvrCryptolib | 3.6 | 737 | Wiselib | 16 | 738 | TinyECC | 18 | 739 | Relic-toolkit | 29 | 740 | NaCl Ed25519 [naclavr] | 17-29 | 741 +-------------------------+---------------------------+ 743 Summary of library ROM needs 745 Table 7 747 All the measurements here are only provided as an example to show 748 that asymmetric-key cryptography (particularly, digital signatures) 749 is possible on resource-constrained devices. These numbers by no way 750 are the final source for measurements and some curves presented here 751 may not be acceptable for real in-the-wild deployments anymore. For 752 example, Mosdorf et al. [mosdorf] and Liu et al. [tinyecc] also 753 document performance of ECDSA on similar resource-constrained 754 devices. 756 9. Example Application 758 We developed an example application on the Arduino platform to use 759 public key crypto mechanisms, data object security, and an easy 760 provisioning model. Our application was originally developed to test 761 different approaches to supporting communications to "always off" 762 sensor nodes. These battery-operated or energy scavenging nodes do 763 not have enough power to be stay on at all times. They wake up 764 periodically and transmit their readings. 766 Such sensor nodes can be supported in various ways. 767 [I-D.arkko-core-sleepy-sensors] was an early multicast-based 768 approach. In the current application we have switched to using 769 resource directories [I-D.ietf-core-resource-directory] and mirror 770 proxies [I-D.vial-core-mirror-proxy] instead. Architecturally, the 771 idea is that sensors can delegate a part of their role to a node in 772 the network. Such a network node could be either a local resource or 773 something in the Internet. In the case of CoAP mirror proxies, the 774 network node agrees to hold the web resources on behalf of the 775 sensor, while the sensor is asleep. The only role that the sensor 776 has is to register itself at the mirror proxy, and periodically 777 update the readings. All queries from the rest of the world go to 778 the mirror proxy. 780 We constructed a system with four entities: 782 Sensor 784 This is an Arduino-based device that runs a CoAP mirror proxy 785 client and Relic-toolkit. Relic takes 29 Kbytes of ROM, and the 786 simple CoAP client roughly 3 kilobytes. 788 Mirror Proxy 790 This is a mirror proxy that holds resources on the sensor's 791 behalf. The sensor registers itself to this node. 793 Resource Directory 795 While physically in the same node in our implementation, a 796 resource directory is a logical function that allows sensors and 797 mirror proxies to register resources in the directory. These 798 resources can be queried by applications. 800 Application 802 This is a simple application that runs on a general purpose 803 computer and can retrieve both registrations from the resource 804 directory and most recent sensor readings from the mirror proxy. 806 The security of this system relies on an SSH-like approach. In Step 807 1, upon first boot, sensors generate keys and register themselves in 808 the mirror proxy. Their public key is submitted along with the 809 registration as an attribute in the CORE Link Format data [RFC6690]. 811 In Step 2, when the sensor makes a sensor reading update to the 812 mirror proxy it signs the message contents with a JOSE signature on 813 the used JSON/SENML payload [RFC7515] [I-D.jennings-core-senml]. 815 In Step 3, any other device in the network -- including the mirror 816 proxy, resource directory and the application -- can check that the 817 public key from the registration corresponds to the private key used 818 to make the signature in the data update. 820 Note that checks can be done at any time and there is no need for the 821 sensor and the checking node to be awake at the same time. In our 822 implementation, the checking is done in the application node. This 823 demonstrates how it is possible to implement end-to-end security even 824 with the presence of assisting middleboxes. 826 To verify the feasibility of our architecture we developed a proof- 827 of-concept prototype. In our prototype, the sensor was implemented 828 using the Arduino Ethernet shield over an Arduino Mega board. Our 829 implementation uses the standard C99 programming language on the 830 Arduino Mega board. In this prototype, the Mirror Proxy (MP) and the 831 Resource Directory (RD) reside on the same physical host. A 64-bit 832 x86 linux machine serves as the MP and the RD, while a similar but 833 physically different 64-bit x86 linux machine serves as the client 834 that requests data from the sensor. We chose the Relic library 835 version 0.3.1 for our sample prototype as it can be easily compiled 836 for different bit-length processors. Therefore, we were able to use 837 it on the 8-bit processor of the Arduino Mega, as well as on the 838 64-bit processor of the x86 client. We used ECDSA to sign and verify 839 data updates with the standard NIST-K163 curve parameters (163-bit 840 Koblitz curve over binary field). While compiling Relic for our 841 prototype, we used the fast configuration without any assembly 842 optimizations. 844 The gateway implements the CoAP base specification in the Java 845 programming language and extends it to add support for Mirror Proxy 846 and Resource Directory REST interfaces. We also developed a 847 minimalistic CoAP C-library for the Arduino sensor and for the client 848 requesting data updates for a resource. The library has small SRAM 849 requirements and uses stack-based allocation only. It is inter- 850 operable with the Java implementation of CoAP running on the gateway. 851 The location of the mirror proxy was pre-configured into the smart 852 object sensor by hardcoding the IP address. We used an IPv4 network 853 with public IP addresses obtained from a DHCP server. 855 Some important statistics of this prototype are listed in table 856 Table 8. Our straw man analysis of the performance of this prototype 857 is preliminary. Our intention was to demonstrate the feasibility of 858 the entire architecture with public-key cryptography on an 8-bit 859 microcontroller. The stated values can be improved further by a 860 considerable amount. For example, the flash memory and SRAM 861 consumption is relatively high because some of the Arduino libraries 862 were used out-of-the- box and there are several functions which can 863 be removed. Similarly we used the fast version of the Relic library 864 in the prototype instead of the low memory version. 866 +-----------------------------------------------------------+-------+ 867 | Flash memory consumption (for the entire prototype | 51 kB | 868 | including Relic crypto + CoAP + Arduino UDP, Ethernet and | | 869 | DHCP Libraries) | | 870 | | | 871 | SRAM consumption (for the entire prototype including DHCP | 4678 | 872 | client + key generation + signing the hash of message + | bytes | 873 | COAP + UDP + Ethernet) | | 874 | | | 875 | Execution time for creating the key pair + sending | 2030 | 876 | registration message + time spent waiting for acknowl- | ms | 877 | edgement | | 878 | | | 879 | Execution time for signing the hash of message + sending | 987 | 880 | update | ms | 881 | | | 882 | Signature overhead | 42 | 883 | | bytes | 884 +-----------------------------------------------------------+-------+ 886 Prototype Performance 888 Table 8 890 To demonstrate the efficacy of this communication model we compare it 891 with a scenario where the smart objects do not transition into the 892 energy saving sleep mode and directly serve temperature data to 893 clients. As an example, we assume that in our architecture, the 894 smart objects wake up once every minute to report the signed 895 temperature data to the caching MP. If we calculate the energy 896 consumption using the formula W = U * I * t (where U is the operating 897 voltage, I is the current drawn and t is the execution time), and use 898 the voltage and current values from the datasheets of the ATmega2560 899 (20mA-active mode and 5.4mA-sleep mode) and W5100 (183mA) chips used 900 in the architecture, then in a one minute period, the Arduino board 901 would consume 60.9 Joules of energy if it directly serves data and 902 does not sleep. On the other hand, in our architecture it would only 903 consume 2.6 Joules if it wakes up once a minute to update the MP with 904 signed data. Therefore, a typical Li-ion battery that provides about 905 1800 milliamps per hour (mAh) at 5V would have a lifetime of 9 hours 906 in the unsecured always-on scenario, whereas it would have a lifetime 907 of about 8.5 days in the secured sleepy architecture presented. 908 These lifetimes appear to be low because the Arduino board in the 909 prototype uses Ethernet which is not energy efficient. The values 910 presented only provide an estimate (ignoring the energy required to 911 transition in and out of the sleep mode) and would vary depending on 912 the hardware and MAC protocol used. Nonetheless, it is evident that 913 our architecture can increase the life of smart objects by allowing 914 them to sleep and can ensure security at the same time. 916 10. Design Trade-Offs 918 This section attempts to make some early conclusions regarding trade- 919 offs in the design space, based on deployment considerations for 920 various mechanisms and the relative ease or difficulty of 921 implementing them. This analysis looks at layering and the choice of 922 symmetric vs. asymmetric cryptography. 924 11. Feasibility 926 The first question is whether using cryptographic security and 927 asymmetric cryptography in particular is feasible at all on small 928 devices. The numbers above give a mixed message. Clearly, an 929 implementation of a significant cryptographic operation such as 930 public key signing can be done in surprisingly small amount of code 931 space. It could even be argued that our chosen prototype platform 932 was unnecessarily restrictive in the amount of code space it allows: 933 we chose this platform on purpose to demonstrate something that is as 934 small and difficult as possible. 936 In reality, ROM memory size is probably easier to grow than other 937 parameters in microcontrollers. A recent trend in microcontrollers 938 is the introduction of 32-bit CPUs that are becoming cheaper and more 939 easily available than 8-bit CPUs, in addition to being more easily 940 programmable. In short, the authors do not expect the code size to 941 be a significant limiting factor, both because of the small amount of 942 code that is needed and because available memory space is growing 943 rapidly. 945 The situation is less clear with regards to the amount of CPU power 946 needed to run the algorithms. The demonstrated speeds are sufficient 947 for many applications. For instance, a sensor that wakes up every 948 now and then can likely spend a fraction of a second for the 949 computation of a signature for the message that it is about to send. 950 Or even spend multiple seconds in some cases. Most applications that 951 use protocols such as DTLS that use public key cryptography only at 952 the beginning of the session would also be fine with any of these 953 execution times. 955 Yet, with reasonably long key sizes the execution times are in the 956 seconds, dozens of seconds, or even longer. For some applications 957 this is too long. Nevertheless, the authors believe that these 958 algorithms can successfully be employed in small devices for the 959 following reasons: 961 o With the right selection of algorithms and libraries, the 962 execution times can actually be smaller. Using the Relic-toolkit 963 with the NIST K163 algorithm (roughly equivalent to RSA at 1024 964 bits) at 0.3 seconds is a good example of this. 966 o As discussed in [wiman], in general the power requirements 967 necessary to send or receive messages are far bigger than those 968 needed to execute cryptographic operations. There is no good 969 reason to choose platforms that do not provide sufficient 970 computing power to run the necessary operations. 972 o Commercial libraries and the use of full potential for various 973 optimizations will provide a better result than what we arrived at 974 in this paper. 976 o Using public key cryptography only at the beginning of a session 977 will reduce the per-packet processing times significantly. 979 12. Freshness 981 In our architecture, if implemented as described thus far, messages 982 along with their signatures sent from the sensors to the mirror proxy 983 can be recorded and replayed by an eavesdropper. The mirror proxy 984 has no mechanism to distinguish previously received packets from 985 those that are retransmitted by the sender or replayed by an 986 eavesdropper. Therefore, it is essential for the smart objects to 987 ensure that data updates include a freshness indicator. However, 988 ensuring freshness on constrained devices can be non-trivial because 989 of several reasons which include: 991 o Communication is mostly unidirectional to save energy. 993 o Internal clocks might not be accurate and may be reset several 994 times during the operational phase of the smart object. 996 o Network time synchronization protocols such as Network Time 997 Protocol (NTP) [RFC5905] are resource intensive and therefore may 998 be undesirable in many smart object networks. 1000 There are several different methods that can be used in our 1001 architecture for replay protection. The selection of the appropriate 1002 choice depends on the actual deployment scenario. 1004 Including sequence numbers in signed messages can provide an 1005 effective method of replay protection. The mirror proxy should 1006 verify the sequence number of each incoming message and accept it 1007 only if it is greater than the highest previously seen sequence 1008 number. The mirror proxy drops any packet with a sequence number 1009 that has already been received or if the received sequence number is 1010 greater than the highest previously seen sequence number by an amount 1011 larger than the preset threshold. 1013 Sequence numbers can wrap-around at their maximum value and, 1014 therefore, it is essential to ensure that sequence numbers are 1015 sufficiently long. However, including long sequence numbers in 1016 packets can increase the network traffic originating from the sensor 1017 and can thus decrease its energy efficiency. To overcome the problem 1018 of long sequence numbers, we can use a scheme similar to that of 1019 Huang [huang], where the sender and receiver maintain and sign long 1020 sequence numbers of equal bit-lengths but they transmit only the 1021 least significant bits. 1023 It is important for the smart object to write the sequence number 1024 into the permanent flash memory after each increment and before it is 1025 included in the message to be transmitted. This ensures that the 1026 sensor can obtain the last sequence number it had intended to send in 1027 case of a reset or a power failure. However, the sensor and the 1028 mirror proxy can still end up in a discordant state where the 1029 sequence number received by the mirror proxy exceeds the expected 1030 sequence number by an amount greater than the preset threshold. This 1031 may happen because of a prolonged network outage or if the mirror 1032 proxy experiences a power failure for some reason. Therefore it is 1033 essential for sensors that normally send Non-Confirmable data updates 1034 to send some Confirmable updates and re-synchronize with the mirror 1035 proxy if a reset message is received. The sensors re-synchronize by 1036 sending a new registration message with the current sequence number. 1038 Although sequence numbers protect the system from replay attacks, a 1039 mirror proxy has no mechanism to determine the time at which updates 1040 were created by the sensor. Moreover, if sequence numbers are the 1041 only freshness indicator used, a malicious eavesdropper can induce 1042 inordinate delays to the communication of signed updates by buffering 1043 messages. It may be important in certain smart object networks for 1044 sensors to send data updates which include timestamps to allow the 1045 mirror proxy to determine the time when the update was created. For 1046 example, when the mirror proxy is collecting temperature data, it may 1047 be necessary to know when exactly the temperature measurement was 1048 made by the sensor. A simple solution to this problem is for the 1049 mirror proxy to assume that the data object was created when it 1050 receives the update. In a relatively reliable network with low RTT, 1051 it can be acceptable to make such an assumption. However most 1052 networks are susceptible to packet loss and hostile attacks making 1053 this assumption unsustainable. 1055 Depending on the hardware used by the smart objects, they may have 1056 access to accurate hardware clocks which can be used to include 1057 timestamps in the signed updates. These timestamps are included in 1058 addition to sequence numbers. The clock time in the smart objects 1059 can be set by the manufacturer or the current time can be 1060 communicated by the mirror proxy during the registration phase. 1061 However, these approaches require the smart objects to either rely on 1062 the long-term accuracy of the clock set by the manufacturer or to 1063 trust the mirror proxy thereby increasing the potential vulnerability 1064 of the system. The smart objects could also obtain the current time 1065 from NTP, but this may consume additional energy and give rise to 1066 security issues discussed in [RFC5905]. The smart objects could also 1067 have access to a GSM network or the Global Positioning System (GPS), 1068 and they can be used obtain the current time. Finally, if the 1069 sensors need to co-ordinate their sleep cycles, or if the mirror 1070 proxy computes an average or mean of updates collected from multiple 1071 smart objects, it is important for the network nodes to synchronize 1072 the time among them. This can be done by using existing 1073 synchronization schemes. 1075 13. Layering 1077 It would be useful to select just one layer where security is 1078 provided at. Otherwise a simple device needs to implement multiple 1079 security mechanisms. While some code can probably be shared across 1080 such implementations (like algorithms), it is likely that most of the 1081 code involving the actual protocol machinery cannot. Looking at the 1082 different layers, here are the choices and their implications: 1084 link layer 1086 This is probably the most common solution today. The biggest 1087 benefits of this choice of layer are that security services are 1088 commonly available (WLAN secrets, cellular SIM cards, etc.) and 1089 that their application protects the entire communications. 1091 The main drawback is that there is no security beyond the first 1092 hop. This can be problematic, e.g., in many devices that 1093 communicate to a server in the Internet. A Withings scale 1094 [Withings], for instance, can support WLAN security but without 1095 some level of end-to-end security, it would be difficult to 1096 prevent fraudulent data submissions to the servers. 1098 Another drawback is that some commonly implemented link layer 1099 security designs use group secrets. This allows any device within 1100 the local network (e.g., an infected laptop) to attack the 1101 communications. 1103 network layer 1105 There are a number of solutions in this space, and many new ones 1106 and variations thereof being proposed: IPsec, PANA, and so on. In 1107 general, these solutions have similar characteristics to those in 1108 the transport layer: they work across forwarding hops but only as 1109 far as to the next middlebox or application entity. There is 1110 plenty of existing solutions and designs. 1112 Experience has shown that it is difficult to control IP layer 1113 entities from an application process. While this is theoretically 1114 easy, in practice the necessary APIs do not exist. For instance, 1115 most IPsec software has been built for the VPN use case, and is 1116 difficult or impossible to tweak to be used on a per-application 1117 basis. As a result, the authors are not particularly enthusiastic 1118 about recommending these solutions. 1120 transport and application layer 1122 This is another popular solution along with link layer designs. 1123 TLS with HTTP (HTTPS) and DTLS with CoAP are examples of solutions 1124 in this space, and have been proven to work well. These solutions 1125 are typically easy to take into use in an application, without 1126 assuming anything from the underlying OS, and they are easy to 1127 control as needed by the applications. The main drawback is that 1128 generally speaking, these solutions only run as far as the next 1129 application level entity. And even for this case, HTTPS can be 1130 made to work through proxies, so this limit is not unsolvable. 1131 Another drawback is that attacks on link layer, network layer and 1132 in some cases, transport layer, can not be protected against. 1133 However, if the upper layers have been protected, such attacks can 1134 at most result in a denial-of-service. Since denial-of-service 1135 can often be caused anyway, it is not clear if this is a real 1136 drawback. 1138 data object layer 1140 This solution does not protect any of the protocol layers, but 1141 protects individual data elements being sent. It works 1142 particularly well when there are multiple application layer 1143 entities on the path of the data. The authors believe smart 1144 object networks are likely to employ such entities for storage, 1145 filtering, aggregation and other reasons, and as such, an end-to- 1146 end solution is the only one that can protect the actual data. 1148 The downside is that the lower layers are not protected. But 1149 again, as long as the data is protected and checked upon every 1150 time it passes through an application level entity, it is not 1151 clear that there are attacks beyond denial-of-service. 1153 The main question mark is whether this type of a solution provides 1154 sufficient advantages over the more commonly implemented transport 1155 and application layer solutions. 1157 14. Symmetric vs. Asymmetric Crypto 1159 The second trade-off that is worth discussing is the use of plain 1160 asymmetric cryptographic mechanisms, plain symmetric cryptographic 1161 mechanisms, or some mixture thereof. 1163 Contrary to popular cryptographic community beliefs, a symmetric 1164 crypto solution can be deployed in large scale. In fact, one of the 1165 largest deployment of cryptographic security, the cellular network 1166 authentication system, uses SIM cards that are based on symmetric 1167 secrets. In contrast, public key systems have yet to show ability to 1168 scale to hundreds of millions of devices, let alone billions. But 1169 the authors do not believe scaling is an important differentiator 1170 when comparing the solutions. 1172 As can be seen from the Section 8, the time needed to calculate some 1173 of the asymmetric crypto operations with reasonable key lengths can 1174 be significant. There are two contrary observations that can be made 1175 from this. First, recent wisdom indicates that computing power on 1176 small devices is far cheaper than transmission power [wiman], and 1177 keeps on becoming more efficient very quickly. From this we can 1178 conclude that the sufficient CPU is or at least will be easily 1179 available. 1181 But the other observation is that when there are very costly 1182 asymmetric operations, doing a key exchange followed by the use of 1183 generated symmetric keys would make sense. This model works very 1184 well for DTLS and other transport layer solutions, but works less 1185 well for data object security, particularly when the number of 1186 communicating entities is not exactly two. 1188 15. Security Considerations 1190 This entire memo deals with security issues. 1192 16. IANA Considerations 1194 There are no IANA impacts in this memo. 1196 17. Informative references 1198 [arduino-uno] 1199 Arduino, "Arduino Uno", September 2015, 1200 . 1202 [avr-crypto-lib] 1203 AVR-CRYPTO-LIB, "AVR-CRYPTO-LIB", September 2015, 1204 . 1206 [avr-cryptolib] 1207 Van der Laan, E., "AVR CRYPTOLIB", September 2015, 1208 . 1210 [avrora] Titzer, Ben., "Avrora", September 2015, 1211 . 1213 [huang] Huang, C., "Low-overhead freshness transmission in sensor 1214 networks", 2008. 1216 [I-D.arkko-core-security-arch] 1217 Arkko, J. and A. Keranen, "CoAP Security Architecture", 1218 draft-arkko-core-security-arch-00 (work in progress), July 1219 2011. 1221 [I-D.arkko-core-sleepy-sensors] 1222 Arkko, J., Rissanen, H., Loreto, S., Turanyi, Z., and O. 1223 Novo, "Implementing Tiny COAP Sensors", draft-arkko-core- 1224 sleepy-sensors-01 (work in progress), July 2011. 1226 [I-D.daniel-6lowpan-security-analysis] 1227 Park, S., Kim, K., Haddad, W., Chakrabarti, S., and J. 1228 Laganier, "IPv6 over Low Power WPAN Security Analysis", 1229 draft-daniel-6lowpan-security-analysis-05 (work in 1230 progress), March 2011. 1232 [I-D.garcia-core-security] 1233 Garcia-Morchon, O., Kumar, S., Keoh, S., Hummen, R., and 1234 R. Struik, "Security Considerations in the IP-based 1235 Internet of Things", draft-garcia-core-security-06 (work 1236 in progress), September 2013. 1238 [I-D.ietf-core-resource-directory] 1239 Shelby, Z., Koster, M., Bormann, C., and P. Stok, "CoRE 1240 Resource Directory", draft-ietf-core-resource-directory-08 1241 (work in progress), July 2016. 1243 [I-D.irtf-cfrg-eddsa] 1244 Josefsson, S. and I. Liusvaara, "Edwards-curve Digital 1245 Signature Algorithm (EdDSA)", draft-irtf-cfrg-eddsa-08 1246 (work in progress), August 2016. 1248 [I-D.jennings-core-senml] 1249 Jennings, C., Shelby, Z., Arkko, J., and A. Keranen, 1250 "Media Types for Sensor Markup Language (SenML)", draft- 1251 jennings-core-senml-06 (work in progress), April 2016. 1253 [I-D.moskowitz-hip-dex] 1254 Moskowitz, R. and R. Hummen, "HIP Diet EXchange (DEX)", 1255 draft-moskowitz-hip-dex-05 (work in progress), January 1256 2016. 1258 [I-D.vial-core-mirror-proxy] 1259 Vial, M., "CoRE Mirror Server", draft-vial-core-mirror- 1260 proxy-01 (work in progress), July 2012. 1262 [matrix-ssl] 1263 PeerSec Networks, "Matrix SSL", September 2015, 1264 . 1266 [micronacl] 1267 MicroNaCl, "The Networking and Cryptography library for 1268 microcontrollers", . 1270 [mosdorf] Mosdorf, M. and W. Zabolotny, "Implementation of elliptic 1271 curve cryptography for 8 bit and 32 bit embedded systems 1272 time efficiency and power consumption analysis", 2010. 1274 [nacl] NaCl, "Networking and Cryptography library", 1275 . 1277 [naclavr] Hutter, M. and P. Schwabe, "NaCl on 8-Bit AVR 1278 Microcontrollers", International Conference on Cryptology 1279 in Africa , Springer Berlin Heidelberg , 2013. 1281 [relic-toolkit] 1282 Aranha, D. and C. Gouv, "Relic Toolkit", September 2015, 1283 . 1285 [RFC3748] Aboba, B., Blunk, L., Vollbrecht, J., Carlson, J., and H. 1286 Levkowetz, Ed., "Extensible Authentication Protocol 1287 (EAP)", RFC 3748, DOI 10.17487/RFC3748, June 2004, 1288 . 1290 [RFC3972] Aura, T., "Cryptographically Generated Addresses (CGA)", 1291 RFC 3972, DOI 10.17487/RFC3972, March 2005, 1292 . 1294 [RFC5191] Forsberg, D., Ohba, Y., Ed., Patil, B., Tschofenig, H., 1295 and A. Yegin, "Protocol for Carrying Authentication for 1296 Network Access (PANA)", RFC 5191, DOI 10.17487/RFC5191, 1297 May 2008, . 1299 [RFC5246] Dierks, T. and E. Rescorla, "The Transport Layer Security 1300 (TLS) Protocol Version 1.2", RFC 5246, 1301 DOI 10.17487/RFC5246, August 2008, 1302 . 1304 [RFC5406] Bellovin, S., "Guidelines for Specifying the Use of IPsec 1305 Version 2", BCP 146, RFC 5406, DOI 10.17487/RFC5406, 1306 February 2009, . 1308 [RFC5905] Mills, D., Martin, J., Ed., Burbank, J., and W. Kasch, 1309 "Network Time Protocol Version 4: Protocol and Algorithms 1310 Specification", RFC 5905, DOI 10.17487/RFC5905, June 2010, 1311 . 1313 [RFC6078] Camarillo, G. and J. Melen, "Host Identity Protocol (HIP) 1314 Immediate Carriage and Conveyance of Upper-Layer Protocol 1315 Signaling (HICCUPS)", RFC 6078, DOI 10.17487/RFC6078, 1316 January 2011, . 1318 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 1319 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 1320 January 2012, . 1322 [RFC6574] Tschofenig, H. and J. Arkko, "Report from the Smart Object 1323 Workshop", RFC 6574, DOI 10.17487/RFC6574, April 2012, 1324 . 1326 [RFC6690] Shelby, Z., "Constrained RESTful Environments (CoRE) Link 1327 Format", RFC 6690, DOI 10.17487/RFC6690, August 2012, 1328 . 1330 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 1331 Application Protocol (CoAP)", RFC 7252, 1332 DOI 10.17487/RFC7252, June 2014, 1333 . 1335 [RFC7296] Kaufman, C., Hoffman, P., Nir, Y., Eronen, P., and T. 1336 Kivinen, "Internet Key Exchange Protocol Version 2 1337 (IKEv2)", STD 79, RFC 7296, DOI 10.17487/RFC7296, October 1338 2014, . 1340 [RFC7401] Moskowitz, R., Ed., Heer, T., Jokela, P., and T. 1341 Henderson, "Host Identity Protocol Version 2 (HIPv2)", 1342 RFC 7401, DOI 10.17487/RFC7401, April 2015, 1343 . 1345 [RFC7515] Jones, M., Bradley, J., and N. Sakimura, "JSON Web 1346 Signature (JWS)", RFC 7515, DOI 10.17487/RFC7515, May 1347 2015, . 1349 [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves 1350 for Security", RFC 7748, DOI 10.17487/RFC7748, January 1351 2016, . 1353 [RFC7815] Kivinen, T., "Minimal Internet Key Exchange Version 2 1354 (IKEv2) Initiator Implementation", RFC 7815, 1355 DOI 10.17487/RFC7815, March 2016, 1356 . 1358 [rsa-8bit] 1359 Gura, N., Patel, A., Wander, A., Eberle, H., and S. 1360 Shantz, "Comparing Elliptic Curve Cryptography and RSA on 1361 8-bit CPUs", 2010. 1363 [rsa-high-speed] 1364 Koc, C., "High-Speed RSA Implementation", November 1994, 1365 . 1367 [tinyecc] North Carolina State University and North Carolina State 1368 University, "TinyECC", 2008, 1369 . 1371 [truerandom] 1372 Drow, C., "Truerandom", September 2015, 1373 . 1375 [wiman] Margi, C., Oliveira, B., Sousa, G., Simplicio, M., Paulo, 1376 S., Carvalho, T., Naslund, M., and R. Gold, "Impact of 1377 Operating Systems on Wireless Sensor Networks (Security) 1378 Applications and Testbeds. In International Conference on 1379 Computer Communication Networks (ICCCN'2010) / IEEE 1380 International Workshop on Wireless Mesh and Ad Hoc 1381 Networks (WiMAN 2010), 2010, Zurich. Proceedings of 1382 ICCCN'2010/WiMAN'2010", 2010. 1384 [wiselib] Baumgartner, T., Chatzigiannakis, I., Fekete, S., Koninis, 1385 C., Kroller, A., and A. Pyrgelis, "Wiselib", 2010, 1386 . 1388 [Withings] 1389 Withings, "The Withings scale", February 2012, 1390 . 1392 Appendix A. Acknowledgments 1394 The authors would like to thank Mats Naslund, Salvatore Loreto, Bob 1395 Moskowitz, Oscar Novo, Vlasios Tsiatsis, Daoyuan Li, Muhammad Waqas, 1396 Eric Rescorla and Tero Kivinen for interesting discussions in this 1397 problem space. The authors would also like to thank Diego Aranha for 1398 helping with the relic-toolkit configurations and Tobias Baumgartner 1399 for helping with questions regarding wiselib. 1401 Authors' Addresses 1403 Mohit Sethi 1404 Ericsson 1405 Jorvas 02420 1406 Finland 1408 EMail: mohit@piuha.net 1410 Jari Arkko 1411 Ericsson 1412 Jorvas 02420 1413 Finland 1415 EMail: jari.arkko@piuha.net 1417 Ari Keranen 1418 Ericsson 1419 Jorvas 02420 1420 Finland 1422 EMail: ari.keranen@ericsson.com 1424 Heidi-Maria Back 1425 Comptel 1426 Helsinki 00181 1427 Finland 1429 EMail: heidi.back@comptel.com