-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathrfc9203.xml
1301 lines (1245 loc) · 88.2 KB
/
rfc9203.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc [
<!ENTITY nbsp " ">
<!ENTITY zwsp "​">
<!ENTITY nbhy "‑">
<!ENTITY wj "⁠">
]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-ietf-ace-oscore-profile-19" number="9203" obsoletes="" updates="" submissionType="IETF" category="std" consensus="true" xml:lang="en" tocInclude="true" sortRefs="true" symRefs="true" version="3">
<!-- xml2rfc v2v3 conversion 2.39.0 -->
<front>
<title abbrev="OSCORE Profile of ACE">The Object Security for Constrained RESTful Environments (OSCORE) Profile of the Authentication and Authorization for Constrained Environments (ACE) Framework</title>
<seriesInfo name="RFC" value="9203"/>
<author initials="F." surname="Palombini" fullname="Francesca Palombini">
<organization>Ericsson AB</organization>
<address>
<email>[email protected]</email>
</address>
</author>
<author fullname="Ludwig Seitz" initials="L." surname="Seitz">
<organization>Combitech</organization>
<address>
<postal>
<street>Djäknegatan 31</street>
<city>Malmö</city>
<code>211 35</code>
<country>Sweden</country>
</postal>
<email>[email protected]</email>
</address>
</author>
<author fullname="Göran Selander" initials="G." surname="Selander">
<organization>Ericsson AB</organization>
<address>
<email>[email protected]</email>
</address>
</author>
<author fullname="Martin Gunnarsson" initials="M." surname="Gunnarsson">
<organization>RISE</organization>
<address>
<postal>
<street>Scheelevägen 17</street>
<city>Lund</city>
<code>22370</code>
<country>Sweden</country>
</postal>
<email>[email protected]</email>
</address>
</author>
<date year="2022" month="March" />
<area>Security</area>
<workgroup>ACE</workgroup>
<keyword>CoAP</keyword>
<keyword>OAuth 2.0</keyword>
<keyword>Access Control</keyword>
<keyword>Authorization</keyword>
<keyword>Internet of Things</keyword>
<abstract>
<t>
This document specifies a profile for the Authentication and Authorization for Constrained Environments (ACE) framework. It utilizes Object Security for Constrained RESTful Environments (OSCORE) to provide communication security and proof-of-possession for a key owned by the client and bound to an OAuth 2.0 access token.
</t>
</abstract>
</front>
<middle>
<section anchor="introduction" numbered="true" toc="default">
<name>Introduction</name>
<t>
This document specifies the <tt>coap_oscore</tt> profile of the ACE framework <xref target="RFC9200" format="default"/>. In this profile, a client (C) and a resource server (RS) use the Constrained Application Protocol (CoAP) <xref target="RFC7252" format="default"/> to communicate. The client uses an access token, bound to a symmetric key (the proof-of-possession (PoP) key) to authorize its access to the resource server. Note that this profile uses a symmetric-crypto-based scheme, where the symmetric secret is used as input material for keying material derivation. In order to provide communication security and PoP, the client and resource server use Object Security for Constrained RESTful Environments (OSCORE) as defined in <xref target="RFC8613" format="default"/>. Note that the PoP is not achieved through a dedicated protocol element but rather occurs after the first message exchange using OSCORE.
</t>
<t>
OSCORE specifies how to use CBOR Object Signing and Encryption (COSE) <xref target="RFC9052" format="default"/> <xref target="RFC9053" format="default"/> to secure CoAP messages.
Note that OSCORE can be used to secure CoAP messages, as well as HTTP and combinations of HTTP and CoAP; a profile of ACE similar to the one described in this document, with the difference of using HTTP instead of CoAP as the communication protocol, could be specified analogously to this one.
</t>
<section anchor="terminology" numbered="true" toc="default">
<name>Terminology</name>
<t>
The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/>
when, and only when, they appear in all capitals, as shown here.
</t>
<t>
Certain security-related terms such as "authentication", "authorization", "confidentiality", "(data) integrity", "Message Authentication Code (MAC)", "Hash-based Message Authentication Code (HMAC)", and "verify" are taken from <xref target="RFC4949" format="default"/>.
</t>
<t>
RESTful terminology follows HTTP <xref target="RFC7231" format="default"/>.
</t>
<t>
Readers are expected to be familiar with the terms and concepts defined in OSCORE <xref target="RFC8613" format="default"/>, such as "security context" and "Recipient ID".
</t>
<t>
Terminology for entities in the architecture is defined in OAuth 2.0 <xref target="RFC6749" format="default"/>, such as client (C), resource server (RS), and authorization server (AS). It is assumed in this document that a given resource on a specific RS is associated to a unique AS.
</t>
<t>
Concise Binary Object Representation (CBOR) <xref target="RFC8949" format="default"/> and Concise Data Definition Language (CDDL) <xref target="RFC8610" format="default"/> are used in this document. CDDL predefined type names, especially "bstr" for CBOR byte strings and "tstr" for CBOR text strings, are used extensively in this document.
</t>
<t>
Note that the term "endpoint" is used as in <xref target="RFC9200" format="default"/>, following its OAuth definition, which is to denote resources such as token and introspect at the AS and authz-info at the RS.
The CoAP definition, which is "[a]n entity participating in the CoAP protocol" <xref target="RFC7252" format="default"/>, is not used in this document.
</t>
<t>Throughout this document, examples for CBOR data items are expressed in
CBOR extended diagnostic notation as defined in
<xref section="8" sectionFormat="of" target="RFC8949"/> and
<xref section="G" sectionFormat="of" target="RFC8610"/>
("diagnostic notation"), unless noted otherwise.
We often use diagnostic notation comments to provide
a textual representation of the numeric parameter names and values.
</t>
<t>In this document, the term "base64-encoded" refers to URL-Safe base64 encoding (see <xref section="5" sectionFormat="of" target="RFC4648"/>) without padding.
</t>
</section>
</section>
<section numbered="true" toc="default">
<name>Protocol Overview</name>
<t>
This section gives an overview of how to use the ACE Framework <xref target="RFC9200" format="default"/> to secure the communication between a client and a resource server using OSCORE <xref target="RFC8613" format="default"/>. The parameters needed by the client to negotiate the use of this profile with the AS, as well as the OSCORE setup process, are described in detail in the following sections.
</t>
<t>
The RS maintains a collection of OSCORE security contexts with associated authorization information for all the clients that it is communicating with. The
authorization information is maintained as policy that is used as input to processing requests from those clients.
</t>
<t>
This profile requires a client to retrieve an access token from the AS for the resource it wants to access on an RS, by sending an access token request to the token endpoint, as specified in <xref target="RFC9200" sectionFormat="of" section="5.8"/>. The access token request and response <bcp14>MUST</bcp14> be confidentiality protected and ensure authenticity. The use of OSCORE between the client and AS is <bcp14>RECOMMENDED</bcp14> in this profile, to reduce the number of libraries the client has to support, but other protocols fulfilling the security requirements defined in <xref target="RFC9200" sectionFormat="of" section="5"/> <bcp14>MAY</bcp14> alternatively be used, such as TLS <xref target="RFC8446" format="default"/> or DTLS <xref target="RFC9147" format="default"/>.
</t>
<t>
Once the client has retrieved the access token, it generates a nonce N1, as defined in this document (see <xref target="nonce1" format="default"/>). The client also generates its own OSCORE Recipient ID, ID1 (see <xref target="RFC8613" sectionFormat="of" section="3.1"/>), for use with the keying material associated to the RS. The client posts the token N1 and its Recipient ID to the RS using the authz-info endpoint and mechanisms specified in <xref target="RFC9200" sectionFormat="of" section="5.8"/> and Content-Format = application/ace+cbor. When using this profile, the communication with the authz-info endpoint is not protected, except for the update of access rights.
</t>
<t>
If the access token is valid, the RS replies to this request with a 2.01 (Created) response with Content-Format = application/ace+cbor, which contains a nonce N2 and its newly generated OSCORE Recipient ID, ID2, for use with the keying material associated to the client. Moreover, the server concatenates the input salt received in the token, N1, and N2 to obtain the Master Salt of the OSCORE security context (see <xref target="RFC8613" sectionFormat="of" section="3"/>).
The RS then derives the complete security context associated with the received token from the Master Salt; the OSCORE Recipient ID generated by the client (set as its OSCORE Sender ID); its own OSCORE Recipient ID; plus the parameters received in the access token from the AS, following <xref target="RFC8613" sectionFormat="of" section="3.2"/>.
</t>
<t>
In a similar way, after receiving the nonce N2, the client concatenates the input salt N1 and N2 to obtain the Master Salt of the OSCORE security context. The client then derives the complete security context from the Master Salt; the OSCORE Recipient ID generated by the RS (set as its OSCORE Sender ID); its own OSCORE Recipient ID; plus the parameters received from the AS.
</t>
<t>
Finally, the client starts the communication with the RS by sending a request protected with OSCORE to the RS. If the request is successfully verified, the server stores the complete security context state that is ready for use in protecting messages and uses it in the response, and in further communications with the client, until token deletion due to, for example, expiration. This security context is discarded when a token (whether the same or a different one) is used to successfully derive a new security context for that client.
</t>
<t>
The use of nonces N1 and N2 during the exchange prevents the reuse of an
Authenticated Encryption with Associated Data (AEAD) nonce/key pair
for two different messages. Reuse might otherwise occur when the
client and RS derive a new security context from an existing (non-expired)
access token, as might occur when either party has just rebooted, and that might lead to loss of both confidentiality and integrity.
Instead, by using the exchanged nonces N1 and N2 as part of the Master Salt, the request to the authz-info endpoint posting the same token results in a different security context, by OSCORE construction, since even though the Master Secret, Sender ID, and Recipient ID are the same, the Master Salt is different (see <xref target="RFC8613" sectionFormat="of" section="3.2.1"/>). If the exchanged nonces were reused, a node reusing a non-expired old token would be susceptible to on-path attackers provoking the creation of an OSCORE message using an old AEAD key and nonce.
</t>
<t>
After the whole message exchange has taken place, the client can contact the AS to request an update of its access rights, sending a similar request to the token endpoint that also includes an identifier so that the AS can find the correct OSCORE Input Material it has previously shared with the client. This specific identifier, encoded as a byte string, is assigned by the AS to be unique in the sets of its OSCORE Input Materials, and it is not used as input material to derive the full OSCORE security context.
</t>
<t>
An overview of the profile flow for the OSCORE profile is given in <xref target="prof-overview" format="default"/>. The names of messages coincide with those of <xref target="RFC9200" format="default"/> when applicable.
</t>
<figure anchor="prof-overview">
<name>Protocol Overview</name>
<artwork name="" type="" align="left" alt=""><![CDATA[
C RS AS
| | |
| ----- POST /token ----------------------------> |
| | |
| <---------------------------- Access Token ----- |
| + Access Information |
| ---- POST /authz-info ---> | |
| (access_token, N1, ID1) | |
| | |
| <- 2.01 Created (N2, ID2)- | |
| | |
/Sec Context /Sec Context |
derivation/ derivation/ |
| | |
| ---- OSCORE Request -----> | |
| | |
| /proof-of-possession |
| Sec Context storage/ |
| | |
| <--- OSCORE Response ----- | |
| | |
/proof-of-possession | |
Sec Context storage/ | |
| | |
| ---- OSCORE Request -----> | |
| | |
| <--- OSCORE Response ----- | |
| | |
| ... | |
]]></artwork>
</figure>
</section>
<section anchor="client-as" numbered="true" toc="default">
<name>Client-AS Communication</name>
<t>
The following subsections describe the details of the POST request and response to the token endpoint between the client and AS. <xref target="RFC8613" sectionFormat="of" section="3.2"/> defines how to derive a security context based on a shared Master Secret and a set of other parameters, established between the client and server, which the client receives from the AS in this exchange. The PoP key included in the response from the AS <bcp14>MUST</bcp14> be used as a Master Secret in OSCORE.
</t>
<section anchor="c-as" numbered="true" toc="default">
<name>C-to-AS: POST to Token Endpoint</name>
<t>
The client-to-AS request is specified in <xref target="RFC9200" sectionFormat="of" section="5.8.1"/>.
</t>
<t>
The client must send this POST request to the token endpoint over a secure channel that guarantees authentication, message integrity, and confidentiality (see <xref target="introsp" format="default"/>).
</t>
<t>
An example of such a request is shown in <xref target="ex0" format="default"/>.
</t>
<figure anchor="ex0">
<name>Example C-to-AS POST /token Request for an Access Token Bound to a Symmetric Key</name>
<sourcecode name="" type="cbor-diag"><![CDATA[
Header: POST (Code=0.02)
Uri-Host: "as.example.com"
Uri-Path: "token"
Content-Format: application/ace+cbor
Payload:
{
/ audience / 5 : "tempSensor4711",
/ scope / 9 : "read"
}
]]></sourcecode>
</figure>
<t>
If the client wants to update its access rights without changing an existing OSCORE security context, it <bcp14>MUST</bcp14> include a <tt>req_cnf</tt> object in its POST request to the token endpoint, with the <tt>kid</tt> field carrying a CBOR byte string containing the OSCORE Input Material identifier (assigned as discussed in <xref target="as-c" format="default"/>). This identifier, together with other information such as audience (see <xref target="RFC9200" sectionFormat="of" section="5.8.1"/>), can be used by the AS to determine the shared secret bound to the proof-of-possession token; therefore, it <bcp14>MUST</bcp14> identify a symmetric key that was previously generated by the AS as a shared secret for the communication between the client and the RS. The AS <bcp14>MUST</bcp14> verify that the received value identifies a proof-of-possession key that has previously been issued to the requesting client. If that is not the case, the client-to-AS request <bcp14>MUST</bcp14> be declined with the error code <tt>invalid_request</tt> as defined in <xref target="RFC9200" sectionFormat="of" section="5.8.3"/>.
</t>
<t>
An example of such a request is shown in <xref target="ex7" format="default"/>.
</t>
<figure anchor="ex7">
<name>Example C-to-AS POST /token Request for Updating Rights to an Access Token Bound to a Symmetric Key</name>
<sourcecode name="" type="cbor-diag"><![CDATA[
Header: POST (Code=0.02)
Uri-Host: "as.example.com"
Uri-Path: "token"
Content-Format: application/ace+cbor
Payload:
{
/ audience / 5 : "tempSensor4711",
/ scope / 9 : "write",
/ req_cnf / 4 : {
/ kid / 3 : h'01'
}
}
]]></sourcecode>
</figure>
</section>
<section anchor="as-c" numbered="true" toc="default">
<name>AS-to-C: Access Token</name>
<t>
After verifying the POST request to the token endpoint and that the client is authorized to obtain an access token corresponding to its access token request, the AS responds as defined in <xref target="RFC9200" sectionFormat="of" section="5.8.2"/>. If the client request was invalid, or not authorized, the AS returns an error response as described in <xref target="RFC9200" sectionFormat="of" section="5.8.3"/>.
</t>
<t>
The AS can signal that the use of OSCORE is <bcp14>REQUIRED</bcp14> for a specific access token by including the <tt>ace_profile</tt> parameter with the value <tt>coap_oscore</tt> in the access token response. This means that the client <bcp14>MUST</bcp14> use OSCORE towards all resource servers for which this access token is valid, and follow <xref target="oscore-setup" format="default"/> to derive the security context to run OSCORE.
Usually, it is assumed that constrained devices will be preconfigured with the necessary profile, so that this kind of profile signaling can be omitted.
</t>
<t>
Moreover, the AS <bcp14>MUST</bcp14> send the following data:
</t>
<ul spacing="normal">
<li>a Master Secret</li>
<li>an identifier of the OSCORE Input Material</li>
</ul>
<t>
Additionally, the AS <bcp14>MAY</bcp14> send the following data, in the same response.
</t>
<ul spacing="normal">
<li>a context identifier</li>
<li>an AEAD algorithm</li>
<li>an HMAC-based key derivation function (HKDF) algorithm <xref target="RFC5869" format="default"/>. It is specified by the HMAC algorithm value; see <xref target="RFC9053" sectionFormat="of" section="3.1"/>.</li>
<li>a salt</li>
<li>the OSCORE version number</li>
</ul>
<t>
This data is transported in the OSCORE_Input_Material. The OSCORE_Input_Material is a CBOR map object, defined in <xref target="oscore-sec-ctx" format="default"/>. This object is transported in the <tt>cnf</tt> parameter of the access token response, as defined in <xref target="RFC9201" sectionFormat="of" section="3.2"/>, as the value of a field named <tt>osc</tt>, which is registered in Sections <xref target="osc-cwt" format="counter"/> and <xref target="osc-jwt" format="counter"/>.
</t>
<t>
The AS <bcp14>MAY</bcp14> assign an identifier to the context (context identifier). This identifier is used as ID Context in the OSCORE context as described in <xref target="RFC8613" sectionFormat="of" section="3.1"/>. If assigned, these parameters <bcp14>MUST</bcp14> be communicated as the <tt>contextId</tt> field in the OSCORE_Input_Material. The application needs to consider that this identifier is sent in the clear and may reveal information about the endpoints, as mentioned in <xref target="RFC8613" sectionFormat="of" section="12.8"/>.
</t>
<t>
The Master Secret and the identifier of the OSCORE_Input_Material <bcp14>MUST</bcp14> be communicated as the <tt>ms</tt> and <tt>id</tt> field in the <tt>osc</tt> field in the <tt>cnf</tt> parameter of the access token response. If included, the following are sent: the AEAD algorithm in the <tt>alg</tt> parameter in the OSCORE_Input_Material; the HKDF algorithm in the <tt>hkdf</tt> parameter of the OSCORE_Input_Material; a salt in the <tt>salt</tt> parameter of the OSCORE_Input_Material; and the OSCORE version in the <tt>version</tt> parameter of the OSCORE_Input_Material.
</t>
<t>
The same parameters <bcp14>MUST</bcp14> be included in the claims associated with the access token.
The OSCORE Master Secret <bcp14>MUST</bcp14> be encrypted by the authorization server so that only the resource server can decrypt it (see <xref target="RFC9200" sectionFormat="of" section="6.1"/>). The use of a CBOR Web Token (CWT) protected with COSE_Encrypt/COSE_Encrypt0 as specified in <xref target="RFC8392" format="default"/> is <bcp14>RECOMMENDED</bcp14> in this profile. If the token is a CWT, the same OSCORE_Input_Material structure defined above <bcp14>MUST</bcp14> be placed in the <tt>osc</tt> field of the <tt>cnf</tt> claim of this token.
</t>
<t>
The AS <bcp14>MUST</bcp14> send a different OSCORE_Input_Material (and therefore different access tokens) to different authorized clients, in order for the RS to differentiate between clients.
</t>
<t>
<xref target="ex1" format="default"/> shows an example of an AS response. The access token has been truncated for readability.
</t>
<figure anchor="ex1">
<name>Example AS-to-C Access Token Response with an OSCORE Profile</name>
<sourcecode name="" type="cbor-diag"><![CDATA[
Header: Created (Code=2.01)
Content-Type: application/ace+cbor
Payload:
{
/ access_token / 1 : h'8343a1010aa2044c53/...
(remainder of access token (CWT) omitted for brevity)/',
/ ace_profile / 38 : / coap_oscore / 2,
/ expires_in / 2 : 3600,
/ cnf / 8 : {
/ osc / 4 : {
/ id / 0 : h'01',
/ ms / 2 : h'f9af838368e353e78888e1426bd94e6f'
}
}
}
]]></sourcecode>
</figure>
<t>
<xref target="ex2" format="default"/> shows an example CWT Claims Set, including the relevant OSCORE parameters in the <tt>cnf</tt> claim.
</t>
<figure anchor="ex2">
<name>Example CWT Claims Set with OSCORE Parameters</name>
<sourcecode name="" type="cbor-diag"><![CDATA[
{
/ aud / 3 : "tempSensorInLivingRoom",
/ iat / 6 : 1360189224,
/ exp / 4 : 1360289224,
/ scope / 9 : "temperature_g firmware_p",
/ cnf / 8 : {
/ osc / 4 : {
/ id / 0 : h'01',
/ ms / 2 : h'f9af838368e353e78888e1426bd94e6f'
}
}
}
]]></sourcecode>
</figure>
<t>
The same CWT Claims Set as in <xref target="ex2" format="default"/>, using the value abbreviations defined in <xref target="RFC9200" format="default"/> and <xref target="RFC8747" format="default"/> and encoded in CBOR, is shown in <xref target="ex2-cbor" format="default"/>. The bytes in hexadecimal are reported in the first column, while their corresponding CBOR meaning is reported after the <tt>#</tt> sign on the second column, for readability.
</t>
<figure anchor="ex2-cbor">
<name>Example CWT Claims Set with OSCORE Parameters Using CBOR Encoding</name>
<sourcecode name="" type="cbor-pretty"><![CDATA[
A5 # map(5)
03 # unsigned(3)
76 # text(22)
74656D7053656E736F72496E4C6976696E67526F6F6D
# "tempSensorInLivingRoom"
06 # unsigned(6)
1A 5112D728 # unsigned(1360189224)
04 # unsigned(4)
1A 51145DC8 # unsigned(1360289224)
09 # unsigned(9)
78 18 # text(24)
74656D70657261747572655F67206669726D776172655F70
# "temperature_g firmware_p"
08 # unsigned(8)
A1 # map(1)
04 # unsigned(4)
A2 # map(2)
00 # unsigned(0)
41 # bytes(1)
01
02 # unsigned(2)
50 # bytes(16)
F9AF838368E353E78888E1426BD94E6F
]]></sourcecode>
</figure>
<t>
If the client has requested an update to its access rights using the same OSCORE security context, which is valid and authorized, the AS <bcp14>MUST</bcp14> omit the <tt>cnf</tt> parameter in the response and <bcp14>MUST</bcp14> carry the OSCORE Input Material identifier in the <tt>kid</tt> field in the <tt>cnf</tt> claim of the token. This identifier needs to be included in the token in order for the RS to identify the correct OSCORE Input Material.
</t>
<t>
<xref target="ex5" format="default"/> shows an example of such an AS response. The access token has been truncated for readability.
</t>
<figure anchor="ex5">
<name>Example AS-to-C Access Token Response with an OSCORE Profile for the Update of Access Rights</name>
<sourcecode name="" type="cbor-diag"><![CDATA[
Header: Created (Code=2.01)
Content-Type: application/ace+cbor
Payload:
{
/ access_token / 1 : h'8343a1010aa2044c53/ ...
(remainder of access token (CWT) omitted for brevity)/',
/ ace_profile / 38 : / coap_oscore / 2,
/ expires_in / 2 : 3600
}
]]></sourcecode>
</figure>
<t>
<xref target="ex6" format="default"/> shows an example CWT Claims Set that contains the necessary OSCORE parameters in the <tt>cnf</tt> claim for the update of access rights.
</t>
<figure anchor="ex6">
<name>Example CWT Claims Set with OSCORE Parameters for the Update of Access Rights</name>
<sourcecode name="" type="cbor-diag"><![CDATA[
{
/ aud / 3 : "tempSensorInLivingRoom",
/ iat / 6 : 1360189224,
/ exp / 4 : 1360289224,
/ scope / 9 : "temperature_h",
/ cnf / 8 : {
/ kid / 3 : h'01'
}
}
]]></sourcecode>
</figure>
<section anchor="oscore-sec-ctx" numbered="true" toc="default">
<name>The OSCORE_Input_Material</name>
<t>
An OSCORE_Input_Material is an object that represents the input material to derive an OSCORE security context, i.e., the local set of information elements necessary to carry out the cryptographic operations in OSCORE (<xref target="RFC8613" sectionFormat="of" section="3.1"/>). In particular, the OSCORE_Input_Material is defined to be serialized and transported between nodes, as specified by this document, but it can also be used by other specifications if needed. The OSCORE_Input_Material can be encoded as either a JSON object or a CBOR map. The set of common parameters that can appear in an OSCORE_Input_Material can be found in the IANA "OSCORE Security Context Parameters" registry (<xref target="sec-ctx-params-reg" format="default"/>), defined for extensibility, and the initial set of parameters defined in this document is specified below.
All parameters are optional.
<xref target="key-labels" format="default"/> provides a summary of the OSCORE_Input_Material parameters defined in this section.
</t>
<table anchor="key-labels" align="center">
<name>OSCORE_Input_Material Parameters</name>
<thead>
<tr>
<th align="left">name</th>
<th align="left">CBOR label</th>
<th align="left">CBOR type</th>
<th align="left">registry</th>
<th align="left">description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left">id</td>
<td align="left">0</td>
<td align="left">byte string</td>
<td align="left"/>
<td align="left">OSCORE Input Material identifier</td>
</tr>
<tr>
<td align="left">version</td>
<td align="left">1</td>
<td align="left">unsigned integer</td>
<td align="left"/>
<td align="left">OSCORE version</td>
</tr>
<tr>
<td align="left">ms</td>
<td align="left">2</td>
<td align="left">byte string</td>
<td align="left"/>
<td align="left">OSCORE Master Secret value</td>
</tr>
<tr>
<td align="left">hkdf</td>
<td align="left">3</td>
<td align="left">text string / integer</td>
<td align="left">
<xref target="COSE.Algorithms" format="default"/> values (HMAC-based)</td>
<td align="left">OSCORE HKDF value</td>
</tr>
<tr>
<td align="left">alg</td>
<td align="left">4</td>
<td align="left">text string / integer</td>
<td align="left">
<xref target="COSE.Algorithms" format="default"/> values (AEAD)</td>
<td align="left">OSCORE AEAD Algorithm value</td>
</tr>
<tr>
<td align="left">salt</td>
<td align="left">5</td>
<td align="left">byte string</td>
<td align="left"/>
<td align="left">an input to OSCORE Master Salt value</td>
</tr>
<tr>
<td align="left">contextId</td>
<td align="left">6</td>
<td align="left">byte string</td>
<td align="left"/>
<td align="left">OSCORE ID Context value</td>
</tr>
</tbody>
</table>
<dl newline="false" spacing="normal">
<dt>id:</dt>
<dd>
This parameter identifies the OSCORE_Input_Material and is encoded as a byte string.
In JSON, the <tt>id</tt> value is a base64-encoded byte string.
In CBOR, the <tt>id</tt> type is a byte string, and it has label 0.
</dd>
<dt>version:</dt>
<dd>
This parameter identifies the OSCORE version number, which is an unsigned integer. For more information about this field, see <xref target="RFC8613" sectionFormat="of" section="5.4"/>.
In JSON, the <tt>version</tt> value is an integer.
In CBOR, the <tt>version</tt> type is an integer, and it has label 1.
</dd>
<dt>ms:</dt>
<dd>
This parameter identifies the OSCORE Master Secret value, which is a byte string. For more information about this field, see <xref target="RFC8613" sectionFormat="of" section="3.1"/>.
In JSON, the <tt>ms</tt> value is a base64-encoded byte string.
In CBOR, the <tt>ms</tt> type is byte string, and it has label 2.
</dd>
<dt>hkdf:</dt>
<dd>
This parameter identifies the OSCORE HKDF Algorithm. For more information about this field, see <xref target="RFC8613" sectionFormat="of" section="3.1"/>.
The values used <bcp14>MUST</bcp14> be registered in the IANA "COSE Algorithms" registry (see <xref target="COSE.Algorithms" format="default"/>) and <bcp14>MUST</bcp14> be HMAC-based HKDF algorithms (see <xref target="RFC9053" sectionFormat="of" section="3.1"/>). The value can be either the integer or the text-string value of the HMAC-based HKDF algorithm in the "COSE Algorithms" registry.
In JSON, the <tt>hkdf</tt> value is a case-sensitive ASCII string or an integer.
In CBOR, the <tt>hkdf</tt> type is a text string or integer, and it has label 3.
</dd>
<dt>alg:</dt>
<dd>
This parameter identifies the OSCORE AEAD Algorithm. For more information about this field, see <xref target="RFC8613" sectionFormat="of" section="3.1"/>.
The values used <bcp14>MUST</bcp14> be registered in the IANA "COSE Algorithms" registry (see <xref target="COSE.Algorithms" format="default"/>) and <bcp14>MUST</bcp14> be AEAD algorithms. The value can be either the integer or the text-string value of the HMAC-based HKDF algorithm in the "COSE Algorithms" registry.
In JSON, the <tt>alg</tt> value is a case-sensitive ASCII string or an integer.
In CBOR, the <tt>alg</tt> type is a text string or integer, and it has label 4.
</dd>
<dt>salt:</dt>
<dd>
This parameter identifies an input to the OSCORE Master Salt value, which is a byte string. For more information about this field, see <xref target="RFC8613" sectionFormat="of" section="3.1"/>.
In JSON, the <tt>salt</tt> value is a base64-encoded byte string.
In CBOR, the <tt>salt</tt> type is a byte string, and it has label 5.
</dd>
<dt>contextId:</dt>
<dd>
This parameter identifies the security context as a byte string. This identifier is used as OSCORE ID Context. For more information about this field, see <xref target="RFC8613" sectionFormat="of" section="3.1"/>.
In JSON, the <tt>contextID</tt> value is a base64-encoded byte string.
In CBOR, the <tt>contextID</tt> type is a byte string, and it has label 6.
</dd>
</dl>
<t>
An example of JSON OSCORE_Input_Material is given in <xref target="JSON-osc" format="default"/>.
</t>
<figure anchor="JSON-osc">
<name>Example JSON OSCORE_Input_Material</name>
<sourcecode name="" type="json"><![CDATA[
"osc" : {
"alg" : "AES-CCM-16-64-128",
"id" : "AQ",
"ms" : "-a-Dg2jjU-eIiOFCa9lObw"
}
]]></sourcecode>
</figure>
<t>
The CDDL grammar describing the CBOR OSCORE_Input_Material is shown in <xref target="CDDL-osc" format="default"/>.
</t>
<figure anchor="CDDL-osc">
<name>CDDL Grammar of the OSCORE_Input_Material</name>
<sourcecode name="" type="cddl"><![CDATA[
OSCORE_Input_Material = {
? 0 => bstr, ; id
? 1 => int, ; version
? 2 => bstr, ; ms
? 3 => tstr / int, ; hkdf
? 4 => tstr / int, ; alg
? 5 => bstr, ; salt
? 6 => bstr, ; contextId
* (int / tstr) => any
}
]]></sourcecode>
</figure>
</section>
</section>
</section>
<section anchor="c-rs1" numbered="true" toc="default">
<name>Client-RS Communication</name>
<t>
The following subsections describe the details of the POST request and response to the authz-info endpoint between the client and RS. The client generates a nonce N1 and an identifier ID1 that is unique in the sets of its own Recipient IDs and posts them together with the token that includes the materials (e.g., OSCORE parameters) received from the AS to the RS. The RS then generates a nonce N2 and an identifier ID2 that is unique in the sets of its own Recipient IDs and uses <xref target="RFC8613" sectionFormat="of" section="3.2"/> to derive a security context based on a shared Master Secret, the two exchanged nonces, and the two identifiers, established between the client and server. The exchanged nonces and identifiers are encoded as a CBOR byte string if CBOR is used and as a base64 string if JSON is used. This security context is used to protect all future communication between the client and RS using OSCORE, as long as the access token is valid.
</t>
<t>
Note that the RS and client authenticate each other
by generating the shared OSCORE security context using
the PoP key as the Master Secret. An attacker
posting a valid token to the RS will not be able to generate a valid OSCORE security context and
thus will not be able to prove possession of the PoP key. Additionally, the mutual authentication is only achieved after the client has successfully verified a response from the RS protected with the generated OSCORE security context.
</t>
<section anchor="c-rs" numbered="true" toc="default">
<name>C-to-RS: POST to authz-info Endpoint</name>
<t>
The client <bcp14>MUST</bcp14> generate a nonce value N1 that is very unlikely to have been previously used with the same input keying material. The use of a 64-bit long random number as the nonce's value is <bcp14>RECOMMENDED</bcp14> in this profile. The client <bcp14>MUST</bcp14> store the nonce N1 as long as the response from the RS is not received and the access token related to it is still valid (to the best of the client's knowledge).
</t>
<t>
The client generates its own Recipient ID, ID1, for the OSCORE security context that it is establishing with the RS. By generating its own Recipient ID, the client makes sure that it does not collide with any of its Recipient IDs, nor with any other identifier ID1 if the client is executing this exchange with a different RS at the same time.
</t>
<t>
The client <bcp14>MUST</bcp14> use CoAP and the authorization information resource as described in <xref target="RFC9200" sectionFormat="of" section="5.8.1"/> to transport the token, N1, and ID1 to the RS.
</t>
<t>
Note that the use of the payload and the Content-Format is different from what is described in <xref target="RFC9200" sectionFormat="of" section="5.8.1"/>, which only transports the token without any CBOR wrapping. In this profile, the client <bcp14>MUST</bcp14> wrap the token, N1, and ID1 in a CBOR map.
The client <bcp14>MUST</bcp14> use the Content-Format application/ace+cbor defined in <xref target="RFC9200" sectionFormat="of" section="8.16"/>. The client <bcp14>MUST</bcp14> include the access token using the <tt>access_token</tt> parameter; N1 using the <tt>nonce1</tt> parameter defined in <xref target="nonce1" format="default"/>; and ID1 using the <tt>ace_client_recipientid</tt> parameter defined in <xref target="id1" format="default"/>.
</t>
<t>
The communication with the authz-info endpoint does not have to be protected, except for the update of access rights case described below.
</t>
<t>
Note that a client may be required to repost the access token in order to complete a request, since an RS may delete a stored access token (and associated security context) at any time, for example, due to all storage space being consumed. This situation is detected by the client when it receives an AS Request Creation Hints response. Reposting the same access token will result in deriving a new OSCORE security context to be used with the RS, as different exchanged nonces will be used.
</t>
<t>
The client may also choose to repost the access token in order to update its OSCORE security context. In that case, the client and the RS will exchange newly generated nonces, renegotiate identifiers, and derive new keying material. The client and RS might decide to keep the same identifiers or renew them during the renegotiation.
</t>
<t>
<xref target="ex3" format="default"/> shows an example of the request sent from the client to the RS. The access token has been truncated for readability.
</t>
<figure anchor="ex3">
<name>Example C-to-RS POST /authz-info Request Using CWT</name>
<sourcecode name="" type="cbor-diag"><![CDATA[
Header: POST (Code=0.02)
Uri-Host: "rs.example.com"
Uri-Path: "authz-info"
Content-Format: application/ace+cbor
Payload:
{
/ access_token / 1 : h'8343a1010aa2044c53/...
(remainder of access token (CWT) omitted for brevity)/',
/ nonce1 / 40 : h'018a278f7faab55a',
/ ace_client_recipientid / 43 : h'1645'
}
]]></sourcecode>
</figure>
<t>
If the client has already posted a valid token, has already established a security association with the RS, and wants to update its access rights, the client can do so by posting the new token (retrieved from the AS and containing the update of access rights) to the /authz-info endpoint. The client <bcp14>MUST</bcp14> protect the request using the OSCORE security context established during the first token exchange. The client <bcp14>MUST</bcp14> only send the <tt>access_token</tt> field in the CBOR map in the payload; no nonce or identifier is sent. After proper verification (see <xref target="rs-c" format="default"/>), the RS will replace the old token with the new one, maintaining the same security context.
</t>
<section anchor="nonce1" numbered="true" toc="default">
<name>The Nonce 1 Parameter</name>
<t>
The <tt>nonce1</tt> parameter <bcp14>MUST</bcp14> be sent from the client to the RS, together with the access token, if the ACE profile used is <tt>coap_oscore</tt>, and the message is not an update of access rights, protected with an existing OSCORE security context. The parameter is encoded as a byte string for
CBOR-based interactions and as a string (base64-encoded binary) for
JSON-based interactions. This parameter is registered in <xref target="iana-nonces-ids" format="default"/>.
</t>
</section>
<section anchor="id1" numbered="true" toc="default">
<name>The ace_client_recipientid Parameter</name>
<t>
The <tt>ace_client_recipientid</tt> parameter <bcp14>MUST</bcp14> be sent from the client to the RS, together with the access token, if the ACE profile used is <tt>coap_oscore</tt>, and the message is not an update of access rights, protected with an existing OSCORE security context. The parameter is encoded as a byte string for
CBOR-based interactions and as a string (base64-encoded binary) for
JSON-based interactions. This parameter is registered in <xref target="iana-nonces-ids" format="default"/>.
</t>
</section>
</section>
<section anchor="rs-c" numbered="true" toc="default">
<name>RS-to-C: 2.01 (Created)</name>
<t>
The RS <bcp14>MUST</bcp14> follow the procedures defined in <xref target="RFC9200" sectionFormat="of" section="5.8.1"/>: the RS must verify the validity of the token. If the token is valid, the RS must respond to the POST request with 2.01 (Created).
If the token is valid but is associated to claims that the RS cannot process (e.g., an unknown scope), or if any of the expected parameters are missing (e.g., any of the mandatory parameters from the AS or the identifier ID1), or if any parameters received in the <tt>osc</tt> field are unrecognized, the RS must respond with an error response code equivalent to the CoAP code 4.00 (Bad Request). In the latter two cases, the RS may provide additional information in the error response, in order to clarify what went wrong.
The RS may make an introspection request (see <xref target="RFC9200" sectionFormat="of" section="5.9.1"/>) to validate the token before responding to the POST request to the authz-info endpoint.
</t>
<t>
Additionally, the RS <bcp14>MUST</bcp14> generate a nonce N2 that is very unlikely to have been previously used with the same input keying material and its own Recipient ID, ID2. The RS makes sure that ID2 does not collide with any of its Recipient IDs. The RS <bcp14>MUST</bcp14> ensure that ID2 is different from the value received in the <tt>ace_client_recipientid</tt> parameter. The RS sends N2 and ID2 within the 2.01 (Created) response. The payload of the 2.01 (Created) response <bcp14>MUST</bcp14> be a CBOR map containing the <tt>nonce2</tt> parameter defined in <xref target="nonce2" format="default"/>, set to N2, and the <tt>ace_server_recipientid</tt> parameter defined in <xref target="id2" format="default"/>, set to ID2. The use of a 64-bit long random number as the nonce's value is <bcp14>RECOMMENDED</bcp14> in this profile.
The RS <bcp14>MUST</bcp14> use the Content-Format application/ace+cbor defined in <xref target="RFC9200" sectionFormat="of" section="8.16"/>.
</t>
<t>
<xref target="ex4" format="default"/> shows an example of the response sent from the RS to the client.
</t>
<figure anchor="ex4">
<name>Example RS-to-C 2.01 (Created) Response</name>
<sourcecode name="" type="cbor-diag"><![CDATA[
Header: Created (Code=2.01)
Content-Format: application/ace+cbor
Payload:
{
/ nonce2 / 42 : h'25a8991cd700ac01',
/ ace_server_recipientid / 44 : h'0000'
}
]]></sourcecode>
</figure>
<t>
As specified in <xref target="RFC9200" sectionFormat="of" section="5.8.3"/>, the RS must notify the client with an error response with code 4.01 (Unauthorized) for any long running request before terminating the session, when the access token expires.
</t>
<t>
If the RS receives the token in an OSCORE-protected message, it means that the client is requesting an update of access rights. The RS <bcp14>MUST</bcp14> ignore any nonce and identifiers in the request, if any were sent. The RS <bcp14>MUST</bcp14> check that the <tt>kid</tt> of the <tt>cnf</tt> claim of the new access token matches the identifier of the OSCORE Input Material of the context used to protect the message. If that is the case, the RS <bcp14>MUST</bcp14> overwrite the old token and associate the new token to the security context identified by the <tt>kid</tt> value in the <tt>cnf</tt> claim. The RS <bcp14>MUST</bcp14> respond with a 2.01 (Created) response protected with the same security context, with no payload. If any verification fails, the RS <bcp14>MUST</bcp14> respond with a 4.01 (Unauthorized) error response.
</t>
<t>
As specified in <xref target="RFC9200" sectionFormat="of" section="5.8.1"/>, when receiving an updated access token with updated authorization information from the client (see <xref target="c-as" format="default"/>), it is recommended that the RS overwrites the previous token; that is, only the latest authorization information in the token received by the RS is valid. This simplifies the process needed by the RS to keep track of authorization information for a given client.
</t>
<section anchor="nonce2" numbered="true" toc="default">
<name>The Nonce 2 Parameter</name>
<t>
The <tt>nonce2</tt> parameter <bcp14>MUST</bcp14> be sent from the RS to the client if the ACE profile used is <tt>coap_oscore</tt> and the message is not a response to an update of access rights, protected with an existing OSCORE security context. The parameter is encoded as a byte string for
CBOR-based interactions and as a string (base64-encoded binary) for
JSON-based interactions. This parameter is registered in <xref target="iana-nonces-ids" format="default"/>
</t>
</section>
<section anchor="id2" numbered="true" toc="default">
<name>The ace_server_recipientid Parameter</name>
<t>
The <tt>ace_server_recipientid</tt> parameter <bcp14>MUST</bcp14> be sent from the RS to the client if the ACE profile used is <tt>coap_oscore</tt> and the message is not a response to an update of access rights, protected with an existing OSCORE security context. The parameter is encoded as a byte string for
CBOR-based interactions and as a string (base64-encoded binary) for
JSON-based interactions. This parameter is registered in <xref target="iana-nonces-ids" format="default"/>
</t>
</section>
</section>
<section anchor="oscore-setup" numbered="true" toc="default">
<name>OSCORE Setup</name>
<t>
Once the 2.01 (Created) response is received from the RS, following the POST request to authz-info endpoint, the client <bcp14>MUST</bcp14> extract the bstr nonce N2 from the <tt>nonce2</tt> parameter in the CBOR map in the payload of the response. Then, the client <bcp14>MUST</bcp14> set the Master Salt of the security context created to communicate with the RS to the concatenation of salt, N1, and N2 in this order: Master Salt = salt | N1 | N2, where | denotes byte string concatenation, salt is the CBOR byte string received from the AS in <xref target="as-c" format="default"/>, and N1 and N2 are the two nonces encoded as CBOR byte strings. An example of Master Salt construction using CBOR encoding is given in <xref target="ms-ex" format="default"/>.
</t>
<figure anchor="ms-ex">
<name>Example of Master Salt Construction Using CBOR Encoding</name>
<sourcecode name="" type=""><![CDATA[
N1, N2, and input salt expressed in CBOR diagnostic notation:
nonce1 = h'018a278f7faab55a'
nonce2 = h'25a8991cd700ac01'
input salt = h'f9af838368e353e78888e1426bd94e6f'
N1, N2, and input salt as CBOR encoded byte strings:
nonce1 = 0x48018a278f7faab55a
nonce2 = 0x4825a8991cd700ac01
input salt = 0x50f9af838368e353e78888e1426bd94e6f
Master Salt = 0x50 f9af838368e353e78888e1426bd94e6f
48 018a278f7faab55a 48 25a8991cd700ac01
]]></sourcecode>
</figure>
<t>
If JSON is used instead of CBOR, the Master Salt of the security context is the base64 encoding of the concatenation of the same parameters, each of them prefixed by their size, encoded in 1 byte. When using JSON, the nonces and input salt have a maximum size of 255 bytes. An example of Master Salt construction using base64 encoding is given in <xref target="ms-ex-2" format="default"/>.
</t>
<figure anchor="ms-ex-2">
<name>Example of Master Salt Construction Using Base64 Encoding</name>
<sourcecode name="" type=""><![CDATA[
N1, N2, and input salt values:
nonce1 = 0x018a278f7faab55a (8 bytes)
nonce2 = 0x25a8991cd700ac01 (8 bytes)
input salt = 0xf9af838368e353e78888e1426bd94e6f (16 bytes)
Input to base64 encoding: 0x10 f9af838368e353e78888e1426bd94e6f
08 018a278f7faab55a 08 25a8991cd700ac01
Master Salt = b64'EPmvg4No41PniIjhQmvZTm8IAYonj3+qtVoIJaiZHNcArAE='
]]></sourcecode>
</figure>
<t>
The client <bcp14>MUST</bcp14> set the Sender ID to the <tt>ace_server_recipientid</tt> received in <xref target="rs-c" format="default"/> and set the Recipient ID to the <tt>ace_client_recipientid</tt> sent in <xref target="c-rs" format="default"/>. The client <bcp14>MUST</bcp14> set the Master Secret from the parameter received from the AS in <xref target="as-c" format="default"/>. The client <bcp14>MUST</bcp14> set the AEAD algorithm, ID Context, HKDF, and OSCORE version from the parameters received from the AS in <xref target="as-c" format="default"/>, if present. In case an optional parameter is omitted, the default value <bcp14>SHALL</bcp14> be used as described in Sections <xref target="RFC8613" sectionFormat="bare" section="3.2"/> and <xref target="RFC8613" sectionFormat="bare" section="5.4"/> of <xref target="RFC8613" format="default"/>. After that, the client <bcp14>MUST</bcp14> derive the complete security context following <xref target="RFC8613" sectionFormat="of" section="3.2.1"/>. From this point on, the client <bcp14>MUST</bcp14> use this security context to communicate with the RS when accessing the resources as specified by the authorization information.
</t>
<t>
If any of the expected parameters are missing (e.g., any of the mandatory parameters from the AS or the RS), or if <tt>ace_client_recipientid</tt> equals <tt>ace_server_recipientid</tt> (and as a consequence, the Sender and Recipient Keys derived would be equal; see <xref target="RFC8613" sectionFormat="of" section="3.3"/>), then the client <bcp14>MUST</bcp14> stop the exchange and <bcp14>MUST NOT</bcp14> derive the security context. The client <bcp14>MAY</bcp14> restart the exchange, to get the correct security material.
</t>
<t>
The client then uses this security context to send requests to the RS using OSCORE.
</t>
<t>
After sending the 2.01 (Created) response, the RS <bcp14>MUST</bcp14> set the Master Salt of the security context created to communicate with the client to the concatenation of salt, N1, and N2 in the same way described above. An example of Master Salt construction using CBOR encoding is given in <xref target="ms-ex" format="default"/> and using base64 encoding is given in <xref target="ms-ex-2" format="default"/>. The RS <bcp14>MUST</bcp14> set the Sender ID from the <tt>ace_client_recipientid</tt> received in <xref target="c-rs" format="default"/> and set the Recipient ID from the <tt>ace_server_recipientid</tt> sent in <xref target="rs-c" format="default"/>. The RS <bcp14>MUST</bcp14> set the Master Secret from the parameter received from the AS and forwarded by the client in the access token in <xref target="c-rs" format="default"/> after validation of the token as specified in <xref target="rs-c" format="default"/>. The RS <bcp14>MUST</bcp14> set the AEAD algorithm, ID Context, HKDF, and OSCORE version from the parameters received from the AS and forwarded by the client in the access token in <xref target="c-rs" format="default"/> after validation of the token as specified in <xref target="rs-c" format="default"/>, if present. In case an optional parameter is omitted, the default value <bcp14>SHALL</bcp14> be used as described in Sections <xref target="RFC8613" sectionFormat="bare" section="3.2"/> and <xref target="RFC8613" sectionFormat="bare" section="5.4"/> of <xref target="RFC8613" format="default"/>. After that, the RS <bcp14>MUST</bcp14> derive the complete security context following <xref target="RFC8613" sectionFormat="of" section="3.2.1"/> and <bcp14>MUST</bcp14> associate this security context with the authorization information from the access token.
</t>
<t>
The RS then uses this security context to verify requests and send responses to the client using OSCORE. If OSCORE verification fails, error responses are used, as specified in <xref target="RFC8613" sectionFormat="of" section="8"/>. Additionally, if OSCORE verification succeeds, the verification of access rights is performed as described in <xref target="tok-ver" format="default"/>. The RS <bcp14>MUST NOT</bcp14> use the security context after the related token has expired and <bcp14>MUST</bcp14> respond with an unprotected 4.01 (Unauthorized) error message to
requests received that correspond to a security context with an expired
token.
</t>
<t>
Note that the ID Context can be assigned by the AS, communicated and set in both the RS and client after the exchange specified in this profile is executed. Subsequently, the client and RS can update their ID Context by running a mechanism such as the one defined in <xref target="RFC8613" sectionFormat="of" section="B.2"/> if they both support it and are configured to do so. In that case, the ID Context in the OSCORE security context will not match the <tt>contextId</tt> parameter of the corresponding OSCORE_Input_Material. Running Appendix <xref target="RFC8613" sectionFormat="bare" section="B.2"/> results in the keying material being updated in the security contexts of the client and RS; this same result can also be achieved by the client reposting the access token to the unprotected /authz-info endpoint at the RS, as described in <xref target="c-rs" format="default"/>, but without updating the ID Context.
</t>
</section>
<section anchor="tok-ver" numbered="true" toc="default">
<name>Access Rights Verification</name>
<t>
The RS <bcp14>MUST</bcp14> follow the procedures defined in <xref target="RFC9200" sectionFormat="of" section="5.8.2"/>: if an RS receives an OSCORE-protected request from a client, then the RS processes it according to <xref target="RFC8613" format="default"/>. If OSCORE verification succeeds, and the target resource
requires authorization, the RS retrieves the authorization information using the access token associated to the security context. The RS then must verify that the authorization information covers the resource and the action requested.
</t>
</section>
</section>
<section anchor="introsp" numbered="true" toc="default">
<name>Secure Communication with AS</name>
<t>
As specified in the ACE framework (<xref target="RFC9200" sectionFormat="of" section="5.9"/>), the requesting entity (RS and/or client) and the AS communicates via the introspection or token endpoint. The use of CoAP and OSCORE <xref target="RFC8613" format="default"/> for this communication is <bcp14>RECOMMENDED</bcp14> in this profile; other protocols fulfilling the security requirements defined in <xref target="RFC9200" sectionFormat="of" section="5"/> (such as HTTP and DTLS or TLS) <bcp14>MAY</bcp14> be used instead.
</t>
<t>
If OSCORE is used, the requesting entity and the AS are expected to have preestablished security contexts in place. How these security contexts are established is out of scope for this profile. Furthermore, the requesting entity and the AS communicate through the introspection endpoint as specified in <xref target="RFC9200" sectionFormat="of" section="5.9"/> and through the token endpoint as specified in <xref target="RFC9200" sectionFormat="of" section="5.8"/>.
</t>
</section>
<section anchor="sec-ctx-discard" numbered="true" toc="default">
<name>Discarding the Security Context</name>
<t>
There are a number of scenarios where a client or RS needs to discard the OSCORE security context and acquire a new one.
</t>
<t>
The client <bcp14>MUST</bcp14> discard the current security context associated with an RS when any of the following occurs:
</t>
<ul spacing="normal">
<li> the sequence number space ends. </li>
<li> the access token associated with the context becomes invalid due to, for example, expiration. </li>
<li> the client receives a number of 4.01 Unauthorized responses to OSCORE requests using the same security context. The exact number needs to be specified by the application. </li>
<li> the client receives a new nonce in the 2.01 (Created) response (see <xref target="rs-c" format="default"/>) to a POST request to the authz-info endpoint, when reposting a (non-expired) token associated to the existing context. </li>
</ul>
<t>
The RS <bcp14>MUST</bcp14> discard the current security context associated with a client when any of the following occurs:
</t>
<ul spacing="normal">
<li> the sequence number space ends. </li>
<li> the access token associated with the context expires. </li>
<li> the client has successfully replaced the current security context with a newer one by posting an access token to the unprotected /authz-info endpoint at the RS, e.g., by reposting the same token, as specified in <xref target="c-rs" format="default"/>.</li>
</ul>
<t>
Whenever one more access token is successfully posted to the RS, and a new security context is derived between the client and RS, messages in transit that were protected with the previous security context might not pass verification, as the old context is discarded. That means that messages sent shortly before the client posts one more access tokens to the RS might not successfully reach the destination. Analogously, implementations may want to cancel CoAP observations at the RS registered before the security context is replaced, or conversely, they will need to implement a mechanism to ensure that those observations are to be protected with the newly derived security context.
</t>
</section>
<section anchor="sec-cons" numbered="true" toc="default">
<name>Security Considerations</name>
<t>
This document specifies a profile for the ACE framework
<xref target="RFC9200" format="default"/>. Thus, the general security
considerations from the framework also apply to this profile.
</t>
<t>
Furthermore, the general security considerations of OSCORE <xref target="RFC8613" format="default"/> also apply to this specific
use of the OSCORE protocol.
</t>
<t>
As previously stated, the proof of possession in this profile is performed by both parties verifying that they have established the same security context, as specified in <xref target="oscore-setup" format="default"/>, which means that both the OSCORE request and the OSCORE response passes verification.
RS authentication requires both that the client trusts the AS and that the OSCORE response from the RS passes verification.
</t>
<t>
OSCORE is designed to secure point-to-point communication,
providing a secure binding between the request and the response(s).
Thus, the basic OSCORE protocol is not intended for use in
point-to-multipoint communication (e.g., multicast, publish-subscribe).
Implementers of this profile should make sure that their use case
corresponds to the expected use of OSCORE, to prevent weakening the
security assurances provided by OSCORE.
</t>
<t>
Since the use of nonces N1 and N2 during the exchange guarantees uniqueness of AEAD keys and nonces, it is <bcp14>REQUIRED</bcp14> that the exchanged nonces are not reused with the same input keying material even in case of reboots. The exchange of 64-bit random nonces is <bcp14>RECOMMENDED</bcp14> in this document. Considering the birthday paradox, the average collision for each nonce will happen after 2<sup>32</sup> messages, which is considerably more token provisionings than would be expected for intended applications. If applications use something else, such as a counter, they need to guarantee that reboot and loss of state on either node does not provoke reuse.
If that is not guaranteed, nodes are susceptible to reuse of AEAD (nonce, key) pairs, especially since an on-path attacker can cause the use of a previously exchanged client nonce N1 for security context establishment by replaying the corresponding client-to-server message.
</t>
<t>
In this profile, it is <bcp14>RECOMMENDED</bcp14> that the RS maintains a single access token for each client. The use of multiple access tokens for a single client increases the strain on the resource server as it must consider every access token and calculate the actual permissions of the client. Also, tokens indicating different or disjoint permissions from each other may lead the server to enforce wrong permissions. If one of the access tokens expires earlier than others, the resulting permissions may offer insufficient protection. Developers <bcp14>SHOULD</bcp14> avoid using multiple access tokens for the same client.
</t>
<t>
If a single OSCORE Input Material is used with multiple RSs, the RSs can impersonate the client to one of the other RSs and impersonate another RS to the client. If a Master Secret is used with several clients, the clients can impersonate RS to one of the other clients. Similarly, if symmetric keys are used to integrity protect the token between AS and RS and the token can be used with multiple RSs, the RSs can impersonate AS to one of the other RSs. If the token key is used for any other communication between the RSs and AS, the RSs can impersonate each other to the AS.
</t>
</section>
<section numbered="true" toc="default">
<name>Privacy Considerations</name>
<t>
This document specifies a profile for the ACE framework
<xref target="RFC9200" format="default"/>. Thus, the general privacy
considerations from the framework also apply to this profile.
</t>
<t>
As this document uses OSCORE, the privacy considerations from
<xref target="RFC8613" format="default"/> apply here as well.
</t>
<t>
An unprotected response to an unauthorized request may disclose information about the resource server and/or its existing relationship with the client. It is advisable to include as little information as possible in an unencrypted response. When an OSCORE security context already exists between the client and the resource server, more detailed information may be included.
</t>
<t>
The token is sent in the clear to the authz-info endpoint, so if a client uses the same single token from multiple locations with multiple resource servers, it can risk being tracked by the token's value even when the access token is encrypted.
</t>
<t>
The nonces exchanged in the request and response to the authz-info endpoint are also sent in the clear, so using random nonces is best for privacy (as opposed to, e.g., a counter, which might leak some information about the client).
</t>
<t>
The identifiers used in OSCORE, negotiated between the client and RS, are privacy sensitive (see <xref target="RFC8613" sectionFormat="of" section="12.8"/>) and could reveal information about the client, or they may be used for correlating requests from one client.
</t>
<t>
Note that some information might still leak after OSCORE is established, due to observable message sizes, the source, and the destination addresses.
</t>
</section>
<section numbered="true" toc="default">
<name>IANA Considerations</name>
<section numbered="true" toc="default">
<name>ACE Profile Registry</name>
<t>The following registration has been made in the "ACE Profiles"
registry following the procedure specified in <xref target="RFC9200" sectionFormat="of" section="8.8"/>:</t>
<dl spacing="compact">
<dt>Name:</dt><dd> coap_oscore</dd>
<dt>Description:</dt><dd>Profile for using OSCORE to secure communication
between constrained nodes using the Authentication and Authorization
for Constrained Environments framework.</dd>
<dt>CBOR Value:</dt><dd>2</dd>
<dt>Reference:</dt><dd>RFC 9203</dd>
</dl>
</section>
<section anchor="iana-nonces-ids" numbered="true" toc="default">
<name>OAuth Parameters Registry</name>
<t>The following registrations have been made in the "OAuth Parameters"
registry <xref target="IANA.OAuthParameters" format="default"/> following the procedure specified in <xref target="RFC6749" sectionFormat="of" section="11.2"/>:</t>
<dl spacing="compact">
<dt>Parameter name:</dt><dd>nonce1</dd>
<dt>Parameter usage location:</dt><dd>client-rs request</dd>
<dt>Change Controller:</dt><dd>IETF</dd>
<dt>Specification Document(s):</dt><dd>RFC 9203</dd>
</dl>
<dl spacing="compact">
<dt>Parameter name:</dt><dd>nonce2</dd>
<dt>Parameter usage location:</dt><dd>rs-client response</dd>
<dt>Change Controller:</dt><dd>IETF</dd>
<dt>Specification Document(s):</dt><dd>RFC 9203</dd>
</dl>
<dl spacing="compact">
<dt>Parameter name:</dt><dd>ace_client_recipientid</dd>
<dt>Parameter usage location:</dt><dd>client-rs request</dd>
<dt>Change Controller:</dt><dd>IETF</dd>
<dt>Specification Document(s):</dt><dd>RFC 9203</dd>
</dl>
<dl spacing="compact">
<dt>Parameter name:</dt><dd>ace_server_recipientid</dd>
<dt>Parameter usage location:</dt><dd>rs-client response</dd>
<dt>Change Controller:</dt><dd>IETF</dd>
<dt>Specification Document(s):</dt><dd>RFC 9203</dd>
</dl>
</section>
<section numbered="true" toc="default">
<name>OAuth Parameters CBOR Mappings Registry</name>
<t>The following registrations have been made in the "OAuth Parameters CBOR Mappings"
registry following the procedure specified in <xref target="RFC9200" sectionFormat="of" section="8.10"/>:</t>
<dl spacing="compact" indent="12">
<dt>Name:</dt><dd>nonce1</dd>
<dt>CBOR Key:</dt><dd>40</dd>
<dt>Value Type:</dt><dd>bstr</dd>
<dt>Reference:</dt><dd>RFC 9203</dd>
<dt>Original Specification:</dt><dd>RFC 9203</dd>
</dl>
<dl spacing="compact" indent="12">
<dt>Name:</dt><dd>nonce2</dd>
<dt>CBOR Key:</dt><dd>42</dd>
<dt>Value Type:</dt><dd>bstr</dd>
<dt>Reference:</dt><dd>RFC 9203</dd>
<dt>Original Specification:</dt><dd>RFC 9203</dd>
</dl>
<dl spacing="compact" indent="12">
<dt>Name:</dt><dd>ace_client_recipientid</dd>
<dt>CBOR Key:</dt><dd>43</dd>
<dt>Value Type:</dt><dd>bstr</dd>
<dt>Reference:</dt><dd>RFC 9203</dd>
<dt>Original Specification:</dt><dd>RFC 9203</dd>
</dl>
<dl spacing="compact" indent="12">
<dt>Name:</dt><dd>ace_server_recipientid</dd>
<dt>CBOR Key:</dt><dd>44</dd>
<dt>Value Type:</dt><dd>bstr</dd>
<dt>Reference:</dt><dd>RFC 9203</dd>
<dt>Original Specification:</dt><dd>RFC 9203</dd>
</dl>
</section>
<section anchor="sec-ctx-params-reg" numbered="true" toc="default">
<name>OSCORE Security Context Parameters Registry</name>
<t>
IANA has created a new registry entitled "OSCORE Security Context Parameters".
The registration procedure depends on range of CBOR label values, following <xref target="RFC8126" format="default"/>.
Guidelines for the experts are provided in <xref target="review" format="default"/>.
</t>
<t>
The columns of the registry are:
</t>
<dl newline="false" spacing="normal">
<dt>Name:</dt>
<dd>
The JSON name requested (e.g., "ms").
Because a core goal of this document is for the resulting representations to be compact, it is <bcp14>RECOMMENDED</bcp14> that the name be short.
This name is case sensitive.
Names may not match other registered names in a case-insensitive manner unless the designated experts determine that there is a compelling reason to allow an exception.
The name is not used in the CBOR encoding.
</dd>
<dt>CBOR Label:</dt>
<!--[rfced] In Section 9.4, the ranges for registration procedures are described,
but they do not match the IANA registry, which shows "Expert Review" only.
(https://www.iana.org/assignments/ace/ace.xhtml#oscore-security-context-parameters).
Which on is correct? i.e.,
Should the IANA registry be updated, or should this document be updated?
Original:
Integer values between -256 and 255
and strings of length 1 are designated as Standards Track Document
required. Integer values from -65536 to -257 and from 256 to
65535 and strings of length 2 are designated as Specification
Required. Integer values greater than 65535 and strings of length
greater than 2 are designated as expert review. Integer values
less than -65536 are marked as private use.
Either way, may this sentence be removed? It seems redundant with the text above.
Original:
It should be noted that in addition to the expert
review, some portions of the registry require a specification,
potentially on standards track, be supplied as well.
Göran: Unfortunately, the IANA registry is not correct and needs to be updated according to the description below. I'll contact IANA on this.
-->
<dd>
The value to be used to identify this name.
Map key labels <bcp14>MUST</bcp14> be unique.
The label can be a positive integer, a negative integer, or a string.
Integer values between -256 and 255 and strings of length 1 are designated as Standards Track document required.
Integer values from -65536 to -257 and from 256 to 65535 and strings of length 2 are designated as Specification Required.
Integer values greater than 65535 and strings of length greater than 2 are designated as Expert Review.
Integer values less than -65536 are marked as Private Use.
</dd>
<dt>CBOR Type:</dt>
<dd>
This field contains the CBOR type for the field.
</dd>
<dt>Registry:</dt>
<dd>
This field denotes the registry that values may come from, if one exists.
</dd>
<dt>Description:</dt>
<dd>
This field contains a brief description for the field.
</dd>
<dt>Reference:</dt>