idnits 2.17.1 draft-ietf-core-oscore-groupcomm-12.txt: -(3424): Line appears to be too long, but this could be caused by non-ascii characters in UTF-8 encoding 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: ---------------------------------------------------------------------------- == There are 4 instances of lines with non-ascii characters in the document. 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 (12 July 2021) is 991 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 (-10) exists of draft-ietf-core-groupcomm-bis-04 == Outdated reference: A later version (-10) exists of draft-ietf-cose-countersign-05 -- Possible downref: Normative reference to a draft: ref. 'I-D.ietf-cose-countersign' ** Downref: Normative reference to an Informational draft: draft-ietf-cose-rfc8152bis-algs (ref. 'I-D.ietf-cose-rfc8152bis-algs') -- Possible downref: Normative reference to a draft: ref. 'I-D.ietf-cose-rfc8152bis-struct' -- Possible downref: Non-RFC (?) normative reference: ref. 'NIST-800-56A' ** Downref: Normative reference to an Informational RFC: RFC 7748 ** Downref: Normative reference to an Informational RFC: RFC 8032 == Outdated reference: A later version (-08) exists of draft-amsuess-core-cachable-oscore-01 == Outdated reference: A later version (-18) exists of draft-ietf-ace-key-groupcomm-13 == Outdated reference: A later version (-16) exists of draft-ietf-ace-key-groupcomm-oscore-11 == Outdated reference: A later version (-46) exists of draft-ietf-ace-oauth-authz-43 == Outdated reference: A later version (-14) exists of draft-ietf-core-echo-request-tag-12 == Outdated reference: A later version (-08) exists of draft-ietf-core-observe-multicast-notifications-01 == Outdated reference: A later version (-09) exists of draft-ietf-cose-cbor-encoded-cert-01 == Outdated reference: A later version (-23) exists of draft-ietf-lwig-curve-representations-21 == Outdated reference: A later version (-07) exists of draft-ietf-lwig-security-protocol-comparison-05 == Outdated reference: A later version (-09) exists of draft-ietf-rats-uccs-00 == Outdated reference: A later version (-04) exists of draft-mattsson-cfrg-det-sigs-with-noise-02 -- Obsolete informational reference (is this intentional?): RFC 6347 (Obsoleted by RFC 9147) Summary: 3 errors (**), 0 flaws (~~), 15 warnings (==), 5 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 CoRE Working Group M. Tiloca 3 Internet-Draft RISE AB 4 Intended status: Standards Track G. Selander 5 Expires: 13 January 2022 F. Palombini 6 J. Mattsson 7 Ericsson AB 8 J. Park 9 Universitaet Duisburg-Essen 10 12 July 2021 12 Group OSCORE - Secure Group Communication for CoAP 13 draft-ietf-core-oscore-groupcomm-12 15 Abstract 17 This document defines Group Object Security for Constrained RESTful 18 Environments (Group OSCORE), providing end-to-end security of CoAP 19 messages exchanged between members of a group, e.g., sent over IP 20 multicast. In particular, the described approach defines how OSCORE 21 is used in a group communication setting to provide source 22 authentication for CoAP group requests, sent by a client to multiple 23 servers, and for protection of the corresponding CoAP responses. 24 Group OSCORE also defines a pairwise mode where each member of the 25 group can efficiently derive a symmetric pairwise key with any other 26 member of the group for pairwise OSCORE communication. 28 Status of This Memo 30 This Internet-Draft is submitted in full conformance with the 31 provisions of BCP 78 and BCP 79. 33 Internet-Drafts are working documents of the Internet Engineering 34 Task Force (IETF). Note that other groups may also distribute 35 working documents as Internet-Drafts. The list of current Internet- 36 Drafts is at https://datatracker.ietf.org/drafts/current/. 38 Internet-Drafts are draft documents valid for a maximum of six months 39 and may be updated, replaced, or obsoleted by other documents at any 40 time. It is inappropriate to use Internet-Drafts as reference 41 material or to cite them other than as "work in progress." 43 This Internet-Draft will expire on 13 January 2022. 45 Copyright Notice 47 Copyright (c) 2021 IETF Trust and the persons identified as the 48 document authors. All rights reserved. 50 This document is subject to BCP 78 and the IETF Trust's Legal 51 Provisions Relating to IETF Documents (https://trustee.ietf.org/ 52 license-info) in effect on the date of publication of this document. 53 Please review these documents carefully, as they describe your rights 54 and restrictions with respect to this document. Code Components 55 extracted from this document must include Simplified BSD License text 56 as described in Section 4.e of the Trust Legal Provisions and are 57 provided without warranty as described in the Simplified BSD License. 59 Table of Contents 61 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 62 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 6 63 2. Security Context . . . . . . . . . . . . . . . . . . . . . . 8 64 2.1. Common Context . . . . . . . . . . . . . . . . . . . . . 10 65 2.1.1. AEAD Algorithm . . . . . . . . . . . . . . . . . . . 10 66 2.1.2. ID Context . . . . . . . . . . . . . . . . . . . . . 10 67 2.1.3. Group Manager Public Key . . . . . . . . . . . . . . 10 68 2.1.4. Signature Encryption Algorithm . . . . . . . . . . . 10 69 2.1.5. Signature Algorithm . . . . . . . . . . . . . . . . . 11 70 2.1.6. Group Encryption Key . . . . . . . . . . . . . . . . 11 71 2.1.7. Pairwise Key Agreement Algorithm . . . . . . . . . . 11 72 2.2. Sender Context and Recipient Context . . . . . . . . . . 12 73 2.3. Format of Public Keys . . . . . . . . . . . . . . . . . . 13 74 2.4. Pairwise Keys . . . . . . . . . . . . . . . . . . . . . . 14 75 2.4.1. Derivation of Pairwise Keys . . . . . . . . . . . . . 14 76 2.4.2. ECDH with Montgomery Coordinates . . . . . . . . . . 16 77 2.4.3. Usage of Sequence Numbers . . . . . . . . . . . . . . 17 78 2.4.4. Security Context for Pairwise Mode . . . . . . . . . 17 79 2.5. Update of Security Context . . . . . . . . . . . . . . . 18 80 2.5.1. Loss of Mutable Security Context . . . . . . . . . . 18 81 2.5.2. Exhaustion of Sender Sequence Number . . . . . . . . 19 82 2.5.3. Retrieving New Security Context Parameters . . . . . 20 83 3. The Group Manager . . . . . . . . . . . . . . . . . . . . . . 22 84 3.1. Support for Additional Principals . . . . . . . . . . . . 24 85 3.2. Management of Group Keying Material . . . . . . . . . . . 24 86 3.2.1. Recycling of Identifiers . . . . . . . . . . . . . . 27 87 3.3. Responsibilities of the Group Manager . . . . . . . . . . 28 88 4. The COSE Object . . . . . . . . . . . . . . . . . . . . . . . 30 89 4.1. Countersignature . . . . . . . . . . . . . . . . . . . . 30 90 4.1.1. Keystream Derivation . . . . . . . . . . . . . . . . 30 91 4.1.2. Clarifications on Using a Countersignature . . . . . 32 92 4.2. The 'kid' and 'kid context' parameters . . . . . . . . . 32 93 4.3. external_aad . . . . . . . . . . . . . . . . . . . . . . 32 94 5. OSCORE Header Compression . . . . . . . . . . . . . . . . . . 35 95 5.1. Examples of Compressed COSE Objects . . . . . . . . . . . 36 96 5.1.1. Examples in Group Mode . . . . . . . . . . . . . . . 36 97 5.1.2. Examples in Pairwise Mode . . . . . . . . . . . . . . 37 99 6. Message Binding, Sequence Numbers, Freshness and Replay 100 Protection . . . . . . . . . . . . . . . . . . . . . . . 38 101 6.1. Supporting Observe . . . . . . . . . . . . . . . . . . . 38 102 6.2. Update of Replay Window . . . . . . . . . . . . . . . . . 38 103 6.3. Message Freshness . . . . . . . . . . . . . . . . . . . . 39 104 7. Message Reception . . . . . . . . . . . . . . . . . . . . . . 39 105 8. Message Processing in Group Mode . . . . . . . . . . . . . . 40 106 8.1. Protecting the Request . . . . . . . . . . . . . . . . . 41 107 8.1.1. Supporting Observe . . . . . . . . . . . . . . . . . 42 108 8.2. Verifying the Request . . . . . . . . . . . . . . . . . . 43 109 8.2.1. Supporting Observe . . . . . . . . . . . . . . . . . 44 110 8.3. Protecting the Response . . . . . . . . . . . . . . . . . 45 111 8.3.1. Supporting Observe . . . . . . . . . . . . . . . . . 46 112 8.4. Verifying the Response . . . . . . . . . . . . . . . . . 46 113 8.4.1. Supporting Observe . . . . . . . . . . . . . . . . . 48 114 8.5. External Signature Checkers . . . . . . . . . . . . . . . 50 115 9. Message Processing in Pairwise Mode . . . . . . . . . . . . . 51 116 9.1. Pre-Conditions . . . . . . . . . . . . . . . . . . . . . 52 117 9.2. Main Differences from OSCORE . . . . . . . . . . . . . . 52 118 9.3. Protecting the Request . . . . . . . . . . . . . . . . . 52 119 9.4. Verifying the Request . . . . . . . . . . . . . . . . . . 53 120 9.5. Protecting the Response . . . . . . . . . . . . . . . . . 53 121 9.6. Verifying the Response . . . . . . . . . . . . . . . . . 54 122 10. Security Considerations . . . . . . . . . . . . . . . . . . . 55 123 10.1. Security of the Group Mode . . . . . . . . . . . . . . . 56 124 10.2. Security of the Pairwise Mode . . . . . . . . . . . . . 57 125 10.3. Uniqueness of (key, nonce) . . . . . . . . . . . . . . . 58 126 10.4. Management of Group Keying Material . . . . . . . . . . 58 127 10.5. Update of Security Context and Key Rotation . . . . . . 59 128 10.5.1. Late Update on the Sender . . . . . . . . . . . . . 59 129 10.5.2. Late Update on the Recipient . . . . . . . . . . . . 60 130 10.6. Collision of Group Identifiers . . . . . . . . . . . . . 60 131 10.7. Cross-group Message Injection . . . . . . . . . . . . . 61 132 10.7.1. Attack Description . . . . . . . . . . . . . . . . . 61 133 10.7.2. Attack Prevention in Group Mode . . . . . . . . . . 62 134 10.8. Prevention of Group Cloning Attack . . . . . . . . . . . 63 135 10.9. Group OSCORE for Unicast Requests . . . . . . . . . . . 63 136 10.10. End-to-end Protection . . . . . . . . . . . . . . . . . 65 137 10.11. Master Secret . . . . . . . . . . . . . . . . . . . . . 65 138 10.12. Replay Protection . . . . . . . . . . . . . . . . . . . 65 139 10.13. Message Freshness . . . . . . . . . . . . . . . . . . . 66 140 10.14. Client Aliveness . . . . . . . . . . . . . . . . . . . . 66 141 10.15. Cryptographic Considerations . . . . . . . . . . . . . . 66 142 10.16. Message Segmentation . . . . . . . . . . . . . . . . . . 69 143 10.17. Privacy Considerations . . . . . . . . . . . . . . . . . 69 144 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 70 145 11.1. OSCORE Flag Bits Registry . . . . . . . . . . . . . . . 70 146 12. References . . . . . . . . . . . . . . . . . . . . . . . . . 70 147 12.1. Normative References . . . . . . . . . . . . . . . . . . 70 148 12.2. Informative References . . . . . . . . . . . . . . . . . 72 149 Appendix A. Assumptions and Security Objectives . . . . . . . . 76 150 A.1. Assumptions . . . . . . . . . . . . . . . . . . . . . . . 76 151 A.2. Security Objectives . . . . . . . . . . . . . . . . . . . 78 152 Appendix B. List of Use Cases . . . . . . . . . . . . . . . . . 79 153 Appendix C. Example of Group Identifier Format . . . . . . . . . 81 154 Appendix D. Set-up of New Endpoints . . . . . . . . . . . . . . 82 155 Appendix E. Challenge-Response Synchronization . . . . . . . . . 83 156 Appendix F. Document Updates . . . . . . . . . . . . . . . . . . 86 157 F.1. Version -11 to -12 . . . . . . . . . . . . . . . . . . . 86 158 F.2. Version -10 to -11 . . . . . . . . . . . . . . . . . . . 87 159 F.3. Version -09 to -10 . . . . . . . . . . . . . . . . . . . 88 160 F.4. Version -08 to -09 . . . . . . . . . . . . . . . . . . . 89 161 F.5. Version -07 to -08 . . . . . . . . . . . . . . . . . . . 90 162 F.6. Version -06 to -07 . . . . . . . . . . . . . . . . . . . 91 163 F.7. Version -05 to -06 . . . . . . . . . . . . . . . . . . . 92 164 F.8. Version -04 to -05 . . . . . . . . . . . . . . . . . . . 92 165 F.9. Version -03 to -04 . . . . . . . . . . . . . . . . . . . 93 166 F.10. Version -02 to -03 . . . . . . . . . . . . . . . . . . . 93 167 F.11. Version -01 to -02 . . . . . . . . . . . . . . . . . . . 94 168 F.12. Version -00 to -01 . . . . . . . . . . . . . . . . . . . 95 169 Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 96 170 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 96 172 1. Introduction 174 The Constrained Application Protocol (CoAP) [RFC7252] is a web 175 transfer protocol specifically designed for constrained devices and 176 networks [RFC7228]. Group communication for CoAP 177 [I-D.ietf-core-groupcomm-bis] addresses use cases where deployed 178 devices benefit from a group communication model, for example to 179 reduce latencies, improve performance, and reduce bandwidth 180 utilization. Use cases include lighting control, integrated building 181 control, software and firmware updates, parameter and configuration 182 updates, commissioning of constrained networks, and emergency 183 multicast (see Appendix B). Group communication for CoAP 184 [I-D.ietf-core-groupcomm-bis] mainly uses UDP/IP multicast as the 185 underlying data transport. 187 Object Security for Constrained RESTful Environments (OSCORE) 188 [RFC8613] describes a security protocol based on the exchange of 189 protected CoAP messages. OSCORE builds on CBOR Object Signing and 190 Encryption (COSE) 191 [I-D.ietf-cose-rfc8152bis-struct][I-D.ietf-cose-rfc8152bis-algs] and 192 provides end-to-end encryption, integrity, replay protection and 193 binding of response to request between a sender and a recipient, 194 independent of the transport layer also in the presence of 195 intermediaries. To this end, a CoAP message is protected by 196 including its payload (if any), certain options, and header fields in 197 a COSE object, which replaces the authenticated and encrypted fields 198 in the protected message. 200 This document defines Group OSCORE, a security protocol for Group 201 communication for CoAP [I-D.ietf-core-groupcomm-bis], providing the 202 same end-to-end security properties as OSCORE in the case where CoAP 203 requests have multiple recipients. In particular, the described 204 approach defines how OSCORE is used in a group communication setting 205 to provide source authentication for CoAP group requests, sent by a 206 client to multiple servers, and for protection of the corresponding 207 CoAP responses. Group OSCORE also defines a pairwise mode where each 208 member of the group can efficiently derive a symmetric pairwise key 209 with any other member of the group for pairwise OSCORE communication. 210 Just like OSCORE, Group OSCORE is independent of the transport layer 211 and works wherever CoAP does. 213 As with OSCORE, it is possible to combine Group OSCORE with 214 communication security on other layers. One example is the use of 215 transport layer security, such as DTLS 216 [RFC6347][I-D.ietf-tls-dtls13], between one client and one proxy (and 217 vice versa), or between one proxy and one server (and vice versa), in 218 order to protect the routing information of packets from observers. 219 Note that DTLS does not define how to secure messages sent over IP 220 multicast. 222 Group OSCORE defines two modes of operation, that can be used 223 independently or together: 225 * In the group mode, Group OSCORE requests and responses are 226 digitally signed with the private key of the sender and the 227 signature is embedded in the protected CoAP message. The group 228 mode supports all COSE signature algorithms as well as signature 229 verification by intermediaries. This mode is defined in 230 Section 8. 232 * In the pairwise mode, two group members exchange OSCORE requests 233 and responses (typically) over unicast, and the messages are 234 protected with symmetric keys. These symmetric keys are derived 235 from Diffie-Hellman shared secrets, calculated with the asymmetric 236 keys of the sender and recipient, allowing for shorter integrity 237 tags and therefore lower message overhead. This mode is defined 238 in Section 9. 240 Both modes provide source authentication of CoAP messages. The 241 application decides what mode to use, potentially on a per-message 242 basis. Such decisions can be based, for instance, on pre-configured 243 policies or dynamic assessing of the target recipient and/or 244 resource, among other things. One important case is when requests 245 are protected with the group mode, and responses with the pairwise 246 mode. Since such responses convey shorter integrity tags instead of 247 bigger, full-fledged signatures, this significantly reduces the 248 message overhead in case of many responses to one request. 250 A special deployment of Group OSCORE is to use pairwise mode only. 251 For example, consider the case of a constrained-node network 252 [RFC7228] with a large number of CoAP endpoints and the objective to 253 establish secure communication between any pair of endpoints with a 254 small provisioning effort and message overhead. Since the total 255 number of security associations that needs to be established grows 256 with the square of the number of nodes, it is desirable to restrict 257 the provisioned keying material. Moreover, a key establishment 258 protocol would need to be executed for each security association. 259 One solution to this is to deploy Group OSCORE, with the endpoints 260 being part of a group, and use the pairwise mode. This solution 261 assumes a trusted third party called Group Manager (see Section 3), 262 but has the benefit of restricting the symmetric keying material 263 while distributing only the public key of each group member. After 264 that, a CoAP endpoint can locally derive the OSCORE Security Context 265 for the other endpoint in the group, and protect CoAP communications 266 with very low overhead [I-D.ietf-lwig-security-protocol-comparison]. 268 1.1. Terminology 270 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 271 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 272 "OPTIONAL" in this document are to be interpreted as described in BCP 273 14 [RFC2119] [RFC8174] when, and only when, they appear in all 274 capitals, as shown here. 276 Readers are expected to be familiar with the terms and concepts 277 described in CoAP [RFC7252] including "endpoint", "client", "server", 278 "sender" and "recipient"; group communication for CoAP 279 [I-D.ietf-core-groupcomm-bis]; CBOR [RFC8949]; COSE 280 [I-D.ietf-cose-rfc8152bis-struct][I-D.ietf-cose-rfc8152bis-algs] and 281 related countersignatures [I-D.ietf-cose-countersign]. 283 Readers are also expected to be familiar with the terms and concepts 284 for protection and processing of CoAP messages through OSCORE, such 285 as "Security Context" and "Master Secret", defined in [RFC8613]. 287 Terminology for constrained environments, such as "constrained 288 device" and "constrained-node network", is defined in [RFC7228]. 290 This document refers also to the following terminology. 292 * Keying material: data that is necessary to establish and maintain 293 secure communication among endpoints. This includes, for 294 instance, keys and IVs [RFC4949]. 296 * Group: a set of endpoints that share group keying material and 297 security parameters (Common Context, see Section 2). That is, 298 unless otherwise specified, the term group used in this document 299 refers to a "security group" (see Section 2.1 of 300 [I-D.ietf-core-groupcomm-bis]), not to be confused with "CoAP 301 group" or "application group". 303 * Group Manager: entity responsible for a group. Each endpoint in a 304 group communicates securely with the respective Group Manager, 305 which is neither required to be an actual group member nor to take 306 part in the group communication. The full list of 307 responsibilities of the Group Manager is provided in Section 3.3. 309 * Silent server: member of a group that never sends protected 310 responses in reply to requests. For CoAP group communications, 311 requests are normally sent without necessarily expecting a 312 response. A silent server may send unprotected responses, as 313 error responses reporting an OSCORE error. Note that an endpoint 314 can implement both a silent server and a client, i.e., the two 315 roles are independent. An endpoint acting only as a silent server 316 performs only Group OSCORE processing on incoming requests. 317 Silent servers maintain less keying material and in particular do 318 not have a Sender Context for the group. Since silent servers do 319 not have a Sender ID, they cannot support the pairwise mode. 321 * Group Identifier (Gid): identifier assigned to the group, unique 322 within the set of groups of a given Group Manager. 324 * Birth Gid: with respect to a group member, the Gid obtained by 325 that group member upon (re-)joining the group. 327 * Group request: CoAP request message sent by a client in the group 328 to all servers in that group. 330 * Key Generation Number: an integer value identifying the current 331 version of the keying material used in a group. 333 * Source authentication: evidence that a received message in the 334 group originated from a specific identified group member. This 335 also provides assurance that the message was not tampered with by 336 anyone, be it a different legitimate group member or an endpoint 337 which is not a group member. 339 2. Security Context 341 This document refers to a group as a set of endpoints sharing keying 342 material and security parameters for executing the Group OSCORE 343 protocol (see Section 1.1). Regardless of what it actually supports, 344 each endpoint of a group is aware of whether the group uses the group 345 mode, or the pairwise mode, or both. 347 All members of a group maintain a Security Context as defined in 348 Section 3 of [RFC8613] and extended as defined in this section. How 349 the Security Context is established by the group members is out of 350 scope for this document, but if there is more than one Security 351 Context applicable to a message, then the endpoints MUST be able to 352 tell which Security Context was latest established. 354 The default setting for how to manage information about the group, 355 including the Security Context, is described in terms of a Group 356 Manager (see Section 3). In particular, the Group Manager indicates 357 whether the group uses the group mode, the pairwise mode, or both of 358 them, as part of the group data provided to candidate group members 359 when joining the group. 361 The remainder of this section provides further details about the 362 Security Context of Group OSCORE. In particular, each endpoint which 363 is member of a group maintains a Security Context as defined in 364 Section 3 of [RFC8613], extended as follows (see Figure 1). 366 * One Common Context, shared by all the endpoints in the group. 367 Several new parameters are included in the Common Context. 369 If a Group Manager is used for maintaining the group, the Common 370 Context is extended with the public key of the Group Manager. 371 When processing a message, the public key of the Group Manager is 372 included in the external additional authenticated data. 374 If the group uses the group mode, the Common context is extended 375 with the following new parameters. 377 - Signature Encryption Algorithm and Signature Algorithm. These 378 relate to the encryption/decryption operations and to the 379 computation/verification of countersignatures, respectively, 380 when a message is protected with the group mode (see 381 Section 8). 383 - Group Encryption Key, used to perform encryption/decryption of 384 countersignatures, when a message is protected with the group 385 mode (see Section 8). 387 If the group uses the pairwise mode, the Common Context is 388 extended with a Pairwise Key Agreement Algorithm used for 389 agreement on a static-static Diffie-Hellman shared secret, from 390 which pairwise keys are derived (see Section 2.4.1) to protect 391 messages with the pairwise mode (see Section 9). 393 * One Sender Context, extended with the endpoint's public and 394 private key pair. The private key is used to sign messages in 395 group mode, or for deriving pairwise keys in pairwise mode (see 396 Section 2.4). When processing a message, the public key is 397 included in the external additional authenticated data. 399 If the endpoint supports the pairwise mode, the Sender Context is 400 also extended with the Pairwise Sender Keys associated to the 401 other endpoints (see Section 2.4). 403 The Sender Context is omitted if the endpoint is configured 404 exclusively as silent server. 406 * One Recipient Context for each endpoint from which messages are 407 received. It is not necessary to maintain Recipient Contexts 408 associated to endpoints from which messages are not (expected to 409 be) received. The Recipient Context is extended with the public 410 key of the associated endpoint, used to verify the signature in 411 group mode and for deriving the pairwise keys in pairwise mode 412 (see Section 2.4). If the endpoint supports the pairwise mode, 413 then the Recipient Context is also extended with the Pairwise 414 Recipient Key associated to the other endpoint (see Section 2.4). 416 +-------------------+------------------------------------------------+ 417 | Context Component | New Information Elements | 418 +-------------------+------------------------------------------------+ 419 | Common Context | Group Manager Public Key | 420 | | * Signature Encryption Algorithm | 421 | | * Signature Algorithm | 422 | | * Group Encryption Key | 423 | | ^ Pairwise Key Agreement Algorithm | 424 +-------------------+------------------------------------------------+ 425 | Sender Context | Endpoint's own public and private key pair | 426 | | ^ Pairwise Sender Keys for the other endpoints | 427 +-------------------+------------------------------------------------+ 428 | Each | Public key of the other endpoint | 429 | Recipient Context | ^ Pairwise Recipient Key of the other endpoint | 430 +-------------------+------------------------------------------------+ 432 Figure 1: Additions to the OSCORE Security Context. The optional 433 elements labeled with * (with ^) are present only if the group 434 uses the group mode (the pairwise mode). 436 2.1. Common Context 438 The Common Context may be acquired from the Group Manager (see 439 Section 3). The following sections define how the Common Context is 440 extended, compared to [RFC8613]. 442 2.1.1. AEAD Algorithm 444 AEAD Algorithm identifies the COSE AEAD algorithm to use for 445 encryption, when messages are protected using the pairwise mode (see 446 Section 9). This algorithm MUST provide integrity protection. This 447 parameter is immutable once the Common Context is established, and it 448 is not relevant if the group uses only the group mode. 450 For endpoints that support the pairwise mode, the AEAD algorithm AES- 451 CCM-16-64-128 defined in Section 4.2 of 452 [I-D.ietf-cose-rfc8152bis-algs] is mandatory to implement. 454 2.1.2. ID Context 456 The ID Context parameter (see Sections 3.1 and 3.3 of [RFC8613]) in 457 the Common Context SHALL contain the Group Identifier (Gid) of the 458 group. The choice of the Gid format is application specific. An 459 example of specific formatting of the Gid is given in Appendix C. 460 The application needs to specify how to handle potential collisions 461 between Gids (see Section 10.6). 463 2.1.3. Group Manager Public Key 465 Group Manager Public Key specifies the public key of the Group 466 Manager. This is included in the external additional authenticated 467 data (see Section 4.3). 469 Each group member MUST obtain the public key of the Group Manager 470 with a valid proof-of-possession of the corresponding private key, 471 for instance from the Group Manager itself when joining the group. 472 Further details on the provisioning of the Group Manager's public key 473 to the group members are out of the scope of this document. 475 2.1.4. Signature Encryption Algorithm 477 Signature Encryption Algorithm identifies the algorithm to use for 478 enryption, when messages are protected using the group mode (see 479 Section 8). This algorithm MAY provide integrity protection. This 480 parameter is immutable once the Common Context is established. 482 For endpoints that support the group mode and use authenticated 483 encryption, the AEAD algorithm AES-CCM-16-64-128 defined in 484 Section 4.2 of [I-D.ietf-cose-rfc8152bis-algs] is mandatory to 485 implement. 487 2.1.5. Signature Algorithm 489 Signature Algorithm identifies the digital signature algorithm used 490 to compute a countersignature on the COSE object (see Sections 3.2 491 and 3.3 of [I-D.ietf-cose-countersign]), when messages are protected 492 using the group mode (see Section 8). This parameter is immutable 493 once the Common Context is established. 495 For endpoints that support the group mode, the EdDSA signature 496 algorithm and the elliptic curve Ed25519 [RFC8032] are mandatory to 497 implement. If elliptic curve signatures are used, it is RECOMMENDED 498 to implement deterministic signatures with additional randomness as 499 specified in [I-D.mattsson-cfrg-det-sigs-with-noise]. 501 2.1.6. Group Encryption Key 503 Group Encryption Key specifies the encryption key for deriving a 504 keystream to encrypt/decrypt a countersignature, when a message is 505 protected with the group mode (see Section 8). 507 The Group Encryption Key is derived as defined for Sender/Recipient 508 Keys in Section 3.2.1 of [RFC8613], with the following differences. 510 * The 'alg_aead' element of the 'info' array takes the value of 511 Signature Encryption Algorithm from the Common Context (see 512 Section 2.1.5). 514 * The 'type' element of the 'info' array is "Group Encryption Key". 515 The label is an ASCII string and does not include a trailing NUL 516 byte. 518 * L and the 'L' element of the 'info' array are the size of the 519 output of the HKDF Algorithm from the Common Context (see 520 Section 3.2 of [RFC8613]), in bytes. 522 2.1.7. Pairwise Key Agreement Algorithm 524 Pairwise Key Agreement Algorithm identifies the elliptic curve 525 Diffie-Hellman algorithm used to derive a static-static Diffie- 526 Hellman shared secret, from which pairwise keys are derived (see 527 Section 2.4.1) to protect messages with the pairwise mode (see 528 Section 9). This parameter is immutable once the Common Context is 529 established. 531 For endpoints that support the pairwise mode, the ECDH-SS + HKDF-256 532 algorithm specified in Section 6.3.1 of 533 [I-D.ietf-cose-rfc8152bis-algs] and the X25519 curve [RFC7748] are 534 mandatory to implement. 536 2.2. Sender Context and Recipient Context 538 OSCORE specifies the derivation of Sender Context and Recipient 539 Context, specifically of Sender/Recipient Keys and Common IV, from a 540 set of input parameters (see Section 3.2 of [RFC8613]). Like in 541 [RFC8613], HKDF SHA-256 is the mandatory to implement HKDF. 543 The derivation of Sender/Recipient Keys and Common IV defined in 544 OSCORE applies also to Group OSCORE, with the following extensions 545 compared to Section 3.2.1 of [RFC8613]. 547 * If the group uses (also) the group mode, the 'alg_aead' element of 548 the 'info' array takes the value of Signature Encryption Algorithm 549 from the Common Context (see Section 2.1.5). 551 * If the group uses only the pairwise mode, the 'alg_aead' element 552 of the 'info' array takes the value of AEAD Algorithm from the 553 Common Context (see Section 2.1.1). 555 The Sender ID SHALL be unique for each endpoint in a group with a 556 certain tuple (Master Secret, Master Salt, Group Identifier), see 557 Section 3.3 of [RFC8613]. 559 For Group OSCORE, the Sender Context and Recipient Context 560 additionally contain asymmetric keys, as described previously in 561 Section 2. The private/public key pair of the sender can, for 562 example, be generated by the endpoint or provisioned during 563 manufacturing. 565 With the exception of the public key of the sender endpoint and the 566 possibly associated pairwise keys, a receiver endpoint can derive a 567 complete Security Context from a received Group OSCORE message and 568 the Common Context. The public keys in the Recipient Contexts can be 569 retrieved from the Group Manager (see Section 3) upon joining the 570 group. A public key can alternatively be acquired from the Group 571 Manager at a later time, for example the first time a message is 572 received from a particular endpoint in the group (see Section 8.2 and 573 Section 8.4). 575 For severely constrained devices, it may be not feasible to 576 simultaneously handle the ongoing processing of a recently received 577 message in parallel with the retrieval of the sender endpoint's 578 public key. Such devices can be configured to drop a received 579 message for which there is no (complete) Recipient Context, and 580 retrieve the sender endpoint's public key in order to have it 581 available to verify subsequent messages from that endpoint. 583 An endpoint admits a maximum amount of Recipient Contexts for a same 584 Security Context, e.g., due to memory limitations. After reaching 585 that limit, the creation of a new Recipient Context results in an 586 overflow. When this happens, the endpoint has to delete a current 587 Recipient Context to install the new one. It is up to the 588 application to define policies for selecting the current Recipient 589 Context to delete. A newly installed Recipient Context that has 590 required to delete another Recipient Context is initialized with an 591 invalid Replay Window, and accordingly requires the endpoint to take 592 appropriate actions (see Section 2.5.1.2). 594 2.3. Format of Public Keys 596 In a group, the following MUST hold for the public key of each 597 endpoint as well as for the public key of the Group Manager. 599 * All public keys MUST be encoded according to the same format used 600 in the group. The format MUST provide the full set of information 601 related to the public key algorithm, including, e.g., the used 602 elliptic curve (when applicable). 604 * All public keys MUST be for the public key algorithm used in the 605 group and aligned with the possible associated parameters used in 606 the group, e.g., the used elliptic curve (when applicable). 608 If the group uses (also) the group mode, the public key algorithm is 609 the Signature Algorithm used in the group. If the group uses only 610 the pairwise mode, the public key algorithm is the Pairwise Key 611 Agreement Algorithm used in the group. 613 If CWTs [RFC8392] or unprotected CWT claim sets [I-D.ietf-rats-uccs] 614 are used as public key format, the public key algorithm is fully 615 described by a COSE key type and its "kty" and "crv" parameters. 617 If X.509 certificates [RFC7925] or C509 certificates 618 [I-D.ietf-cose-cbor-encoded-cert] are used as public key format, the 619 public key algorithm is fully described by the "algorithm" field of 620 the "SubjectPublicKeyInfo" structure, and by the 621 "subjectPublicKeyAlgorithm" element, respectively. 623 Public keys are also used to derive pairwise keys (see Section 2.4.1) 624 and are included in the external additional authenticated data (see 625 Section 4.3). In both of these cases, an endpoint in a group MUST 626 treat public keys as opaque data, i.e., by considering the same 627 binary representation made available to other endpoints in the group, 628 possibly through a designated trusted source (e.g., the Group 629 Manager). 631 For example, an X.509 certificate is provided as its direct binary 632 serialization. If C509 certificates or CWTs are used as credential 633 format, they are provided as the binary serialization of a (possibly 634 tagged) CBOR array. If a CWT claim set is used as credential format, 635 it is provided as the binary serialization of a CBOR map. 637 2.4. Pairwise Keys 639 Certain signature schemes, such as EdDSA and ECDSA, support a secure 640 combined signature and encryption scheme. This section specifies the 641 derivation of "pairwise keys", for use in the pairwise mode defined 642 in Section 9. Group OSCORE keys used for both signature and 643 encryption MUST NOT be used for any other purposes than Group OSCORE. 645 2.4.1. Derivation of Pairwise Keys 647 Using the Group OSCORE Security Context (see Section 2), a group 648 member can derive AEAD keys, to protect point-to-point communication 649 between itself and any other endpoint in the group by means of the 650 AEAD Algorithm from the Common Context (see Section 2.1.1). The key 651 derivation of these so-called pairwise keys follows the same 652 construction as in Section 3.2.1 of [RFC8613]: 654 Pairwise Sender Key = HKDF(Sender Key, IKM-Sender, info, L) 655 Pairwise Recipient Key = HKDF(Recipient Key, IKM-Recipient, info, L) 657 with 659 IKM-Sender = Sender Pub Key | Recipient Pub Key | Shared Secret 660 IKM-Recipient = Recipient Pub Key | Sender Pub Key | Shared Secret 662 where: 664 * The Pairwise Sender Key is the AEAD key for processing outgoing 665 messages addressed to endpoint X. 667 * The Pairwise Recipient Key is the AEAD key for processing incoming 668 messages from endpoint X. 670 * HKDF is the OSCORE HKDF algorithm [RFC8613] from the Common 671 Context. 673 * The Sender Key from the Sender Context is used as salt in the 674 HKDF, when deriving the Pairwise Sender Key. 676 * The Recipient Key from the Recipient Context associated to 677 endpoint X is used as salt in the HKDF, when deriving the Pairwise 678 Recipient Key. 680 * IKM-Sender is the Input Keying Material (IKM) used in the HKDF for 681 the derivation of the Pairwise Sender Key. IKM-Sender is the byte 682 string concatenation of the endpoint's own (signature) public key, 683 the endpoint X's (signature) public key from the Recipient 684 Context, and the Shared Secret. The two (signature) public keys 685 are binary encoded as defined in Section 2.3. 687 * IKM-Recipient is the Input Keying Material (IKM) used in the HKDF 688 for the derivation of the Recipient Sender Key. IKM-Recipient is 689 the byte string concatenation of the endpoint X's (signature) 690 public key from the Recipient Context, the endpoint's own 691 (signature) public key, and the Shared Secret. The two 692 (signature) public keys are binary encoded as defined in 693 Section 2.3. 695 * The Shared Secret is computed as a cofactor Diffie-Hellman shared 696 secret, see Section 5.7.1.2 of [NIST-800-56A], using the Pairwise 697 Key Agreement Algorithm. The endpoint uses its private key from 698 the Sender Context and the public key of the other endpoint X from 699 the associated Recipient Context. Note the requirement of 700 validation of public keys in Section 10.15. For X25519 and X448, 701 the procedure is described in Section 5 of [RFC7748] using public 702 keys mapped to Montgomery coordinates, see Section 2.4.2. 704 * info and L are as defined in Section 3.2.1 of [RFC8613]. That is: 706 - The 'alg_aead' element of the 'info' array takes the value of 707 AEAD Algorithm from the Common Context (see Section 2.1.1). 709 - L and the 'L' element of the 'info' array are the size of the 710 key for the AEAD Algorithm from the Common Context (see 711 Section 2.1.1), in bytes. 713 If EdDSA asymmetric keys are used, the Edward coordinates are mapped 714 to Montgomery coordinates using the maps defined in Sections 4.1 and 715 4.2 of [RFC7748], before using the X25519 and X448 functions defined 716 in Section 5 of [RFC7748]. For further details, see Section 2.4.2. 717 ECC asymmetric keys in Montgomery or Weirstrass form are used 718 directly in the key agreement algorithm without coordinate mapping. 720 After establishing a partially or completely new Security Context 721 (see Section 2.5 and Section 3.2), the old pairwise keys MUST be 722 deleted. Since new Sender/Recipient Keys are derived from the new 723 group keying material (see Section 2.2), every group member MUST use 724 the new Sender/Recipient Keys when deriving new pairwise keys. 726 As long as any two group members preserve the same asymmetric keys, 727 their Diffie-Hellman shared secret does not change across updates of 728 the group keying material. 730 2.4.2. ECDH with Montgomery Coordinates 732 2.4.2.1. Curve25519 734 The y-coordinate of the other endpoint's Ed25519 public key is 735 decoded as specified in Section 5.1.3 of [RFC8032]. The Curve25519 736 u-coordinate is recovered as u = (1 + y) / (1 - y) (mod p) following 737 the map in Section 4.1 of [RFC7748]. Note that the mapping is not 738 defined for y = 1, and that y = -1 maps to u = 0 which corresponds to 739 the neutral group element and thus will result in a degenerate shared 740 secret. Therefore implementations MUST abort if the y-coordinate of 741 the other endpoint's Ed25519 public key is 1 or -1 (mod p). 743 The private signing key byte strings (= the lower 32 bytes used for 744 generating the public key, see step 1 of Section 5.1.5 of [RFC8032]) 745 are decoded the same way for signing in Ed25519 and scalar 746 multiplication in X25519. Hence, to compute the shared secret the 747 endpoint applies the X25519 function to the Ed25519 private signing 748 key byte string and the encoded u-coordinate byte string as specified 749 in Section 5 of [RFC7748]. 751 2.4.2.2. Curve448 753 The y-coordinate of the other endpoint's Ed448 public key is decoded 754 as specified in Section 5.2.3. of [RFC8032]. The Curve448 755 u-coordinate is recovered as u = y^2 * (d * y^2 - 1) / (y^2 - 1) (mod 756 p) following the map from "edwards448" in Section 4.2 of [RFC7748], 757 and also using the relation x^2 = (y^2 - 1)/(d * y^2 - 1) from the 758 curve equation. Note that the mapping is not defined for y = 1 or 759 -1. Therefore implementations MUST abort if the y-coordinate of the 760 peer endpoint's Ed448 public key is 1 or -1 (mod p). 762 The private signing key byte strings (= the lower 57 bytes used for 763 generating the public key, see step 1 of Section 5.2.5 of [RFC8032]) 764 are decoded the same way for signing in Ed448 and scalar 765 multiplication in X448. Hence, to compute the shared secret the 766 endpoint applies the X448 function to the Ed448 private signing key 767 byte string and the encoded u-coordinate byte string as specified in 768 Section 5 of [RFC7748]. 770 2.4.3. Usage of Sequence Numbers 772 When using any of its Pairwise Sender Keys, a sender endpoint 773 including the 'Partial IV' parameter in the protected message MUST 774 use the current fresh value of the Sender Sequence Number from its 775 Sender Context (see Section 2.2). That is, the same Sender Sequence 776 Number space is used for all outgoing messages protected with Group 777 OSCORE, thus limiting both storage and complexity. 779 On the other hand, when combining group and pairwise communication 780 modes, this may result in the Partial IV values moving forward more 781 often. This can happen when a client engages in frequent or long 782 sequences of one-to-one exchanges with servers in the group, by 783 sending requests over unicast. 785 2.4.4. Security Context for Pairwise Mode 787 If the pairwise mode is supported, the Security Context additionally 788 includes Pairwise Key Agreement Algorithm and the pairwise keys, as 789 described at the beginning of Section 2. 791 The pairwise keys as well as the shared secrets used in their 792 derivation (see Section 2.4.1) may be stored in memory or recomputed 793 every time they are needed. The shared secret changes only when a 794 public/private key pair used for its derivation changes, which 795 results in the pairwise keys also changing. Additionally, the 796 pairwise keys change if the Sender ID changes or if a new Security 797 Context is established for the group (see Section 2.5.3). In order 798 to optimize protocol performance, an endpoint may store the derived 799 pairwise keys for easy retrieval. 801 In the pairwise mode, the Sender Context includes the Pairwise Sender 802 Keys to use with the other endpoints (see Figure 1). In order to 803 identify the right key to use, the Pairwise Sender Key for endpoint X 804 may be associated to the Recipient ID of endpoint X, as defined in 805 the Recipient Context (i.e., the Sender ID from the point of view of 806 endpoint X). In this way, the Recipient ID can be used to lookup for 807 the right Pairwise Sender Key. This association may be implemented in 808 different ways, e.g., by storing the pair (Recipient ID, Pairwise 809 Sender Key) or linking a Pairwise Sender Key to a Recipient Context. 811 2.5. Update of Security Context 813 It is RECOMMENDED that the immutable part of the Security Context is 814 stored in non-volatile memory, or that it can otherwise be reliably 815 accessed throughout the operation of the group, e.g., after a device 816 reboots. However, also immutable parts of the Security Context may 817 need to be updated, for example due to scheduled key renewal, new or 818 re-joining members in the group, or the fact that the endpoint 819 changes Sender ID (see Section 2.5.3). 821 On the other hand, the mutable parts of the Security Context are 822 updated by the endpoint when executing the security protocol, but may 823 nevertheless become outdated, e.g., due to loss of the mutable 824 Security Context (see Section 2.5.1) or exhaustion of Sender Sequence 825 Numbers (see Section 2.5.2). 827 If it is not feasible or practically possible to store and maintain 828 up-to-date the mutable part in non-volatile memory (e.g., due to 829 limited number of write operations), the endpoint MUST be able to 830 detect a loss of the mutable Security Context and MUST accordingly 831 take the actions defined in Section 2.5.1. 833 2.5.1. Loss of Mutable Security Context 835 An endpoint may lose its mutable Security Context, e.g., due to a 836 reboot (see Section 2.5.1.1) or to an overflow of Recipient Contexts 837 (see Section 2.5.1.2). 839 In such a case, the endpoint needs to prevent the re-use of a nonce 840 with the same AEAD key, and to handle incoming replayed messages. 842 2.5.1.1. Reboot and Total Loss 844 In case a loss of the Sender Context and/or of the Recipient Contexts 845 is detected (e.g., following a reboot), the endpoint MUST NOT protect 846 further messages using this Security Context to avoid reusing an AEAD 847 nonce with the same AEAD key. 849 In particular, before resuming its operations in the group, the 850 endpoint MUST retrieve new Security Context parameters from the Group 851 Manager (see Section 2.5.3) and use them to derive a new Sender 852 Context (see Section 2.2). Since this includes a newly derived 853 Sender Key, a server will not reuse the same pair (key, nonce), even 854 when using the Partial IV of (old re-injected) requests to build the 855 AEAD nonce for protecting the corresponding responses. 857 From then on, the endpoint MUST use the latest installed Sender 858 Context to protect outgoing messages. Also, newly created Recipient 859 Contexts will have a Replay Window which is initialized as valid. 861 If not able to establish an updated Sender Context, e.g., because of 862 lack of connectivity with the Group Manager, the endpoint MUST NOT 863 protect further messages using the current Security Context and MUST 864 NOT accept incoming messages from other group members, as currently 865 unable to detect possible replays. 867 2.5.1.2. Overflow of Recipient Contexts 869 After reaching the maximum amount of Recipient Contexts, an endpoint 870 will experience an overflow when installing a new Recipient Context, 871 as it requires to first delete an existing one (see Section 2.2). 873 Every time this happens, the Replay Window of the new Recipient 874 Context is initialized as not valid. Therefore, the endpoint MUST 875 take the following actions, before accepting request messages from 876 the client associated to the new Recipient Context. 878 If it is not configured as silent server, the endpoint MUST either: 880 * Retrieve new Security Context parameters from the Group Manager 881 and derive a new Sender Context, as defined in Section 2.5.1.1; or 883 * When receiving a first request to process with the new Recipient 884 Context, use the approach specified in Appendix E and based on the 885 Echo Option for CoAP [I-D.ietf-core-echo-request-tag], if 886 supported. In particular, the endpoint MUST use its Partial IV 887 when generating the AEAD nonce and MUST include the Partial IV in 888 the response message conveying the Echo Option. If the endpoint 889 supports the CoAP Echo Option, it is RECOMMENDED to take this 890 approach. 892 If it is configured exclusively as silent server, the endpoint MUST 893 wait for the next group rekeying to occur, in order to derive a new 894 Security Context and re-initialize the Replay Window of each 895 Recipient Contexts as valid. 897 2.5.2. Exhaustion of Sender Sequence Number 899 An endpoint can eventually exhaust the Sender Sequence Number, which 900 is incremented for each new outgoing message including a Partial IV. 901 This is the case for group requests, Observe notifications [RFC7641] 902 and, optionally, any other response. 904 Implementations MUST be able to detect an exhaustion of Sender 905 Sequence Number, after the endpoint has consumed the largest usable 906 value. If an implementation's integers support wrapping addition, 907 the implementation MUST treat Sender Sequence Number as exhausted 908 when a wrap-around is detected. 910 Upon exhausting the Sender Sequence Numbers, the endpoint MUST NOT 911 use this Security Context to protect further messages including a 912 Partial IV. 914 The endpoint SHOULD inform the Group Manager, retrieve new Security 915 Context parameters from the Group Manager (see Section 2.5.3), and 916 use them to derive a new Sender Context (see Section 2.2). 918 From then on, the endpoint MUST use its latest installed Sender 919 Context to protect outgoing messages. 921 2.5.3. Retrieving New Security Context Parameters 923 The Group Manager can assist an endpoint with an incomplete Sender 924 Context to retrieve missing data of the Security Context and thereby 925 become fully operational in the group again. The two main options 926 for the Group Manager are described in this section: i) assignment of 927 a new Sender ID to the endpoint (see Section 2.5.3.1); and ii) 928 establishment of a new Security Context for the group (see 929 Section 2.5.3.2). The update of the Replay Window in each of the 930 Recipient Contexts is discussed in Section 6.2. 932 As group membership changes, or as group members get new Sender IDs 933 (see Section 2.5.3.1) so do the relevant Recipient IDs that the other 934 endpoints need to keep track of. As a consequence, group members may 935 end up retaining stale Recipient Contexts, that are no longer useful 936 to verify incoming secure messages. 938 The Recipient ID ('kid') SHOULD NOT be considered as a persistent and 939 reliable indicator of a group member. Such an indication can be 940 achieved only by using that member's public key, when verifying 941 countersignatures of received messages (in group mode), or when 942 verifying messages integrity-protected with pairwise keying material 943 derived from asymmetric keys (in pairwise mode). 945 Furthermore, applications MAY define policies to: i) delete 946 (long-)unused Recipient Contexts and reduce the impact on storage 947 space; as well as ii) check with the Group Manager that a public key 948 is currently the one associated to a 'kid' value, after a number of 949 consecutive failed verifications. 951 2.5.3.1. New Sender ID for the Endpoint 953 The Group Manager may assign a new Sender ID to an endpoint, while 954 leaving the Gid, Master Secret and Master Salt unchanged in the 955 group. In this case, the Group Manager MUST assign a Sender ID that 956 has not been used in the group since the latest time when the current 957 Gid value was assigned to the group (see Section 3.2). 959 Having retrieved the new Sender ID, and potentially other missing 960 data of the immutable Security Context, the endpoint can derive a new 961 Sender Context (see Section 2.2). When doing so, the endpoint resets 962 the Sender Sequence Number in its Sender Context to 0, and derives a 963 new Sender Key. This is in turn used to possibly derive new Pairwise 964 Sender Keys. 966 From then on, the endpoint MUST use its latest installed Sender 967 Context to protect outgoing messages. 969 The assignment of a new Sender ID may be the result of different 970 processes. The endpoint may request a new Sender ID, e.g., because 971 of exhaustion of Sender Sequence Numbers (see Section 2.5.2). An 972 endpoint may request to re-join the group, e.g., because of losing 973 its mutable Security Context (see Section 2.5.1), and is provided 974 with a new Sender ID together with the latest immutable Security 975 Context. 977 For the other group members, the Recipient Context corresponding to 978 the old Sender ID becomes stale (see Section 3.2). 980 2.5.3.2. New Security Context for the Group 982 The Group Manager may establish a new Security Context for the group 983 (see Section 3.2). The Group Manager does not necessarily establish 984 a new Security Context for the group if one member has an outdated 985 Security Context (see Section 2.5.3.1), unless that was already 986 planned or required for other reasons. 988 All the group members need to acquire new Security Context parameters 989 from the Group Manager. Once having acquired new Security Context 990 parameters, each group member performs the following actions. 992 * From then on, it MUST NOT use the current Security Context to 993 start processing new messages for the considered group. 995 * It completes any ongoing message processing for the considered 996 group. 998 * It derives and install a new Security Context. In particular: 1000 - It re-derives the keying material stored in its Sender Context 1001 and Recipient Contexts (see Section 2.2). The Master Salt used 1002 for the re-derivations is the updated Master Salt parameter if 1003 provided by the Group Manager, or the empty byte string 1004 otherwise. 1006 - It resets to 0 its Sender Sequence Number in its Sender 1007 Context. 1009 - It re-initializes the Replay Window of each Recipient Context. 1011 - For each ongoing observation where it is an observer client and 1012 that it wants to keep active, it resets to 0 the Notification 1013 Number of each associated server (see Section 6.1). 1015 From then on, it can resume processing new messages for the 1016 considered group. In particular: 1018 * It MUST use its latest installed Sender Context to protect 1019 outgoing messages. 1021 * It SHOULD use its latest installed Recipient Contexts to process 1022 incoming messages, unless application policies admit to 1023 temporarily retain and use the old, recent, Security Context (see 1024 Section 10.5.1). 1026 The distribution of a new Gid and Master Secret may result in 1027 temporarily misaligned Security Contexts among group members. In 1028 particular, this may result in a group member not being able to 1029 process messages received right after a new Gid and Master Secret 1030 have been distributed. A discussion on practical consequences and 1031 possible ways to address them, as well as on how to handle the old 1032 Security Context, is provided in Section 10.5. 1034 3. The Group Manager 1036 As with OSCORE, endpoints communicating with Group OSCORE need to 1037 establish the relevant Security Context. Group OSCORE endpoints need 1038 to acquire OSCORE input parameters, information about the group(s) 1039 and about other endpoints in the group(s). This document is based on 1040 the existence of an entity called Group Manager and responsible for 1041 the group, but it does not mandate how the Group Manager interacts 1042 with the group members. The responsibilities of the Group Manager 1043 are compiled together in Section 3.3. 1045 It is RECOMMENDED to use a Group Manager as described in 1046 [I-D.ietf-ace-key-groupcomm-oscore], where the join process is based 1047 on the ACE framework for authentication and authorization in 1048 constrained environments [I-D.ietf-ace-oauth-authz]. 1050 The Group Manager assigns an integer Key Generation Number to each of 1051 its groups, identifying the current version of the keying material 1052 used in that group. The first Key Generation Number assigned to 1053 every group MUST be 0. Separately for each group, the value of the 1054 Key Generation Number increases strictly monotonically, each time the 1055 Group Manager distributes new keying material to that group (see 1056 Section 3.2). That is, if the current Key Generation Number for a 1057 group is X, then X+1 will denote the keying material distributed and 1058 used in that group immediately after the current one. 1060 The Group Manager assigns unique Group Identifiers (Gids) to the 1061 groups under its control. Also, for each group, the Group Manager 1062 assigns unique Sender IDs (and thus Recipient IDs) to the respective 1063 group members. According to a hierarchical approach, the Gid value 1064 assigned to a group is associated to a dedicated space for the values 1065 of Sender ID and Recipient ID of the members of that group. 1067 When a node (re-)joins a group, it is provided also with the current 1068 Gid to use in the group, namely the Birth Gid of that node for that 1069 group. For each group member, the Group Manager MUST store the 1070 latest corresponding Birth Gid until that member leaves the group. 1071 In case the node has in fact re-joined the group, the newly 1072 determined Birth Gid overwrites the one currently stored. 1074 The Group Manager maintains records of the public keys of endpoints 1075 in a group, and provides information about the group and its members 1076 to other group members and to external principals with selected roles 1077 (see Section 3.1). Upon nodes' joining, the Group Manager collects 1078 such public keys and MUST verify proof-of-possession of the 1079 respective private key. 1081 An endpoint acquires group data such as the Gid and OSCORE input 1082 parameters including its own Sender ID from the Group Manager, and 1083 provides information about its public key to the Group Manager, for 1084 example upon joining the group. 1086 Furthermore, when joining the group or later on as a group member, an 1087 endpoint can retrieve from the Group Manager the public key of the 1088 Group Manager as well as the public key and other information 1089 associated to other members of the group, with which it can derive 1090 the corresponding Recipient Context. Together with the requested 1091 public keys, the Group Manager MUST provide the Sender ID of the 1092 associated group members and the current Key Generation Number in the 1093 group. An application can configure a group member to asynchronously 1094 retrieve information about Recipient Contexts, e.g., by Observing 1095 [RFC7641] a resource at the Group Manager to get updates on the group 1096 membership. 1098 3.1. Support for Additional Principals 1100 The Group Manager MAY serve additional principals acting as signature 1101 checkers, e.g., intermediary gateways. These principals do not join 1102 a group as members, but can retrieve public keys of group members and 1103 other selected group data from the Group Manager, in order to solely 1104 verify countersignatures of messages protected in group mode (see 1105 Section 8.5). 1107 In order to verify countersignatures of messages in a group, a 1108 signature checker needs to retrieve the following information about 1109 that group from the Group Manager. 1111 * The current ID Context (Gid) used in the group. 1113 * The public keys of the group members and the public key of the 1114 Group Manager. 1116 * The current Group Encryption Key (see Section 2.1.6). 1118 * The identifiers of the algorithms used in the group (see 1119 Section 2), i.e.: i) Signature Encryption Algorithm and Signature 1120 Algorithm; and ii) AEAD Algorithm and Pairwise Key Agreement 1121 Algorithm, if the group uses also the pairwise mode. 1123 A signature checker MUST be authorized before it can retrieve such 1124 information. To this end, the same method mentioned above based on 1125 the ACE framework [I-D.ietf-ace-oauth-authz] can be used. 1127 3.2. Management of Group Keying Material 1129 In order to establish a new Security Context for a group, the Group 1130 Manager MUST generate and assign to the group a new Group Identifier 1131 (Gid) and a new value for the Master Secret parameter. When doing 1132 so, a new value for the Master Salt parameter MAY also be generated 1133 and assigned to the group. When establishing the new Security 1134 Context, the Group Manager should preserve the current value of the 1135 Sender ID of each group member. 1137 The specific group key management scheme used to distribute new 1138 keying material, is out of the scope of this document. However, it 1139 is RECOMMENDED that the Group Manager supports the Group Rekeying 1140 Process described in [I-D.ietf-ace-key-groupcomm-oscore]. When 1141 possible, the delivery of rekeying messages should use a reliable 1142 transport, in order to reduce chances of group members missing a 1143 rekeying instance. 1145 The set of group members should not be assumed as fixed, i.e., the 1146 group membership is subject to changes, possibly on a frequent basis. 1147 The Group Manager MUST rekey the group when one or more currently 1148 present endpoints leave the group, or in order to evict them as 1149 compromised or suspected so. In either case, this excludes such 1150 nodes from future communications in the group, and thus preserves 1151 forward security. If required by the application, the Group Manager 1152 MUST rekey the group also before one or more new joining endpoints 1153 are added to the group, thus preserving backward security. 1155 The establishment of the new Security Context for the group takes the 1156 following steps. 1158 1. The Group Manager MUST increment by 1 the Key Generation Number 1159 for the group. 1161 2. The Group Manager MUST check if the new Gid to be distributed 1162 coincides with the Birth Gid of any of the current group members. 1163 If any of such "elder members" is found in the group, then: 1165 * The Group Manager MUST evict the elder members from the group. 1166 That is, the Group Manager MUST terminate their membership and 1167 MUST rekey the group in such a way that the new keying 1168 material is not provided to those evicted elder members. This 1169 ensures that an Observe notification [RFC7641] can never 1170 successfully match against the Observe requests of two 1171 different observations. 1173 * Until a further following group rekeying, the Group Manager 1174 MUST store the list of those latest-evicted elder members. If 1175 any of those endpoints re-joins the group before a further 1176 following group rekeying occurs, the Group Manager MUST NOT 1177 rekey the group upon their re-joining. When one of those 1178 endpoints re-joins the group, the Group Manager can rely, 1179 e.g., on the ongoing secure communication association to 1180 recognize the endpoint as included in the stored list. 1182 3. The Group Manager MUST build a set of stale Sender IDs including: 1184 * The Sender IDs that, during the current Gid, were both 1185 assigned to an endpoint and subsequently relinquished (see 1186 Section 2.5.3.1). 1188 * The current Sender IDs of the group members that the upcoming 1189 group rekeying aims to exclude from future group 1190 communications, if any. 1192 4. The Group Manager rekeys the group, by distributing: 1194 * The new keying material, i.e., the new Master Secret, the new 1195 Gid and (optionally) the new Master Salt. 1197 * The new Key Generation Number from step 1. 1199 * The set of stale Sender IDs from step 3. 1201 Further information may be distributed, depending on the specific 1202 group key management scheme used in the group. 1204 When receiving the new group keying materal, a group member considers 1205 the received stale Sender IDs and performs the following actions. 1207 * The group member MUST remove every public key associated to a 1208 stale Sender ID from its list of group members' public keys used 1209 in the group. 1211 * The group member MUST delete each of its Recipient Contexts used 1212 in the group whose corresponding Recipient ID is a stale Sender 1213 ID. 1215 After that, the group member installs the new keying material and 1216 derives the corresponding new Security Context. 1218 A group member might miss one group rekeying or more consecutive 1219 instances. As a result, the group member will retain old group 1220 keying material with Key Generation Number GEN_OLD. Eventually, the 1221 group member can notice the discrepancy, e.g., by repeatedly failing 1222 to verify incoming messages, or by explicitly querying the Group 1223 Manager for the current Key Generation Number. Once the group member 1224 gains knowledge of having missed a group rekeying, it MUST delete the 1225 old keying material it owns. 1227 Then, the group member proceeds according to the following steps. 1229 1. The group member retrieves from the Group Manager the current 1230 group keying material, together with the current Key Generation 1231 Number GEN_NEW. The group member MUST NOT install the obtained 1232 group keying material yet. 1234 2. The group member asks the Group Manager for the set of stale 1235 Sender IDs. 1237 3. If no exact indication can be obtained from the Group Manager, 1238 the group member MUST remove all the public keys from its list of 1239 group members' public keys used in the group and MUST delete all 1240 its Recipient Contexts used in the group. 1242 Otherwise, the group member MUST remove every public key 1243 associated to a stale Sender ID from its list of group members' 1244 public keys used in the group, and MUST delete each of its 1245 Recipient Contexts used in the group whose corresponding 1246 Recipient ID is a stale Sender ID. 1248 4. The group member installs the current group keying material, and 1249 derives the corresponding new Security Context. 1251 Alternatively, the group member can re-join the group. In such a 1252 case, the group member MUST take one of the following two actions. 1254 * The group member performs steps 2 and 3 above. Then, the group 1255 member re-joins the group. 1257 * The group member re-joins the group with the same roles it 1258 currently has in the group, and, during the re-joining process, it 1259 asks the Group Manager for the public keys of all the current 1260 group members. 1262 Then, given Z the set of public keys received from the Group 1263 Manager, the group member removes every public key which is not in 1264 Z from its list of group members' public keys used in the group, 1265 and deletes each of its Recipient Contexts used in the group that 1266 does not include any of the public keys in Z. 1268 By removing public keys and deleting Recipient Contexts associated to 1269 stale Sender IDs, it is ensured that a recipient endpoint owning the 1270 latest group keying material does not store the public keys of sender 1271 endpoints that are not current group members. This in turn allows 1272 group members to rely on owned public keys to confidently assert the 1273 group membership of sender endpoints, when receiving incoming 1274 messages protected in group mode (see Section 8). 1276 3.2.1. Recycling of Identifiers 1278 Although the Gid value changes every time a group is rekeyed, the 1279 Group Manager can reassign a Gid to the same group over that group's 1280 lifetime. This would happen, for instance, once the whole space of 1281 Gid values has been used for the group in question. 1283 From the moment when a Gid is assigned to a group until the moment a 1284 new Gid is assigned to that same group, the Group Manager MUST NOT 1285 reassign a Sender ID within the group. This prevents to reuse a 1286 Sender ID ('kid') with the same Gid, Master Secret and Master Salt. 1287 Within this restriction, the Group Manager can assign a Sender ID 1288 used under an old Gid value (including under a same, recycled Gid 1289 value), thus avoiding Sender ID values to irrecoverably grow in size. 1291 Even when an endpoint joining a group is recognized as a current 1292 member of that group, e.g., through the ongoing secure communication 1293 association, the Group Manager MUST assign a new Sender ID different 1294 than the one currently used by the endpoint in the group, unless the 1295 group is rekeyed first and a new Gid value is established. 1297 Figure 2 overviews the different keying material components, 1298 considering their relation and possible reuse across group rekeying. 1300 Components changed in lockstep 1301 upon a group rekeying 1302 +----------------------------+ * Changing a kid does not 1303 | | need changing the Group ID 1304 | Master Group |<--> kid1 1305 | Secret <---> o <---> ID | * A kid is not reassigned 1306 | ^ |<--> kid2 under the ongoing usage of 1307 | | | the current Group ID 1308 | | |<--> kid3 1309 | v | * Upon changing the Group ID, 1310 | Master Salt | ... ... every current kid should 1311 | (optional) | be preserved for efficient 1312 | | key rollover 1313 | The Key Generation Number | 1314 | is incremented by 1 | * After changing Group ID, an 1315 | | unused kid can be assigned 1316 +----------------------------+ 1318 Figure 2: Relations among keying material components. 1320 3.3. Responsibilities of the Group Manager 1322 The Group Manager is responsible for performing the following tasks: 1324 1. Creating and managing OSCORE groups. This includes the 1325 assignment of a Gid to every newly created group, ensuring 1326 uniqueness of Gids within the set of its OSCORE groups, and 1327 tracking the Birth Gids of current group members in each group. 1329 2. Defining policies for authorizing the joining of its OSCORE 1330 groups. 1332 3. Handling the join process to add new endpoints as group members. 1334 4. Establishing the Common Context part of the Security Context, 1335 and providing it to authorized group members during the join 1336 process, together with the corresponding Sender Context. 1338 5. Updating the Key Generation Number and the Gid of its OSCORE 1339 groups, upon renewing the respective Security Context. 1341 6. Generating and managing Sender IDs within its OSCORE groups, as 1342 well as assigning and providing them to new endpoints during the 1343 join process, or to current group members upon request of 1344 renewal or re-joining. This includes ensuring that: 1346 * Each Sender ID is unique within each of the OSCORE groups; 1348 * Each Sender ID is not reassigned within the same group since 1349 the latest time when the current Gid value was assigned to 1350 the group. That is, the Sender ID is not reassigned even to 1351 a current group member re-joining the same group, without a 1352 rekeying happening first. 1354 7. Defining communication policies for each of its OSCORE groups, 1355 and signaling them to new endpoints during the join process. 1357 8. Renewing the Security Context of an OSCORE group upon membership 1358 change, by revoking and renewing common security parameters and 1359 keying material (rekeying). 1361 9. Providing the management keying material that a new endpoint 1362 requires to participate in the rekeying process, consistently 1363 with the key management scheme used in the group joined by the 1364 new endpoint. 1366 10. Assisting a group member that has missed a group rekeying 1367 instance to understand which public keys and Recipient Contexts 1368 to delete, as associated to former group members. 1370 11. Acting as key repository, in order to handle the public keys of 1371 the members of its OSCORE groups, and providing such public keys 1372 to other members of the same group upon request. The actual 1373 storage of public keys may be entrusted to a separate secure 1374 storage device or service. 1376 12. Validating that the format and parameters of public keys of 1377 group members are consistent with the public key algorithm and 1378 related parameters used in the respective OSCORE group. 1380 The Group Manager described in [I-D.ietf-ace-key-groupcomm-oscore] 1381 provides these functionalities. 1383 4. The COSE Object 1385 Building on Section 5 of [RFC8613], this section defines how to use 1386 COSE [I-D.ietf-cose-rfc8152bis-struct] to wrap and protect data in 1387 the original message. OSCORE uses the untagged COSE_Encrypt0 1388 structure with an Authenticated Encryption with Associated Data 1389 (AEAD) algorithm. Unless otherwise specified, the following 1390 modifications apply for both the group mode and the pairwise mode of 1391 Group OSCORE. 1393 4.1. Countersignature 1395 When protecting a message in group mode, the 'unprotected' field MUST 1396 additionally include the following parameter: 1398 * COSE_CounterSignature0: its value is set to the encrypted 1399 countersignature of the COSE object, namely ENC_SIGNATURE. That 1400 is: 1402 - The countersignature of the COSE object, namely SIGNATURE, is 1403 computed by the sender as described in Sections 3.2 and 3.3 of 1404 [I-D.ietf-cose-countersign], by using its private key and 1405 according to the Signature Algorithm in the Security Context. 1407 In particular, the Countersign_structure contains the context 1408 text string "CounterSignature0", the external_aad as defined in 1409 Section 4.3 of this document, and the ciphertext of the COSE 1410 object as payload. 1412 - The encrypted countersignature, namely ENC_SIGNATURE, is 1413 computed as 1415 ENC_SIGNATURE = SIGNATURE XOR KEYSTREAM 1417 where KEYSTREAM is derived as per Section 4.1.1. 1419 4.1.1. Keystream Derivation 1421 The following defines how an endpoint derives the keystream 1422 KEYSTREAM, used to encrypt/decrypt the countersignature of an 1423 outgoing/incoming message M protected in group mode. 1425 The keystream SHALL be derived as follows, by using the HKDF 1426 Algorithm from the Common Context (see Section 3.2 of [RFC8613]), 1427 which consists of composing the HKDF-Extract and HKDF-Expand steps 1428 [RFC5869]. 1430 KEYSTREAM = HKDF(salt, IKM, info, L) 1432 The input parameters of HKDF are as follows. 1434 * salt takes as value the Partial IV (PIV) used to protect M. Note 1435 that, if M is a response, salt takes as value either: i) the fresh 1436 Partial IV generated by the server and included in the response; 1437 or ii) the same Partial IV of the request generated by the client 1438 and not included in the response. 1440 * IKM is the Group Encryption Key from the Common Context (see 1441 Section 2.1.6). 1443 * info is the serialization of a CBOR array consisting of (the 1444 notation follows [RFC8610]): 1446 info = [ 1447 id : bstr, 1448 id_context : bstr, 1449 type : bool, 1450 L: uint 1451 ] 1453 where: 1455 * id is the Sender ID of the endpoint that generated PIV. 1457 * id_context is the ID Context (Gid) used when protecting M. 1459 Note that, in case of group rekeying, a server might use a 1460 different Gid when protecting a response, compared to the Gid that 1461 it used to verify (that the client used to protect) the request, 1462 see Section 8.3. 1464 * type is the CBOR simple value True (0xf5) if M is a request, or 1465 the CBOR simple value False (0xf4) otherwise. 1467 * L is the size of the countersignature, as per Signature Algorithm 1468 from the Common Context (see Section 2.1.5), in bytes. 1470 4.1.2. Clarifications on Using a Countersignature 1472 Note that the literature commonly refers to a countersignature as a 1473 signature computed by a principal A over a document already protected 1474 by a different principal B. 1476 However, the COSE_Countersignature0 structure belongs to the set of 1477 abbreviated countersignatures defined in Sections 3.2 and 3.3 of 1478 [I-D.ietf-cose-countersign], which were designed primarily to deal 1479 with the problem of encrypted group messaging, but where it is 1480 required to know who originated the message. 1482 Since the parameters for computing or verifying the abbreviated 1483 countersignature generated by A are provided by the same context used 1484 to describe the security processing performed by B and to be 1485 countersigned, these structures are applicable also when the two 1486 principals A and B are actually the same one, like the sender of a 1487 Group OSCORE message protected in group mode. 1489 4.2. The 'kid' and 'kid context' parameters 1491 The value of the 'kid' parameter in the 'unprotected' field of 1492 response messages MUST be set to the Sender ID of the endpoint 1493 transmitting the message, if the request was protected in group mode. 1494 That is, unlike in [RFC8613], the 'kid' parameter is always present 1495 in responses to a request that was protected in group mode. 1497 The value of the 'kid context' parameter in the 'unprotected' field 1498 of requests messages MUST be set to the ID Context, i.e., the Group 1499 Identifier value (Gid) of the group. That is, unlike in [RFC8613], 1500 the 'kid context' parameter is always present in requests. 1502 4.3. external_aad 1504 The external_aad of the Additional Authenticated Data (AAD) is 1505 different compared to OSCORE [RFC8613], and is defined in this 1506 section. 1508 The same external_aad structure is used in group mode and pairwise 1509 mode for authenticated encryption/decryption (see Section 5.3 of 1510 [I-D.ietf-cose-rfc8152bis-struct]), as well as in group mode for 1511 computing and verifying the countersignature (see Section 4.4 of 1512 [I-D.ietf-cose-rfc8152bis-struct]). 1514 In particular, the external_aad includes also the Signature 1515 Algorithm, the Signature Encryption Algorithm, the Pairwise Key 1516 Agreement Algorithm, the value of the 'kid context' in the COSE 1517 object of the request, the OSCORE option of the protected message, 1518 the sender's public key, and the Group Manager's public key. 1520 The external_aad SHALL be a CBOR array wrapped in a bstr object as 1521 defined below, following the notation of [RFC8610]: 1523 external_aad = bstr .cbor aad_array 1525 aad_array = [ 1526 oscore_version : uint, 1527 algorithms : [alg_aead : int / tstr / null, 1528 alg_signature_enc : int / tstr / null, 1529 alg_signature : int / tstr / null, 1530 alg_pairwise_key_agreement : int / tstr / null], 1531 request_kid : bstr, 1532 request_piv : bstr, 1533 options : bstr, 1534 request_kid_context : bstr, 1535 OSCORE_option: bstr, 1536 sender_public_key: bstr, 1537 gm_public_key: bstr / null 1538 ] 1540 Figure 3: external_aad 1542 Compared with Section 5.4 of [RFC8613], the aad_array has the 1543 following differences. 1545 * The 'algorithms' array is extended as follows. 1547 The parameter 'alg_aead' MUST be set to the CBOR simple value Null 1548 if the group does not use the pairwise mode, regardless whether 1549 the endpoint supports the pairwise mode or not. Otherwise, this 1550 parameter MUST encode the value of AEAD Algorithm from the Common 1551 Context (see Section 2.1.1), as per Section 5.4 of [RFC8613]. 1553 Furthermore, the 'algorithms' array additionally includes: 1555 - 'alg_signature_enc', which specifies Signature Encryption 1556 Algorithm from the Common Context (see Section 2.1.5). This 1557 parameter MUST be set to the CBOR simple value Null if the 1558 group does not use the group mode, regardless whether the 1559 endpoint supports the group mode or not. Otherwise, this 1560 parameter MUST encode the value of Signature Encryption 1561 Algorithm as a CBOR integer or text string, consistently with 1562 the "Value" field in the "COSE Algorithms" Registry for this 1563 AEAD algorithm. 1565 - 'alg_signature', which specifies Signature Algorithm from the 1566 Common Context (see Section 2.1.5). This parameter MUST be set 1567 to the CBOR simple value Null if the group does not use the 1568 group mode, regardless whether the endpoint supports the group 1569 mode or not. Otherwise, this parameter MUST encode the value 1570 of Signature Algorithm as a CBOR integer or text string, 1571 consistently with the "Value" field in the "COSE Algorithms" 1572 Registry for this signature algorithm. 1574 - 'alg_pairwise_key_agreement', which specifies Pairwise Key 1575 Agreement Algorithm from the Common Context (see 1576 Section 2.1.5). This parameter MUST be set to the CBOR simple 1577 value Null if the group does not use the pairwise mode, 1578 regardless whether the endpoint supports the pairwise mode or 1579 not. Otherwise, this parameter MUST encode the value of 1580 Pairwise Key Agreement Algorithm as a CBOR integer or text 1581 string, consistently with the "Value" field in the "COSE 1582 Algorithms" Registry for this HKDF algorithm. 1584 * The new element 'request_kid_context' contains the value of the 1585 'kid context' in the COSE object of the request (see Section 4.2). 1587 In case Observe [RFC7641] is used, this enables endpoints to 1588 safely keep an observation active beyond a possible change of Gid 1589 (i.e., of ID Context), following a group rekeying (see 1590 Section 3.2). In fact, it ensures that every notification 1591 cryptographically matches with only one observation request, 1592 rather than with multiple ones that were protected with different 1593 keying material but share the same 'request_kid' and 'request_piv' 1594 values. 1596 * The new element 'OSCORE_option', containing the value of the 1597 OSCORE Option present in the protected message, encoded as a 1598 binary string. This prevents the attack described in Section 10.7 1599 when using the group mode, as further explained in Section 10.7.2. 1601 Note for implementation: this construction requires the OSCORE 1602 option of the message to be generated and finalized before 1603 computing the ciphertext of the COSE_Encrypt0 object (when using 1604 the group mode or the pairwise mode) and before calculating the 1605 countersignature (when using the group mode). Also, the aad_array 1606 needs to be large enough to contain the largest possible OSCORE 1607 option. 1609 * The new element 'sender_public_key', containing the sender's 1610 public key. This parameter MUST be set to a CBOR byte string, 1611 which encodes the sender's public key in its original binary 1612 representation made available to other endpoints in the group (see 1613 Section 2.3). 1615 * The new element 'gm_public_key', containing the Group Manager's 1616 public key. If no Group Manager maintains the group, this 1617 parameter MUST encode the CBOR simple value Null. Otherwise, this 1618 parameter MUST be set to a CBOR byte string, which encodes the 1619 Group Manager's public key in its original binary representation 1620 made available to other endpoints in the group (see Section 2.3). 1621 This prevents the attack described in Section 10.8. 1623 5. OSCORE Header Compression 1625 The OSCORE header compression defined in Section 6 of [RFC8613] is 1626 used, with the following differences. 1628 * The payload of the OSCORE message SHALL encode the ciphertext of 1629 the COSE_Encrypt0 object. In the group mode, the ciphertext above 1630 is concatenated with the value of the COSE_CounterSignature0 of 1631 the COSE object, computed as described in Section 4.1. 1633 * This document defines the usage of the sixth least significant 1634 bit, called "Group Flag", in the first byte of the OSCORE option 1635 containing the OSCORE flag bits. This flag bit is specified in 1636 Section 11.1. 1638 * The Group Flag MUST be set to 1 if the OSCORE message is protected 1639 using the group mode (see Section 8). 1641 * The Group Flag MUST be set to 0 if the OSCORE message is protected 1642 using the pairwise mode (see Section 9). The Group Flag MUST also 1643 be set to 0 for ordinary OSCORE messages processed according to 1644 [RFC8613]. 1646 5.1. Examples of Compressed COSE Objects 1648 This section covers a list of OSCORE Header Compression examples of 1649 Group OSCORE used in group mode (see Section 5.1.1) or in pairwise 1650 mode (see Section 5.1.2). 1652 The examples assume that the COSE_Encrypt0 object is set (which means 1653 the CoAP message and cryptographic material is known). Note that the 1654 examples do not include the full CoAP unprotected message or the full 1655 Security Context, but only the input necessary to the compression 1656 mechanism, i.e., the COSE_Encrypt0 object. The output is the 1657 compressed COSE object as defined in Section 5 and divided into two 1658 parts, since the object is transported in two CoAP fields: OSCORE 1659 option and payload. 1661 The examples assume that the plaintext (see Section 5.3 of [RFC8613]) 1662 is 6 bytes long, and that the AEAD tag is 8 bytes long, hence 1663 resulting in a ciphertext which is 14 bytes long. When using the 1664 group mode, the COSE_CounterSignature0 byte string as described in 1665 Section 4 is assumed to be 64 bytes long. 1667 5.1.1. Examples in Group Mode 1669 * Request with ciphertext = 0xaea0155667924dff8a24e4cb35b9, kid = 1670 0x25, Partial IV = 5 and kid context = 0x44616c. 1672 * Before compression (96 bytes): 1674 [ 1675 h'', 1676 { 4:h'25', 6:h'05', 10:h'44616c', 11:h'de9e ... f1' }, 1677 h'aea0155667924dff8a24e4cb35b9' 1678 ] 1680 * After compression (85 bytes): 1682 Flag byte: 0b00111001 = 0x39 (1 byte) 1684 Option Value: 0x39 05 03 44 61 6c 25 (7 bytes) 1686 Payload: 0xaea0155667924dff8a24e4cb35b9 de9e ... f1 1687 (14 bytes + size of the encrypted countersignature) 1689 * Response with ciphertext = 0x60b035059d9ef5667c5a0710823b, kid = 1690 0x52 and no Partial IV. 1692 * Before compression (88 bytes): 1694 [ 1695 h'', 1696 { 4:h'52', 11:h'ca1e ... b3' }, 1697 h'60b035059d9ef5667c5a0710823b' 1698 ] 1700 * After compression (80 bytes): 1702 Flag byte: 0b00101000 = 0x28 (1 byte) 1704 Option Value: 0x28 52 (2 bytes) 1706 Payload: 0x60b035059d9ef5667c5a0710823b ca1e ... b3 1707 (14 bytes + size of the encrypted countersignature) 1709 5.1.2. Examples in Pairwise Mode 1711 * Request with ciphertext = 0xaea0155667924dff8a24e4cb35b9, kid = 1712 0x25, Partial IV = 5 and kid context = 0x44616c. 1714 * Before compression (29 bytes): 1716 [ 1717 h'', 1718 { 4:h'25', 6:h'05', 10:h'44616c' }, 1719 h'aea0155667924dff8a24e4cb35b9' 1720 ] 1722 * After compression (21 bytes): 1724 Flag byte: 0b00011001 = 0x19 (1 byte) 1726 Option Value: 0x19 05 03 44 61 6c 25 (7 bytes) 1728 Payload: 0xaea0155667924dff8a24e4cb35b9 (14 bytes) 1730 * Response with ciphertext = 0x60b035059d9ef5667c5a0710823b and no 1731 Partial IV. 1733 * Before compression (18 bytes): 1735 [ 1736 h'', 1737 {}, 1738 h'60b035059d9ef5667c5a0710823b' 1739 ] 1741 * After compression (14 bytes): 1743 Flag byte: 0b00000000 = 0x00 (1 byte) 1745 Option Value: 0x (0 bytes) 1747 Payload: 0x60b035059d9ef5667c5a0710823b (14 bytes) 1749 6. Message Binding, Sequence Numbers, Freshness and Replay Protection 1751 The requirements and properties described in Section 7 of [RFC8613] 1752 also apply to Group OSCORE. In particular, Group OSCORE provides 1753 message binding of responses to requests, which enables absolute 1754 freshness of responses that are not notifications, relative freshness 1755 of requests and notification responses, and replay protection of 1756 requests. In addition, the following holds for Group OSCORE. 1758 6.1. Supporting Observe 1760 When Observe [RFC7641] is used, a client maintains for each ongoing 1761 observation one Notification Number for each different server. Then, 1762 separately for each server, the client uses the associated 1763 Notification Number to perform ordering and replay protection of 1764 notifications received from that server (see Section 8.4.1). 1766 Group OSCORE allows to preserve an observation active indefinitely, 1767 even in case the group is rekeyed, with consequent change of ID 1768 Context, or in case the observer client obtains a new Sender ID. 1770 As defined in Section 8 when discussing support for Observe, this is 1771 achieved by the client and server(s) storing the 'kid' and 'kid 1772 context' used in the original Observe request, throughout the whole 1773 duration of the observation. 1775 Upon leaving the group or before re-joining the group, a group member 1776 MUST terminate all the ongoing observations that it has started in 1777 the group as observer client. 1779 6.2. Update of Replay Window 1781 Sender Sequence Numbers seen by a server as Partial IV values in 1782 request messages can spontaneously increase at a fast pace, for 1783 example when a client exchanges unicast messages with other servers 1784 using the Group OSCORE Security Context. As in OSCORE [RFC8613], a 1785 server always needs to accept such increases and accordingly updates 1786 the Replay Window in each of its Recipient Contexts. 1788 As discussed in Section 2.5.1, a newly created Recipient Context 1789 would have an invalid Replay Window, if its installation has required 1790 to delete another Recipient Context. Hence, the server is not able 1791 to verify if a request from the client associated to the new 1792 Recipient Context is a replay. When this happens, the server MUST 1793 validate the Replay Window of the new Recipient Context, before 1794 accepting messages from the associated client (see Section 2.5.1). 1796 Furthermore, when the Group Manager establishes a new Security 1797 Context for the group (see Section 2.5.3.2), every server re- 1798 initializes the Replay Window in each of its Recipient Contexts. 1800 6.3. Message Freshness 1802 When receiving a request from a client for the first time, the server 1803 is not synchronized with the client's Sender Sequence Number, i.e., 1804 it is not able to verify if that request is fresh. This applies to a 1805 server that has just joined the group, with respect to already 1806 present clients, and recurs as new clients are added as group 1807 members. 1809 During its operations in the group, the server may also lose 1810 synchronization with a client's Sender Sequence Number. This can 1811 happen, for instance, if the server has rebooted or has deleted its 1812 previously synchronized version of the Recipient Context for that 1813 client (see Section 2.5.1). 1815 If the application requires message freshness, e.g., according to 1816 time- or event-based policies, the server has to (re-)synchronize 1817 with a client's Sender Sequence Number before delivering request 1818 messages from that client to the application. To this end, the 1819 server can use the approach in Appendix E based on the Echo Option 1820 for CoAP [I-D.ietf-core-echo-request-tag], as a variant of the 1821 approach defined in Appendix B.1.2 of [RFC8613] applicable to Group 1822 OSCORE. 1824 7. Message Reception 1826 Upon receiving a protected message, a recipient endpoint retrieves a 1827 Security Context as in [RFC8613]. An endpoint MUST be able to 1828 distinguish between a Security Context to process OSCORE messages as 1829 in [RFC8613] and a Group OSCORE Security Context to process Group 1830 OSCORE messages as defined in this document. 1832 To this end, an endpoint can take into account the different 1833 structure of the Security Context defined in Section 2, for example 1834 based on the presence of Signature Algorithm and/or Pairwise Key 1835 Agreement Algorithm in the Common Context. Alternatively 1836 implementations can use an additional parameter in the Security 1837 Context, to explicitly signal that it is intended for processing 1838 Group OSCORE messages. 1840 If either of the following conditions holds, a recipient endpoint 1841 MUST discard the incoming protected message: 1843 * The Group Flag is set to 0, and the recipient endpoint retrieves a 1844 Security Context which is both valid to process the message and 1845 also associated to an OSCORE group, but the endpoint does not 1846 support the pairwise mode. 1848 * The Group Flag is set to 1, and the recipient endpoint retrieves a 1849 Security Context which is both valid to process the message and 1850 also associated to an OSCORE group, but the endpoint does not 1851 support the group mode. 1853 * The Group Flag is set to 1, and the recipient endpoint can not 1854 retrieve a Security Context which is both valid to process the 1855 message and also associated to an OSCORE group. 1857 As per Section 6.1 of [RFC8613], this holds also when retrieving a 1858 Security Context which is valid but not associated to an OSCORE 1859 group. Future specifications may define how to process incoming 1860 messages protected with a Security Contexts as in [RFC8613], when 1861 the Group Flag bit is set to 1. 1863 Otherwise, if a Security Context associated to an OSCORE group and 1864 valid to process the message is retrieved, the recipient endpoint 1865 processes the message with Group OSCORE, using the group mode (see 1866 Section 8) if the Group Flag is set to 1, or the pairwise mode (see 1867 Section 9) if the Group Flag is set to 0. 1869 Note that, if the Group Flag is set to 0, and the recipient endpoint 1870 retrieves a Security Context which is valid to process the message 1871 but is not associated to an OSCORE group, then the message is 1872 processed according to [RFC8613]. 1874 8. Message Processing in Group Mode 1876 When using the group mode, messages are protected and processed as 1877 specified in [RFC8613], with the modifications described in this 1878 section. The security objectives of the group mode are discussed in 1879 Appendix A.2. 1881 The Group Manager indicates that the group uses (also) the group 1882 mode, as part of the group data provided to candidate group members 1883 when joining the group. 1885 During all the steps of the message processing, an endpoint MUST use 1886 the same Security Context for the considered group. That is, an 1887 endpoint MUST NOT install a new Security Context for that group (see 1888 Section 2.5.3.2) until the message processing is completed. 1890 The group mode MUST be used to protect group requests intended for 1891 multiple recipients or for the whole group. This includes both 1892 requests directly addressed to multiple recipients, e.g., sent by the 1893 client over multicast, as well as requests sent by the client over 1894 unicast to a proxy, that forwards them to the intended recipients 1895 over multicast [I-D.ietf-core-groupcomm-bis]. For encryption and 1896 decryption operations, the Signature Encryption Algorithm from the 1897 Common Context is used. 1899 As per [RFC7252][I-D.ietf-core-groupcomm-bis], group requests sent 1900 over multicast MUST be Non-Confirmable, and thus are not 1901 retransmitted by the CoAP messaging layer. Instead, applications 1902 should store such outgoing messages for a predefined, sufficient 1903 amount of time, in order to correctly perform possible 1904 retransmissions at the application layer. According to Section 5.2.3 1905 of [RFC7252], responses to Non-Confirmable group requests SHOULD also 1906 be Non-Confirmable, but endpoints MUST be prepared to receive 1907 Confirmable responses in reply to a Non-Confirmable group request. 1908 Confirmable group requests are acknowledged in non-multicast 1909 environments, as specified in [RFC7252]. 1911 Furthermore, endpoints in the group locally perform error handling 1912 and processing of invalid messages according to the same principles 1913 adopted in [RFC8613]. However, a recipient MUST stop processing and 1914 silently reject any message which is malformed and does not follow 1915 the format specified in Section 4 of this document, or which is not 1916 cryptographically validated in a successful way. In either case, it 1917 is RECOMMENDED that the recipient does not send back any error 1918 message. This prevents servers from replying with multiple error 1919 messages to a client sending a group request, so avoiding the risk of 1920 flooding and possibly congesting the network. 1922 8.1. Protecting the Request 1924 A client transmits a secure group request as described in Section 8.1 1925 of [RFC8613], with the following modifications. 1927 * In step 2, the Additional Authenticated Data is modified as 1928 described in Section 4 of this document. 1930 * In step 4, the encryption of the COSE object is modified as 1931 described in Section 4 of this document. The encoding of the 1932 compressed COSE object is modified as described in Section 5 of 1933 this document. In particular, the Group Flag MUST be set to 1. 1934 The Signature Encryption Algorithm from the Common Context MUST be 1935 used. 1937 * In step 5, the countersignature is computed and the format of the 1938 OSCORE message is modified as described in Section 4 and Section 5 1939 of this document. In particular the payload of the OSCORE message 1940 includes also the encrypted countersignature (see Section 4.1). 1942 8.1.1. Supporting Observe 1944 If Observe [RFC7641] is supported, the following holds for each newly 1945 started observation. 1947 * If the client intends to keep the observation active beyond a 1948 possible change of Sender ID, the client MUST store the value of 1949 the 'kid' parameter from the original Observe request, and retain 1950 it for the whole duration of the observation. Even in case the 1951 client is individually rekeyed and receives a new Sender ID from 1952 the Group Manager (see Section 2.5.3.1), the client MUST NOT 1953 update the stored value associated to a particular Observe 1954 request. 1956 * If the client intends to keep the observation active beyond a 1957 possible change of ID Context following a group rekeying (see 1958 Section 3.2), then the following applies. 1960 - The client MUST store the value of the 'kid context' parameter 1961 from the original Observe request, and retain it for the whole 1962 duration of the observation. Upon establishing a new Security 1963 Context with a new Gid as ID Context (see Section 2.5.3.2), the 1964 client MUST NOT update the stored value associated to a 1965 particular Observe request. 1967 - The client MUST store an invariant identifier of the group, 1968 which is immutable even in case the Security Context of the 1969 group is re-established. For example, this invariant 1970 identifier can be the "group name" in 1971 [I-D.ietf-ace-key-groupcomm-oscore], where it is used for 1972 joining the group and retrieving the current group keying 1973 material from the Group Manager. 1975 After a group rekeying, such an invariant information makes it 1976 simpler for the observer client to retrieve the current group 1977 keying material from the Group Manager, in case the client has 1978 missed both the rekeying messages and the first observe 1979 notification protected with the new Security Context (see 1980 Section 8.3.1). 1982 8.2. Verifying the Request 1984 Upon receiving a secure group request with the Group Flag set to 1, 1985 following the procedure in Section 7, a server proceeds as described 1986 in Section 8.2 of [RFC8613], with the following modifications. 1988 * In step 2, the decoding of the compressed COSE object follows 1989 Section 5 of this document. In particular: 1991 - If the server discards the request due to not retrieving a 1992 Security Context associated to the OSCORE group, the server MAY 1993 respond with a 4.01 (Unauthorized) error message. When doing 1994 so, the server MAY set an Outer Max-Age option with value zero, 1995 and MAY include a descriptive string as diagnostic payload. 1997 - If the received 'kid context' matches an existing ID Context 1998 (Gid) but the received 'kid' does not match any Recipient ID in 1999 this Security Context, then the server MAY create a new 2000 Recipient Context for this Recipient ID and initialize it 2001 according to Section 3 of [RFC8613], and also retrieve the 2002 associated public key. Such a configuration is application 2003 specific. If the application does not specify dynamic 2004 derivation of new Recipient Contexts, then the server SHALL 2005 stop processing the request. 2007 * In step 4, the Additional Authenticated Data is modified as 2008 described in Section 4 of this document. 2010 * In step 6, the server also verifies the countersignature using the 2011 public key of the client from the associated Recipient Context. 2012 In particular: 2014 - If the server does not have the public key of the client yet, 2015 the server MUST stop processing the request and MAY respond 2016 with a 5.03 (Service Unavailable) response. The response MAY 2017 include a Max-Age Option, indicating to the client the number 2018 of seconds after which to retry. If the Max-Age Option is not 2019 present, a retry time of 60 seconds will be assumed by the 2020 client, as default value defined in Section 5.10.5 of 2021 [RFC7252]. 2023 - The server retrieves the encrypted countersignature 2024 ENC_SIGNATURE from the message payload, and computes the 2025 original countersignature SIGNATURE as 2027 SIGNATURE = ENC_SIGNATURE XOR KEYSTREAM 2029 where KEYSTREAM is derived as per Section 4.1.1. 2031 The following verification applies to the original 2032 countersignature SIGNATURE. 2034 - The server MUST perform signature verification before 2035 decrypting the COSE object. Implementations that cannot 2036 perform the two steps in this order MUST ensure that no access 2037 to the plaintext is possible before a successful signature 2038 verification and MUST prevent any possible leak of time-related 2039 information that can yield side-channel attacks. 2041 - If the signature verification fails, the server SHALL stop 2042 processing the request, SHALL NOT update the Replay Window, and 2043 MAY respond with a 4.00 (Bad Request) response. The server MAY 2044 set an Outer Max-Age option with value zero. The diagnostic 2045 payload MAY contain a string, which, if present, MUST be 2046 "Decryption failed" as if the decryption had failed. 2048 - When decrypting the COSE object using the Recipient Key, the 2049 Signature Encryption Algorithm from the Common Context MUST be 2050 used. 2052 * Additionally, if the used Recipient Context was created upon 2053 receiving this group request and the message is not verified 2054 successfully, the server MAY delete that Recipient Context. Such 2055 a configuration, which is specified by the application, mitigates 2056 attacks that aim at overloading the server's storage. 2058 A server SHOULD NOT process a request if the received Recipient ID 2059 ('kid') is equal to its own Sender ID in its own Sender Context. For 2060 an example where this is not fulfilled, see Sections 7.2.1 and 7.2.4 2061 of [I-D.ietf-core-observe-multicast-notifications]. 2063 8.2.1. Supporting Observe 2065 If Observe [RFC7641] is supported, the following holds for each newly 2066 started observation. 2068 * The server MUST store the value of the 'kid' parameter from the 2069 original Observe request, and retain it for the whole duration of 2070 the observation. The server MUST NOT update the stored value of a 2071 'kid' parameter associated to a particular Observe request, even 2072 in case the observer client is individually rekeyed and starts 2073 using a new Sender ID received from the Group Manager (see 2074 Section 2.5.3.1). 2076 * The server MUST store the value of the 'kid context' parameter 2077 from the original Observe request, and retain it for the whole 2078 duration of the observation, beyond a possible change of ID 2079 Context following a group rekeying (see Section 3.2). That is, 2080 upon establishing a new Security Context with a new Gid as ID 2081 Context (see Section 2.5.3.2), the server MUST NOT update the 2082 stored value associated to the ongoing observation. 2084 8.3. Protecting the Response 2086 If a server generates a CoAP message in response to a Group OSCORE 2087 request, then the server SHALL follow the description in Section 8.3 2088 of [RFC8613], with the modifications described in this section. 2090 Note that the server always protects a response with the Sender 2091 Context from its latest Security Context, and that establishing a new 2092 Security Context resets the Sender Sequence Number to 0 (see 2093 Section 3.2). 2095 * In step 2, the Additional Authenticated Data is modified as 2096 described in Section 4 of this document. 2098 * In step 3, if the server is using a different Security Context for 2099 the response compared to what was used to verify the request (see 2100 Section 3.2), then the server MUST include its Sender Sequence 2101 Number as Partial IV in the response and use it to build the AEAD 2102 nonce to protect the response. This prevents the AEAD nonce from 2103 the request from being reused. 2105 * In step 4, the encryption of the COSE object is modified as 2106 described in Section 4 of this document. The encoding of the 2107 compressed COSE object is modified as described in Section 5 of 2108 this document. In particular, the Group Flag MUST be set to 1. 2109 The Signature Encryption Algorithm from the Common Context MUST be 2110 used. 2112 If the server is using a different ID Context (Gid) for the 2113 response compared to what was used to verify the request (see 2114 Section 3.2), then the new ID Context MUST be included in the 'kid 2115 context' parameter of the response. 2117 The server can obtain a new Sender ID from the Group Manager, when 2118 individually rekeyed (see Section 2.5.3.1) or when re-joining the 2119 group. In such a case, the server can help the client to 2120 synchronize, by including the 'kid' parameter in a response 2121 protected in group mode, even when the request was protected in 2122 pairwise mode (see Section 9.3). 2124 That is, when responding to a request protected in pairwise mode, 2125 the server SHOULD include the 'kid' parameter in a response 2126 protected in group mode, if it is replying to that client for the 2127 first time since the assignment of its new Sender ID. 2129 * In step 5, the countersignature is computed and the format of the 2130 OSCORE message is modified as described in Section 4 and Section 5 2131 of this document. In particular the payload of the OSCORE message 2132 includes also the encrypted countersignature (see Section 4.1). 2134 8.3.1. Supporting Observe 2136 If Observe [RFC7641] is supported, the following holds when 2137 protecting notifications for an ongoing observation. 2139 * The server MUST use the stored value of the 'kid' parameter from 2140 the original Observe request (see Section 8.2.1), as value for the 2141 'request_kid' parameter in the external_aad structure (see 2142 Section 4.3). 2144 * The server MUST use the stored value of the 'kid context' 2145 parameter from the original Observe request (see Section 8.2.1), 2146 as value for the 'request_kid_context' parameter in the 2147 external_aad structure (see Section 4.3). 2149 Furthermore, the server may have ongoing observations started by 2150 Observe requests protected with an old Security Context. After 2151 completing the establishment of a new Security Context, the server 2152 MUST protect the following notifications with the Sender Context of 2153 the new Security Context. 2155 For each ongoing observation, the server can help the client to 2156 synchronize, by including also the 'kid context' parameter in 2157 notifications following a group rekeying, with value set to the ID 2158 Context (Gid) of the new Security Context. 2160 If there is a known upper limit to the duration of a group rekeying, 2161 the server SHOULD include the 'kid context' parameter during that 2162 time. Otherwise, the server SHOULD include it until the Max-Age has 2163 expired for the last notification sent before the installation of the 2164 new Security Context. 2166 8.4. Verifying the Response 2168 Upon receiving a secure response message with the Group Flag set to 2169 1, following the procedure in Section 7, the client proceeds as 2170 described in Section 8.4 of [RFC8613], with the following 2171 modifications. 2173 Note that a client may receive a response protected with a Security 2174 Context different from the one used to protect the corresponding 2175 request, and that, upon the establishment of a new Security Context, 2176 the client re-initializes its Replay Windows in its Recipient 2177 Contexts (see Section 3.2). 2179 * In step 2, the decoding of the compressed COSE object is modified 2180 as described in Section 5 of this document. In particular, a 2181 'kid' may not be present, if the response is a reply to a request 2182 protected in pairwise mode. In such a case, the client assumes 2183 the response 'kid' to be the Recipient ID for the server to which 2184 the request protected in pairwise mode was intended for. 2186 If the response 'kid context' matches an existing ID Context (Gid) 2187 but the received/assumed 'kid' does not match any Recipient ID in 2188 this Security Context, then the client MAY create a new Recipient 2189 Context for this Recipient ID and initialize it according to 2190 Section 3 of [RFC8613], and also retrieve the associated public 2191 key. If the application does not specify dynamic derivation of 2192 new Recipient Contexts, then the client SHALL stop processing the 2193 response. 2195 * In step 3, the Additional Authenticated Data is modified as 2196 described in Section 4 of this document. 2198 * In step 5, the client also verifies the countersignature using the 2199 public key of the server from the associated Recipient Context. 2200 In particular: 2202 - The client MUST perform signature verification before 2203 decrypting the COSE object. Implementations that cannot 2204 perform the two steps in this order MUST ensure that no access 2205 to the plaintext is possible before a successful signature 2206 verification and MUST prevent any possible leak of time-related 2207 information that can yield side-channel attacks. 2209 - The client retrieves the encrypted countersignature 2210 ENC_SIGNATURE from the message payload, and computes the 2211 original countersignature SIGNATURE as 2213 SIGNATURE = ENC_SIGNATURE XOR KEYSTREAM 2215 where KEYSTREAM is derived as per Section 4.1.1. 2217 The following verification applies to the original 2218 countersignature SIGNATURE. 2220 - If the verification of the countersignature fails, the server 2221 SHALL stop processing the response, and SHALL NOT update the 2222 Notification Number associated to the server if the response is 2223 an Observe notification [RFC7641]. 2225 - After a successful verification of the countersignature, the 2226 client performs also the following actions if the response is 2227 not an Observe notification. 2229 o In case the request was protected in pairwise mode and the 2230 'kid' parameter is present in the response, the client 2231 checks whether this received 'kid' is equal to the expected 2232 'kid', i.e., the known Recipient ID for the server to which 2233 the request was intended for. 2235 o If this is not the case, the client checks whether the 2236 server that has sent the response is the same one to which 2237 the request was intended for. This can be done by checking 2238 that the public key used to verify the countersignature of 2239 the response is equal to the Recipient Public Key taken as 2240 input to derive the Pairwise Sender Key used for protecting 2241 the request (see Section 2.4.1). 2243 o If the client determines that the response has come from a 2244 different server than the expected one, then the client 2245 SHALL discard the response and SHALL NOT deliver it to the 2246 application. Otherwise, the client hereafter considers the 2247 received 'kid' as the current Recipient ID for the server. 2249 - When decrypting the COSE object using the Recipient Key, the 2250 Signature Encryption Algorithm from the Common Context MUST be 2251 used. 2253 * Additionally, if the used Recipient Context was created upon 2254 receiving this response and the message is not verified 2255 successfully, the client MAY delete that Recipient Context. Such 2256 a configuration, which is specified by the application, mitigates 2257 attacks that aim at overloading the client's storage. 2259 8.4.1. Supporting Observe 2261 If Observe [RFC7641] is supported, the following holds when verifying 2262 notifications for an ongoing observation. 2264 * The client MUST use the stored value of the 'kid' parameter from 2265 the original Observe request (see Section 8.1.1), as value for the 2266 'request_kid' parameter in the external_aad structure (see 2267 Section 4.3). 2269 * The client MUST use the stored value of the 'kid context' 2270 parameter from the original Observe request (see Section 8.1.1), 2271 as value for the 'request_kid_context' parameter in the 2272 external_aad structure (see Section 4.3). 2274 This ensures that the client can correctly verify notifications, even 2275 in case it is individually rekeyed and starts using a new Sender ID 2276 received from the Group Manager (see Section 2.5.3.1), as well as 2277 when it installs a new Security Context with a new ID Context (Gid) 2278 following a group rekeying (see Section 3.2). 2280 * The ordering and the replay protection of notifications received 2281 from a server are performed as per Sections 4.1.3.5.2 and 7.4.1 of 2282 [RFC8613], by using the Notification Number associated to that 2283 server for the observation in question. In addition, the client 2284 performs the following actions for each ongoing observation. 2286 - When receiving the first valid notification from a server, the 2287 client MUST store the current kid "kid1" of that server for the 2288 observation in question. If the 'kid' field is included in the 2289 OSCORE option of the notification, its value specifies "kid1". 2290 If the Observe request was protected in pairwise mode (see 2291 Section 9.3), the 'kid' field may not be present in the OSCORE 2292 option of the notification (see Section 4.2). In this case, 2293 the client assumes "kid1" to be the Recipient ID for the server 2294 to which the Observe request was intended for. 2296 - When receiving another valid notification from the same server 2297 - which can be identified and recognized through the same 2298 public key used to verify the countersignature - the client 2299 determines the current kid "kid2" of the server as above for 2300 "kid1", and MUST check whether "kid2" is equal to the stored 2301 "kid1". If "kid1" and "kid2" are different, the client MUST 2302 cancel or re-register the observation in question. 2304 Note that, if "kid2" is different from "kid1" and the 'kid' 2305 field is omitted from the notification - which is possible if 2306 the Observe request was protected in pairwise mode - then the 2307 client will compute a wrong keystream to decrypt the 2308 countersignature (i.e., by using "kid1" rather than "kid2" in 2309 the 'id' field of the 'info' array in Section 4.1.1), thus 2310 subsequently failing to verify the countersignature and 2311 discarding the notification. 2313 This ensures that the client remains able to correctly perform the 2314 ordering and replay protection of notifications, even in case a 2315 server legitimately starts using a new Sender ID, as received from 2316 the Group Manager when individually rekeyed (see Section 2.5.3.1) or 2317 when re-joining the group. 2319 8.5. External Signature Checkers 2321 When receiving a message protected in group mode, a signature checker 2322 (see Section 3.1) proceeds as follows. 2324 * The signature checker retrieves the encrypted countersignature 2325 ENC_SIGNATURE from the message payload, and computes the original 2326 countersignature SIGNATURE as 2328 SIGNATURE = ENC_SIGNATURE XOR KEYSTREAM 2330 where KEYSTREAM is derived as per Section 4.1.1. 2332 * The signature checker verifies the original countersignature 2333 SIGNATURE, by using the public key of the sender endpoint. The 2334 signature checker determines the public key to use based on the ID 2335 Context (Gid) and the Sender ID of the sender endpoint. 2337 Note that the following applies when attempting to verify the 2338 countersignature of a response message. 2340 * The response may not include a Partial IV and/or an ID Context. 2341 In such a case, the signature checker considers the same values 2342 from the corresponding request, i.e., the request matching with 2343 the response by CoAP Token value. 2345 * The response may not include a Sender ID. This can happen when 2346 the response protected in group mode matches a request protected 2347 in pairwise mode (see Section 9.1), with a case in point provided 2348 by [I-D.amsuess-core-cachable-oscore]. In such a case, the 2349 signature checker needs to use other means (e.g., source 2350 addressing information of the server endpoint) to identify the 2351 correct public key to use for verifying the countersignature of 2352 the response. 2354 The particular actions following a successful or unsuccessful 2355 verification of the countersignature are application specific and out 2356 of the scope of this document. 2358 9. Message Processing in Pairwise Mode 2360 When using the pairwise mode of Group OSCORE, messages are protected 2361 and processed as in [RFC8613], with the modifications described in 2362 this section. The security objectives of the pairwise mode are 2363 discussed in Appendix A.2. 2365 The pairwise mode takes advantage of an existing Security Context for 2366 the group mode to establish a Security Context shared exclusively 2367 with any other member. In order to use the pairwise mode in a group 2368 that uses also the group mode, the signature scheme of the group mode 2369 MUST support a combined signature and encryption scheme. This can 2370 be, for example, signature using ECDSA, and encryption using AES-CCM 2371 with a key derived with ECDH. For encryption and decryption 2372 operations, the AEAD Algorithm from the Common Context is used (see 2373 Section 2.1.1). 2375 The pairwise mode does not support the use of additional entities 2376 acting as verifiers of source authentication and integrity of group 2377 messages, such as intermediary gateways (see Section 3). 2379 An endpoint implementing only a silent server does not support the 2380 pairwise mode. 2382 If the signature algorithm used in the group supports ECDH (e.g., 2383 ECDSA, EdDSA), the pairwise mode MUST be supported by endpoints that 2384 use the CoAP Echo Option [I-D.ietf-core-echo-request-tag] and/or 2385 block-wise transfers [RFC7959], for instance for responses after the 2386 first block-wise request, which possibly targets all servers in the 2387 group and includes the CoAP Block2 option (see Section 3.8 of 2388 [I-D.ietf-core-groupcomm-bis]). This prevents the attack described 2389 in Section 10.9, which leverages requests sent over unicast to a 2390 single group member and protected with the group mode. 2392 Senders cannot use the pairwise mode to protect a message intended 2393 for multiple recipients. In fact, the pairwise mode is defined only 2394 between two endpoints and the keying material is thus only available 2395 to one recipient. 2397 However, a sender can use the pairwise mode to protect a message sent 2398 to (but not intended for) multiple recipients, if interested in a 2399 response from only one of them. For instance, this is useful to 2400 support the address discovery service defined in Section 9.1, when a 2401 single 'kid' value is indicated in the payload of a request sent to 2402 multiple recipients, e.g., over multicast. 2404 The Group Manager indicates that the group uses (also) the pairwise 2405 mode, as part of the group data provided to candidate group members 2406 when joining the group. 2408 9.1. Pre-Conditions 2410 In order to protect an outgoing message in pairwise mode, the sender 2411 needs to know the public key and the Recipient ID for the recipient 2412 endpoint, as stored in the Recipient Context associated to that 2413 endpoint (see Section 2.4.4). 2415 Furthermore, the sender needs to know the individual address of the 2416 recipient endpoint. This information may not be known at any given 2417 point in time. For instance, right after having joined the group, a 2418 client may know the public key and Recipient ID for a given server, 2419 but not the addressing information required to reach it with an 2420 individual, one-to-one request. 2422 To make addressing information of individual endpoints available, 2423 servers in the group MAY expose a resource to which a client can send 2424 a group request targeting a set of servers, identified by their 'kid' 2425 values specified in the request payload. The specified set may be 2426 empty, hence identifying all the servers in the group. Further 2427 details of such an interface are out of scope for this document. 2429 9.2. Main Differences from OSCORE 2431 The pairwise mode protects messages between two members of a group, 2432 essentially following [RFC8613], but with the following notable 2433 differences. 2435 * The 'kid' and 'kid context' parameters of the COSE object are used 2436 as defined in Section 4.2 of this document. 2438 * The external_aad defined in Section 4.3 of this document is used 2439 for the encryption process. 2441 * The Pairwise Sender/Recipient Keys used as Sender/Recipient keys 2442 are derived as defined in Section 2.4 of this document. 2444 9.3. Protecting the Request 2446 When using the pairwise mode, the request is protected as defined in 2447 Section 8.1 of [RFC8613], with the differences summarized in 2448 Section 9.2 of this document. The following difference also applies. 2450 * If Observe [RFC7641] is supported, what defined in Section 8.1.1 2451 of this document holds. 2453 9.4. Verifying the Request 2455 Upon receiving a request with the Group Flag set to 0, following the 2456 procedure in Section 7, the server MUST process it as defined in 2457 Section 8.2 of [RFC8613], with the differences summarized in 2458 Section 9.2 of this document. The following differences also apply. 2460 * If the server discards the request due to not retrieving a 2461 Security Context associated to the OSCORE group or to not 2462 supporting the pairwise mode, the server MAY respond with a 4.01 2463 (Unauthorized) error message or a 4.02 (Bad Option) error message, 2464 respectively. When doing so, the server MAY set an Outer Max-Age 2465 option with value zero, and MAY include a descriptive string as 2466 diagnostic payload. 2468 * If a new Recipient Context is created for this Recipient ID, new 2469 Pairwise Sender/Recipient Keys are also derived (see 2470 Section 2.4.1). The new Pairwise Sender/Recipient Keys are 2471 deleted if the Recipient Context is deleted as a result of the 2472 message not being successfully verified. 2474 * If Observe [RFC7641] is supported, what defined in Section 8.2.1 2475 of this document holds. 2477 9.5. Protecting the Response 2479 When using the pairwise mode, a response is protected as defined in 2480 Section 8.3 of [RFC8613], with the differences summarized in 2481 Section 9.2 of this document. The following differences also apply. 2483 * If the server is using a different Security Context for the 2484 response compared to what was used to verify the request (see 2485 Section 3.2), then the server MUST include its Sender Sequence 2486 Number as Partial IV in the response and use it to build the AEAD 2487 nonce to protect the response. This prevents the AEAD nonce from 2488 the request from being reused. 2490 * If the server is using a different ID Context (Gid) for the 2491 response compared to what was used to verify the request (see 2492 Section 3.2), then the new ID Context MUST be included in the 'kid 2493 context' parameter of the response. 2495 * The server can obtain a new Sender ID from the Group Manager, when 2496 individually rekeyed (see Section 2.5.3.1) or when re-joining the 2497 group. In such a case, the server can help the client to 2498 synchronize, by including the 'kid' parameter in a response 2499 protected in pairwise mode, even when the request was also 2500 protected in pairwise mode. 2502 That is, when responding to a request protected in pairwise mode, 2503 the server SHOULD include the 'kid' parameter in a response 2504 protected in pairwise mode, if it is replying to that client for 2505 the first time since the assignment of its new Sender ID. 2507 * If Observe [RFC7641] is supported, what defined in Section 8.3.1 2508 of this document holds. 2510 9.6. Verifying the Response 2512 Upon receiving a response with the Group Flag set to 0, following the 2513 procedure in Section 7, the client MUST process it as defined in 2514 Section 8.4 of [RFC8613], with the differences summarized in 2515 Section 9.2 of this document. The following differences also apply. 2517 * The client may receive a response protected with a Security 2518 Context different from the one used to protect the corresponding 2519 request. Also, upon the establishment of a new Security Context, 2520 the client re-initializes its Replay Windows in its Recipient 2521 Contexts (see Section 3.2). 2523 * The same as described in Section 8.4 holds with respect to 2524 handling the 'kid' parameter of the response, when received as a 2525 reply to a request protected in pairwise mode. The client can 2526 also in this case check whether the replying server is the 2527 expected one, by relying on the server's public key. However, 2528 since the response is protected in pairwise mode, the public key 2529 is not used for verifying a countersignature as in Section 8.4, 2530 but rather as input to derive the Pairwise Recipient Key used to 2531 decrypt and verify the response (see Section 2.4.1). 2533 * If a new Recipient Context is created for this Recipient ID, new 2534 Pairwise Sender/Recipient Keys are also derived (see 2535 Section 2.4.1). The new Pairwise Sender/Recipient Keys are 2536 deleted if the Recipient Context is deleted as a result of the 2537 message not being successfully verified. 2539 * If Observe [RFC7641] is supported, what defined in Section 8.4.1 2540 of this document holds. The client can also in this case identify 2541 a server to be the same one across a change of Sender ID, by 2542 relying on the server's public key. However, since the 2543 notification is protected in pairwise mode, the public key is not 2544 used for verifying a countersignature as in Section 8.4, but 2545 rather as input to derive the Pairwise Recipient Key used to 2546 decrypt and verify the notification (see Section 2.4.1). 2548 10. Security Considerations 2550 The same threat model discussed for OSCORE in Appendix D.1 of 2551 [RFC8613] holds for Group OSCORE. In addition, when using the group 2552 mode, source authentication of messages is explicitly ensured by 2553 means of countersignatures, as discussed in Section 10.1. 2555 Note that, even if an endpoint is authorized to be a group member and 2556 to take part in group communications, there is a risk that it behaves 2557 inappropriately. For instance, it can forward the content of 2558 messages in the group to unauthorized entities. However, in many use 2559 cases, the devices in the group belong to a common authority and are 2560 configured by a commissioner (see Appendix B), which results in a 2561 practically limited risk and enables a prompt detection/reaction in 2562 case of misbehaving. 2564 The same considerations on supporting Proxy operations discussed for 2565 OSCORE in Appendix D.2 of [RFC8613] hold for Group OSCORE. 2567 The same considerations on protected message fields for OSCORE 2568 discussed in Appendix D.3 of [RFC8613] hold for Group OSCORE. 2570 The same considerations on uniqueness of (key, nonce) pairs for 2571 OSCORE discussed in Appendix D.4 of [RFC8613] hold for Group OSCORE. 2572 This is further discussed in Section 10.3 of this document. 2574 The same considerations on unprotected message fields for OSCORE 2575 discussed in Appendix D.5 of [RFC8613] hold for Group OSCORE, with 2576 the following differences. First, the 'kid context' of request 2577 messages is part of the Additional Authenticated Data, thus safely 2578 enabling to keep observations active beyond a possible change of ID 2579 Context (Gid), following a group rekeying (see Section 4.3). Second, 2580 the countersignature included in a Group OSCORE message protected in 2581 group mode is computed also over the value of the OSCORE option, 2582 which is also part of the Additional Authenticated Data used in the 2583 signing process. This is further discussed in Section 10.7 of this 2584 document. 2586 As discussed in Section 6.2.3 of [I-D.ietf-core-groupcomm-bis], Group 2587 OSCORE addresses security attacks against CoAP listed in Sections 2588 11.2-11.6 of [RFC7252], especially when run over IP multicast. 2590 The rest of this section first discusses security aspects to be taken 2591 into account when using Group OSCORE. Then it goes through aspects 2592 covered in the security considerations of OSCORE (see Section 12 of 2593 [RFC8613]), and discusses how they hold when Group OSCORE is used. 2595 10.1. Security of the Group Mode 2597 The group mode defined in Section 8 relies on commonly shared group 2598 keying material to protect communication within a group. Using the 2599 group mode has the implications discussed below. The following 2600 refers to group members as the endpoints in the group owning the 2601 latest version of the group keying material. 2603 * Messages are encrypted at a group level (group-level data 2604 confidentiality), i.e., they can be decrypted by any member of the 2605 group, but not by an external adversary or other external 2606 entities. 2608 * If the used encryption algorithm provides integrity protection, 2609 then it also ensures group authentication and proof of group 2610 membership, but not source authentication. That is, it ensures 2611 that a message sent to a group has been sent by a member of that 2612 group, but not necessarily by the alleged sender. In fact, any 2613 group member is able to derive the Sender Key used by the actual 2614 sender endpoint, and thus can compute a valid authentication tag. 2615 Therefore, the message content could originate from any of the 2616 current group members. 2618 Furthermore, if the used encryption algorithm does not provide 2619 integrity protection, then it does not ensure any level of message 2620 authentication or proof of group membership. 2622 On the other hand, proof of group membership is always ensured by 2623 construction through the strict management of the group keying 2624 material (see Section 3.2). That is, the group is rekeyed in case 2625 of nodes' leaving, and the current group members are informed of 2626 former group members. Thus, a current group member owning the 2627 latest group keying material does not own the public key of any 2628 former group member. 2630 This allows a recipient endpoint to rely on the owned public keys, 2631 in order to always confidently assert the group membership of a 2632 sender endpoint when processing an incoming message, i.e., to 2633 assert that the sender endpoint was a group member when it signed 2634 the message. In turn, this prevents a former group member to 2635 possibly re-sign and inject in the group a stored message that was 2636 protected with old keying material. 2638 * Source authentication of messages sent to a group is ensured 2639 through a countersignature, which is computed by the sender using 2640 its own private key and then appended to the message payload. 2641 Also, the countersignature is encrypted by using a keystream 2642 derived from the group keying material (see Section 4.1). This 2643 ensures group privacy, i.e., an attacker cannot track an endpoint 2644 over two groups by linking messages between the two groups, unless 2645 being also a member of those groups. 2647 The security properties of the group mode are summarized below. 2649 1. Asymmetric source authentication, by means of a countersignature. 2651 2. Symmetric group authentication, by means of an authentication tag 2652 (only for encryption algorithms providing integrity protection). 2654 3. Symmetric group confidentiality, by means of symmetric 2655 encryption. 2657 4. Proof of group membership, by strictly managing the group keying 2658 material, as well as by means of integrity tags when using an 2659 encryption algorithm that provides also integrity protection. 2661 5. Group privacy, by encrypting the countersignature. 2663 The group mode fulfills the security properties above while also 2664 displaying the following benefits. First, the use of encryption 2665 algorithm that does not provide integrity protection results in a 2666 minimal communication overhead, by limiting the message payload to 2667 the ciphertext and the encrypted countersignature. Second, it is 2668 possible to deploy semi-trusted principals such as signature checkers 2669 (see Section 3.1), which can break property 5, but cannot break 2670 properties 1, 2 and 3. 2672 10.2. Security of the Pairwise Mode 2674 The pairwise mode defined in Section 9 protects messages by using 2675 pairwise symmetric keys, derived from the static-static Diffie- 2676 Hellman shared secret computed from the asymmetric keys of the sender 2677 and recipient endpoint (see Section 2.4). 2679 The used encryption algorithm MUST provide integrity protection. 2680 Therefore, the pairwise mode ensures both pairwise data- 2681 confidentiality and source authentication of messages, without using 2682 countersignatures. Furthermore, the recipient endpoint achieves 2683 proof of group membership for the sender endpoint, since only current 2684 group members have the required keying material to derive a valid 2685 Pairwise Sender/Recipient Key. 2687 The long-term storing of the Diffie-Hellman shared secret is a 2688 potential security issue. In fact, if the shared secret of two group 2689 members is leaked, a third group member can exploit it to impersonate 2690 any of those two group members, by deriving and using their pairwise 2691 key. The possibility of such leakage should be contemplated, as more 2692 likely to happen than the leakage of a private key, which could be 2693 rather protected at a significantly higher level than generic memory, 2694 e.g., by using a Trusted Platform Module. Therefore, there is a 2695 trade-off between the maximum amount of time a same shared secret is 2696 stored and the frequency of its re-computing. 2698 10.3. Uniqueness of (key, nonce) 2700 The proof for uniqueness of (key, nonce) pairs in Appendix D.4 of 2701 [RFC8613] is also valid in group communication scenarios. That is, 2702 given an OSCORE group: 2704 * Uniqueness of Sender IDs within the group is enforced by the Group 2705 Manager. In fact, from the moment when a Gid is assigned to a 2706 group until the moment a new Gid is assigned to that same group, 2707 the Group Manager does not reassign a Sender ID within the group 2708 (see Section 3.2). 2710 * The case A in Appendix D.4 of [RFC8613] concerns all group 2711 requests and responses including a Partial IV (e.g., Observe 2712 notifications). In this case, same considerations from [RFC8613] 2713 apply here as well. 2715 * The case B in Appendix D.4 of [RFC8613] concerns responses not 2716 including a Partial IV (e.g., single response to a group request). 2717 In this case, same considerations from [RFC8613] apply here as 2718 well. 2720 As a consequence, each message encrypted/decrypted with the same 2721 Sender Key is processed by using a different (ID_PIV, PIV) pair. 2722 This means that nonces used by any fixed encrypting endpoint are 2723 unique. Thus, each message is processed with a different (key, 2724 nonce) pair. 2726 10.4. Management of Group Keying Material 2728 The approach described in this document should take into account the 2729 risk of compromise of group members. In particular, this document 2730 specifies that a key management scheme for secure revocation and 2731 renewal of Security Contexts and group keying material MUST be 2732 adopted. 2734 [I-D.ietf-ace-key-groupcomm-oscore] provides a simple rekeying scheme 2735 for renewing the Security Context in a group. 2737 Alternative rekeying schemes which are more scalable with the group 2738 size may be needed in dynamic, large-scale groups where endpoints can 2739 join and leave at any time, in order to limit the impact on 2740 performance due to the Security Context and keying material update. 2742 10.5. Update of Security Context and Key Rotation 2744 A group member can receive a message shortly after the group has been 2745 rekeyed, and new security parameters and keying material have been 2746 distributed by the Group Manager. 2748 This may result in a client using an old Security Context to protect 2749 a request, and a server using a different new Security Context to 2750 protect a corresponding response. As a consequence, clients may 2751 receive a response protected with a Security Context different from 2752 the one used to protect the corresponding request. 2754 In particular, a server may first get a request protected with the 2755 old Security Context, then install the new Security Context, and only 2756 after that produce a response to send back to the client. In such a 2757 case, as specified in Section 8.3, the server MUST protect the 2758 potential response using the new Security Context. Specifically, the 2759 server MUST include its Sender Sequence Number as Partial IV in the 2760 response and use it to build the AEAD nonce to protect the response. 2761 This prevents the AEAD nonce from the request from being reused with 2762 the new Security Context. 2764 The client will process that response using the new Security Context, 2765 provided that it has installed the new security parameters and keying 2766 material before the message processing. 2768 In case block-wise transfer [RFC7959] is used, the same 2769 considerations from Section 9.2 of [I-D.ietf-ace-key-groupcomm] hold. 2771 Furthermore, as described below, a group rekeying may temporarily 2772 result in misaligned Security Contexts between the sender and 2773 recipient of a same message. 2775 10.5.1. Late Update on the Sender 2777 In this case, the sender protects a message using the old Security 2778 Context, i.e., before having installed the new Security Context. 2779 However, the recipient receives the message after having installed 2780 the new Security Context, and is thus unable to correctly process it. 2782 A possible way to ameliorate this issue is to preserve the old, 2783 recent, Security Context for a maximum amount of time defined by the 2784 application. By doing so, the recipient can still try to process the 2785 received message using the old retained Security Context as a second 2786 attempt. This makes particular sense when the recipient is a client, 2787 that would hence be able to process incoming responses protected with 2788 the old, recent, Security Context used to protect the associated 2789 group request. Instead, a recipient server would better and more 2790 simply discard an incoming group request which is not successfully 2791 processed with the new Security Context. 2793 This tolerance preserves the processing of secure messages throughout 2794 a long-lasting key rotation, as group rekeying processes may likely 2795 take a long time to complete, especially in large scale groups. On 2796 the other hand, a former (compromised) group member can abusively 2797 take advantage of this, and send messages protected with the old 2798 retained Security Context. Therefore, a conservative application 2799 policy should not admit the retention of old Security Contexts. 2801 10.5.2. Late Update on the Recipient 2803 In this case, the sender protects a message using the new Security 2804 Context, but the recipient receives that message before having 2805 installed the new Security Context. Therefore, the recipient would 2806 not be able to correctly process the message and hence discards it. 2808 If the recipient installs the new Security Context shortly after that 2809 and the sender endpoint retransmits the message, the former will 2810 still be able to receive and correctly process the message. 2812 In any case, the recipient should actively ask the Group Manager for 2813 an updated Security Context according to an application-defined 2814 policy, for instance after a given number of unsuccessfully decrypted 2815 incoming messages. 2817 10.6. Collision of Group Identifiers 2819 In case endpoints are deployed in multiple groups managed by 2820 different non-synchronized Group Managers, it is possible for Group 2821 Identifiers of different groups to coincide. 2823 This does not impair the security of the AEAD algorithm. In fact, as 2824 long as the Master Secret is different for different groups and this 2825 condition holds over time, AEAD keys are different among different 2826 groups. 2828 The entity assigning an IP multicast address may help limiting the 2829 chances to experience such collisions of Group Identifiers. In 2830 particular, it may allow the Group Managers of groups using the same 2831 IP multicast address to share their respective list of assigned Group 2832 Identifiers currently in use. 2834 10.7. Cross-group Message Injection 2836 A same endpoint is allowed to and would likely use the same public/ 2837 private key pair in multiple OSCORE groups, possibly administered by 2838 different Group Managers. 2840 When a sender endpoint sends a message protected in pairwise mode to 2841 a recipient endpoint in an OSCORE group, a malicious group member may 2842 attempt to inject the message to a different OSCORE group also 2843 including the same endpoints (see Section 10.7.1). 2845 This practically relies on altering the content of the OSCORE option, 2846 and having the same MAC in the ciphertext still correctly validating, 2847 which has a success probability depending on the size of the MAC. 2849 As discussed in Section 10.7.2, the attack is practically infeasible 2850 if the message is protected in group mode, thanks to the 2851 countersignature also bound to the OSCORE option through the 2852 Additional Authenticated Data used in the signing process (see 2853 Section 4.3). 2855 10.7.1. Attack Description 2857 Let us consider: 2859 * Two OSCORE groups G1 and G2, with ID Context (Group ID) Gid1 and 2860 Gid2, respectively. Both G1 and G2 use the AEAD cipher AES-CCM- 2861 16-64-128, i.e., the MAC of the ciphertext is 8 bytes in size. 2863 * A sender endpoint X which is member of both G1 and G2, and uses 2864 the same public/private key pair in both groups. The endpoint X 2865 has Sender ID Sid1 in G1 and Sender ID Sid2 in G2. The pairs 2866 (Sid1, Gid1) and (Sid2, Gid2) identify the same public key of X in 2867 G1 and G2, respectively. 2869 * A recipient endpoint Y which is member of both G1 and G2, and uses 2870 the same public/private key pair in both groups. The endpoint Y 2871 has Sender ID Sid3 in G1 and Sender ID Sid4 in G2. The pairs 2872 (Sid3, Gid1) and (Sid4, Gid2) identify the same public key of Y in 2873 G1 and G2, respectively. 2875 * A malicious endpoint Z is also member of both G1 and G2. Hence, Z 2876 is able to derive the Sender Keys used by X in G1 and G2. 2878 When X sends a message M1 addressed to Y in G1 and protected in 2879 pairwise mode, Z can intercept M1, and attempt to forge a valid 2880 message M2 to be injected in G2, making it appear as still sent by X 2881 to Y and valid to be accepted. 2883 More in detail, Z intercepts and stops message M1, and forges a 2884 message M2 by changing the value of the OSCORE option from M1 as 2885 follows: the 'kid context' is set to G2 (rather than G1); and the 2886 'kid' is set to Sid2 (rather than Sid1). Then, Z injects message M2 2887 as addressed to Y in G2. 2889 Upon receiving M2, there is a probability equal to 2^-64 that Y 2890 successfully verifies the same unchanged MAC by using the Pairwise 2891 Recipient Key associated to X in G2. 2893 Note that Z does not know the pairwise keys of X and Y, since it does 2894 not know and is not able to compute their shared Diffie-Hellman 2895 secret. Therefore, Z is not able to check offline if a performed 2896 forgery is actually valid, before sending the forged message to G2. 2898 10.7.2. Attack Prevention in Group Mode 2900 When a Group OSCORE message is protected with the group mode, the 2901 countersignature is computed also over the value of the OSCORE 2902 option, which is part of the Additional Authenticated Data used in 2903 the signing process (see Section 4.3). 2905 That is, other than over the ciphertext, the countersignature is 2906 computed over: the ID Context (Gid) and the Partial IV, which are 2907 always present in group requests; as well as the Sender ID of the 2908 message originator, which is always present in group requests as well 2909 as in responses to requests protected in group mode. 2911 Since the signing process takes as input also the ciphertext of the 2912 COSE_Encrypt0 object, the countersignature is bound not only to the 2913 intended OSCORE group, hence to the triplet (Master Secret, Master 2914 Salt, ID Context), but also to a specific Sender ID in that group and 2915 to its specific symmetric key used for AEAD encryption, hence to the 2916 quartet (Master Secret, Master Salt, ID Context, Sender ID). 2918 This makes it practically infeasible to perform the attack described 2919 in Section 10.7.1, since it would require the adversary to 2920 additionally forge a valid countersignature that replaces the 2921 original one in the forged message M2. 2923 If the countersignature did not cover the OSCORE option, the attack 2924 would still be possible against response messages protected in group 2925 mode, since the same unchanged countersignature from message M1 would 2926 be also valid in message M2. 2928 Also, the following attack simplifications would hold, since Z is 2929 able to derive the Sender/Recipient Keys of X and Y in G1 and G2. 2930 That is, Z can also set a convenient Partial IV in the response, 2931 until the same unchanged MAC is successfully verified by using G2 as 2932 'request_kid_context', Sid2 as 'request_kid', and the symmetric key 2933 associated to X in G2. 2935 Since the Partial IV is 5 bytes in size, this requires 2^40 2936 operations to test all the Partial IVs, which can be done in real- 2937 time. The probability that a single given message M1 can be used to 2938 forge a response M2 for a given request would be equal to 2^-24, 2939 since there are more MAC values (8 bytes in size) than Partial IV 2940 values (5 bytes in size). 2942 Note that, by changing the Partial IV as discussed above, any member 2943 of G1 would also be able to forge a valid signed response message M2 2944 to be injected in the same group G1. 2946 10.8. Prevention of Group Cloning Attack 2948 Both when using the group mode and the pairwise mode, the message 2949 protection covers also the Group Manager's public key. This public 2950 key is included in the Additional Authenticated Data used in the 2951 signing process and/or in the integrity-protected encryption process 2952 (see Section 4.3). 2954 By doing so, an endpoint X member of a group G1 cannot perform the 2955 following attack. 2957 1. X sets up a group G2 where it acts as Group Manager. 2959 2. X makes G2 a "clone" of G1, i.e., G1 and G2 use the same 2960 algorithms and have the same Master Secret, Master Salt and ID 2961 Context. 2963 3. X collects a message M sent to G1 and injects it in G2. 2965 4. Members of G2 accept M and believe it to be originated in G2. 2967 The attack above is effectively prevented, since message M is 2968 protected by including the public key of G1's Group Manager in the 2969 Additional Authenticated Data. Therefore, members of G2 do not 2970 successfully verify and decrypt M, since they correctly use the 2971 public key of X as Group Manager of G2 when attempting to. 2973 10.9. Group OSCORE for Unicast Requests 2975 If a request is intended to be sent over unicast as addressed to a 2976 single group member, it is NOT RECOMMENDED for the client to protect 2977 the request by using the group mode as defined in Section 8.1. 2979 This does not include the case where the client sends a request over 2980 unicast to a proxy, to be forwarded to multiple intended recipients 2981 over multicast [I-D.ietf-core-groupcomm-bis]. In this case, the 2982 client MUST protect the request with the group mode, even though it 2983 is sent to the proxy over unicast (see Section 8). 2985 If the client uses the group mode with its own Sender Key to protect 2986 a unicast request to a group member, an on-path adversary can, right 2987 then or later on, redirect that request to one/many different group 2988 member(s) over unicast, or to the whole OSCORE group over multicast. 2989 By doing so, the adversary can induce the target group member(s) to 2990 perform actions intended for one group member only. Note that the 2991 adversary can be external, i.e., (s)he does not need to also be a 2992 member of the OSCORE group. 2994 This is due to the fact that the client is not able to indicate the 2995 single intended recipient in a way which is secure and possible to 2996 process for Group OSCORE on the server side. In particular, Group 2997 OSCORE does not protect network addressing information such as the IP 2998 address of the intended recipient server. It follows that the 2999 server(s) receiving the redirected request cannot assert whether that 3000 was the original intention of the client, and would thus simply 3001 assume so. 3003 The impact of such an attack depends especially on the REST method of 3004 the request, i.e., the Inner CoAP Code of the OSCORE request message. 3005 In particular, safe methods such as GET and FETCH would trigger 3006 (several) unintended responses from the targeted server(s), while not 3007 resulting in destructive behavior. On the other hand, non safe 3008 methods such as PUT, POST and PATCH/iPATCH would result in the target 3009 server(s) taking active actions on their resources and possible 3010 cyber-physical environment, with the risk of destructive consequences 3011 and possible implications for safety. 3013 A client can instead use the pairwise mode as defined in Section 9.3, 3014 in order to protect a request sent to a single group member by using 3015 pairwise keying material (see Section 2.4). This prevents the attack 3016 discussed above by construction, as only the intended server is able 3017 to derive the pairwise keying material used by the client to protect 3018 the request. A client supporting the pairwise mode SHOULD use it to 3019 protect requests sent to a single group member over unicast, instead 3020 of using the group mode. For an example where this is not fulfilled, 3021 see Sections 7.2.1 and 7.2.4 of 3022 [I-D.ietf-core-observe-multicast-notifications]. 3024 With particular reference to block-wise transfers [RFC7959], 3025 Section 3.8 of [I-D.ietf-core-groupcomm-bis] points out that, while 3026 an initial request including the CoAP Block2 option can be sent over 3027 multicast, any other request in a transfer has to occur over unicast, 3028 individually addressing the servers in the group. 3030 Additional considerations are discussed in Appendix E, with respect 3031 to requests including a CoAP Echo Option 3032 [I-D.ietf-core-echo-request-tag] that has to be sent over unicast, as 3033 a challenge-response method for servers to achieve synchronization of 3034 clients' Sender Sequence Number. 3036 10.10. End-to-end Protection 3038 The same considerations from Section 12.1 of [RFC8613] hold for Group 3039 OSCORE. 3041 Additionally, (D)TLS and Group OSCORE can be combined for protecting 3042 message exchanges occurring over unicast. However, it is not 3043 possible to combine (D)TLS and Group OSCORE for protecting message 3044 exchanges where messages are (also) sent over multicast. 3046 10.11. Master Secret 3048 Group OSCORE derives the Security Context using the same construction 3049 as OSCORE, and by using the Group Identifier of a group as the 3050 related ID Context. Hence, the same required properties of the 3051 Security Context parameters discussed in Section 3.3 of [RFC8613] 3052 hold for this document. 3054 With particular reference to the OSCORE Master Secret, it has to be 3055 kept secret among the members of the respective OSCORE group and the 3056 Group Manager responsible for that group. Also, the Master Secret 3057 must have a good amount of randomness, and the Group Manager can 3058 generate it offline using a good random number generator. This 3059 includes the case where the Group Manager rekeys the group by 3060 generating and distributing a new Master Secret. Randomness 3061 requirements for security are described in [RFC4086]. 3063 10.12. Replay Protection 3065 As in OSCORE [RFC8613], also Group OSCORE relies on Sender Sequence 3066 Numbers included in the COSE message field 'Partial IV' and used to 3067 build AEAD nonces. 3069 Note that the Partial IV of an endpoint does not necessarily grow 3070 monotonically. For instance, upon exhaustion of the endpoint Sender 3071 Sequence Number, the Partial IV also gets exhausted. As discussed in 3072 Section 2.5.3, this results either in the endpoint being individually 3073 rekeyed and getting a new Sender ID, or in the establishment of a new 3074 Security Context in the group. Therefore, uniqueness of (key, nonce) 3075 pairs (see Section 10.3) is preserved also when a new Security 3076 Context is established. 3078 Since one-to-many communication such as multicast usually involves 3079 unreliable transports, the simplification of the Replay Window to a 3080 size of 1 suggested in Section 7.4 of [RFC8613] is not viable with 3081 Group OSCORE, unless exchanges in the group rely only on unicast 3082 messages. 3084 As discussed in Section 6.2, a Replay Window may be initialized as 3085 not valid, following the loss of mutable Security Context 3086 Section 2.5.1. In particular, Section 2.5.1.1 and Section 2.5.1.2 3087 define measures that endpoints need to take in such a situation, 3088 before resuming to accept incoming messages from other group members. 3090 10.13. Message Freshness 3092 As discussed in Section 6.3, a server may not be able to assert 3093 whether an incoming request is fresh, in case it does not have or has 3094 lost synchronization with the client's Sender Sequence Number. 3096 If freshness is relevant for the application, the server may 3097 (re-)synchronize with the client's Sender Sequence Number at any 3098 time, by using the approach described in Appendix E and based on the 3099 CoAP Echo Option [I-D.ietf-core-echo-request-tag], as a variant of 3100 the approach defined in Appendix B.1.2 of [RFC8613] applicable to 3101 Group OSCORE. 3103 10.14. Client Aliveness 3105 Building on Section 12.5 of [RFC8613], a server may use the CoAP Echo 3106 Option [I-D.ietf-core-echo-request-tag] to verify the aliveness of 3107 the client that originated a received request, by using the approach 3108 described in Appendix E of this document. 3110 10.15. Cryptographic Considerations 3112 The same considerations from Section 12.6 of [RFC8613] about the 3113 maximum Sender Sequence Number hold for Group OSCORE. 3115 As discussed in Section 2.5.2, an endpoint that experiences an 3116 exhaustion of its own Sender Sequence Numbers MUST NOT protect 3117 further messages including a Partial IV, until it has derived a new 3118 Sender Context. This prevents the endpoint to reuse the same AEAD 3119 nonces with the same Sender Key. 3121 In order to renew its own Sender Context, the endpoint SHOULD inform 3122 the Group Manager, which can either renew the whole Security Context 3123 by means of group rekeying, or provide only that endpoint with a new 3124 Sender ID value. In either case, the endpoint derives a new Sender 3125 Context, and in particular a new Sender Key. 3127 Additionally, the same considerations from Section 12.6 of [RFC8613] 3128 hold for Group OSCORE, about building the AEAD nonce and the secrecy 3129 of the Security Context parameters. 3131 For endpoints that support the group mode, the EdDSA signature 3132 algorithm Ed25519 [RFC8032] is mandatory to implement. The group 3133 mode uses the "encrypt-then-sign" construction, i.e., the 3134 countersignature is computed over the COSE_Encrypt0 object (see 3135 Section 4.1). This is motivated by enabling additional principals 3136 acting as signature checkers (see Section 3.1), which do not join a 3137 group as members but are allowed to verify countersignatures of 3138 messages protected in group mode without being able to decrypt them 3139 (see Section 8.5). 3141 If the encryption algorithm used in group mode provides integrity 3142 protection, countersignatures of COSE_Encrypt0 with short 3143 authentication tags do not provide the security properties associated 3144 with the same algorithm used in COSE_Sign (see Section 6 of 3145 [I-D.ietf-cose-countersign]). To provide 128-bit security against 3146 collision attacks, the tag length MUST be at least 256-bits. A 3147 countersignature of a COSE_Encrypt0 with AES-CCM-16-64-128 provides 3148 at most 32 bits of integrity protection. 3150 For endpoints that support the pairwise mode, the ECDH-SS + HKDF-256 3151 algorithm specified in Section 6.3.1 of 3152 [I-D.ietf-cose-rfc8152bis-algs] and the X25519 algorithm [RFC7748] 3153 are also mandatory to implement. 3155 Constrained IoT devices may alternatively represent Montgomery curves 3156 and (twisted) Edwards curves [RFC7748] in the short-Weierstrass form 3157 Wei25519, with which the algorithms ECDSA25519 and ECDH25519 can be 3158 used for signature operations and Diffie-Hellman secret calculation, 3159 respectively [I-D.ietf-lwig-curve-representations]. 3161 For many constrained IoT devices, it is problematic to support more 3162 than one signature algorithm or multiple whole cipher suites. As a 3163 consequence, some deployments using, for instance, ECDSA with NIST 3164 P-256 may not support the mandatory signature algorithm but that 3165 should not be an issue for local deployments. 3167 The derivation of pairwise keys defined in Section 2.4.1 is 3168 compatible with ECDSA and EdDSA asymmetric keys, but is not 3169 compatible with RSA asymmetric keys. 3171 For the public key translation from Ed25519 (Ed448) to X25519 (X448) 3172 specified in Section 2.4.1, variable time methods can be used since 3173 the translation operates on public information. Any byte string of 3174 appropriate length is accepted as a public key for X25519 (X448) in 3175 [RFC7748]. It is therefore not necessary for security to validate 3176 the translated public key (assuming the translation was successful). 3178 The security of using the same key pair for Diffie-Hellman and for 3179 signing (by considering the ECDH procedure in Section 2.4 as a Key 3180 Encapsulation Mechanism (KEM)) is demonstrated in [Degabriele] and 3181 [Thormarker]. 3183 Applications using ECDH (except X25519 and X448) based KEM in 3184 Section 2.4 are assumed to verify that a peer endpoint's public key 3185 is on the expected curve and that the shared secret is not the point 3186 at infinity. The KEM in [Degabriele] checks that the shared secret 3187 is different from the point at infinity, as does the procedure in 3188 Section 5.7.1.2 of [NIST-800-56A] which is referenced in Section 2.4. 3190 Extending Theorem 2 of [Degabriele], [Thormarker] shows that the same 3191 key pair can be used with X25519 and Ed25519 (X448 and Ed448) for the 3192 KEM specified in Section 2.4. By symmetry in the KEM used in this 3193 document, both endpoints can consider themselves to have the 3194 recipient role in the KEM - as discussed in Section 7 of [Thormarker] 3195 - and rely on the mentioned proofs for the security of their key 3196 pairs. 3198 Theorem 3 in [Degabriele] shows that the same key pair can be used 3199 for an ECDH based KEM and ECDSA. The KEM uses a different KDF than 3200 in Section 2.4, but the proof only depends on that the KDF has 3201 certain required properties, which are the typical assumptions about 3202 HKDF, e.g., that output keys are pseudorandom. In order to comply 3203 with the assumptions of Theorem 3, received public keys MUST be 3204 successfully validated, see Section 5.6.2.3.4 of [NIST-800-56A]. The 3205 validation MAY be performed by a trusted Group Manager. For 3206 [Degabriele] to apply as it is written, public keys need to be in the 3207 expected subgroup. For this we rely on cofactor DH, Section 5.7.1.2 3208 of [NIST-800-56A] which is referenced in Section 2.4. 3210 HashEdDSA variants of Ed25519 and Ed448 are not used by COSE, see 3211 Section 2.2 of [I-D.ietf-cose-rfc8152bis-algs], and are not covered 3212 by the analysis in [Thormarker], and hence MUST NOT be used with the 3213 public keys used with pairwise keys as specified in this document. 3215 10.16. Message Segmentation 3217 The same considerations from Section 12.7 of [RFC8613] hold for Group 3218 OSCORE. 3220 10.17. Privacy Considerations 3222 Group OSCORE ensures end-to-end integrity protection and encryption 3223 of the message payload and all options that are not used for proxy 3224 operations. In particular, options are processed according to the 3225 same class U/I/E that they have for OSCORE. Therefore, the same 3226 privacy considerations from Section 12.8 of [RFC8613] hold for Group 3227 OSCORE, with the following addition. 3229 * When protecting a message in group mode, the countersignature is 3230 encrypted by using a keystream derived from the group keying 3231 material (see Section 4.1 and Section 4.1.1). This ensures group 3232 privacy. That is, an attacker cannot track an endpoint over two 3233 groups by linking messages between the two groups, unless being 3234 also a member of those groups. 3236 Furthermore, the following privacy considerations hold about the 3237 OSCORE option, which may reveal information on the communicating 3238 endpoints. 3240 * The 'kid' parameter, which is intended to help a recipient 3241 endpoint to find the right Recipient Context, may reveal 3242 information about the Sender Endpoint. When both a request and 3243 the corresponding responses include the 'kid' parameter, this may 3244 reveal information about both a client sending a request and all 3245 the possibly replying servers sending their own individual 3246 response. 3248 * The 'kid context' parameter, which is intended to help a recipient 3249 endpoint to find the right Security Context, reveals information 3250 about the sender endpoint. In particular, it reveals that the 3251 sender endpoint is a member of a particular OSCORE group, whose 3252 current Group ID is indicated in the 'kid context' parameter. 3254 When receiving a group request, each of the recipient endpoints can 3255 reply with a response that includes its Sender ID as 'kid' parameter. 3256 All these responses will be matchable with the request through the 3257 Token. Thus, even if these responses do not include a 'kid context' 3258 parameter, it becomes possible to understand that the responder 3259 endpoints are in the same group of the requester endpoint. 3261 Furthermore, using the mechanisms described in Appendix E to achieve 3262 Sender Sequence Number synchronization with a client may reveal when 3263 a server device goes through a reboot. This can be mitigated by the 3264 server device storing the precise state of the Replay Window of each 3265 known client on a clean shutdown. 3267 Finally, the mechanism described in Section 10.6 to prevent 3268 collisions of Group Identifiers from different Group Managers may 3269 reveal information about events in the respective OSCORE groups. In 3270 particular, a Group Identifier changes when the corresponding group 3271 is rekeyed. Thus, Group Managers might use the shared list of Group 3272 Identifiers to infer the rate and patterns of group membership 3273 changes triggering a group rekeying, e.g., due to newly joined 3274 members or evicted (compromised) members. In order to alleviate this 3275 privacy concern, it should be hidden from the Group Managers which 3276 exact Group Manager has currently assigned which Group Identifiers in 3277 its OSCORE groups. 3279 11. IANA Considerations 3281 Note to RFC Editor: Please replace "[This Document]" with the RFC 3282 number of this document and delete this paragraph. 3284 This document has the following actions for IANA. 3286 11.1. OSCORE Flag Bits Registry 3288 IANA is asked to add the following value entry to the "OSCORE Flag 3289 Bits" subregistry defined in Section 13.7 of [RFC8613] as part of the 3290 "CoRE Parameters" registry. 3292 +--------------+------------+-----------------------------+-----------+ 3293 | Bit Position | Name | Description | Reference | 3294 +--------------+------------+-----------------------------+-----------+ 3295 | 2 | Group Flag | For using a Group OSCORE | [This | 3296 | | | Security Context, set to 1 | Document] | 3297 | | | if the message is protected | | 3298 | | | with the group mode | | 3299 +--------------+------------+-----------------------------+-----------+ 3301 12. References 3303 12.1. Normative References 3305 [I-D.ietf-core-groupcomm-bis] 3306 Dijk, E., Wang, C., and M. Tiloca, "Group Communication 3307 for the Constrained Application Protocol (CoAP)", Work in 3308 Progress, Internet-Draft, draft-ietf-core-groupcomm-bis- 3309 04, 12 July 2021, . 3312 [I-D.ietf-cose-countersign] 3313 Schaad, J. and R. Housley, "CBOR Object Signing and 3314 Encryption (COSE): Countersignatures", Work in Progress, 3315 Internet-Draft, draft-ietf-cose-countersign-05, 23 June 3316 2021, . 3319 [I-D.ietf-cose-rfc8152bis-algs] 3320 Schaad, J., "CBOR Object Signing and Encryption (COSE): 3321 Initial Algorithms", Work in Progress, Internet-Draft, 3322 draft-ietf-cose-rfc8152bis-algs-12, 24 September 2020, 3323 . 3326 [I-D.ietf-cose-rfc8152bis-struct] 3327 Schaad, J., "CBOR Object Signing and Encryption (COSE): 3328 Structures and Process", Work in Progress, Internet-Draft, 3329 draft-ietf-cose-rfc8152bis-struct-15, 1 February 2021, 3330 . 3333 [NIST-800-56A] 3334 Barker, E., Chen, L., Roginsky, A., Vassilev, A., and R. 3335 Davis, "Recommendation for Pair-Wise Key-Establishment 3336 Schemes Using Discrete Logarithm Cryptography - NIST 3337 Special Publication 800-56A, Revision 3", April 2018, 3338 . 3341 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 3342 Requirement Levels", BCP 14, RFC 2119, 3343 DOI 10.17487/RFC2119, March 1997, 3344 . 3346 [RFC4086] Eastlake 3rd, D., Schiller, J., and S. Crocker, 3347 "Randomness Requirements for Security", BCP 106, RFC 4086, 3348 DOI 10.17487/RFC4086, June 2005, 3349 . 3351 [RFC7252] Shelby, Z., Hartke, K., and C. Bormann, "The Constrained 3352 Application Protocol (CoAP)", RFC 7252, 3353 DOI 10.17487/RFC7252, June 2014, 3354 . 3356 [RFC7748] Langley, A., Hamburg, M., and S. Turner, "Elliptic Curves 3357 for Security", RFC 7748, DOI 10.17487/RFC7748, January 3358 2016, . 3360 [RFC8032] Josefsson, S. and I. Liusvaara, "Edwards-Curve Digital 3361 Signature Algorithm (EdDSA)", RFC 8032, 3362 DOI 10.17487/RFC8032, January 2017, 3363 . 3365 [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 3366 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, 3367 May 2017, . 3369 [RFC8610] Birkholz, H., Vigano, C., and C. Bormann, "Concise Data 3370 Definition Language (CDDL): A Notational Convention to 3371 Express Concise Binary Object Representation (CBOR) and 3372 JSON Data Structures", RFC 8610, DOI 10.17487/RFC8610, 3373 June 2019, . 3375 [RFC8613] Selander, G., Mattsson, J., Palombini, F., and L. Seitz, 3376 "Object Security for Constrained RESTful Environments 3377 (OSCORE)", RFC 8613, DOI 10.17487/RFC8613, July 2019, 3378 . 3380 [RFC8949] Bormann, C. and P. Hoffman, "Concise Binary Object 3381 Representation (CBOR)", STD 94, RFC 8949, 3382 DOI 10.17487/RFC8949, December 2020, 3383 . 3385 12.2. Informative References 3387 [Degabriele] 3388 Degabriele, J.P., Lehmann, A., Paterson, K.G., Smart, 3389 N.P., and M. Strefler, "On the Joint Security of 3390 Encryption and Signature in EMV", December 2011, 3391 . 3393 [I-D.amsuess-core-cachable-oscore] 3394 Amsüss, C. and M. Tiloca, "Cacheable OSCORE", Work in 3395 Progress, Internet-Draft, draft-amsuess-core-cachable- 3396 oscore-01, 22 February 2021, 3397 . 3400 [I-D.ietf-ace-key-groupcomm] 3401 Palombini, F. and M. Tiloca, "Key Provisioning for Group 3402 Communication using ACE", Work in Progress, Internet- 3403 Draft, draft-ietf-ace-key-groupcomm-13, 12 July 2021, 3404 . 3407 [I-D.ietf-ace-key-groupcomm-oscore] 3408 Tiloca, M., Park, J., and F. Palombini, "Key Management 3409 for OSCORE Groups in ACE", Work in Progress, Internet- 3410 Draft, draft-ietf-ace-key-groupcomm-oscore-11, 12 July 3411 2021, . 3414 [I-D.ietf-ace-oauth-authz] 3415 Seitz, L., Selander, G., Wahlstroem, E., Erdtman, S., and 3416 H. Tschofenig, "Authentication and Authorization for 3417 Constrained Environments (ACE) using the OAuth 2.0 3418 Framework (ACE-OAuth)", Work in Progress, Internet-Draft, 3419 draft-ietf-ace-oauth-authz-43, 10 July 2021, 3420 . 3423 [I-D.ietf-core-echo-request-tag] 3424 Amsüss, C., Mattsson, J. P., and G. Selander, "CoAP: Echo, 3425 Request-Tag, and Token Processing", Work in Progress, 3426 Internet-Draft, draft-ietf-core-echo-request-tag-12, 1 3427 February 2021, . 3430 [I-D.ietf-core-observe-multicast-notifications] 3431 Tiloca, M., Hoeglund, R., Amsuess, C., and F. Palombini, 3432 "Observe Notifications as CoAP Multicast Responses", Work 3433 in Progress, Internet-Draft, draft-ietf-core-observe- 3434 multicast-notifications-01, 12 July 2021, 3435 . 3438 [I-D.ietf-cose-cbor-encoded-cert] 3439 Raza, S., Höglund, J., Selander, G., Mattsson, J. P., and 3440 M. Furuhed, "CBOR Encoded X.509 Certificates (C509 3441 Certificates)", Work in Progress, Internet-Draft, draft- 3442 ietf-cose-cbor-encoded-cert-01, 25 May 2021, 3443 . 3446 [I-D.ietf-lwig-curve-representations] 3447 Struik, R., "Alternative Elliptic Curve Representations", 3448 Work in Progress, Internet-Draft, draft-ietf-lwig-curve- 3449 representations-21, 9 June 2021, 3450 . 3453 [I-D.ietf-lwig-security-protocol-comparison] 3454 Mattsson, J. P., Palombini, F., and M. Vucinic, 3455 "Comparison of CoAP Security Protocols", Work in Progress, 3456 Internet-Draft, draft-ietf-lwig-security-protocol- 3457 comparison-05, 2 November 2020, 3458 . 3461 [I-D.ietf-rats-uccs] 3462 Birkholz, H., O'Donoghue, J., Cam-Winget, N., and C. 3463 Bormann, "A CBOR Tag for Unprotected CWT Claims Sets", 3464 Work in Progress, Internet-Draft, draft-ietf-rats-uccs-00, 3465 19 May 2021, . 3468 [I-D.ietf-tls-dtls13] 3469 Rescorla, E., Tschofenig, H., and N. Modadugu, "The 3470 Datagram Transport Layer Security (DTLS) Protocol Version 3471 1.3", Work in Progress, Internet-Draft, draft-ietf-tls- 3472 dtls13-43, 30 April 2021, . 3475 [I-D.mattsson-cfrg-det-sigs-with-noise] 3476 Mattsson, J. P., Thormarker, E., and S. Ruohomaa, 3477 "Deterministic ECDSA and EdDSA Signatures with Additional 3478 Randomness", Work in Progress, Internet-Draft, draft- 3479 mattsson-cfrg-det-sigs-with-noise-02, 11 March 2020, 3480 . 3483 [RFC4944] Montenegro, G., Kushalnagar, N., Hui, J., and D. Culler, 3484 "Transmission of IPv6 Packets over IEEE 802.15.4 3485 Networks", RFC 4944, DOI 10.17487/RFC4944, September 2007, 3486 . 3488 [RFC4949] Shirey, R., "Internet Security Glossary, Version 2", 3489 FYI 36, RFC 4949, DOI 10.17487/RFC4949, August 2007, 3490 . 3492 [RFC5869] Krawczyk, H. and P. Eronen, "HMAC-based Extract-and-Expand 3493 Key Derivation Function (HKDF)", RFC 5869, 3494 DOI 10.17487/RFC5869, May 2010, 3495 . 3497 [RFC6282] Hui, J., Ed. and P. Thubert, "Compression Format for IPv6 3498 Datagrams over IEEE 802.15.4-Based Networks", RFC 6282, 3499 DOI 10.17487/RFC6282, September 2011, 3500 . 3502 [RFC6347] Rescorla, E. and N. Modadugu, "Datagram Transport Layer 3503 Security Version 1.2", RFC 6347, DOI 10.17487/RFC6347, 3504 January 2012, . 3506 [RFC7228] Bormann, C., Ersue, M., and A. Keranen, "Terminology for 3507 Constrained-Node Networks", RFC 7228, 3508 DOI 10.17487/RFC7228, May 2014, 3509 . 3511 [RFC7641] Hartke, K., "Observing Resources in the Constrained 3512 Application Protocol (CoAP)", RFC 7641, 3513 DOI 10.17487/RFC7641, September 2015, 3514 . 3516 [RFC7925] Tschofenig, H., Ed. and T. Fossati, "Transport Layer 3517 Security (TLS) / Datagram Transport Layer Security (DTLS) 3518 Profiles for the Internet of Things", RFC 7925, 3519 DOI 10.17487/RFC7925, July 2016, 3520 . 3522 [RFC7959] Bormann, C. and Z. Shelby, Ed., "Block-Wise Transfers in 3523 the Constrained Application Protocol (CoAP)", RFC 7959, 3524 DOI 10.17487/RFC7959, August 2016, 3525 . 3527 [RFC8392] Jones, M., Wahlstroem, E., Erdtman, S., and H. Tschofenig, 3528 "CBOR Web Token (CWT)", RFC 8392, DOI 10.17487/RFC8392, 3529 May 2018, . 3531 [Thormarker] 3532 Thormarker, E., "On using the same key pair for Ed25519 3533 and an X25519 based KEM", April 2021, 3534 . 3536 Appendix A. Assumptions and Security Objectives 3538 This section presents a set of assumptions and security objectives 3539 for the approach described in this document. The rest of this 3540 section refers to three types of groups: 3542 * Application group, i.e., a set of CoAP endpoints that share a 3543 common pool of resources. 3545 * Security group, as defined in Section 1.1 of this document. There 3546 can be a one-to-one or a one-to-many relation between security 3547 groups and application groups, and vice versa. 3549 * CoAP group, i.e., a set of CoAP endpoints where each endpoint is 3550 configured to receive one-to-many CoAP requests, e.g., sent to the 3551 group's associated IP multicast address and UDP port as defined in 3552 [I-D.ietf-core-groupcomm-bis]. An endpoint may be a member of 3553 multiple CoAP groups. There can be a one-to-one or a one-to-many 3554 relation between application groups and CoAP groups. Note that a 3555 device sending a CoAP request to a CoAP group is not necessarily 3556 itself a member of that group: it is a member only if it also has 3557 a CoAP server endpoint listening to requests for this CoAP group, 3558 sent to the associated IP multicast address and port. In order to 3559 provide secure group communication, all members of a CoAP group as 3560 well as all further endpoints configured only as clients sending 3561 CoAP (multicast) requests to the CoAP group have to be member of a 3562 security group. There can be a one-to-one or a one-to-many 3563 relation between security groups and CoAP groups, and vice versa. 3565 A.1. Assumptions 3567 The following points are assumed to be already addressed and are out 3568 of the scope of this document. 3570 * Multicast communication topology: this document considers both 3571 1-to-N (one sender and multiple recipients) and M-to-N (multiple 3572 senders and multiple recipients) communication topologies. The 3573 1-to-N communication topology is the simplest group communication 3574 scenario that would serve the needs of a typical Low-power and 3575 Lossy Network (LLN). Examples of use cases that benefit from 3576 secure group communication are provided in Appendix B. 3578 In a 1-to-N communication model, only a single client transmits 3579 data to the CoAP group, in the form of request messages; in an 3580 M-to-N communication model (where M and N do not necessarily have 3581 the same value), M clients transmit data to the CoAP group. 3582 According to [I-D.ietf-core-groupcomm-bis], any possible proxy 3583 entity is supposed to know about the clients. Also, every client 3584 expects and is able to handle multiple response messages 3585 associated to a same request sent to the CoAP group. 3587 * Group size: security solutions for group communication should be 3588 able to adequately support different and possibly large security 3589 groups. The group size is the current number of members in a 3590 security group. In the use cases mentioned in this document, the 3591 number of clients (normally the controlling devices) is expected 3592 to be much smaller than the number of servers (i.e., the 3593 controlled devices). A security solution for group communication 3594 that supports 1 to 50 clients would be able to properly cover the 3595 group sizes required for most use cases that are relevant for this 3596 document. The maximum group size is expected to be in the range 3597 of 2 to 100 devices. Security groups larger than that should be 3598 divided into smaller independent groups. One should not assume 3599 that the set of members of a security group remains fixed. That 3600 is, the group membership is subject to changes, possibly on a 3601 frequent basis. 3603 * Communication with the Group Manager: an endpoint must use a 3604 secure dedicated channel when communicating with the Group 3605 Manager, also when not registered as a member of the security 3606 group. 3608 * Provisioning and management of Security Contexts: a Security 3609 Context must be established among the members of the security 3610 group. A secure mechanism must be used to generate, revoke and 3611 (re-)distribute keying material, communication policies and 3612 security parameters in the security group. The actual 3613 provisioning and management of the Security Context is out of the 3614 scope of this document. 3616 * Multicast data security ciphersuite: all members of a security 3617 group must agree on a ciphersuite to provide authenticity, 3618 integrity and confidentiality of messages in the group. The 3619 ciphersuite is specified as part of the Security Context. 3621 * Backward security: a new device joining the security group should 3622 not have access to any old Security Contexts used before its 3623 joining. This ensures that a new member of the security group is 3624 not able to decrypt confidential data sent before it has joined 3625 the security group. The adopted key management scheme should 3626 ensure that the Security Context is updated to ensure backward 3627 confidentiality. The actual mechanism to update the Security 3628 Context and renew the group keying material in the security group 3629 upon a new member's joining has to be defined as part of the group 3630 key management scheme. 3632 * Forward security: entities that leave the security group should 3633 not have access to any future Security Contexts or message 3634 exchanged within the security group after their leaving. This 3635 ensures that a former member of the security group is not able to 3636 decrypt confidential data sent within the security group anymore. 3637 Also, it ensures that a former member is not able to send 3638 protected messages to the security group anymore. The actual 3639 mechanism to update the Security Context and renew the group 3640 keying material in the security group upon a member's leaving has 3641 to be defined as part of the group key management scheme. 3643 A.2. Security Objectives 3645 The approach described in this document aims at fulfilling the 3646 following security objectives: 3648 * Data replay protection: group request messages or response 3649 messages replayed within the security group must be detected. 3651 * Data confidentiality: messages sent within the security group 3652 shall be encrypted. 3654 * Group-level data confidentiality: the group mode provides group- 3655 level data confidentiality since messages are encrypted at a group 3656 level, i.e., in such a way that they can be decrypted by any 3657 member of the security group, but not by an external adversary or 3658 other external entities. 3660 * Pairwise data confidentiality: the pairwise mode especially 3661 provides pairwise data confidentiality, since messages are 3662 encrypted using pairwise keying material shared between any two 3663 group members, hence they can be decrypted only by the intended 3664 single recipient. 3666 * Source message authentication: messages sent within the security 3667 group shall be authenticated. That is, it is essential to ensure 3668 that a message is originated by a member of the security group in 3669 the first place, and in particular by a specific, identifiable 3670 member of the security group. 3672 * Message integrity: messages sent within the security group shall 3673 be integrity protected. That is, it is essential to ensure that a 3674 message has not been tampered with, either by a group member, or 3675 by an external adversary or other external entities which are not 3676 members of the security group. 3678 * Message ordering: it must be possible to determine the ordering of 3679 messages coming from a single sender. In accordance with OSCORE 3680 [RFC8613], this results in providing absolute freshness of 3681 responses that are not notifications, as well as relative 3682 freshness of group requests and notification responses. It is not 3683 required to determine ordering of messages from different senders. 3685 Appendix B. List of Use Cases 3687 Group Communication for CoAP [I-D.ietf-core-groupcomm-bis] provides 3688 the necessary background for multicast-based CoAP communication, with 3689 particular reference to low-power and lossy networks (LLNs) and 3690 resource constrained environments. The interested reader is 3691 encouraged to first read [I-D.ietf-core-groupcomm-bis] to understand 3692 the non-security related details. This section discusses a number of 3693 use cases that benefit from secure group communication, and refers to 3694 the three types of groups from Appendix A. Specific security 3695 requirements for these use cases are discussed in Appendix A. 3697 * Lighting control: consider a building equipped with IP-connected 3698 lighting devices, switches, and border routers. The lighting 3699 devices acting as servers are organized into application groups 3700 and CoAP groups, according to their physical location in the 3701 building. For instance, lighting devices in a room or corridor 3702 can be configured as members of a single application group and 3703 corresponding CoAP group. Those lighting devices together with 3704 the switches acting as clients in the same room or corridor can be 3705 configured as members of the corresponding security group. 3706 Switches are then used to control the lighting devices by sending 3707 on/off/dimming commands to all lighting devices in the CoAP group, 3708 while border routers connected to an IP network backbone (which is 3709 also multicast-enabled) can be used to interconnect routers in the 3710 building. Consequently, this would also enable logical groups to 3711 be formed even if devices with a role in the lighting application 3712 may be physically in different subnets (e.g., on wired and 3713 wireless networks). Connectivity between lighting devices may be 3714 realized, for instance, by means of IPv6 and (border) routers 3715 supporting 6LoWPAN [RFC4944][RFC6282]. Group communication 3716 enables synchronous operation of a set of connected lights, 3717 ensuring that the light preset (e.g., dimming level or color) of a 3718 large set of luminaires are changed at the same perceived time. 3719 This is especially useful for providing a visual synchronicity of 3720 light effects to the user. As a practical guideline, events 3721 within a 200 ms interval are perceived as simultaneous by humans, 3722 which is necessary to ensure in many setups. Devices may reply 3723 back to the switches that issue on/off/dimming commands, in order 3724 to report about the execution of the requested operation (e.g., 3725 OK, failure, error) and their current operational status. In a 3726 typical lighting control scenario, a single switch is the only 3727 entity responsible for sending commands to a set of lighting 3728 devices. In more advanced lighting control use cases, a M-to-N 3729 communication topology would be required, for instance in case 3730 multiple sensors (presence or day-light) are responsible to 3731 trigger events to a set of lighting devices. Especially in 3732 professional lighting scenarios, the roles of client and server 3733 are configured by the lighting commissioner, and devices strictly 3734 follow those roles. 3736 * Integrated building control: enabling Building Automation and 3737 Control Systems (BACSs) to control multiple heating, ventilation 3738 and air-conditioning units to predefined presets. Controlled 3739 units can be organized into application groups and CoAP groups in 3740 order to reflect their physical position in the building, e.g., 3741 devices in the same room can be configured as members of a single 3742 application group and corresponding CoAP group. As a practical 3743 guideline, events within intervals of seconds are typically 3744 acceptable. Controlled units are expected to possibly reply back 3745 to the BACS issuing control commands, in order to report about the 3746 execution of the requested operation (e.g., OK, failure, error) 3747 and their current operational status. 3749 * Software and firmware updates: software and firmware updates often 3750 comprise quite a large amount of data. This can overload a Low- 3751 power and Lossy Network (LLN) that is otherwise typically used to 3752 deal with only small amounts of data, on an infrequent base. 3753 Rather than sending software and firmware updates as unicast 3754 messages to each individual device, multicasting such updated data 3755 to a larger set of devices at once displays a number of benefits. 3756 For instance, it can significantly reduce the network load and 3757 decrease the overall time latency for propagating this data to all 3758 devices. Even if the complete whole update process itself is 3759 secured, securing the individual messages is important, in case 3760 updates consist of relatively large amounts of data. In fact, 3761 checking individual received data piecemeal for tampering avoids 3762 that devices store large amounts of partially corrupted data and 3763 that they detect tampering hereof only after all data has been 3764 received. Devices receiving software and firmware updates are 3765 expected to possibly reply back, in order to provide a feedback 3766 about the execution of the update operation (e.g., OK, failure, 3767 error) and their current operational status. 3769 * Parameter and configuration update: by means of multicast 3770 communication, it is possible to update the settings of a set of 3771 similar devices, both simultaneously and efficiently. Possible 3772 parameters are related, for instance, to network load management 3773 or network access controls. Devices receiving parameter and 3774 configuration updates are expected to possibly reply back, to 3775 provide a feedback about the execution of the update operation 3776 (e.g., OK, failure, error) and their current operational status. 3778 * Commissioning of Low-power and Lossy Network (LLN) systems: a 3779 commissioning device is responsible for querying all devices in 3780 the local network or a selected subset of them, in order to 3781 discover their presence, and be aware of their capabilities, 3782 default configuration, and operating conditions. Queried devices 3783 displaying similarities in their capabilities and features, or 3784 sharing a common physical location can be configured as members of 3785 a single application group and corresponding CoAP group. Queried 3786 devices are expected to reply back to the commissioning device, in 3787 order to notify their presence, and provide the requested 3788 information and their current operational status. 3790 * Emergency multicast: a particular emergency related information 3791 (e.g., natural disaster) is generated and multicast by an 3792 emergency notifier, and relayed to multiple devices. The latter 3793 may reply back to the emergency notifier, in order to provide 3794 their feedback and local information related to the ongoing 3795 emergency. This kind of setups should additionally rely on a 3796 fault tolerance multicast algorithm, such as Multicast Protocol 3797 for Low-Power and Lossy Networks (MPL). 3799 Appendix C. Example of Group Identifier Format 3801 This section provides an example of how the Group Identifier (Gid) 3802 can be specifically formatted. That is, the Gid can be composed of 3803 two parts, namely a Group Prefix and a Group Epoch. 3805 For each group, the Group Prefix is constant over time and is 3806 uniquely defined in the set of all the groups associated to the same 3807 Group Manager. The choice of the Group Prefix for a given group's 3808 Security Context is application specific. The size of the Group 3809 Prefix directly impact on the maximum number of distinct groups under 3810 the same Group Manager. 3812 The Group Epoch is set to 0 upon the group's initialization, and is 3813 incremented by 1 each time new keying material, together with a new 3814 Gid, is distributed to the group in order to establish a new Security 3815 Context (see Section 3.2). 3817 As an example, a 3-byte Gid can be composed of: i) a 1-byte Group 3818 Prefix '0xb1' interpreted as a raw byte string; and ii) a 2-byte 3819 Group Epoch interpreted as an unsigned integer ranging from 0 to 3820 65535. Then, after having established the Common Context 61532 times 3821 in the group, its Gid will assume value '0xb1f05c'. 3823 Using an immutable Group Prefix for a group assumes that enough time 3824 elapses before all possible Group Epoch values are used, i.e., before 3825 the Group Manager starts reassigning Gid values to the same group 3826 (see Section 3.2). Thus, the expected highest rate for addition/ 3827 removal of group members and consequent group rekeying should be 3828 taken into account for a proper dimensioning of the Group Epoch size. 3830 As discussed in Section 10.6, if endpoints are deployed in multiple 3831 groups managed by different non-synchronized Group Managers, it is 3832 possible that Group Identifiers of different groups coincide at some 3833 point in time. In this case, a recipient has to handle coinciding 3834 Group Identifiers, and has to try using different Security Contexts 3835 to process an incoming message, until the right one is found and the 3836 message is correctly verified. Therefore, it is favorable that Group 3837 Identifiers from different Group Managers have a size that result in 3838 a small probability of collision. How small this probability should 3839 be is up to system designers. 3841 Appendix D. Set-up of New Endpoints 3843 An endpoint joins a group by explicitly interacting with the 3844 responsible Group Manager. When becoming members of a group, 3845 endpoints are not required to know how many and what endpoints are in 3846 the same group. 3848 Communications between a joining endpoint and the Group Manager rely 3849 on the CoAP protocol and must be secured. Specific details on how to 3850 secure communications between joining endpoints and a Group Manager 3851 are out of the scope of this document. 3853 The Group Manager must verify that the joining endpoint is authorized 3854 to join the group. To this end, the Group Manager can directly 3855 authorize the joining endpoint, or expect it to provide authorization 3856 evidence previously obtained from a trusted entity. Further details 3857 about the authorization of joining endpoints are out of scope. 3859 In case of successful authorization check, the Group Manager 3860 generates a Sender ID assigned to the joining endpoint, before 3861 proceeding with the rest of the join process. That is, the Group 3862 Manager provides the joining endpoint with the keying material and 3863 parameters to initialize the Security Context, including its own 3864 public key (see Section 2). The actual provisioning of keying 3865 material and parameters to the joining endpoint is out of the scope 3866 of this document. 3868 It is RECOMMENDED that the join process adopts the approach described 3869 in [I-D.ietf-ace-key-groupcomm-oscore] and based on the ACE framework 3870 for Authentication and Authorization in constrained environments 3871 [I-D.ietf-ace-oauth-authz]. 3873 Appendix E. Challenge-Response Synchronization 3875 This section describes a possible approach that a server endpoint can 3876 use to synchronize with Sender Sequence Numbers of client endpoints 3877 in the group. In particular, the server performs a challenge- 3878 response exchange with a client, by using the Echo Option for CoAP 3879 described in Section 2 of [I-D.ietf-core-echo-request-tag] and 3880 according to Appendix B.1.2 of [RFC8613]. 3882 That is, upon receiving a request from a particular client for the 3883 first time, the server processes the message as described in this 3884 document, but, even if valid, does not deliver it to the application. 3885 Instead, the server replies to the client with an OSCORE protected 3886 4.01 (Unauthorized) response message, including only the Echo Option 3887 and no diagnostic payload. The Echo option value SHOULD NOT be 3888 reused; when it is reused, it MUST be highly unlikely to have been 3889 used with this client recently. Since this response is protected 3890 with the Security Context used in the group, the client will consider 3891 the response valid upon successfully decrypting and verifying it. 3893 The server stores the Echo Option value included therein, together 3894 with the pair (gid,kid), where 'gid' is the Group Identifier of the 3895 OSCORE group and 'kid' is the Sender ID of the client in the group, 3896 as specified in the 'kid context' and 'kid' fields of the OSCORE 3897 Option of the request, respectively. After a group rekeying has been 3898 completed and a new Security Context has been established in the 3899 group, which results also in a new Group Identifier (see 3900 Section 3.2), the server MUST delete all the stored Echo values 3901 associated to members of that group. 3903 Upon receiving a 4.01 (Unauthorized) response that includes an Echo 3904 Option and originates from a verified group member, the client sends 3905 a request as a unicast message addressed to the same server, echoing 3906 the Echo Option value. The client MUST NOT send the request 3907 including the Echo Option over multicast. 3909 If the group uses also the group mode and the used Signature 3910 Algorithm supports ECDH (e.g., ECDSA, EdDSA), the client MUST use the 3911 pairwise mode of Group OSCORE to protect the request, as described in 3912 Section 9.3. Note that, as defined in Section 9, members of such a 3913 group and that use the Echo Option MUST support the pairwise mode. 3915 The client does not necessarily resend the same group request, but 3916 can instead send a more recent one, if the application permits it. 3917 This makes it possible for the client to not retain previously sent 3918 group requests for full retransmission, unless the application 3919 explicitly requires otherwise. In either case, the client uses a 3920 fresh Sender Sequence Number value from its own Sender Context. If 3921 the client stores group requests for possible retransmission with the 3922 Echo Option, it should not store a given request for longer than a 3923 preconfigured time interval. Note that the unicast request echoing 3924 the Echo Option is correctly treated and processed as a message, 3925 since the 'kid context' field including the Group Identifier of the 3926 OSCORE group is still present in the OSCORE Option as part of the 3927 COSE object (see Section 4). 3929 Upon receiving the unicast request including the Echo Option, the 3930 server performs the following verifications. 3932 * If the server does not store an Echo Option value for the pair 3933 (gid,kid), it considers: i) the time t1 when it has established 3934 the Security Context used to protect the received request; and ii) 3935 the time t2 when the request has been received. Since a valid 3936 request cannot be older than the Security Context used to protect 3937 it, the server verifies that (t2 - t1) is less than the largest 3938 amount of time acceptable to consider the request fresh. 3940 * If the server stores an Echo Option value for the pair (gid,kid) 3941 associated to that same client in the same group, the server 3942 verifies that the option value equals that same stored value 3943 previously sent to that client. 3945 If the verifications above fail, the server MUST NOT process the 3946 request further and MAY send a 4.01 (Unauthorized) response including 3947 an Echo Option. 3949 If the verifications above are successful and the Replay Window has 3950 not been set yet, the server updates its Replay Window to mark the 3951 current Sender Sequence Number from the latest received request as 3952 seen (but all newer ones as new), and delivers the message as fresh 3953 to the application. Otherwise, it discards the verification result 3954 and treats the message as fresh or as a replay, according to the 3955 existing Replay Window. 3957 A server should not deliver requests from a given client to the 3958 application until one valid request from that same client has been 3959 verified as fresh, as conveying an echoed Echo Option 3960 [I-D.ietf-core-echo-request-tag]. Also, a server may perform the 3961 challenge-response described above at any time, if synchronization 3962 with Sender Sequence Numbers of clients is lost, for instance after a 3963 device reboot. A client has to be always ready to perform the 3964 challenge-response based on the Echo Option in case a server starts 3965 it. 3967 It is the role of the server application to define under what 3968 circumstances Sender Sequence Numbers lose synchronization. This can 3969 include experiencing a "large enough" gap D = (SN2 - SN1), between 3970 the Sender Sequence Number SN1 of the latest accepted group request 3971 from a client and the Sender Sequence Number SN2 of a group request 3972 just received from that client. However, a client may send several 3973 unicast requests to different group members as protected with the 3974 pairwise mode (see Section 9.3), which may result in the server 3975 experiencing the gap D in a relatively short time. This would induce 3976 the server to perform more challenge-response exchanges than actually 3977 needed. 3979 To ameliorate this, the server may rather rely on a trade-off between 3980 the Sender Sequence Number gap D and a time gap T = (t2 - t1), where 3981 t1 is the time when the latest group request from a client was 3982 accepted and t2 is the time when the latest group request from that 3983 client has been received, respectively. Then, the server can start a 3984 challenge-response when experiencing a time gap T larger than a 3985 given, preconfigured threshold. Also, the server can start a 3986 challenge-response when experiencing a Sender Sequence Number gap D 3987 greater than a different threshold, computed as a monotonically 3988 increasing function of the currently experienced time gap T. 3990 The challenge-response approach described in this appendix provides 3991 an assurance of absolute message freshness. However, it can result 3992 in an impact on performance which is undesirable or unbearable, 3993 especially in large groups where many endpoints at the same time 3994 might join as new members or lose synchronization. 3996 Note that endpoints configured as silent servers are not able to 3997 perform the challenge-response described above, as they do not store 3998 a Sender Context to secure the 4.01 (Unauthorized) response to the 3999 client. Therefore, silent servers should adopt alternative 4000 approaches to achieve and maintain synchronization with Sender 4001 Sequence Numbers of clients. 4003 Since requests including the Echo Option are sent over unicast, a 4004 server can be a victim of the attack discussed in Section 10.9, when 4005 such requests are protected with the group mode of Group OSCORE, as 4006 described in Section 8.1. 4008 Instead, protecting requests with the Echo Option by using the 4009 pairwise mode of Group OSCORE as described in Section 9.3 prevents 4010 the attack in Section 10.9. In fact, only the exact server involved 4011 in the Echo exchange is able to derive the correct pairwise key used 4012 by the client to protect the request including the Echo Option. 4014 In either case, an internal on-path adversary would not be able to 4015 mix up the Echo Option value of two different unicast requests, sent 4016 by a same client to any two different servers in the group. In fact, 4017 if the group mode was used, this would require the adversary to forge 4018 the client's countersignature in both such requests. As a 4019 consequence, each of the two servers remains able to selectively 4020 accept a request with the Echo Option only if it is waiting for that 4021 exact integrity-protected Echo Option value, and is thus the intended 4022 recipient. 4024 Appendix F. Document Updates 4026 RFC EDITOR: PLEASE REMOVE THIS SECTION. 4028 F.1. Version -11 to -12 4030 * No mode of operation is mandatory to support. 4032 * Revised parameters of the Security Context, COSE object and 4033 external_aad. 4035 * Revised management of keying material for the Group Manager. 4037 * Informing of former members when rekeying the group. 4039 * Admit encryption-only algorithms in group mode. 4041 * Encrypted countersignature through a keystream. 4043 * Added public key of the Group Manager as key material and 4044 protected data. 4046 * Clarifications about message processing, especially notifications. 4048 * Guidance for message processing of external signature checkers. 4050 * Updated derivation of pairwise keys, with more security 4051 considerations. 4053 * Termination of ongoing observations as client, upon leaving or 4054 before re-joining the group. 4056 * Recycling Group IDs by tracking the "Birth Gid" of each group 4057 member. 4059 * Expanded security and privacy considerations about the group mode. 4061 * Removed appendices on skipping signature verification and on COSE 4062 capabilities. 4064 * Fixes and editorial improvements. 4066 F.2. Version -10 to -11 4068 * Loss of Recipient Contexts due to their overflow. 4070 * Added diagram on keying material components and their relation. 4072 * Distinction between anti-replay and freshness. 4074 * Preservation of Sender IDs over rekeying. 4076 * Clearer cause-effect about reset of SSN. 4078 * The GM provides public keys of group members with associated 4079 Sender IDs. 4081 * Removed 'par_countersign_key' from the external_aad. 4083 * One single format for the external_aad, both for encryption and 4084 signing. 4086 * Presence of 'kid' in responses to requests protected with the 4087 pairwise mode. 4089 * Inclusion of 'kid_context' in notifications following a group 4090 rekeying. 4092 * Pairwise mode presented with OSCORE as baseline. 4094 * Revised examples with signature values. 4096 * Decoupled growth of clients' Sender Sequence Numbers and loss of 4097 synchronization for server. 4099 * Sender IDs not recycled in the group under the same Gid. 4101 * Processing and description of the Group Flag bit in the OSCORE 4102 option. 4104 * Usage of the pairwise mode for multicast requests. 4106 * Clarifications on synchronization using the Echo option. 4108 * General format of context parameters and external_aad elements, 4109 supporting future registered COSE algorithms (new Appendix). 4111 * Fixes and editorial improvements. 4113 F.3. Version -09 to -10 4115 * Removed 'Counter Signature Key Parameters' from the Common 4116 Context. 4118 * New parameters in the Common Context covering the DH secret 4119 derivation. 4121 * New countersignature header parameter from draft-ietf-cose- 4122 countersign. 4124 * Stronger policies non non-recycling of Sender IDs and Gid. 4126 * The Sender Sequence Number is reset when establishing a new 4127 Security Context. 4129 * Added 'request_kid_context' in the aad_array. 4131 * The server can respond with 5.03 if the client's public key is not 4132 available. 4134 * The observer client stores an invariant identifier of the group. 4136 * Relaxed storing of original 'kid' for observer clients. 4138 * Both client and server store the 'kid_context' of the original 4139 observation request. 4141 * The server uses a fresh PIV if protecting the response with a 4142 Security Context different from the one used to protect the 4143 request. 4145 * Clarifications on MTI algorithms and curves. 4147 * Removed optimized requests. 4149 * Overall clarifications and editorial revision. 4151 F.4. Version -08 to -09 4153 * Pairwise keys are discarded after group rekeying. 4155 * Signature mode renamed to group mode. 4157 * The parameters for countersignatures use the updated COSE 4158 registries. Newly defined IANA registries have been removed. 4160 * Pairwise Flag bit renamed as Group Flag bit, set to 1 in group 4161 mode and set to 0 in pairwise mode. 4163 * Dedicated section on updating the Security Context. 4165 * By default, sender sequence numbers and replay windows are not 4166 reset upon group rekeying. 4168 * An endpoint implementing only a silent server does not support the 4169 pairwise mode. 4171 * Separate section on general message reception. 4173 * Pairwise mode moved to the document body. 4175 * Considerations on using the pairwise mode in non-multicast 4176 settings. 4178 * Optimized requests are moved as an appendix. 4180 * Normative support for the signature and pairwise mode. 4182 * Revised methods for synchronization with clients' sender sequence 4183 number. 4185 * Appendix with example values of parameters for countersignatures. 4187 * Clarifications and editorial improvements. 4189 F.5. Version -07 to -08 4191 * Clarified relation between pairwise mode and group communication 4192 (Section 1). 4194 * Improved definition of "silent server" (Section 1.1). 4196 * Clarified when a Recipient Context is needed (Section 2). 4198 * Signature checkers as entities supported by the Group Manager 4199 (Section 2.3). 4201 * Clarified that the Group Manager is under exclusive control of Gid 4202 and Sender ID values in a group, with Sender ID values under each 4203 Gid value (Section 2.3). 4205 * Mitigation policies in case of recycled 'kid' values 4206 (Section 2.4). 4208 * More generic exhaustion (not necessarily wrap-around) of sender 4209 sequence numbers (Sections 2.5 and 10.11). 4211 * Pairwise key considerations, as to group rekeying and Sender 4212 Sequence Numbers (Section 3). 4214 * Added reference to static-static Diffie-Hellman shared secret 4215 (Section 3). 4217 * Note for implementation about the external_aad for signing 4218 (Sectino 4.3.2). 4220 * Retransmission by the application for group requests over 4221 multicast as Non-Confirmable (Section 7). 4223 * A server MUST use its own Partial IV in a response, if protecting 4224 it with a different context than the one used for the request 4225 (Section 7.3). 4227 * Security considerations: encryption of pairwise mode as 4228 alternative to group-level security (Section 10.1). 4230 * Security considerations: added approach to reduce the chance of 4231 global collisions of Gid values from different Group Managers 4232 (Section 10.5). 4234 * Security considerations: added implications for block-wise 4235 transfers when using the signature mode for requests over unicast 4236 (Section 10.7). 4238 * Security considerations: (multiple) supported signature algorithms 4239 (Section 10.13). 4241 * Security considerations: added privacy considerations on the 4242 approach for reducing global collisions of Gid values 4243 (Section 10.15). 4245 * Updates to the methods for synchronizing with clients' sequence 4246 number (Appendix E). 4248 * Simplified text on discovery services supporting the pairwise mode 4249 (Appendix G.1). 4251 * Editorial improvements. 4253 F.6. Version -06 to -07 4255 * Updated abstract and introduction. 4257 * Clarifications of what pertains a group rekeying. 4259 * Derivation of pairwise keying material. 4261 * Content re-organization for COSE Object and OSCORE header 4262 compression. 4264 * Defined the Pairwise Flag bit for the OSCORE option. 4266 * Supporting CoAP Observe for group requests and responses. 4268 * Considerations on message protection across switching to new 4269 keying material. 4271 * New optimized mode based on pairwise keying material. 4273 * More considerations on replay protection and Security Contexts 4274 upon key renewal. 4276 * Security considerations on Group OSCORE for unicast requests, also 4277 as affecting the usage of the Echo option. 4279 * Clarification on different types of groups considered 4280 (application/security/CoAP). 4282 * New pairwise mode, using pairwise keying material for both 4283 requests and responses. 4285 F.7. Version -05 to -06 4287 * Group IDs mandated to be unique under the same Group Manager. 4289 * Clarifications on parameter update upon group rekeying. 4291 * Updated external_aad structures. 4293 * Dynamic derivation of Recipient Contexts made optional and 4294 application specific. 4296 * Optional 4.00 response for failed signature verification on the 4297 server. 4299 * Removed client handling of duplicated responses to multicast 4300 requests. 4302 * Additional considerations on public key retrieval and group 4303 rekeying. 4305 * Added Group Manager responsibility on validating public keys. 4307 * Updates IANA registries. 4309 * Reference to RFC 8613. 4311 * Editorial improvements. 4313 F.8. Version -04 to -05 4315 * Added references to draft-dijk-core-groupcomm-bis. 4317 * New parameter Counter Signature Key Parameters (Section 2). 4319 * Clarification about Recipient Contexts (Section 2). 4321 * Two different external_aad for encrypting and signing 4322 (Section 3.1). 4324 * Updated response verification to handle Observe notifications 4325 (Section 6.4). 4327 * Extended Security Considerations (Section 8). 4329 * New "Counter Signature Key Parameters" IANA Registry 4330 (Section 9.2). 4332 F.9. Version -03 to -04 4334 * Added the new "Counter Signature Parameters" in the Common Context 4335 (see Section 2). 4337 * Added recommendation on using "deterministic ECDSA" if ECDSA is 4338 used as countersignature algorithm (see Section 2). 4340 * Clarified possible asynchronous retrieval of keying material from 4341 the Group Manager, in order to process incoming messages (see 4342 Section 2). 4344 * Structured Section 3 into subsections. 4346 * Added the new 'par_countersign' to the aad_array of the 4347 external_aad (see Section 3.1). 4349 * Clarified non reliability of 'kid' as identity indicator for a 4350 group member (see Section 2.1). 4352 * Described possible provisioning of new Sender ID in case of 4353 Partial IV wrap-around (see Section 2.2). 4355 * The former signature bit in the Flag Byte of the OSCORE option 4356 value is reverted to reserved (see Section 4.1). 4358 * Updated examples of compressed COSE object, now with the sixth 4359 less significant bit in the Flag Byte of the OSCORE option value 4360 set to 0 (see Section 4.3). 4362 * Relaxed statements on sending error messages (see Section 6). 4364 * Added explicit step on computing the countersignature for outgoing 4365 messages (see Sections 6.1 and 6.3). 4367 * Handling of just created Recipient Contexts in case of 4368 unsuccessful message verification (see Sections 6.2 and 6.4). 4370 * Handling of replied/repeated responses on the client (see 4371 Section 6.4). 4373 * New IANA Registry "Counter Signature Parameters" (see 4374 Section 9.1). 4376 F.10. Version -02 to -03 4378 * Revised structure and phrasing for improved readability and better 4379 alignment with draft-ietf-core-object-security. 4381 * Added discussion on wrap-Around of Partial IVs (see Section 2.2). 4383 * Separate sections for the COSE Object (Section 3) and the OSCORE 4384 Header Compression (Section 4). 4386 * The countersignature is now appended to the encrypted payload of 4387 the OSCORE message, rather than included in the OSCORE Option (see 4388 Section 4). 4390 * Extended scope of Section 5, now titled " Message Binding, 4391 Sequence Numbers, Freshness and Replay Protection". 4393 * Clarifications about Non-Confirmable messages in Section 5.1 4394 "Synchronization of Sender Sequence Numbers". 4396 * Clarifications about error handling in Section 6 "Message 4397 Processing". 4399 * Compacted list of responsibilities of the Group Manager in 4400 Section 7. 4402 * Revised and extended security considerations in Section 8. 4404 * Added IANA considerations for the OSCORE Flag Bits Registry in 4405 Section 9. 4407 * Revised Appendix D, now giving a short high-level description of a 4408 new endpoint set-up. 4410 F.11. Version -01 to -02 4412 * Terminology has been made more aligned with RFC7252 and draft- 4413 ietf-core-object-security: i) "client" and "server" replace the 4414 old "multicaster" and "listener", respectively; ii) "silent 4415 server" replaces the old "pure listener". 4417 * Section 2 has been updated to have the Group Identifier stored in 4418 the 'ID Context' parameter defined in draft-ietf-core-object- 4419 security. 4421 * Section 3 has been updated with the new format of the Additional 4422 Authenticated Data. 4424 * Major rewriting of Section 4 to better highlight the differences 4425 with the message processing in draft-ietf-core-object-security. 4427 * Added Sections 7.2 and 7.3 discussing security considerations 4428 about uniqueness of (key, nonce) and collision of group 4429 identifiers, respectively. 4431 * Minor updates to Appendix A.1 about assumptions on multicast 4432 communication topology and group size. 4434 * Updated Appendix C on format of group identifiers, with practical 4435 implications of possible collisions of group identifiers. 4437 * Updated Appendix D.2, adding a pointer to draft-palombini-ace-key- 4438 groupcomm about retrieval of nodes' public keys through the Group 4439 Manager. 4441 * Minor updates to Appendix E.3 about Challenge-Response 4442 synchronization of sequence numbers based on the Echo option from 4443 draft-ietf-core-echo-request-tag. 4445 F.12. Version -00 to -01 4447 * Section 1.1 has been updated with the definition of group as 4448 "security group". 4450 * Section 2 has been updated with: 4452 - Clarifications on establishment/derivation of Security 4453 Contexts. 4455 - A table summarizing the the additional context elements 4456 compared to OSCORE. 4458 * Section 3 has been updated with: 4460 - Examples of request and response messages. 4462 - Use of CounterSignature0 rather than CounterSignature. 4464 - Additional Authenticated Data including also the signature 4465 algorithm, while not including the Group Identifier any longer. 4467 * Added Section 6, listing the responsibilities of the Group 4468 Manager. 4470 * Added Appendix A (former section), including assumptions and 4471 security objectives. 4473 * Appendix B has been updated with more details on the use cases. 4475 * Added Appendix C, providing an example of Group Identifier format. 4477 * Appendix D has been updated to be aligned with draft-palombini- 4478 ace-key-groupcomm. 4480 Acknowledgments 4482 The authors sincerely thank Christian Amsuess, Stefan Beck, Rolf 4483 Blom, Carsten Bormann, Esko Dijk, Martin Gunnarsson, Klaus Hartke, 4484 Rikard Hoeglund, Richard Kelsey, Dave Robin, Jim Schaad, Ludwig 4485 Seitz, Peter van der Stok and Erik Thormarker for their feedback and 4486 comments. 4488 The work on this document has been partly supported by VINNOVA and 4489 the Celtic-Next project CRITISEC; the H2020 project SIFIS-Home (Grant 4490 agreement 952652); the SSF project SEC4Factory under the grant 4491 RIT17-0032; and the EIT-Digital High Impact Initiative ACTIVE. 4493 Authors' Addresses 4495 Marco Tiloca 4496 RISE AB 4497 Isafjordsgatan 22 4498 SE-16440 Stockholm Kista 4499 Sweden 4501 Email: marco.tiloca@ri.se 4503 Göran Selander 4504 Ericsson AB 4505 Torshamnsgatan 23 4506 SE-16440 Stockholm Kista 4507 Sweden 4509 Email: goran.selander@ericsson.com 4511 Francesca Palombini 4512 Ericsson AB 4513 Torshamnsgatan 23 4514 SE-16440 Stockholm Kista 4515 Sweden 4517 Email: francesca.palombini@ericsson.com 4518 John Preuss Mattsson 4519 Ericsson AB 4520 Torshamnsgatan 23 4521 SE-16440 Stockholm Kista 4522 Sweden 4524 Email: john.mattsson@ericsson.com 4526 Jiye Park 4527 Universitaet Duisburg-Essen 4528 Schuetzenbahn 70 4529 45127 Essen 4530 Germany 4532 Email: ji-ye.park@uni-due.de