Debian Codegraph @

rfc8824.html

raw
1 <!DOCTYPE html>
2 <html lang="en" class="RFC">
3 <head>
4 <meta charset="utf-8">
5 <meta content="Common,Latin" name="scripts">
6 <meta content="initial-scale=1.0" name="viewport">
7 <title>RFC 8824: Static Context Header Compression (SCHC) for the Constrained Application Protocol (CoAP)</title>
8 <meta content="Ana Minaburo" name="author">
9 <meta content="Laurent Toutain" name="author">
10 <meta content="Ricardo Andreasen" name="author">
11 <meta content="
12 This document defines how to compress Constrained Application Protocol (CoAP) headers using the Static Context Header Compression and fragmentation (SCHC) framework.
13 SCHC defines a header compression mechanism adapted for Constrained Devices.
14 SCHC uses a static description of the header to reduce the header's redundancy and size.
15 While RFC 8724 describes the SCHC compression and fragmentation framework,
16 and its application for IPv6/UDP headers, this document applies SCHC to CoAP headers. The CoAP header structure differs from
17 IPv6 and UDP, since CoAP uses a flexible header with a variable number of options, themselves of variable length. The CoAP message format is asymmetric: the request messages have a header format different from the format in the response messages.
18 This
19 specification gives guidance on applying SCHC to flexible headers and how to leverage the asymmetry for more efficient compression Rules.
20 " name="description">
21 <meta content="xml2rfc 3.9.1" name="generator">
22 <meta content="header compression" name="keyword">
23 <meta content="fragmentation" name="keyword">
24 <meta content="IoT" name="keyword">
25 <meta content="constrained networks" name="keyword">
26 <meta content="LPWAN" name="keyword">
27 <meta content="sensor network" name="keyword">
28 <meta content="constrained node" name="keyword">
29 <meta content="wireless sensor network" name="keyword">
30 <meta content="core" name="keyword">
31 <meta content="OSCORE" name="keyword">
32 <meta content="8824" name="rfc.number">
33 <!-- Generator version information:
34 xml2rfc 3.9.1
35 Python 3.6.10
36 appdirs 1.4.4
37 ConfigArgParse 1.2.3
38 google-i18n-address 2.3.5
39 html5lib 1.0.1
40 intervaltree 3.0.2
41 Jinja2 2.11.2
42 kitchen 1.2.6
43 lxml 4.4.2
44 pycairo 1.19.0
45 pycountry 19.8.18
46 pyflakes 2.1.1
47 PyYAML 5.3.1
48 requests 2.22.0
49 setuptools 40.6.2
50 six 1.14.0
51 WeasyPrint 51
52 -->
53 <link href="rfc8824.xml" rel="alternate" type="application/rfc+xml">
54 <link href="#copyright" rel="license">
55 <style type="text/css">/*
56
57 NOTE: Changes at the bottom of this file overrides some earlier settings.
58
59 Once the style has stabilized and has been adopted as an official RFC style,
60 this can be consolidated so that style settings occur only in one place, but
61 for now the contents of this file consists first of the initial CSS work as
62 provided to the RFC Formatter (xml2rfc) work, followed by itemized and
63 commented changes found necssary during the development of the v3
64 formatters.
65
66 */
67
68 /* fonts */
69 @import url('https://fonts.googleapis.com/css?family=Noto+Sans'); /* Sans-serif */
70 @import url('https://fonts.googleapis.com/css?family=Noto+Serif'); /* Serif (print) */
71 @import url('https://fonts.googleapis.com/css?family=Roboto+Mono'); /* Monospace */
72
73 @viewport {
74 zoom: 1.0;
75 width: extend-to-zoom;
76 }
77 @-ms-viewport {
78 width: extend-to-zoom;
79 zoom: 1.0;
80 }
81 /* general and mobile first */
82 html {
83 }
84 body {
85 max-width: 90%;
86 margin: 1.5em auto;
87 color: #222;
88 background-color: #fff;
89 font-size: 14px;
90 font-family: 'Noto Sans', Arial, Helvetica, sans-serif;
91 line-height: 1.6;
92 scroll-behavior: smooth;
93 }
94 .ears {
95 display: none;
96 }
97
98 /* headings */
99 #title, h1, h2, h3, h4, h5, h6 {
100 margin: 1em 0 0.5em;
101 font-weight: bold;
102 line-height: 1.3;
103 }
104 #title {
105 clear: both;
106 border-bottom: 1px solid #ddd;
107 margin: 0 0 0.5em 0;
108 padding: 1em 0 0.5em;
109 }
110 .author {
111 padding-bottom: 4px;
112 }
113 h1 {
114 font-size: 26px;
115 margin: 1em 0;
116 }
117 h2 {
118 font-size: 22px;
119 margin-top: -20px; /* provide offset for in-page anchors */
120 padding-top: 33px;
121 }
122 h3 {
123 font-size: 18px;
124 margin-top: -36px; /* provide offset for in-page anchors */
125 padding-top: 42px;
126 }
127 h4 {
128 font-size: 16px;
129 margin-top: -36px; /* provide offset for in-page anchors */
130 padding-top: 42px;
131 }
132 h5, h6 {
133 font-size: 14px;
134 }
135 #n-copyright-notice {
136 border-bottom: 1px solid #ddd;
137 padding-bottom: 1em;
138 margin-bottom: 1em;
139 }
140 /* general structure */
141 p {
142 padding: 0;
143 margin: 0 0 1em 0;
144 text-align: left;
145 }
146 div, span {
147 position: relative;
148 }
149 div {
150 margin: 0;
151 }
152 .alignRight.art-text {
153 background-color: #f9f9f9;
154 border: 1px solid #eee;
155 border-radius: 3px;
156 padding: 1em 1em 0;
157 margin-bottom: 1.5em;
158 }
159 .alignRight.art-text pre {
160 padding: 0;
161 }
162 .alignRight {
163 margin: 1em 0;
164 }
165 .alignRight > *:first-child {
166 border: none;
167 margin: 0;
168 float: right;
169 clear: both;
170 }
171 .alignRight > *:nth-child(2) {
172 clear: both;
173 display: block;
174 border: none;
175 }
176 svg {
177 display: block;
178 }
179 .alignCenter.art-text {
180 background-color: #f9f9f9;
181 border: 1px solid #eee;
182 border-radius: 3px;
183 padding: 1em 1em 0;
184 margin-bottom: 1.5em;
185 }
186 .alignCenter.art-text pre {
187 padding: 0;
188 }
189 .alignCenter {
190 margin: 1em 0;
191 }
192 .alignCenter > *:first-child {
193 border: none;
194 /* this isn't optimal, but it's an existence proof. PrinceXML doesn't
195 support flexbox yet.
196 */
197 display: table;
198 margin: 0 auto;
199 }
200
201 /* lists */
202 ol, ul {
203 padding: 0;
204 margin: 0 0 1em 2em;
205 }
206 ol ol, ul ul, ol ul, ul ol {
207 margin-left: 1em;
208 }
209 li {
210 margin: 0 0 0.25em 0;
211 }
212 .ulCompact li {
213 margin: 0;
214 }
215 ul.empty, .ulEmpty {
216 list-style-type: none;
217 }
218 ul.empty li, .ulEmpty li {
219 margin-top: 0.5em;
220 }
221 ul.ulBare, li.ulBare {
222 margin-left: 0em !important;
223 }
224 ul.compact, .ulCompact,
225 ol.compact, .olCompact {
226 line-height: 100%;
227 margin: 0 0 0 2em;
228 }
229
230 /* definition lists */
231 dl {
232 }
233 dl > dt {
234 float: left;
235 margin-right: 1em;
236 }
237 /*
238 dl.nohang > dt {
239 float: none;
240 }
241 */
242 dl > dd {
243 margin-bottom: .8em;
244 min-height: 1.3em;
245 }
246 dl.compact > dd, .dlCompact > dd {
247 margin-bottom: 0em;
248 }
249 dl > dd > dl {
250 margin-top: 0.5em;
251 margin-bottom: 0em;
252 }
253
254 /* links */
255 a {
256 text-decoration: none;
257 }
258 a[href] {
259 color: #22e; /* Arlen: WCAG 2019 */
260 }
261 a[href]:hover {
262 background-color: #f2f2f2;
263 }
264 figcaption a[href],
265 a[href].selfRef {
266 color: #222;
267 }
268 /* XXX probably not this:
269 a.selfRef:hover {
270 background-color: transparent;
271 cursor: default;
272 } */
273
274 /* Figures */
275 tt, code, pre, code {
276 background-color: #f9f9f9;
277 font-family: 'Roboto Mono', monospace;
278 }
279 pre {
280 border: 1px solid #eee;
281 margin: 0;
282 padding: 1em;
283 }
284 img {
285 max-width: 100%;
286 }
287 figure {
288 margin: 0;
289 }
290 figure blockquote {
291 margin: 0.8em 0.4em 0.4em;
292 }
293 figcaption {
294 font-style: italic;
295 margin: 0 0 1em 0;
296 }
297 @media screen {
298 pre {
299 overflow-x: auto;
300 max-width: 100%;
301 max-width: calc(100% - 22px);
302 }
303 }
304
305 /* aside, blockquote */
306 aside, blockquote {
307 margin-left: 0;
308 padding: 1.2em 2em;
309 }
310 blockquote {
311 background-color: #f9f9f9;
312 color: #111; /* Arlen: WCAG 2019 */
313 border: 1px solid #ddd;
314 border-radius: 3px;
315 margin: 1em 0;
316 }
317 cite {
318 display: block;
319 text-align: right;
320 font-style: italic;
321 }
322
323 /* tables */
324 table {
325 width: 100%;
326 margin: 0 0 1em;
327 border-collapse: collapse;
328 border: 1px solid #eee;
329 }
330 th, td {
331 text-align: left;
332 vertical-align: top;
333 padding: 0.5em 0.75em;
334 }
335 th {
336 text-align: left;
337 background-color: #e9e9e9;
338 }
339 tr:nth-child(2n+1) > td {
340 background-color: #f5f5f5;
341 }
342 table caption {
343 font-style: italic;
344 margin: 0;
345 padding: 0;
346 text-align: left;
347 }
348 table p {
349 /* XXX to avoid bottom margin on table row signifiers. If paragraphs should
350 be allowed within tables more generally, it would be far better to select on a class. */
351 margin: 0;
352 }
353
354 /* pilcrow */
355 a.pilcrow {
356 color: #666; /* Arlen: AHDJ 2019 */
357 text-decoration: none;
358 visibility: hidden;
359 user-select: none;
360 -ms-user-select: none;
361 -o-user-select:none;
362 -moz-user-select: none;
363 -khtml-user-select: none;
364 -webkit-user-select: none;
365 -webkit-touch-callout: none;
366 }
367 @media screen {
368 aside:hover > a.pilcrow,
369 p:hover > a.pilcrow,
370 blockquote:hover > a.pilcrow,
371 div:hover > a.pilcrow,
372 li:hover > a.pilcrow,
373 pre:hover > a.pilcrow {
374 visibility: visible;
375 }
376 a.pilcrow:hover {
377 background-color: transparent;
378 }
379 }
380
381 /* misc */
382 hr {
383 border: 0;
384 border-top: 1px solid #eee;
385 }
386 .bcp14 {
387 font-variant: small-caps;
388 }
389
390 .role {
391 font-variant: all-small-caps;
392 }
393
394 /* info block */
395 #identifiers {
396 margin: 0;
397 font-size: 0.9em;
398 }
399 #identifiers dt {
400 width: 3em;
401 clear: left;
402 }
403 #identifiers dd {
404 float: left;
405 margin-bottom: 0;
406 }
407 #identifiers .authors .author {
408 display: inline-block;
409 margin-right: 1.5em;
410 }
411 #identifiers .authors .org {
412 font-style: italic;
413 }
414
415 /* The prepared/rendered info at the very bottom of the page */
416 .docInfo {
417 color: #666; /* Arlen: WCAG 2019 */
418 font-size: 0.9em;
419 font-style: italic;
420 margin-top: 2em;
421 }
422 .docInfo .prepared {
423 float: left;
424 }
425 .docInfo .prepared {
426 float: right;
427 }
428
429 /* table of contents */
430 #toc {
431 padding: 0.75em 0 2em 0;
432 margin-bottom: 1em;
433 }
434 nav.toc ul {
435 margin: 0 0.5em 0 0;
436 padding: 0;
437 list-style: none;
438 }
439 nav.toc li {
440 line-height: 1.3em;
441 margin: 0.75em 0;
442 padding-left: 1.2em;
443 text-indent: -1.2em;
444 }
445 /* references */
446 .references dt {
447 text-align: right;
448 font-weight: bold;
449 min-width: 7em;
450 }
451 .references dd {
452 margin-left: 8em;
453 overflow: auto;
454 }
455
456 .refInstance {
457 margin-bottom: 1.25em;
458 }
459
460 .references .ascii {
461 margin-bottom: 0.25em;
462 }
463
464 /* index */
465 .index ul {
466 margin: 0 0 0 1em;
467 padding: 0;
468 list-style: none;
469 }
470 .index ul ul {
471 margin: 0;
472 }
473 .index li {
474 margin: 0;
475 text-indent: -2em;
476 padding-left: 2em;
477 padding-bottom: 5px;
478 }
479 .indexIndex {
480 margin: 0.5em 0 1em;
481 }
482 .index a {
483 font-weight: 700;
484 }
485 /* make the index two-column on all but the smallest screens */
486 @media (min-width: 600px) {
487 .index ul {
488 -moz-column-count: 2;
489 -moz-column-gap: 20px;
490 }
491 .index ul ul {
492 -moz-column-count: 1;
493 -moz-column-gap: 0;
494 }
495 }
496
497 /* authors */
498 address.vcard {
499 font-style: normal;
500 margin: 1em 0;
501 }
502
503 address.vcard .nameRole {
504 font-weight: 700;
505 margin-left: 0;
506 }
507 address.vcard .label {
508 font-family: "Noto Sans",Arial,Helvetica,sans-serif;
509 margin: 0.5em 0;
510 }
511 address.vcard .type {
512 display: none;
513 }
514 .alternative-contact {
515 margin: 1.5em 0 1em;
516 }
517 hr.addr {
518 border-top: 1px dashed;
519 margin: 0;
520 color: #ddd;
521 max-width: calc(100% - 16px);
522 }
523
524 /* temporary notes */
525 .rfcEditorRemove::before {
526 position: absolute;
527 top: 0.2em;
528 right: 0.2em;
529 padding: 0.2em;
530 content: "The RFC Editor will remove this note";
531 color: #9e2a00; /* Arlen: WCAG 2019 */
532 background-color: #ffd; /* Arlen: WCAG 2019 */
533 }
534 .rfcEditorRemove {
535 position: relative;
536 padding-top: 1.8em;
537 background-color: #ffd; /* Arlen: WCAG 2019 */
538 border-radius: 3px;
539 }
540 .cref {
541 background-color: #ffd; /* Arlen: WCAG 2019 */
542 padding: 2px 4px;
543 }
544 .crefSource {
545 font-style: italic;
546 }
547 /* alternative layout for smaller screens */
548 @media screen and (max-width: 1023px) {
549 body {
550 padding-top: 2em;
551 }
552 #title {
553 padding: 1em 0;
554 }
555 h1 {
556 font-size: 24px;
557 }
558 h2 {
559 font-size: 20px;
560 margin-top: -18px; /* provide offset for in-page anchors */
561 padding-top: 38px;
562 }
563 #identifiers dd {
564 max-width: 60%;
565 }
566 #toc {
567 position: fixed;
568 z-index: 2;
569 top: 0;
570 right: 0;
571 padding: 0;
572 margin: 0;
573 background-color: inherit;
574 border-bottom: 1px solid #ccc;
575 }
576 #toc h2 {
577 margin: -1px 0 0 0;
578 padding: 4px 0 4px 6px;
579 padding-right: 1em;
580 min-width: 190px;
581 font-size: 1.1em;
582 text-align: right;
583 background-color: #444;
584 color: white;
585 cursor: pointer;
586 }
587 #toc h2::before { /* css hamburger */
588 float: right;
589 position: relative;
590 width: 1em;
591 height: 1px;
592 left: -164px;
593 margin: 6px 0 0 0;
594 background: white none repeat scroll 0 0;
595 box-shadow: 0 4px 0 0 white, 0 8px 0 0 white;
596 content: "";
597 }
598 #toc nav {
599 display: none;
600 padding: 0.5em 1em 1em;
601 overflow: auto;
602 height: calc(100vh - 48px);
603 border-left: 1px solid #ddd;
604 }
605 }
606
607 /* alternative layout for wide screens */
608 @media screen and (min-width: 1024px) {
609 body {
610 max-width: 724px;
611 margin: 42px auto;
612 padding-left: 1.5em;
613 padding-right: 29em;
614 }
615 #toc {
616 position: fixed;
617 top: 42px;
618 right: 42px;
619 width: 25%;
620 margin: 0;
621 padding: 0 1em;
622 z-index: 1;
623 }
624 #toc h2 {
625 border-top: none;
626 border-bottom: 1px solid #ddd;
627 font-size: 1em;
628 font-weight: normal;
629 margin: 0;
630 padding: 0.25em 1em 1em 0;
631 }
632 #toc nav {
633 display: block;
634 height: calc(90vh - 84px);
635 bottom: 0;
636 padding: 0.5em 0 0;
637 overflow: auto;
638 }
639 img { /* future proofing */
640 max-width: 100%;
641 height: auto;
642 }
643 }
644
645 /* pagination */
646 @media print {
647 body {
648
649 width: 100%;
650 }
651 p {
652 orphans: 3;
653 widows: 3;
654 }
655 #n-copyright-notice {
656 border-bottom: none;
657 }
658 #toc, #n-introduction {
659 page-break-before: always;
660 }
661 #toc {
662 border-top: none;
663 padding-top: 0;
664 }
665 figure, pre {
666 page-break-inside: avoid;
667 }
668 figure {
669 overflow: scroll;
670 }
671 h1, h2, h3, h4, h5, h6 {
672 page-break-after: avoid;
673 }
674 h2+*, h3+*, h4+*, h5+*, h6+* {
675 page-break-before: avoid;
676 }
677 pre {
678 white-space: pre-wrap;
679 word-wrap: break-word;
680 font-size: 10pt;
681 }
682 table {
683 border: 1px solid #ddd;
684 }
685 td {
686 border-top: 1px solid #ddd;
687 }
688 }
689
690 /* This is commented out here, as the string-set: doesn't
691 pass W3C validation currently */
692 /*
693 .ears thead .left {
694 string-set: ears-top-left content();
695 }
696
697 .ears thead .center {
698 string-set: ears-top-center content();
699 }
700
701 .ears thead .right {
702 string-set: ears-top-right content();
703 }
704
705 .ears tfoot .left {
706 string-set: ears-bottom-left content();
707 }
708
709 .ears tfoot .center {
710 string-set: ears-bottom-center content();
711 }
712
713 .ears tfoot .right {
714 string-set: ears-bottom-right content();
715 }
716 */
717
718 @page :first {
719 padding-top: 0;
720 @top-left {
721 content: normal;
722 border: none;
723 }
724 @top-center {
725 content: normal;
726 border: none;
727 }
728 @top-right {
729 content: normal;
730 border: none;
731 }
732 }
733
734 @page {
735 size: A4;
736 margin-bottom: 45mm;
737 padding-top: 20px;
738 /* The follwing is commented out here, but set appropriately by in code, as
739 the content depends on the document */
740 /*
741 @top-left {
742 content: 'Internet-Draft';
743 vertical-align: bottom;
744 border-bottom: solid 1px #ccc;
745 }
746 @top-left {
747 content: string(ears-top-left);
748 vertical-align: bottom;
749 border-bottom: solid 1px #ccc;
750 }
751 @top-center {
752 content: string(ears-top-center);
753 vertical-align: bottom;
754 border-bottom: solid 1px #ccc;
755 }
756 @top-right {
757 content: string(ears-top-right);
758 vertical-align: bottom;
759 border-bottom: solid 1px #ccc;
760 }
761 @bottom-left {
762 content: string(ears-bottom-left);
763 vertical-align: top;
764 border-top: solid 1px #ccc;
765 }
766 @bottom-center {
767 content: string(ears-bottom-center);
768 vertical-align: top;
769 border-top: solid 1px #ccc;
770 }
771 @bottom-right {
772 content: '[Page ' counter(page) ']';
773 vertical-align: top;
774 border-top: solid 1px #ccc;
775 }
776 */
777
778 }
779
780 /* Changes introduced to fix issues found during implementation */
781 /* Make sure links are clickable even if overlapped by following H* */
782 a {
783 z-index: 2;
784 }
785 /* Separate body from document info even without intervening H1 */
786 section {
787 clear: both;
788 }
789
790
791 /* Top align author divs, to avoid names without organization dropping level with org names */
792 .author {
793 vertical-align: top;
794 }
795
796 /* Leave room in document info to show Internet-Draft on one line */
797 #identifiers dt {
798 width: 8em;
799 }
800
801 /* Don't waste quite as much whitespace between label and value in doc info */
802 #identifiers dd {
803 margin-left: 1em;
804 }
805
806 /* Give floating toc a background color (needed when it's a div inside section */
807 #toc {
808 background-color: white;
809 }
810
811 /* Make the collapsed ToC header render white on gray also when it's a link */
812 @media screen and (max-width: 1023px) {
813 #toc h2 a,
814 #toc h2 a:link,
815 #toc h2 a:focus,
816 #toc h2 a:hover,
817 #toc a.toplink,
818 #toc a.toplink:hover {
819 color: white;
820 background-color: #444;
821 text-decoration: none;
822 }
823 }
824
825 /* Give the bottom of the ToC some whitespace */
826 @media screen and (min-width: 1024px) {
827 #toc {
828 padding: 0 0 1em 1em;
829 }
830 }
831
832 /* Style section numbers with more space between number and title */
833 .section-number {
834 padding-right: 0.5em;
835 }
836
837 /* prevent monospace from becoming overly large */
838 tt, code, pre, code {
839 font-size: 95%;
840 }
841
842 /* Fix the height/width aspect for ascii art*/
843 pre.sourcecode,
844 .art-text pre {
845 line-height: 1.12;
846 }
847
848
849 /* Add styling for a link in the ToC that points to the top of the document */
850 a.toplink {
851 float: right;
852 margin-right: 0.5em;
853 }
854
855 /* Fix the dl styling to match the RFC 7992 attributes */
856 dl > dt,
857 dl.dlParallel > dt {
858 float: left;
859 margin-right: 1em;
860 }
861 dl.dlNewline > dt {
862 float: none;
863 }
864
865 /* Provide styling for table cell text alignment */
866 table td.text-left,
867 table th.text-left {
868 text-align: left;
869 }
870 table td.text-center,
871 table th.text-center {
872 text-align: center;
873 }
874 table td.text-right,
875 table th.text-right {
876 text-align: right;
877 }
878
879 /* Make the alternative author contact informatio look less like just another
880 author, and group it closer with the primary author contact information */
881 .alternative-contact {
882 margin: 0.5em 0 0.25em 0;
883 }
884 address .non-ascii {
885 margin: 0 0 0 2em;
886 }
887
888 /* With it being possible to set tables with alignment
889 left, center, and right, { width: 100%; } does not make sense */
890 table {
891 width: auto;
892 }
893
894 /* Avoid reference text that sits in a block with very wide left margin,
895 because of a long floating dt label.*/
896 .references dd {
897 overflow: visible;
898 }
899
900 /* Control caption placement */
901 caption {
902 caption-side: bottom;
903 }
904
905 /* Limit the width of the author address vcard, so names in right-to-left
906 script don't end up on the other side of the page. */
907
908 address.vcard {
909 max-width: 30em;
910 margin-right: auto;
911 }
912
913 /* For address alignment dependent on LTR or RTL scripts */
914 address div.left {
915 text-align: left;
916 }
917 address div.right {
918 text-align: right;
919 }
920
921 /* Provide table alignment support. We can't use the alignX classes above
922 since they do unwanted things with caption and other styling. */
923 table.right {
924 margin-left: auto;
925 margin-right: 0;
926 }
927 table.center {
928 margin-left: auto;
929 margin-right: auto;
930 }
931 table.left {
932 margin-left: 0;
933 margin-right: auto;
934 }
935
936 /* Give the table caption label the same styling as the figcaption */
937 caption a[href] {
938 color: #222;
939 }
940
941 @media print {
942 .toplink {
943 display: none;
944 }
945
946 /* avoid overwriting the top border line with the ToC header */
947 #toc {
948 padding-top: 1px;
949 }
950
951 /* Avoid page breaks inside dl and author address entries */
952 .vcard {
953 page-break-inside: avoid;
954 }
955
956 }
957 /* Tweak the bcp14 keyword presentation */
958 .bcp14 {
959 font-variant: small-caps;
960 font-weight: bold;
961 font-size: 0.9em;
962 }
963 /* Tweak the invisible space above H* in order not to overlay links in text above */
964 h2 {
965 margin-top: -18px; /* provide offset for in-page anchors */
966 padding-top: 31px;
967 }
968 h3 {
969 margin-top: -18px; /* provide offset for in-page anchors */
970 padding-top: 24px;
971 }
972 h4 {
973 margin-top: -18px; /* provide offset for in-page anchors */
974 padding-top: 24px;
975 }
976 /* Float artwork pilcrow to the right */
977 @media screen {
978 .artwork a.pilcrow {
979 display: block;
980 line-height: 0.7;
981 margin-top: 0.15em;
982 }
983 }
984 /* Make pilcrows on dd visible */
985 @media screen {
986 dd:hover > a.pilcrow {
987 visibility: visible;
988 }
989 }
990 /* Make the placement of figcaption match that of a table's caption
991 by removing the figure's added bottom margin */
992 .alignLeft.art-text,
993 .alignCenter.art-text,
994 .alignRight.art-text {
995 margin-bottom: 0;
996 }
997 .alignLeft,
998 .alignCenter,
999 .alignRight {
1000 margin: 1em 0 0 0;
1001 }
1002 /* In print, the pilcrow won't show on hover, so prevent it from taking up space,
1003 possibly even requiring a new line */
1004 @media print {
1005 a.pilcrow {
1006 display: none;
1007 }
1008 }
1009 /* Styling for the external metadata */
1010 div#external-metadata {
1011 background-color: #eee;
1012 padding: 0.5em;
1013 margin-bottom: 0.5em;
1014 display: none;
1015 }
1016 div#internal-metadata {
1017 padding: 0.5em; /* to match the external-metadata padding */
1018 }
1019 /* Styling for title RFC Number */
1020 h1#rfcnum {
1021 clear: both;
1022 margin: 0 0 -1em;
1023 padding: 1em 0 0 0;
1024 }
1025 /* Make .olPercent look the same as <ol><li> */
1026 dl.olPercent > dd {
1027 margin-bottom: 0.25em;
1028 min-height: initial;
1029 }
1030 /* Give aside some styling to set it apart */
1031 aside {
1032 border-left: 1px solid #ddd;
1033 margin: 1em 0 1em 2em;
1034 padding: 0.2em 2em;
1035 }
1036 aside > dl,
1037 aside > ol,
1038 aside > ul,
1039 aside > table,
1040 aside > p {
1041 margin-bottom: 0.5em;
1042 }
1043 /* Additional page break settings */
1044 @media print {
1045 figcaption, table caption {
1046 page-break-before: avoid;
1047 }
1048 }
1049 /* Font size adjustments for print */
1050 @media print {
1051 body { font-size: 10pt; line-height: normal; max-width: 96%; }
1052 h1 { font-size: 1.72em; padding-top: 1.5em; } /* 1*1.2*1.2*1.2 */
1053 h2 { font-size: 1.44em; padding-top: 1.5em; } /* 1*1.2*1.2 */
1054 h3 { font-size: 1.2em; padding-top: 1.5em; } /* 1*1.2 */
1055 h4 { font-size: 1em; padding-top: 1.5em; }
1056 h5, h6 { font-size: 1em; margin: initial; padding: 0.5em 0 0.3em; }
1057 }
1058 /* Sourcecode margin in print, when there's no pilcrow */
1059 @media print {
1060 .artwork,
1061 .sourcecode {
1062 margin-bottom: 1em;
1063 }
1064 }
1065 /* Avoid narrow tables forcing too narrow table captions, which may render badly */
1066 table {
1067 min-width: 20em;
1068 }
1069 /* ol type a */
1070 ol.type-a { list-style-type: lower-alpha; }
1071 ol.type-A { list-style-type: upper-alpha; }
1072 ol.type-i { list-style-type: lower-roman; }
1073 ol.type-I { list-style-type: lower-roman; }
1074 /* Apply the print table and row borders in general, on request from the RPC,
1075 and increase the contrast between border and odd row background sligthtly */
1076 table {
1077 border: 1px solid #ddd;
1078 }
1079 td {
1080 border-top: 1px solid #ddd;
1081 }
1082 tr:nth-child(2n+1) > td {
1083 background-color: #f8f8f8;
1084 }
1085 /* Use style rules to govern display of the TOC. */
1086 @media screen and (max-width: 1023px) {
1087 #toc nav { display: none; }
1088 #toc.active nav { display: block; }
1089 }
1090 /* Add support for keepWithNext */
1091 .keepWithNext {
1092 break-after: avoid-page;
1093 break-after: avoid-page;
1094 }
1095 /* Add support for keepWithPrevious */
1096 .keepWithPrevious {
1097 break-before: avoid-page;
1098 }
1099 /* Change the approach to avoiding breaks inside artwork etc. */
1100 figure, pre, table, .artwork, .sourcecode {
1101 break-before: avoid-page;
1102 break-after: auto;
1103 }
1104 /* Avoid breaks between <dt> and <dd> */
1105 dl {
1106 break-before: auto;
1107 break-inside: auto;
1108 }
1109 dt {
1110 break-before: auto;
1111 break-after: avoid-page;
1112 }
1113 dd {
1114 break-before: avoid-page;
1115 break-after: auto;
1116 orphans: 3;
1117 widows: 3
1118 }
1119 span.break, dd.break {
1120 margin-bottom: 0;
1121 min-height: 0;
1122 break-before: auto;
1123 break-inside: auto;
1124 break-after: auto;
1125 }
1126 /* Undo break-before ToC */
1127 @media print {
1128 #toc {
1129 break-before: auto;
1130 }
1131 }
1132 /* Text in compact lists should not get extra bottim margin space,
1133 since that would makes the list not compact */
1134 ul.compact p, .ulCompact p,
1135 ol.compact p, .olCompact p {
1136 margin: 0;
1137 }
1138 /* But the list as a whole needs the extra space at the end */
1139 section ul.compact,
1140 section .ulCompact,
1141 section ol.compact,
1142 section .olCompact {
1143 margin-bottom: 1em; /* same as p not within ul.compact etc. */
1144 }
1145 /* The tt and code background above interferes with for instance table cell
1146 backgrounds. Changed to something a bit more selective. */
1147 tt, code {
1148 background-color: transparent;
1149 }
1150 p tt, p code, li tt, li code {
1151 background-color: #f8f8f8;
1152 }
1153 /* Tweak the pre margin -- 0px doesn't come out well */
1154 pre {
1155 margin-top: 0.5px;
1156 }
1157 /* Tweak the comact list text */
1158 ul.compact, .ulCompact,
1159 ol.compact, .olCompact,
1160 dl.compact, .dlCompact {
1161 line-height: normal;
1162 }
1163 /* Don't add top margin for nested lists */
1164 li > ul, li > ol, li > dl,
1165 dd > ul, dd > ol, dd > dl,
1166 dl > dd > dl {
1167 margin-top: initial;
1168 }
1169 /* Elements that should not be rendered on the same line as a <dt> */
1170 /* This should match the element list in writer.text.TextWriter.render_dl() */
1171 dd > div.artwork:first-child,
1172 dd > aside:first-child,
1173 dd > figure:first-child,
1174 dd > ol:first-child,
1175 dd > div:first-child > pre.sourcecode,
1176 dd > table:first-child,
1177 dd > ul:first-child {
1178 clear: left;
1179 }
1180 /* fix for weird browser behaviour when <dd/> is empty */
1181 dt+dd:empty::before{
1182 content: "\00a0";
1183 }
1184 /* Make paragraph spacing inside <li> smaller than in body text, to fit better within the list */
1185 li > p {
1186 margin-bottom: 0.5em
1187 }
1188 /* Don't let p margin spill out from inside list items */
1189 li > p:last-of-type {
1190 margin-bottom: 0;
1191 }
1192 </style>
1193 <link href="rfc-local.css" rel="stylesheet" type="text/css">
1194 <link href="https://dx.doi.org/10.17487/rfc8824" rel="alternate">
1195 <link href="urn:issn:2070-1721" rel="alternate">
1196 <link href="https://datatracker.ietf.org/doc/draft-ietf-lpwan-coap-static-context-hc-19" rel="prev">
1197 </head>
1198 <body>
1199 <script src="https://www.rfc-editor.org/js/metadata.min.js"></script>
1200 <table class="ears">
1201 <thead><tr>
1202 <td class="left">RFC 8824</td>
1203 <td class="center">SCHC for CoAP</td>
1204 <td class="right">June 2021</td>
1205 </tr></thead>
1206 <tfoot><tr>
1207 <td class="left">Minaburo, et al.</td>
1208 <td class="center">Standards Track</td>
1209 <td class="right">[Page]</td>
1210 </tr></tfoot>
1211 </table>
1212 <div id="external-metadata" class="document-information"></div>
1213 <div id="internal-metadata" class="document-information">
1214 <dl id="identifiers">
1215 <dt class="label-stream">Stream:</dt>
1216 <dd class="stream">Internet Engineering Task Force (IETF)</dd>
1217 <dt class="label-rfc">RFC:</dt>
1218 <dd class="rfc"><a href="https://www.rfc-editor.org/rfc/rfc8824" class="eref">8824</a></dd>
1219 <dt class="label-category">Category:</dt>
1220 <dd class="category">Standards Track</dd>
1221 <dt class="label-published">Published:</dt>
1222 <dd class="published">
1223 <time datetime="2021-06" class="published">June 2021</time>
1224 </dd>
1225 <dt class="label-issn">ISSN:</dt>
1226 <dd class="issn">2070-1721</dd>
1227 <dt class="label-authors">Authors:</dt>
1228 <dd class="authors">
1229 <div class="author">
1230 <div class="author-name">A. Minaburo</div>
1231 <div class="org">Acklio</div>
1232 </div>
1233 <div class="author">
1234 <div class="author-name">L. Toutain</div>
1235 <div class="org">IMT Atlantique</div>
1236 </div>
1237 <div class="author">
1238 <div class="author-name">R. Andreasen</div>
1239 <div class="org">Universidad de Buenos Aires</div>
1240 </div>
1241 </dd>
1242 </dl>
1243 </div>
1244 <h1 id="rfcnum">RFC 8824</h1>
1245 <h1 id="title">Static Context Header Compression (SCHC) for the Constrained Application Protocol (CoAP)</h1>
1246 <section id="section-abstract">
1247 <h2 id="abstract"><a href="#abstract" class="selfRef">Abstract</a></h2>
1248 <p id="section-abstract-1">This document defines how to compress Constrained Application Protocol (CoAP) headers using the Static Context Header Compression and fragmentation (SCHC) framework.
1249 SCHC defines a header compression mechanism adapted for Constrained Devices.
1250 SCHC uses a static description of the header to reduce the header's redundancy and size.
1251 While RFC 8724 describes the SCHC compression and fragmentation framework,
1252 and its application for IPv6/UDP headers, this document applies SCHC to CoAP headers. The CoAP header structure differs from
1253 IPv6 and UDP, since CoAP uses a flexible header with a variable number of options, themselves of variable length. The CoAP message format is asymmetric: the request messages have a header format different from the format in the response messages.
1254 This
1255 specification gives guidance on applying SCHC to flexible headers and how to leverage the asymmetry for more efficient compression Rules.<a href="#section-abstract-1" class="pilcrow">¶</a></p>
1256 </section>
1257 <div id="status-of-memo">
1258 <section id="section-boilerplate.1">
1259 <h2 id="name-status-of-this-memo">
1260 <a href="#name-status-of-this-memo" class="section-name selfRef">Status of This Memo</a>
1261 </h2>
1262 <p id="section-boilerplate.1-1">
1263 This is an Internet Standards Track document.<a href="#section-boilerplate.1-1" class="pilcrow">¶</a></p>
1264 <p id="section-boilerplate.1-2">
1265 This document is a product of the Internet Engineering Task Force
1266 (IETF). It represents the consensus of the IETF community. It has
1267 received public review and has been approved for publication by
1268 the Internet Engineering Steering Group (IESG). Further
1269 information on Internet Standards is available in Section 2 of
1270 RFC 7841.<a href="#section-boilerplate.1-2" class="pilcrow">¶</a></p>
1271 <p id="section-boilerplate.1-3">
1272 Information about the current status of this document, any
1273 errata, and how to provide feedback on it may be obtained at
1274 <span><a href="https://www.rfc-editor.org/info/rfc8824">https://www.rfc-editor.org/info/rfc8824</a></span>.<a href="#section-boilerplate.1-3" class="pilcrow">¶</a></p>
1275 </section>
1276 </div>
1277 <div id="copyright">
1278 <section id="section-boilerplate.2">
1279 <h2 id="name-copyright-notice">
1280 <a href="#name-copyright-notice" class="section-name selfRef">Copyright Notice</a>
1281 </h2>
1282 <p id="section-boilerplate.2-1">
1283 Copyright (c) 2021 IETF Trust and the persons identified as the
1284 document authors. All rights reserved.<a href="#section-boilerplate.2-1" class="pilcrow">¶</a></p>
1285 <p id="section-boilerplate.2-2">
1286 This document is subject to BCP 78 and the IETF Trust's Legal
1287 Provisions Relating to IETF Documents
1288 (<span><a href="https://trustee.ietf.org/license-info">https://trustee.ietf.org/license-info</a></span>) in effect on the date of
1289 publication of this document. Please review these documents
1290 carefully, as they describe your rights and restrictions with
1291 respect to this document. Code Components extracted from this
1292 document must include Simplified BSD License text as described in
1293 Section 4.e of the Trust Legal Provisions and are provided without
1294 warranty as described in the Simplified BSD License.<a href="#section-boilerplate.2-2" class="pilcrow">¶</a></p>
1295 </section>
1296 </div>
1297 <div id="toc">
1298 <section id="section-toc.1">
1299 <a href="#" onclick="scroll(0,0)" class="toplink">▲</a><h2 id="name-table-of-contents">
1300 <a href="#name-table-of-contents" class="section-name selfRef">Table of Contents</a>
1301 </h2>
1302 <nav class="toc"><ul class="ulEmpty toc compact ulBare">
1303 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.1">
1304 <p id="section-toc.1-1.1.1" class="keepWithNext"><a href="#section-1" class="xref">1</a>.  <a href="#name-introduction" class="xref">Introduction</a></p>
1305 <ul class="compact ulEmpty toc ulBare">
1306 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.1.2.1">
1307 <p id="section-toc.1-1.1.2.1.1" class="keepWithNext"><a href="#section-1.1" class="xref">1.1</a>.  <a href="#name-terminology" class="xref">Terminology</a></p>
1308 </li>
1309 </ul>
1310 </li>
1311 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.2">
1312 <p id="section-toc.1-1.2.1" class="keepWithNext"><a href="#section-2" class="xref">2</a>.  <a href="#name-schc-applicability-to-coap" class="xref">SCHC Applicability to CoAP</a></p>
1313 </li>
1314 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.3">
1315 <p id="section-toc.1-1.3.1"><a href="#section-3" class="xref">3</a>.  <a href="#name-coap-headers-compressed-wit" class="xref">CoAP Headers Compressed with SCHC</a></p>
1316 <ul class="compact ulEmpty toc ulBare">
1317 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.3.2.1">
1318 <p id="section-toc.1-1.3.2.1.1"><a href="#section-3.1" class="xref">3.1</a>.  <a href="#name-differences-between-coap-an" class="xref">Differences between CoAP and UDP/IP Compression</a></p>
1319 </li>
1320 </ul>
1321 </li>
1322 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.4">
1323 <p id="section-toc.1-1.4.1"><a href="#section-4" class="xref">4</a>.  <a href="#name-compression-of-coap-header-" class="xref">Compression of CoAP Header Fields</a></p>
1324 <ul class="compact ulEmpty toc ulBare">
1325 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.4.2.1">
1326 <p id="section-toc.1-1.4.2.1.1"><a href="#section-4.1" class="xref">4.1</a>.  <a href="#name-coap-version-field" class="xref">CoAP Version Field</a></p>
1327 </li>
1328 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.4.2.2">
1329 <p id="section-toc.1-1.4.2.2.1"><a href="#section-4.2" class="xref">4.2</a>.  <a href="#name-coap-type-field" class="xref">CoAP Type Field</a></p>
1330 </li>
1331 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.4.2.3">
1332 <p id="section-toc.1-1.4.2.3.1"><a href="#section-4.3" class="xref">4.3</a>.  <a href="#name-coap-code-field" class="xref">CoAP Code Field</a></p>
1333 </li>
1334 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.4.2.4">
1335 <p id="section-toc.1-1.4.2.4.1"><a href="#section-4.4" class="xref">4.4</a>.  <a href="#name-coap-message-id-field" class="xref">CoAP Message ID Field</a></p>
1336 </li>
1337 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.4.2.5">
1338 <p id="section-toc.1-1.4.2.5.1"><a href="#section-4.5" class="xref">4.5</a>.  <a href="#name-coap-token-fields" class="xref">CoAP Token Fields</a></p>
1339 </li>
1340 </ul>
1341 </li>
1342 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.5">
1343 <p id="section-toc.1-1.5.1"><a href="#section-5" class="xref">5</a>.  <a href="#name-coap-options" class="xref">CoAP Options</a></p>
1344 <ul class="compact ulEmpty toc ulBare">
1345 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.5.2.1">
1346 <p id="section-toc.1-1.5.2.1.1"><a href="#section-5.1" class="xref">5.1</a>.  <a href="#name-coap-content-and-accept-opt" class="xref">CoAP Content and Accept Options</a></p>
1347 </li>
1348 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.5.2.2">
1349 <p id="section-toc.1-1.5.2.2.1"><a href="#section-5.2" class="xref">5.2</a>.  <a href="#name-coap-option-max-age-uri-hos" class="xref">CoAP Option Max-Age, Uri-Host, and Uri-Port Fields</a></p>
1350 </li>
1351 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.5.2.3">
1352 <p id="section-toc.1-1.5.2.3.1"><a href="#section-5.3" class="xref">5.3</a>.  <a href="#name-coap-option-uri-path-and-ur" class="xref">CoAP Option Uri-Path and Uri-Query Fields</a></p>
1353 <ul class="compact ulEmpty toc ulBare">
1354 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.5.2.3.2.1">
1355 <p id="section-toc.1-1.5.2.3.2.1.1"><a href="#section-5.3.1" class="xref">5.3.1</a>.  <a href="#name-variable-number-of-path-or-" class="xref">Variable Number of Path or Query Elements</a></p>
1356 </li>
1357 </ul>
1358 </li>
1359 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.5.2.4">
1360 <p id="section-toc.1-1.5.2.4.1"><a href="#section-5.4" class="xref">5.4</a>.  <a href="#name-coap-option-size1-size2-pro" class="xref">CoAP Option Size1, Size2, Proxy-URI, and Proxy-Scheme Fields</a></p>
1361 </li>
1362 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.5.2.5">
1363 <p id="section-toc.1-1.5.2.5.1"><a href="#section-5.5" class="xref">5.5</a>.  <a href="#name-coap-option-etag-if-match-i" class="xref">CoAP Option ETag, If-Match, If-None-Match, Location-Path, and Location-Query Fields</a></p>
1364 </li>
1365 </ul>
1366 </li>
1367 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.6">
1368 <p id="section-toc.1-1.6.1"><a href="#section-6" class="xref">6</a>.  <a href="#name-schc-compression-of-coap-ex" class="xref">SCHC Compression of CoAP Extensions</a></p>
1369 <ul class="compact ulEmpty toc ulBare">
1370 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.6.2.1">
1371 <p id="section-toc.1-1.6.2.1.1"><a href="#section-6.1" class="xref">6.1</a>.  <a href="#name-block" class="xref">Block</a></p>
1372 </li>
1373 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.6.2.2">
1374 <p id="section-toc.1-1.6.2.2.1"><a href="#section-6.2" class="xref">6.2</a>.  <a href="#name-observe" class="xref">Observe</a></p>
1375 </li>
1376 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.6.2.3">
1377 <p id="section-toc.1-1.6.2.3.1"><a href="#section-6.3" class="xref">6.3</a>.  <a href="#name-no-response" class="xref">No-Response</a></p>
1378 </li>
1379 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.6.2.4">
1380 <p id="section-toc.1-1.6.2.4.1"><a href="#section-6.4" class="xref">6.4</a>.  <a href="#name-oscore" class="xref">OSCORE</a></p>
1381 </li>
1382 </ul>
1383 </li>
1384 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.7">
1385 <p id="section-toc.1-1.7.1"><a href="#section-7" class="xref">7</a>.  <a href="#name-examples-of-coap-header-com" class="xref">Examples of CoAP Header Compression</a></p>
1386 <ul class="compact ulEmpty toc ulBare">
1387 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.7.2.1">
1388 <p id="section-toc.1-1.7.2.1.1"><a href="#section-7.1" class="xref">7.1</a>.  <a href="#name-mandatory-header-with-con-m" class="xref">Mandatory Header with CON Message</a></p>
1389 </li>
1390 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.7.2.2">
1391 <p id="section-toc.1-1.7.2.2.1"><a href="#section-7.2" class="xref">7.2</a>.  <a href="#name-oscore-compression" class="xref">OSCORE Compression</a></p>
1392 </li>
1393 <li class="compact ulEmpty toc ulBare" id="section-toc.1-1.7.2.3">
1394 <p id="section-toc.1-1.7.2.3.1"><a href="#section-7.3" class="xref">7.3</a>.  <a href="#name-example-oscore-compression" class="xref">Example OSCORE Compression</a></p>
1395 </li>
1396 </ul>
1397 </li>
1398 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.8">
1399 <p id="section-toc.1-1.8.1"><a href="#section-8" class="xref">8</a>.  <a href="#name-iana-considerations" class="xref">IANA Considerations</a></p>
1400 </li>
1401 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.9">
1402 <p id="section-toc.1-1.9.1"><a href="#section-9" class="xref">9</a>.  <a href="#name-security-considerations" class="xref">Security Considerations</a></p>
1403 </li>
1404 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.10">
1405 <p id="section-toc.1-1.10.1"><a href="#section-10" class="xref">10</a>. <a href="#name-normative-references" class="xref">Normative References</a></p>
1406 </li>
1407 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.11">
1408 <p id="section-toc.1-1.11.1"><a href="#appendix-A" class="xref"></a><a href="#name-acknowledgements" class="xref">Acknowledgements</a></p>
1409 </li>
1410 <li class="ulEmpty toc compact ulBare" id="section-toc.1-1.12">
1411 <p id="section-toc.1-1.12.1"><a href="#appendix-B" class="xref"></a><a href="#name-authors-addresses" class="xref">Authors' Addresses</a></p>
1412 </li>
1413 </ul>
1414 </nav>
1415 </section>
1416 </div>
1417 <div id="Introduction">
1418 <section id="section-1">
1419 <h2 id="name-introduction">
1420 <a href="#section-1" class="section-number selfRef">1. </a><a href="#name-introduction" class="section-name selfRef">Introduction</a>
1421 </h2>
1422 <p id="section-1-1">The Constrained Application Protocol (CoAP) <span>[<a href="#RFC7252" class="xref">RFC7252</a>]</span> is a command/response protocol designed for microcontrollers with small RAM and ROM and optimized for services based on REST (Representational State Transfer). Although the Constrained Devices are a leading factor in the design of CoAP, a CoAP header's size is still too large for LPWANs (Low-Power Wide-Area Networks). Static Context Header Compression and fragmentation (SCHC) over CoAP headers is required to increase performance or to use CoAP over LPWAN technologies.<a href="#section-1-1" class="pilcrow">¶</a></p>
1423 <p id="section-1-2"><span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span> defines the SCHC framework, which includes a header compression mechanism for LPWANs that is based on a static context.
1424 <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-5" class="relref">Section 5</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span> explains where compression and decompression occur in the architecture. The SCHC compression scheme assumes as a prerequisite that both endpoints know the static context before transmission. The way the context is configured, provisioned, or exchanged is out of this document's scope.<a href="#section-1-2" class="pilcrow">¶</a></p>
1425 <p id="section-1-3">CoAP is an application protocol, so CoAP compression requires installing common Rules between the two SCHC instances. SCHC compression may apply at two different levels: at IP and UDP in the LPWAN and another at the application level for CoAP. These two compression techniques may be independent. Both follow the same principle as that described in <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span>. As different entities manage the CoAP compression process at different levels, the SCHC Rules driving the compression/decompression are also different. <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span> describes how to use SCHC for IP and UDP headers. This document specifies how to apply SCHC compression to CoAP headers.<a href="#section-1-3" class="pilcrow">¶</a></p>
1426 <p id="section-1-4">SCHC compresses and decompresses headers based on common contexts between Devices. The SCHC context includes multiple Rules. Each Rule can match the header fields to specific values or ranges of values. If a Rule matches, the matched header fields are replaced by the RuleID and the Compression Residue that contains the residual bits of the compression. Thus, different Rules may correspond to different protocol headers in the packet that a Device expects to send or receive.<a href="#section-1-4" class="pilcrow">¶</a></p>
1427 <p id="section-1-5">A Rule describes the packets' entire header with an ordered list of Field Descriptors; see <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-7" class="relref">Section 7</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span>. Thereby, each description contains the Field ID (FID), Field Length (FL), and Field Position (FP), as well as a Direction Indicator (DI) (upstream, downstream, and bidirectional) and some associated Target Values (TVs). The DI is used for compression to give the best TV to the FID when these values differ in their transmission direction. So, a field may be described several times.<a href="#section-1-5" class="pilcrow">¶</a></p>
1428 <p id="section-1-6">A Matching Operator (MO) is associated with each header Field Descriptor. The Rule is selected if all the MOs fit the TVs for all fields of the incoming header.
1429 A Rule cannot be selected if the message contains a field that is unknown to the SCHC compressor.<a href="#section-1-6" class="pilcrow">¶</a></p>
1430 <p id="section-1-7">In that case, a Compression/Decompression Action (CDA) associated with each field gives the method to compress and decompress each field.
1431 Compression mainly results in one of four actions:<a href="#section-1-7" class="pilcrow">¶</a></p>
1432 <ul class="normal">
1433 <li class="normal" id="section-1-8.1">send the field value (value-sent),<a href="#section-1-8.1" class="pilcrow">¶</a>
1434 </li>
1435 <li class="normal" id="section-1-8.2">send nothing (not-sent),<a href="#section-1-8.2" class="pilcrow">¶</a>
1436 </li>
1437 <li class="normal" id="section-1-8.3">send some Least Significant Bits (LSBs) of the field, or<a href="#section-1-8.3" class="pilcrow">¶</a>
1438 </li>
1439 <li class="normal" id="section-1-8.4">send an index (mapping-sent).<a href="#section-1-8.4" class="pilcrow">¶</a>
1440 </li>
1441 </ul>
1442 <p id="section-1-9">After applying the compression, there may be some bits to be sent.
1443 These values are called "Compression Residue".<a href="#section-1-9" class="pilcrow">¶</a></p>
1444 <p id="section-1-10">SCHC is a general mechanism applied to different protocols, with the exact Rules to be used depending on the protocol and the application. <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-10" class="relref">Section 10</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span> describes the compression scheme for IPv6 and UDP headers. This document targets CoAP header compression using SCHC.<a href="#section-1-10" class="pilcrow">¶</a></p>
1445 <div id="terminology">
1446 <section id="section-1.1">
1447 <h3 id="name-terminology">
1448 <a href="#section-1.1" class="section-number selfRef">1.1. </a><a href="#name-terminology" class="section-name selfRef">Terminology</a>
1449 </h3>
1450 <p id="section-1.1-1">The key words "<span class="bcp14">MUST</span>", "<span class="bcp14">MUST NOT</span>",
1451 "<span class="bcp14">REQUIRED</span>", "<span class="bcp14">SHALL</span>",
1452 "<span class="bcp14">SHALL NOT</span>", "<span class="bcp14">SHOULD</span>",
1453 "<span class="bcp14">SHOULD NOT</span>",
1454 "<span class="bcp14">RECOMMENDED</span>", "<span class="bcp14">NOT RECOMMENDED</span>",
1455 "<span class="bcp14">MAY</span>", and "<span class="bcp14">OPTIONAL</span>" in this document
1456 are to be interpreted as described in BCP 14
1457 <span>[<a href="#RFC2119" class="xref">RFC2119</a>]</span> <span>[<a href="#RFC8174" class="xref">RFC8174</a>]</span> when, and only
1458 when, they appear in all capitals, as shown here.<a href="#section-1.1-1" class="pilcrow">¶</a></p>
1459 </section>
1460 </div>
1461 </section>
1462 </div>
1463 <div id="schc-applicability-to-coap">
1464 <section id="section-2">
1465 <h2 id="name-schc-applicability-to-coap">
1466 <a href="#section-2" class="section-number selfRef">2. </a><a href="#name-schc-applicability-to-coap" class="section-name selfRef">SCHC Applicability to CoAP</a>
1467 </h2>
1468 <p id="section-2-1">SCHC compression for CoAP headers <span class="bcp14">MAY</span> be done in conjunction with the lower layers (IPv6/UDP) or independently. The SCHC adaptation layers, described in <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-5" class="relref">Section 5</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span>, may be used as shown in Figures <a href="#Fig-SCHCCOAP1" class="xref">1</a>, <a href="#Fig-SCHCCOAP2" class="xref">2</a>, and <a href="#Fig-SCHCCOAP3" class="xref">3</a>.<a href="#section-2-1" class="pilcrow">¶</a></p>
1469 <p id="section-2-2">In the first example, <a href="#Fig-SCHCCOAP1" class="xref">Figure 1</a>, a Rule compresses the complete header stack from IPv6 to CoAP. In this case, the Device and the Network Gateway (NGW) perform SCHC C/D (SCHC Compression/Decompression; see <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span>). The application communicating with the Device does not implement SCHC C/D.<a href="#section-2-2" class="pilcrow">¶</a></p>
1470 <span id="name-compression-decompression-a"></span><div id="Fig-SCHCCOAP1">
1471 <figure id="figure-1">
1472 <div class="artwork art-text alignLeft" id="section-2-3.1">
1473 <pre>
1474 (Device) (NGW) (App)
1475
1476 +--------+ +--------+
1477 | CoAP | | CoAP |
1478 +--------+ +--------+
1479 | UDP | | UDP |
1480 +--------+ +----------------+ +--------+
1481 | IPv6 | | IPv6 | | IPv6 |
1482 +--------+ +--------+-------+ +--------+
1483 | SCHC | | SCHC | | | |
1484 +--------+ +--------+ + + +
1485 | LPWAN | | LPWAN | | | |
1486 +--------+ +--------+-------+ +--------+
1487 ((((LPWAN)))) ------ Internet ------
1488 </pre>
1489 </div>
1490 <figcaption><a href="#figure-1" class="selfRef">Figure 1</a>:
1491 <a href="#name-compression-decompression-a" class="selfRef">Compression/Decompression at the LPWAN Boundary</a>
1492 </figcaption></figure>
1493 </div>
1494 <p id="section-2-4"><a href="#Fig-SCHCCOAP1" class="xref">Figure 1</a> shows the use of SCHC header compression above Layer 2 in the Device and the NGW. The SCHC layer receives non-encrypted packets and can apply compression Rules to all the headers in the stack. On the other end, the NGW receives the SCHC packet and reconstructs the headers using the Rule and the Compression Residue. After the decompression, the NGW forwards the IPv6 packet toward the destination. The same process applies in the other direction when a non-encrypted packet arrives at the NGW. Thanks to the IP forwarding based on the IPv6 prefix, the NGW identifies the Device and compresses headers using the Device's Rules.<a href="#section-2-4" class="pilcrow">¶</a></p>
1495 <p id="section-2-5">In the second example, <a href="#Fig-SCHCCOAP2" class="xref">Figure 2</a>, SCHC compression is applied in the CoAP layer, compressing the CoAP header independently of the other layers. The RuleID, Compression Residue, and CoAP payload are encrypted using a mechanism such as DTLS. Only the other end (App) can decipher the information. If needed, layers below use SCHC to compress the header as defined in <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span> (represented by dotted lines in the figure).<a href="#section-2-5" class="pilcrow">¶</a></p>
1496 <p id="section-2-6">This use case needs an end-to-end context initialization between the Device and the application. The context initialization is out of scope for this document.<a href="#section-2-6" class="pilcrow">¶</a></p>
1497 <span id="name-standalone-coap-end-to-end-"></span><div id="Fig-SCHCCOAP2">
1498 <figure id="figure-2">
1499 <div class="artwork art-text alignLeft" id="section-2-7.1">
1500 <pre>
1501 (Device) (NGW) (App)
1502
1503 +--------+ +--------+
1504 | CoAP | | CoAP |
1505 +--------+ +--------+
1506 | SCHC | | SCHC |
1507 +--------+ +--------+
1508 | DTLS | | DTLS |
1509 +--------+ +--------+
1510 . udp . . udp .
1511 .......... .................. ..........
1512 . ipv6 . . ipv6 . . ipv6 .
1513 .......... .................. ..........
1514 . schc . . schc . . . .
1515 .......... .......... . . .
1516 . lpwan . . lpwan . . . .
1517 .......... .................. ..........
1518 ((((LPWAN)))) ------ Internet ------
1519 </pre>
1520 </div>
1521 <figcaption><a href="#figure-2" class="selfRef">Figure 2</a>:
1522 <a href="#name-standalone-coap-end-to-end-" class="selfRef">Standalone CoAP End-to-End Compression/Decompression</a>
1523 </figcaption></figure>
1524 </div>
1525 <p id="section-2-8">The third example, <a href="#Fig-SCHCCOAP3" class="xref">Figure 3</a>, shows the use of Object Security for Constrained RESTful Environments (OSCORE) <span>[<a href="#RFC8613" class="xref">RFC8613</a>]</span>. In this case, SCHC needs two Rules to compress the CoAP header. A first Rule focuses on the Inner header. The result of this first compression is encrypted using the OSCORE mechanism. Then, a second Rule compresses the Outer header, including the OSCORE options.<a href="#section-2-8" class="pilcrow">¶</a></p>
1526 <span id="name-oscore-compression-decompre"></span><div id="Fig-SCHCCOAP3">
1527 <figure id="figure-3">
1528 <div class="artwork art-text alignLeft" id="section-2-9.1">
1529 <pre>
1530 (Device) (NGW) (App)
1531
1532 +--------+ +--------+
1533 | CoAP | | CoAP |
1534 | Inner | | Inner |
1535 +--------+ +--------+
1536 | SCHC | | SCHC |
1537 | Inner | | Inner |
1538 +--------+ +--------+
1539 | CoAP | | CoAP |
1540 | Outer | | Outer |
1541 +--------+ +--------+
1542 | SCHC | | SCHC |
1543 | Outer | | Outer |
1544 +--------+ +--------+
1545 . udp . . udp .
1546 .......... .................. ..........
1547 . ipv6 . . ipv6 . . ipv6 .
1548 .......... .................. ..........
1549 . schc . . schc . . . .
1550 .......... .......... . . .
1551 . lpwan . . lpwan . . . .
1552 .......... .................. ..........
1553 ((((LPWAN)))) ------ Internet ------
1554 </pre>
1555 </div>
1556 <figcaption><a href="#figure-3" class="selfRef">Figure 3</a>:
1557 <a href="#name-oscore-compression-decompre" class="selfRef">OSCORE Compression/Decompression</a>
1558 </figcaption></figure>
1559 </div>
1560 <p id="section-2-10">In the case of several SCHC instances, as shown in Figures <a href="#Fig-SCHCCOAP2" class="xref">2</a> and <a href="#Fig-SCHCCOAP3" class="xref">3</a>, the Rules may come from different provisioning domains.<a href="#section-2-10" class="pilcrow">¶</a></p>
1561 <p id="section-2-11">This document focuses on CoAP compression, as represented by the dashed boxes in the previous figures.<a href="#section-2-11" class="pilcrow">¶</a></p>
1562 </section>
1563 </div>
1564 <div id="coap-headers-compressed-with-schc">
1565 <section id="section-3">
1566 <h2 id="name-coap-headers-compressed-wit">
1567 <a href="#section-3" class="section-number selfRef">3. </a><a href="#name-coap-headers-compressed-wit" class="section-name selfRef">CoAP Headers Compressed with SCHC</a>
1568 </h2>
1569 <p id="section-3-1">The use of SCHC over the CoAP header applies the same description and compression/decompression techniques as the technique used for IP and UDP, as explained in <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span>. For CoAP, the SCHC Rules description uses the direction information to optimize the compression by reducing the number of Rules needed to compress headers. The Field Descriptor <span class="bcp14">MAY</span> define both request/response headers and TVs in the same Rule, using the DI to indicate the header type.<a href="#section-3-1" class="pilcrow">¶</a></p>
1570 <p id="section-3-2">As for other header compression protocols, when the compressor does not find a correct Rule to compress the header, the packet <span class="bcp14">MUST</span> be sent uncompressed using the RuleID dedicated to this purpose, and where the Compression Residue is the complete header of the packet. See <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-6" class="relref">Section 6</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span>.<a href="#section-3-2" class="pilcrow">¶</a></p>
1571 <div id="differences-between-coap-and-udpip-compression">
1572 <section id="section-3.1">
1573 <h3 id="name-differences-between-coap-an">
1574 <a href="#section-3.1" class="section-number selfRef">3.1. </a><a href="#name-differences-between-coap-an" class="section-name selfRef">Differences between CoAP and UDP/IP Compression</a>
1575 </h3>
1576 <p id="section-3.1-1">CoAP compression differs from IPv6 and UDP compression in the following aspects:<a href="#section-3.1-1" class="pilcrow">¶</a></p>
1577 <ul class="normal">
1578 <li class="normal" id="section-3.1-2.1">
1579 <p id="section-3.1-2.1.1">The CoAP message format is asymmetric; the headers are different for a request or a response.
1580 For example, the Uri-Path option is mandatory in the request, and it might not be present in the response.
1581 A request might contain an Accept option, and the response might include a Content-Format option.
1582 In comparison, the IPv6 and UDP returning path swaps the value of some fields in the header. However, all the directions have the same fields (e.g., source and destination address fields).<a href="#section-3.1-2.1.1" class="pilcrow">¶</a></p>
1583 <p id="section-3.1-2.1.2">
1584 <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span> defines the use of a DI in the
1585 Field Descriptor, which allows a single Rule to process a message
1586 header differently, depending on the direction.<a href="#section-3.1-2.1.2" class="pilcrow">¶</a></p>
1587 </li>
1588 <li class="normal" id="section-3.1-2.2">Even when a field is "symmetric" (i.e., found in both directions), the values carried in each direction are different.
1589 The compression may use a "match-mapping" MO to limit the range of expected values
1590 in a particular direction and reduce the Compression Residue's size.
1591 Through the DI, a Field Descriptor in the Rules splits the possible field value into two parts,
1592 one for each direction. For instance, if a client sends only Confirmable (CON) requests <span>[<a href="#RFC7252" class="xref">RFC7252</a>]</span>, the Type can be elided by compression,
1593 and the answer may use one single bit to carry either the ACK or Reset (RST) type.
1594 The field Code has the same behavior: the 0.0X code format value in the request and the Y.ZZ code format in the response.<a href="#section-3.1-2.2" class="pilcrow">¶</a>
1595 </li>
1596 <li class="normal" id="section-3.1-2.3">
1597 <p id="section-3.1-2.3.1">In SCHC, the Rule defines the different header fields' length, so SCHC does not need to send it.
1598 In IPv6 and UDP headers, the fields have a fixed size, known by definition.
1599 On the other hand, some CoAP header fields have variable lengths, and the Rule description specifies it.
1600 For example, in a Uri-Path or Uri-Query, the Token size may vary from 0 to 8 bytes,
1601 and the CoAP options use the Type-Length-Value encoding format.<a href="#section-3.1-2.3.1" class="pilcrow">¶</a></p>
1602 <p id="section-3.1-2.3.2">
1603 When doing SCHC compression of a variable-length field,
1604 <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-7.4.2" class="relref">Section 7.4.2</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span> offers the option of defining a function for the Field Length in the Field Descriptor to know the length before compression. If the Field Length is unknown, the Rule will set it as a variable, and SCHC will send the compressed field's length in the Compression Residue.<a href="#section-3.1-2.3.2" class="pilcrow">¶</a></p>
1605 </li>
1606 <li class="normal" id="section-3.1-2.4">A field can appear several times in the CoAP headers.
1607 It is found typically for elements of a URI (path or queries).
1608 The SCHC specification <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span> allows a FID to appear several times in the Rule
1609 and uses the Field Position (FP) to identify the correct instance, thereby removing the MO's ambiguity.<a href="#section-3.1-2.4" class="pilcrow">¶</a>
1610 </li>
1611 <li class="normal" id="section-3.1-2.5">Field Lengths defined in CoAP can be too large when it comes to LPWAN traffic constraints.
1612 For instance, this is particularly true for the Message ID field and the Token field.
1613 SCHC uses different MOs to perform the compression. See
1614 <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-7.4" class="relref">Section 7.4</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span>.
1615 In this case, SCHC can apply the Most Significant Bits (MSBs) MO to reduce the information carried on LPWANs.<a href="#section-3.1-2.5" class="pilcrow">¶</a>
1616 </li>
1617 </ul>
1618 </section>
1619 </div>
1620 </section>
1621 </div>
1622 <div id="CoAPcomp">
1623 <section id="section-4">
1624 <h2 id="name-compression-of-coap-header-">
1625 <a href="#section-4" class="section-number selfRef">4. </a><a href="#name-compression-of-coap-header-" class="section-name selfRef">Compression of CoAP Header Fields</a>
1626 </h2>
1627 <p id="section-4-1">This section discusses the compression of the different CoAP header fields. CoAP compression with SCHC follows the information provided in <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-7.1" class="relref">Section 7.1</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span>.<a href="#section-4-1" class="pilcrow">¶</a></p>
1628 <div id="coap-version-field">
1629 <section id="section-4.1">
1630 <h3 id="name-coap-version-field">
1631 <a href="#section-4.1" class="section-number selfRef">4.1. </a><a href="#name-coap-version-field" class="section-name selfRef">CoAP Version Field</a>
1632 </h3>
1633 <p id="section-4.1-1">The CoAP version is bidirectional and <span class="bcp14">MUST</span> be elided during SCHC compression, since it always contains the same value.
1634 In the future, or if a new version of CoAP is defined, new Rules will be needed to avoid ambiguities between versions.<a href="#section-4.1-1" class="pilcrow">¶</a></p>
1635 </section>
1636 </div>
1637 <div id="coap-type-field">
1638 <section id="section-4.2">
1639 <h3 id="name-coap-type-field">
1640 <a href="#section-4.2" class="section-number selfRef">4.2. </a><a href="#name-coap-type-field" class="section-name selfRef">CoAP Type Field</a>
1641 </h3>
1642 <p id="section-4.2-1">CoAP <span>[<a href="#RFC7252" class="xref">RFC7252</a>]</span> has four types of messages: two requests (CON, NON), one response (ACK), and one empty message (RST).<a href="#section-4.2-1" class="pilcrow">¶</a></p>
1643 <p id="section-4.2-2">The SCHC compression scheme <span class="bcp14">SHOULD</span> elide this field if, for instance, a client is sending only Non-confirmable (NON) messages or only CON messages.
1644 For the RST message, SCHC may use a dedicated Rule. For other usages, SCHC can use a "match-mapping" MO.<a href="#section-4.2-2" class="pilcrow">¶</a></p>
1645 </section>
1646 </div>
1647 <div id="coap-code-field">
1648 <section id="section-4.3">
1649 <h3 id="name-coap-code-field">
1650 <a href="#section-4.3" class="section-number selfRef">4.3. </a><a href="#name-coap-code-field" class="section-name selfRef">CoAP Code Field</a>
1651 </h3>
1652 <p id="section-4.3-1">The Code field, defined in an IANA registry <span>[<a href="#RFC7252" class="xref">RFC7252</a>]</span>, indicates the Request Method used in CoAP.
1653 The compression of the CoAP Code field follows the same principle as that of the CoAP Type field. If the Device plays a specific role, SCHC may split the code values into two Field Descriptors: (1) the request codes with the 0 class and (2) the response values. SCHC will use the DI to identify the correct value in the packet.<a href="#section-4.3-1" class="pilcrow">¶</a></p>
1654 <p id="section-4.3-2">If the Device only implements a CoAP client, SCHC compression may reduce the request code to the set of requests the client can process.<a href="#section-4.3-2" class="pilcrow">¶</a></p>
1655 <p id="section-4.3-3">For known values, SCHC can use a "match-mapping" MO. If SCHC cannot compress the Code field, it will send the values in the Compression Residue.<a href="#section-4.3-3" class="pilcrow">¶</a></p>
1656 </section>
1657 </div>
1658 <div id="coap-message-id-field">
1659 <section id="section-4.4">
1660 <h3 id="name-coap-message-id-field">
1661 <a href="#section-4.4" class="section-number selfRef">4.4. </a><a href="#name-coap-message-id-field" class="section-name selfRef">CoAP Message ID Field</a>
1662 </h3>
1663 <p id="section-4.4-1">SCHC can compress the Message ID field with the "MSB" MO and the "LSB" CDA.
1664 See <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-7.4" class="relref">Section 7.4</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span>.<a href="#section-4.4-1" class="pilcrow">¶</a></p>
1665 </section>
1666 </div>
1667 <div id="coap-token-fields">
1668 <section id="section-4.5">
1669 <h3 id="name-coap-token-fields">
1670 <a href="#section-4.5" class="section-number selfRef">4.5. </a><a href="#name-coap-token-fields" class="section-name selfRef">CoAP Token Fields</a>
1671 </h3>
1672 <p id="section-4.5-1">CoAP defines the Token using two CoAP fields: Token Length in the
1673 mandatory header and Token Value directly following the mandatory
1674 CoAP header.<a href="#section-4.5-1" class="pilcrow">¶</a></p>
1675 <p id="section-4.5-2">SCHC processes the Token Length as it would any header field. If the value does not change, the size can be stored in the TV and elided during the transmission. Otherwise, SCHC will send the Token Length in the Compression Residue.<a href="#section-4.5-2" class="pilcrow">¶</a></p>
1676 <p id="section-4.5-3">For the Token Value, SCHC <span class="bcp14">MUST NOT</span> send it as
1677 variable-length data in the Compression Residue, to avoid ambiguity with the Token Length. Therefore, SCHC <span class="bcp14">MUST</span> use the Token Length value to define the size of the Compression Residue. SCHC designates a specific function, "tkl", that the Rule <span class="bcp14">MUST</span> use to complete the Field Descriptor. During the decompression, this function returns the value contained in the Token Length field.<a href="#section-4.5-3" class="pilcrow">¶</a></p>
1678 </section>
1679 </div>
1680 </section>
1681 </div>
1682 <div id="coap-options">
1683 <section id="section-5">
1684 <h2 id="name-coap-options">
1685 <a href="#section-5" class="section-number selfRef">5. </a><a href="#name-coap-options" class="section-name selfRef">CoAP Options</a>
1686 </h2>
1687 <p id="section-5-1">CoAP defines options placed after the basic header, ordered by option number; see <span>[<a href="#RFC7252" class="xref">RFC7252</a>]</span>. Each Option instance in a message uses
1688 the format Delta-Type (D-T), Length (L), Value (V). The SCHC Rule builds the description of the option by using the following:<a href="#section-5-1" class="pilcrow">¶</a></p>
1689 <ul class="normal">
1690 <li class="normal" id="section-5-2.1">in the FID: the option number built from the D-T;<a href="#section-5-2.1" class="pilcrow">¶</a>
1691 </li>
1692 <li class="normal" id="section-5-2.2">in the TV: the option value; and<a href="#section-5-2.2" class="pilcrow">¶</a>
1693 </li>
1694 <li class="normal" id="section-5-2.3">for the Option Length: the information provided in Sections <a href="https://www.rfc-editor.org/rfc/rfc8724#section-7.4.1" class="relref">7.4.1</a> and <a href="https://www.rfc-editor.org/rfc/rfc8724#section-7.4.2" class="relref">7.4.2</a> of <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span>.<a href="#section-5-2.3" class="pilcrow">¶</a>
1695 </li>
1696 </ul>
1697 <p id="section-5-3">When the Option Length has a well-known size, the Rule may keep the length value. Therefore, SCHC compression does not send it. Otherwise, SCHC compression carries the length of the Compression Residue, in addition to the Compression Residue value.<a href="#section-5-3" class="pilcrow">¶</a></p>
1698 <p id="section-5-4">CoAP requests and responses do not include the same options. So, compression Rules may reflect this asymmetry by tagging the DI.<a href="#section-5-4" class="pilcrow">¶</a></p>
1699 <p id="section-5-5">Note that length coding differs between CoAP options and SCHC variable size Compression Residue.<a href="#section-5-5" class="pilcrow">¶</a></p>
1700 <p id="section-5-6">The following sections present how SCHC compresses some specific CoAP options.<a href="#section-5-6" class="pilcrow">¶</a></p>
1701 <p id="section-5-7">If CoAP introduces a new option, the SCHC Rules <span class="bcp14">MAY</span> be updated, and the new FID description <span class="bcp14">MUST</span> be assigned to allow its compression.
1702 Otherwise, if no Rule describes this new option, SCHC compression is not achieved, and SCHC sends the CoAP header without compression.<a href="#section-5-7" class="pilcrow">¶</a></p>
1703 <div id="coap-content-and-accept-options">
1704 <section id="section-5.1">
1705 <h3 id="name-coap-content-and-accept-opt">
1706 <a href="#section-5.1" class="section-number selfRef">5.1. </a><a href="#name-coap-content-and-accept-opt" class="section-name selfRef">CoAP Content and Accept Options</a>
1707 </h3>
1708 <p id="section-5.1-1">If the client expects a single value, it can be stored in the TV and elided during the transmission.
1709 Otherwise, if the client expects several possible values, a "match-mapping" MO <span class="bcp14">SHOULD</span> be used to limit the Compression Residue's size. If not, SCHC has to send the option value in the Compression Residue (fixed or variable length).<a href="#section-5.1-1" class="pilcrow">¶</a></p>
1710 </section>
1711 </div>
1712 <div id="coap-option-max-age-uri-host-and-uri-port-fields">
1713 <section id="section-5.2">
1714 <h3 id="name-coap-option-max-age-uri-hos">
1715 <a href="#section-5.2" class="section-number selfRef">5.2. </a><a href="#name-coap-option-max-age-uri-hos" class="section-name selfRef">CoAP Option Max-Age, Uri-Host, and Uri-Port Fields</a>
1716 </h3>
1717 <p id="section-5.2-1">SCHC compresses these three fields in the same way. When the values of these options are known, SCHC can elide these fields.
1718 If the option uses well-known values, SCHC can use a "match-mapping" MO. Otherwise, SCHC will use the "value-sent" MO, and the Compression Residue will send these options' values.<a href="#section-5.2-1" class="pilcrow">¶</a></p>
1719 </section>
1720 </div>
1721 <div id="coap-option-uri-path-and-uri-query-fields">
1722 <section id="section-5.3">
1723 <h3 id="name-coap-option-uri-path-and-ur">
1724 <a href="#section-5.3" class="section-number selfRef">5.3. </a><a href="#name-coap-option-uri-path-and-ur" class="section-name selfRef">CoAP Option Uri-Path and Uri-Query Fields</a>
1725 </h3>
1726 <p id="section-5.3-1">The Uri-Path and Uri-Query fields are repeatable options; this means that in the CoAP header, they may appear several times with different values. The SCHC Rule description uses the FP to distinguish the different instances in the path.<a href="#section-5.3-1" class="pilcrow">¶</a></p>
1727 <p id="section-5.3-2">To compress repeatable field values, SCHC may use a "match-mapping" MO to reduce the size of variable paths or queries. In these cases, to optimize the compression, several elements can be regrouped into a single entry. The numbering of elements does not change, and the first matching element sets the MO comparison.<a href="#section-5.3-2" class="pilcrow">¶</a></p>
1728 <p id="section-5.3-3">In <a href="#Table-complex-path" class="xref">Table 1</a>, SCHC can use a single bit in the Compression Residue to code one of the two paths.
1729 If regrouping were not allowed, 2 bits in the Compression Residue would be needed. SCHC sends the third path element as a variable size in the Compression Residue.<a href="#section-5.3-3" class="pilcrow">¶</a></p>
1730 <span id="name-complex-path-example"></span><div id="Table-complex-path">
1731 <table class="center" id="table-1">
1732 <caption>
1733 <a href="#table-1" class="selfRef">Table 1</a>:
1734 <a href="#name-complex-path-example" class="selfRef">Complex Path Example</a>
1735 </caption>
1736 <thead>
1737 <tr>
1738 <th class="text-center" rowspan="1" colspan="1">Field</th>
1739 <th class="text-center" rowspan="1" colspan="1">FL</th>
1740 <th class="text-center" rowspan="1" colspan="1">FP</th>
1741 <th class="text-center" rowspan="1" colspan="1">DI</th>
1742 <th class="text-center" rowspan="1" colspan="1">TV</th>
1743 <th class="text-center" rowspan="1" colspan="1">MO</th>
1744 <th class="text-center" rowspan="1" colspan="1">CDA</th>
1745 </tr>
1746 </thead>
1747 <tbody>
1748 <tr>
1749 <td class="text-left" rowspan="1" colspan="1">Uri-Path</td>
1750 <td class="text-left" rowspan="1" colspan="1"></td>
1751 <td class="text-left" rowspan="1" colspan="1">1</td>
1752 <td class="text-left" rowspan="1" colspan="1">Up</td>
1753 <td class="text-left" rowspan="1" colspan="1">["/a/b",<br>"/c/d"]</td>
1754 <td class="text-left" rowspan="1" colspan="1">match-<br>mapping</td>
1755 <td class="text-left" rowspan="1" colspan="1">mapping-sent</td>
1756 </tr>
1757 <tr>
1758 <td class="text-left" rowspan="1" colspan="1">Uri-Path</td>
1759 <td class="text-left" rowspan="1" colspan="1">var</td>
1760 <td class="text-left" rowspan="1" colspan="1">3</td>
1761 <td class="text-left" rowspan="1" colspan="1">Up</td>
1762 <td class="text-left" rowspan="1" colspan="1"></td>
1763 <td class="text-left" rowspan="1" colspan="1">ignore</td>
1764 <td class="text-left" rowspan="1" colspan="1">value-sent</td>
1765 </tr>
1766 </tbody>
1767 </table>
1768 </div>
1769 <p id="section-5.3-5">The length of Uri-Path and Uri-Query may be known when the Rule is defined. In any case, SCHC <span class="bcp14">MUST</span> set the Field Length to a variable value. The Compression Residue size is expressed in bytes.<a href="#section-5.3-5" class="pilcrow">¶</a></p>
1770 <p id="section-5.3-6">SCHC compression can use the MSB MO to a Uri-Path or Uri-Query element. However, attention to the length is important because the MSB value is in bits, and the size <span class="bcp14">MUST</span> always be a multiple of 8 bits.<a href="#section-5.3-6" class="pilcrow">¶</a></p>
1771 <p id="section-5.3-7">The length sent at the beginning of a variable-length Compression Residue indicates the LSB's size in bytes.<a href="#section-5.3-7" class="pilcrow">¶</a></p>
1772 <p id="section-5.3-8">For instance, for a CORECONF path /c/X6?k=eth0, the Rule description can be as follows (<a href="#Table-CoMicompress" class="xref">Table 2</a>):<a href="#section-5.3-8" class="pilcrow">¶</a></p>
1773 <span id="name-coreconf-uri-compression"></span><div id="Table-CoMicompress">
1774 <table class="center" id="table-2">
1775 <caption>
1776 <a href="#table-2" class="selfRef">Table 2</a>:
1777 <a href="#name-coreconf-uri-compression" class="selfRef">CORECONF URI Compression</a>
1778 </caption>
1779 <thead>
1780 <tr>
1781 <th class="text-center" rowspan="1" colspan="1">Field</th>
1782 <th class="text-center" rowspan="1" colspan="1">FL</th>
1783 <th class="text-center" rowspan="1" colspan="1">FP</th>
1784 <th class="text-center" rowspan="1" colspan="1">DI</th>
1785 <th class="text-center" rowspan="1" colspan="1">TV</th>
1786 <th class="text-center" rowspan="1" colspan="1">MO</th>
1787 <th class="text-center" rowspan="1" colspan="1">CDA</th>
1788 </tr>
1789 </thead>
1790 <tbody>
1791 <tr>
1792 <td class="text-left" rowspan="1" colspan="1">Uri-Path</td>
1793 <td class="text-left" rowspan="1" colspan="1"></td>
1794 <td class="text-left" rowspan="1" colspan="1">1</td>
1795 <td class="text-left" rowspan="1" colspan="1">Up</td>
1796 <td class="text-left" rowspan="1" colspan="1">"c"</td>
1797 <td class="text-left" rowspan="1" colspan="1">equal</td>
1798 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
1799 </tr>
1800 <tr>
1801 <td class="text-left" rowspan="1" colspan="1">Uri-Path</td>
1802 <td class="text-left" rowspan="1" colspan="1">var</td>
1803 <td class="text-left" rowspan="1" colspan="1">2</td>
1804 <td class="text-left" rowspan="1" colspan="1">Up</td>
1805 <td class="text-left" rowspan="1" colspan="1"></td>
1806 <td class="text-left" rowspan="1" colspan="1">ignore</td>
1807 <td class="text-left" rowspan="1" colspan="1">value-sent</td>
1808 </tr>
1809 <tr>
1810 <td class="text-left" rowspan="1" colspan="1">Uri-Query</td>
1811 <td class="text-left" rowspan="1" colspan="1">var</td>
1812 <td class="text-left" rowspan="1" colspan="1">1</td>
1813 <td class="text-left" rowspan="1" colspan="1">Up</td>
1814 <td class="text-left" rowspan="1" colspan="1">"k="</td>
1815 <td class="text-left" rowspan="1" colspan="1">MSB(16)</td>
1816 <td class="text-left" rowspan="1" colspan="1">LSB</td>
1817 </tr>
1818 </tbody>
1819 </table>
1820 </div>
1821 <p id="section-5.3-10"><a href="#Table-CoMicompress" class="xref">Table 2</a> shows the Rule description for a Uri-Path and a Uri-Query. SCHC compresses the first part of the Uri-Path with a "not-sent" CDA.
1822 SCHC will send the second element of the Uri-Path with the length (i.e., 0x2 "X6") followed by the query option (i.e., 0x4 "eth0").<a href="#section-5.3-10" class="pilcrow">¶</a></p>
1823 <div id="variable-number-of-path-or-query-elements">
1824 <section id="section-5.3.1">
1825 <h4 id="name-variable-number-of-path-or-">
1826 <a href="#section-5.3.1" class="section-number selfRef">5.3.1. </a><a href="#name-variable-number-of-path-or-" class="section-name selfRef">Variable Number of Path or Query Elements</a>
1827 </h4>
1828 <p id="section-5.3.1-1">SCHC fixed the number of Uri-Path or Uri-Query elements in a Rule at
1829 the Rule creation time. If the number varies, SCHC <span class="bcp14">SHOULD</span> either<a href="#section-5.3.1-1" class="pilcrow">¶</a></p>
1830 <ul class="normal">
1831 <li class="normal" id="section-5.3.1-2.1">create several Rules to cover all possibilities or<a href="#section-5.3.1-2.1" class="pilcrow">¶</a>
1832 </li>
1833 <li class="normal" id="section-5.3.1-2.2">create a Rule that defines several entries for Uri-Path to cover the longest path and send a Compression Residue with a length of 0 to indicate that a Uri-Path entry is empty.<a href="#section-5.3.1-2.2" class="pilcrow">¶</a>
1834 </li>
1835 </ul>
1836 <p id="section-5.3.1-3">However, this adds 4 bits to the variable Compression Residue size. See
1837 <span><a href="https://www.rfc-editor.org/rfc/rfc8724#section-7.4.2" class="relref">Section 7.4.2</a> of [<a href="#RFC8724" class="xref">RFC8724</a>]</span>.<a href="#section-5.3.1-3" class="pilcrow">¶</a></p>
1838 </section>
1839 </div>
1840 </section>
1841 </div>
1842 <div id="coap-option-size1-size2-proxy-uri-and-proxy-scheme-fields">
1843 <section id="section-5.4">
1844 <h3 id="name-coap-option-size1-size2-pro">
1845 <a href="#section-5.4" class="section-number selfRef">5.4. </a><a href="#name-coap-option-size1-size2-pro" class="section-name selfRef">CoAP Option Size1, Size2, Proxy-URI, and Proxy-Scheme Fields</a>
1846 </h3>
1847 <p id="section-5.4-1">The SCHC Rule description <span class="bcp14">MAY</span> define sending some field values by setting the TV to "not-sent", the MO to "ignore", and the CDA to "value-sent". A Rule <span class="bcp14">MAY</span> also use a "match-mapping" MO when there are different options for the same FID. Otherwise, the Rule sets the TV to the value, the MO to "equal", and the CDA to "not-sent".<a href="#section-5.4-1" class="pilcrow">¶</a></p>
1848 </section>
1849 </div>
1850 <div id="coap-option-etag-if-match-if-none-match-location-path-and-location-query-fields">
1851 <section id="section-5.5">
1852 <h3 id="name-coap-option-etag-if-match-i">
1853 <a href="#section-5.5" class="section-number selfRef">5.5. </a><a href="#name-coap-option-etag-if-match-i" class="section-name selfRef">CoAP Option ETag, If-Match, If-None-Match, Location-Path, and Location-Query Fields</a>
1854 </h3>
1855 <p id="section-5.5-1">A Rule entry cannot store these fields' values. The Rule description <span class="bcp14">MUST</span> always send these values in the Compression Residue.<a href="#section-5.5-1" class="pilcrow">¶</a></p>
1856 </section>
1857 </div>
1858 </section>
1859 </div>
1860 <div id="schc-compression-of-coap-extension-rfcs">
1861 <section id="section-6">
1862 <h2 id="name-schc-compression-of-coap-ex">
1863 <a href="#section-6" class="section-number selfRef">6. </a><a href="#name-schc-compression-of-coap-ex" class="section-name selfRef">SCHC Compression of CoAP Extensions</a>
1864 </h2>
1865 <div id="block">
1866 <section id="section-6.1">
1867 <h3 id="name-block">
1868 <a href="#section-6.1" class="section-number selfRef">6.1. </a><a href="#name-block" class="section-name selfRef">Block</a>
1869 </h3>
1870 <p id="section-6.1-1">When a packet uses a Block option <span>[<a href="#RFC7959" class="xref">RFC7959</a>]</span>, SCHC compression <span class="bcp14">MUST</span> send its content in the Compression Residue.
1871 The SCHC Rule describes an empty TV with the MO set to "ignore" and the CDA set to "value-sent".
1872 The Block option allows fragmentation at the CoAP level that is compatible with SCHC fragmentation.
1873 Both fragmentation mechanisms are complementary, and the node may use them for the same packet as needed.<a href="#section-6.1-1" class="pilcrow">¶</a></p>
1874 </section>
1875 </div>
1876 <div id="observe">
1877 <section id="section-6.2">
1878 <h3 id="name-observe">
1879 <a href="#section-6.2" class="section-number selfRef">6.2. </a><a href="#name-observe" class="section-name selfRef">Observe</a>
1880 </h3>
1881 <p id="section-6.2-1"><span>[<a href="#RFC7641" class="xref">RFC7641</a>]</span> defines the Observe Option. The SCHC Rule description will not define the TV but will set the MO to "ignore" and the CDA to "value-sent". SCHC does not limit the maximum size for this option (3 bytes). To reduce the transmission size, either the Device implementation <span class="bcp14">MAY</span> limit the delta between two consecutive values or a proxy can modify the increment.<a href="#section-6.2-1" class="pilcrow">¶</a></p>
1882 <p id="section-6.2-2">Since the Observe Option <span class="bcp14">MAY</span> use a RST message to inform a server that the client does not require the Observe response, a specific SCHC Rule <span class="bcp14">SHOULD</span> exist to allow the message's compression with the RST type.<a href="#section-6.2-2" class="pilcrow">¶</a></p>
1883 </section>
1884 </div>
1885 <div id="no-response">
1886 <section id="section-6.3">
1887 <h3 id="name-no-response">
1888 <a href="#section-6.3" class="section-number selfRef">6.3. </a><a href="#name-no-response" class="section-name selfRef">No-Response</a>
1889 </h3>
1890 <p id="section-6.3-1"><span>[<a href="#RFC7967" class="xref">RFC7967</a>]</span> defines a No-Response option limiting the responses made by a server to a request. Different behaviors exist while using this option to limit the responses made by a server to a request. If both ends know the value, then the SCHC Rule will describe a TV to this value, with the MO set to "equal" and the CDA set to "not-sent".<a href="#section-6.3-1" class="pilcrow">¶</a></p>
1891 <p id="section-6.3-2">Otherwise, if the value is changing over time, the SCHC Rule will set the MO to "ignore" and the CDA to "value-sent". The Rule may also use a "match-mapping" MO to compress this option.<a href="#section-6.3-2" class="pilcrow">¶</a></p>
1892 </section>
1893 </div>
1894 <div id="Sec-OSCORE">
1895 <section id="section-6.4">
1896 <h3 id="name-oscore">
1897 <a href="#section-6.4" class="section-number selfRef">6.4. </a><a href="#name-oscore" class="section-name selfRef">OSCORE</a>
1898 </h3>
1899 <p id="section-6.4-1">OSCORE <span>[<a href="#RFC8613" class="xref">RFC8613</a>]</span> defines end-to-end protection for CoAP messages.
1900 This section describes how SCHC Rules can be applied to compress OSCORE-protected messages.<a href="#section-6.4-1" class="pilcrow">¶</a></p>
1901 <p id="section-6.4-2"><a href="#Fig-OSCORE-Option" class="xref">Figure 4</a> shows the OSCORE option value encoding defined in
1902 <span><a href="https://www.rfc-editor.org/rfc/rfc8613#section-6.1" class="relref">Section 6.1</a> of [<a href="#RFC8613" class="xref">RFC8613</a>]</span>, where the first byte specifies the content of the OSCORE options using flags. The three most significant bits of this byte are reserved and always set to 0. Bit h, when set, indicates the presence of the kid context field in the option. Bit k, when set, indicates the presence of a kid field. The three least significant bits, n, indicate the length of the piv (Partial Initialization Vector) field in bytes. When n = 0, no piv is present.<a href="#section-6.4-2" class="pilcrow">¶</a></p>
1903 <span id="name-oscore-option"></span><div id="Fig-OSCORE-Option">
1904 <figure id="figure-4">
1905 <div class="artwork art-text alignLeft" id="section-6.4-3.1">
1906 <pre>
1907 0 1 2 3 4 5 6 7 &lt;--------- n bytes -------------&gt;
1908 +-+-+-+-+-+-+-+-+---------------------------------
1909 |0 0 0|h|k| n | Partial IV (if any) ...
1910 +-+-+-+-+-+-+-+-+---------------------------------
1911 | | |
1912 |&lt;-- CoAP --&gt;|&lt;------ CoAP OSCORE_piv ------&gt; |
1913 OSCORE_flags
1914
1915 &lt;- 1 byte -&gt; &lt;------ s bytes -----&gt;
1916 +------------+----------------------+-----------------------+
1917 | s (if any) | kid context (if any) | kid (if any) ... |
1918 +------------+----------------------+-----------------------+
1919 | | |
1920 | &lt;------ CoAP OSCORE_kidctx ------&gt;|&lt;-- CoAP OSCORE_kid --&gt;|
1921 </pre>
1922 </div>
1923 <figcaption><a href="#figure-4" class="selfRef">Figure 4</a>:
1924 <a href="#name-oscore-option" class="selfRef">OSCORE Option</a>
1925 </figcaption></figure>
1926 </div>
1927 <p id="section-6.4-4">The flag byte is followed by the piv field, the kid context field, and the kid field, in that order, and, if present,
1928 the kid context field's length (in bytes) is encoded in the first byte, denoted by "s".<a href="#section-6.4-4" class="pilcrow">¶</a></p>
1929 <p id="section-6.4-5">To better perform OSCORE SCHC compression, the Rule description needs to identify the OSCORE option and the fields it contains. Conceptually, it discerns up to four distinct pieces of information within the OSCORE option: the flag bits, the piv, the kid context, and the kid. The SCHC Rule splits the OSCORE option into four Field Descriptors in order to compress them:<a href="#section-6.4-5" class="pilcrow">¶</a></p>
1930 <ul class="normal">
1931 <li class="normal" id="section-6.4-6.1">CoAP OSCORE_flags<a href="#section-6.4-6.1" class="pilcrow">¶</a>
1932 </li>
1933 <li class="normal" id="section-6.4-6.2">CoAP OSCORE_piv<a href="#section-6.4-6.2" class="pilcrow">¶</a>
1934 </li>
1935 <li class="normal" id="section-6.4-6.3">CoAP OSCORE_kidctx<a href="#section-6.4-6.3" class="pilcrow">¶</a>
1936 </li>
1937 <li class="normal" id="section-6.4-6.4">CoAP OSCORE_kid<a href="#section-6.4-6.4" class="pilcrow">¶</a>
1938 </li>
1939 </ul>
1940 <p id="section-6.4-7"><a href="#Fig-OSCORE-Option" class="xref">Figure 4</a> shows the OSCORE option format with those four fields superimposed on it.
1941 Note that the CoAP OSCORE_kidctx field directly includes the size octet, s.<a href="#section-6.4-7" class="pilcrow">¶</a></p>
1942 </section>
1943 </div>
1944 </section>
1945 </div>
1946 <div id="examples-of-coap-header-compression">
1947 <section id="section-7">
1948 <h2 id="name-examples-of-coap-header-com">
1949 <a href="#section-7" class="section-number selfRef">7. </a><a href="#name-examples-of-coap-header-com" class="section-name selfRef">Examples of CoAP Header Compression</a>
1950 </h2>
1951 <div id="mandatory-header-with-con-message">
1952 <section id="section-7.1">
1953 <h3 id="name-mandatory-header-with-con-m">
1954 <a href="#section-7.1" class="section-number selfRef">7.1. </a><a href="#name-mandatory-header-with-con-m" class="section-name selfRef">Mandatory Header with CON Message</a>
1955 </h3>
1956 <p id="section-7.1-1">In this first scenario, the SCHC compressor on the NGW side
1957 receives a POST message from an Internet client, which is immediately acknowledged by the Device.
1958 <a href="#Table-CoAP-header-1" class="xref">Table 3</a> describes the SCHC Rule descriptions for this scenario.<a href="#section-7.1-1" class="pilcrow">¶</a></p>
1959 <span id="name-coap-context-to-compress-he"></span><div id="Table-CoAP-header-1">
1960 <table class="center" id="table-3">
1961 <caption>
1962 <a href="#table-3" class="selfRef">Table 3</a>:
1963 <a href="#name-coap-context-to-compress-he" class="selfRef">CoAP Context to Compress Header without Token</a>
1964 </caption>
1965 <thead>
1966 <tr>
1967 <th class="text-left" rowspan="1" colspan="8">RuleID 1</th>
1968 </tr>
1969 <tr>
1970 <th class="text-center" rowspan="1" colspan="1">Field</th>
1971 <th class="text-center" rowspan="1" colspan="1">FL</th>
1972 <th class="text-center" rowspan="1" colspan="1">FP</th>
1973 <th class="text-center" rowspan="1" colspan="1">DI</th>
1974 <th class="text-center" rowspan="1" colspan="1">TV</th>
1975 <th class="text-center" rowspan="1" colspan="1">MO</th>
1976 <th class="text-center" rowspan="1" colspan="1">CDA</th>
1977 <th class="text-center" rowspan="1" colspan="1">Sent [bits]</th>
1978 </tr>
1979 </thead>
1980 <tbody>
1981 <tr>
1982 <td class="text-left" rowspan="1" colspan="1">CoAP version</td>
1983 <td class="text-left" rowspan="1" colspan="1">2</td>
1984 <td class="text-left" rowspan="1" colspan="1">1</td>
1985 <td class="text-left" rowspan="1" colspan="1">Bi</td>
1986 <td class="text-left" rowspan="1" colspan="1">01</td>
1987 <td class="text-left" rowspan="1" colspan="1">equal</td>
1988 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
1989 <th class="text-left" rowspan="1" colspan="1"></th>
1990 </tr>
1991 <tr>
1992 <td class="text-left" rowspan="1" colspan="1">CoAP Type</td>
1993 <td class="text-left" rowspan="1" colspan="1">2</td>
1994 <td class="text-left" rowspan="1" colspan="1">1</td>
1995 <td class="text-left" rowspan="1" colspan="1">Dw</td>
1996 <td class="text-left" rowspan="1" colspan="1">CON</td>
1997 <td class="text-left" rowspan="1" colspan="1">equal</td>
1998 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
1999 <th class="text-left" rowspan="1" colspan="1"></th>
2000 </tr>
2001 <tr>
2002 <td class="text-left" rowspan="1" colspan="1">CoAP Type</td>
2003 <td class="text-left" rowspan="1" colspan="1">2</td>
2004 <td class="text-left" rowspan="1" colspan="1">1</td>
2005 <td class="text-left" rowspan="1" colspan="1">Up</td>
2006 <td class="text-left" rowspan="1" colspan="1">[ACK,<br>RST]</td>
2007 <td class="text-left" rowspan="1" colspan="1">match-mapping</td>
2008 <td class="text-left" rowspan="1" colspan="1">matching-sent</td>
2009 <th class="text-left" rowspan="1" colspan="1">T</th>
2010 </tr>
2011 <tr>
2012 <td class="text-left" rowspan="1" colspan="1">CoAP TKL</td>
2013 <td class="text-left" rowspan="1" colspan="1">4</td>
2014 <td class="text-left" rowspan="1" colspan="1">1</td>
2015 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2016 <td class="text-left" rowspan="1" colspan="1">0</td>
2017 <td class="text-left" rowspan="1" colspan="1">equal</td>
2018 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2019 <th class="text-left" rowspan="1" colspan="1"></th>
2020 </tr>
2021 <tr>
2022 <td class="text-left" rowspan="1" colspan="1">CoAP Code</td>
2023 <td class="text-left" rowspan="1" colspan="1">8</td>
2024 <td class="text-left" rowspan="1" colspan="1">1</td>
2025 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2026 <td class="text-left" rowspan="1" colspan="1">[0.00,<br>...<br>5.05]</td>
2027 <td class="text-left" rowspan="1" colspan="1">match-mapping</td>
2028 <td class="text-left" rowspan="1" colspan="1">matching-sent</td>
2029 <th class="text-left" rowspan="1" colspan="1">CC CCC</th>
2030 </tr>
2031 <tr>
2032 <td class="text-left" rowspan="1" colspan="1">CoAP MID</td>
2033 <td class="text-left" rowspan="1" colspan="1">16</td>
2034 <td class="text-left" rowspan="1" colspan="1">1</td>
2035 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2036 <td class="text-left" rowspan="1" colspan="1">0000</td>
2037 <td class="text-left" rowspan="1" colspan="1">MSB(7)</td>
2038 <td class="text-left" rowspan="1" colspan="1">LSB</td>
2039 <th class="text-left" rowspan="1" colspan="1">MID</th>
2040 </tr>
2041 <tr>
2042 <td class="text-left" rowspan="1" colspan="1">CoAP Uri-Path</td>
2043 <td class="text-left" rowspan="1" colspan="1">var</td>
2044 <td class="text-left" rowspan="1" colspan="1">1</td>
2045 <td class="text-left" rowspan="1" colspan="1">Dw</td>
2046 <td class="text-left" rowspan="1" colspan="1">path</td>
2047 <td class="text-left" rowspan="1" colspan="1">equal 1</td>
2048 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2049 <th class="text-left" rowspan="1" colspan="1"></th>
2050 </tr>
2051 </tbody>
2052 </table>
2053 </div>
2054 <p id="section-7.1-3">In this example, SCHC compression elides the version and Token Length fields. The 25 Method and Response Codes defined in <span>[<a href="#RFC7252" class="xref">RFC7252</a>]</span> have been shrunk to 5 bits using a "match-mapping" MO. The Uri-Path contains a single element indicated in the TV and elided with the CDA "not-sent".<a href="#section-7.1-3" class="pilcrow">¶</a></p>
2055 <p id="section-7.1-4">SCHC compression reduces the header, sending only the Type, a mapped code, and the least significant bits of the Message ID (9 bits in the example above).<a href="#section-7.1-4" class="pilcrow">¶</a></p>
2056 <p id="section-7.1-5">Note that a client located in an Application Server sending a request to a server located in the Device may not be compressed through this Rule, since the MID might not start with 7 bits equal to 0. A CoAP proxy placed before SCHC C/D can rewrite the Message ID to fit the value and match the Rule.<a href="#section-7.1-5" class="pilcrow">¶</a></p>
2057 </section>
2058 </div>
2059 <div id="Sec-OSCORE-Examples">
2060 <section id="section-7.2">
2061 <h3 id="name-oscore-compression">
2062 <a href="#section-7.2" class="section-number selfRef">7.2. </a><a href="#name-oscore-compression" class="section-name selfRef">OSCORE Compression</a>
2063 </h3>
2064 <p id="section-7.2-1">OSCORE aims to solve the problem of end-to-end encryption for CoAP messages. Therefore, the goal is to hide the message as much as possible
2065 while still enabling proxy operation.<a href="#section-7.2-1" class="pilcrow">¶</a></p>
2066 <p id="section-7.2-2">Conceptually, this is achieved by splitting the CoAP message into an Inner Plaintext and Outer OSCORE message. The Inner Plaintext contains sensitive information that is not necessary for proxy operation. However, it is part of the message that can be encrypted until it
2067 reaches its end destination. The Outer Message acts as a shell matching the regular CoAP message format and includes all options and information
2068 needed for proxy operation and caching. <a href="#Fig-inner-outer" class="xref">Figure 5</a> below illustrates this analysis.<a href="#section-7.2-2" class="pilcrow">¶</a></p>
2069 <p id="section-7.2-3">CoAP arranges the options into one of three classes, each granted a specific type of protection by the protocol:<a href="#section-7.2-3" class="pilcrow">¶</a></p>
2070 <span class="break"></span><dl class="dlParallel" id="section-7.2-4">
2071 <dt id="section-7.2-4.1">Class E:</dt>
2072 <dd style="margin-left: 1.5em" id="section-7.2-4.2">Encrypted options moved to the Inner Plaintext.<a href="#section-7.2-4.2" class="pilcrow">¶</a>
2073 </dd>
2074 <dd class="break"></dd>
2075 <dt id="section-7.2-4.3">Class I:</dt>
2076 <dd style="margin-left: 1.5em" id="section-7.2-4.4">Integrity-protected options included in the Additional Authenticated Data (AAD) for the encryption of the Plaintext but otherwise left untouched in the Outer Message.<a href="#section-7.2-4.4" class="pilcrow">¶</a>
2077 </dd>
2078 <dd class="break"></dd>
2079 <dt id="section-7.2-4.5">Class U:</dt>
2080 <dd style="margin-left: 1.5em" id="section-7.2-4.6">Unprotected options left untouched in the Outer Message.<a href="#section-7.2-4.6" class="pilcrow">¶</a>
2081 </dd>
2082 <dd class="break"></dd>
2083 </dl>
2084 <p id="section-7.2-5">These classes point out that the Outer option contains the OSCORE option and that the message is OSCORE protected; this option carries the information necessary to retrieve the Security Context. The endpoint will use this Security Context to decrypt the message correctly.<a href="#section-7.2-5" class="pilcrow">¶</a></p>
2085 <span id="name-coap-packet-split-into-osco"></span><div id="Fig-inner-outer">
2086 <figure id="figure-5">
2087 <div class="artwork art-text alignLeft" id="section-7.2-6.1">
2088 <pre>
2089 Original CoAP Packet
2090 +-+-+---+-------+---------------+
2091 |v|t|TKL| code | Message ID |
2092 +-+-+---+-------+---------------+....+
2093 | Token |
2094 +-------------------------------.....+
2095 | Options (IEU) |
2096 . .
2097 . .
2098 +------+-------------------+
2099 | 0xFF |
2100 +------+------------------------+
2101 | |
2102 | Payload |
2103 | |
2104 +-------------------------------+
2105 / \
2106 / \
2107 / \
2108 / \
2109 Outer Header v v Plaintext
2110 +-+-+---+--------+---------------+ +-------+
2111 |v|t|TKL|new code| Message ID | | code |
2112 +-+-+---+--------+---------------+....+ +-------+-----......+
2113 | Token | | Options (E) |
2114 +--------------------------------.....+ +-------+------.....+
2115 | Options (IU) | | 0xFF |
2116 . . +-------+-----------+
2117 . OSCORE Option . | |
2118 +------+-------------------+ | Payload |
2119 | 0xFF | | |
2120 +------+ +-------------------+
2121 </pre>
2122 </div>
2123 <figcaption><a href="#figure-5" class="selfRef">Figure 5</a>:
2124 <a href="#name-coap-packet-split-into-osco" class="selfRef">CoAP Packet Split into OSCORE Outer Header and Plaintext</a>
2125 </figcaption></figure>
2126 </div>
2127 <p id="section-7.2-7"><a href="#Fig-inner-outer" class="xref">Figure 5</a> shows the packet format for the OSCORE Outer header and Plaintext.<a href="#section-7.2-7" class="pilcrow">¶</a></p>
2128 <p id="section-7.2-8">In the Outer header, the original header code is hidden and replaced by a default dummy value. As seen in
2129 Sections <a href="https://www.rfc-editor.org/rfc/rfc8613#section-4.1.3.5" class="relref">4.1.3.5</a> and <a href="https://www.rfc-editor.org/rfc/rfc8613#section-4.2" class="relref">4.2</a> of <span>[<a href="#RFC8613" class="xref">RFC8613</a>]</span>, the message code is replaced by POST for requests and Changed for responses when CoAP is not using the Observe Option. If CoAP uses Observe, the OSCORE message code is replaced by FETCH for requests and Content for responses.<a href="#section-7.2-8" class="pilcrow">¶</a></p>
2130 <p id="section-7.2-9">The first byte of the Plaintext contains the original packet code, followed by the message code, the class E options, and, if present, the original message payload preceded by its payload marker.<a href="#section-7.2-9" class="pilcrow">¶</a></p>
2131 <p id="section-7.2-10">An Authenticated Encryption with Associated Data (AEAD) algorithm now encrypts the Plaintext. This integrity-protects the Security Context parameters and, eventually, any class I options from the Outer header. The resulting ciphertext becomes the new payload of the OSCORE message, as illustrated in <a href="#Fig-full-oscore" class="xref">Figure 6</a>.<a href="#section-7.2-10" class="pilcrow">¶</a></p>
2132 <p id="section-7.2-11">As defined in <span>[<a href="#RFC5116" class="xref">RFC5116</a>]</span>, this ciphertext is the encrypted Plaintext's concatenation of the Authentication Tag. Note that Inner Compression only affects the Plaintext before encryption.
2133 The Authentication Tag, fixed in length and uncompressed, is considered part of the cost of protection.<a href="#section-7.2-11" class="pilcrow">¶</a></p>
2134 <span id="name-oscore-message"></span><div id="Fig-full-oscore">
2135 <figure id="figure-6">
2136 <div class="artwork art-text alignLeft" id="section-7.2-12.1">
2137 <pre>
2138 Outer Header
2139 +-+-+---+--------+---------------+
2140 |v|t|TKL|new code| Message ID |
2141 +-+-+---+--------+---------------+....+
2142 | Token |
2143 +--------------------------------.....+
2144 | Options (IU) |
2145 . .
2146 . OSCORE Option .
2147 +------+-------------------+
2148 | 0xFF |
2149 +------+---------------------------+
2150 | |
2151 | Ciphertext: Encrypted Inner |
2152 | Header and Payload |
2153 | + Authentication Tag |
2154 | |
2155 +----------------------------------+
2156 </pre>
2157 </div>
2158 <figcaption><a href="#figure-6" class="selfRef">Figure 6</a>:
2159 <a href="#name-oscore-message" class="selfRef">OSCORE Message</a>
2160 </figcaption></figure>
2161 </div>
2162 <p id="section-7.2-13">The SCHC compression scheme consists of compressing both the Plaintext before encryption and the resulting OSCORE message after encryption; see <a href="#Fig-OSCORE-Compression" class="xref">Figure 7</a>.<a href="#section-7.2-13" class="pilcrow">¶</a></p>
2163 <p id="section-7.2-14">The OSCORE message translates into a segmented process where SCHC compression is applied independently in two stages, each with its corresponding set of Rules, with the Inner SCHC Rules and the Outer SCHC Rules. This way, compression is applied to all fields of the original CoAP message.<a href="#section-7.2-14" class="pilcrow">¶</a></p>
2164 <span id="name-oscore-compression-diagram"></span><div id="Fig-OSCORE-Compression">
2165 <figure id="figure-7">
2166 <div class="artwork art-text alignLeft" id="section-7.2-15.1">
2167 <pre>
2168 Outer Message OSCORE Plaintext
2169 +-+-+---+--------+---------------+ +-------+
2170 |v|t|TKL|new code| Message ID | | code |
2171 +-+-+---+--------+---------------+....+ +-------+-----......+
2172 | Token | | Options (E) |
2173 +--------------------------------.....+ +-------+------.....+
2174 | Options (IU) | | 0xFF |
2175 . . +-------+-----------+
2176 . OSCORE Option . | |
2177 +------+-------------------+ | Payload |
2178 | 0xFF | | |
2179 +------+------------+ +-------------------+
2180 | Ciphertext |&lt;---------\ |
2181 | | | v
2182 +-------------------+ | +-----------------+
2183 | | | Inner SCHC |
2184 v | | Compression |
2185 +-----------------+ | +-----------------+
2186 | Outer SCHC | | |
2187 | Compression | | v
2188 +-----------------+ | +-------+
2189 | | |RuleID |
2190 v | +-------+-----------+
2191 +--------+ +------------+ |Compression Residue|
2192 |RuleID' | | Encryption | &lt;-- +----------+--------+
2193 +--------+-----------+ +------------+ | |
2194 |Compression Residue'| | Payload |
2195 +-----------+--------+ | |
2196 | Ciphertext | +-------------------+
2197 | |
2198 +--------------------+
2199 </pre>
2200 </div>
2201 <figcaption><a href="#figure-7" class="selfRef">Figure 7</a>:
2202 <a href="#name-oscore-compression-diagram" class="selfRef">OSCORE Compression Diagram</a>
2203 </figcaption></figure>
2204 </div>
2205 <p id="section-7.2-16">Note that since the corresponding endpoint can only decrypt the Inner part of the message, this endpoint will also have to implement Inner SCHC Compression/Decompression.<a href="#section-7.2-16" class="pilcrow">¶</a></p>
2206 </section>
2207 </div>
2208 <div id="example-oscore-compression">
2209 <section id="section-7.3">
2210 <h3 id="name-example-oscore-compression">
2211 <a href="#section-7.3" class="section-number selfRef">7.3. </a><a href="#name-example-oscore-compression" class="section-name selfRef">Example OSCORE Compression</a>
2212 </h3>
2213 <p id="section-7.3-1">This section gives an example with a GET request and its consequent Content
2214 response from a Device-based CoAP client to a cloud-based CoAP server.
2215 The example also describes a possible set of Rules for Inner SCHC Compression and Outer SCHC
2216 Compression. A dump of the results and a contrast between SCHC + OSCORE
2217 performance with SCHC + CoAP performance are also listed. This example gives an approximation of the
2218 cost of security with SCHC-OSCORE.<a href="#section-7.3-1" class="pilcrow">¶</a></p>
2219 <p id="section-7.3-2">Our first CoAP message is the GET request in <a href="#Fig-GET-temp" class="xref">Figure 8</a>.<a href="#section-7.3-2" class="pilcrow">¶</a></p>
2220 <span id="name-coap-get-request"></span><div id="Fig-GET-temp">
2221 <figure id="figure-8">
2222 <div class="artwork art-text alignLeft" id="section-7.3-3.1">
2223 <pre>
2224 Original message:
2225 =================
2226 0x4101000182bb74656d7065726174757265
2227
2228 Header:
2229 0x4101
2230 01 Ver
2231 00 CON
2232 0001 TKL
2233 00000001 Request Code 1 "GET"
2234
2235 0x0001 = mid
2236 0x82 = token
2237
2238 Options:
2239 0xbb74656d7065726174757265
2240 Option 11: URI_PATH
2241 Value = temperature
2242
2243 Original message length: 17 bytes
2244 </pre>
2245 </div>
2246 <figcaption><a href="#figure-8" class="selfRef">Figure 8</a>:
2247 <a href="#name-coap-get-request" class="selfRef">CoAP GET Request</a>
2248 </figcaption></figure>
2249 </div>
2250 <p id="section-7.3-4">Its corresponding response is the Content response in <a href="#Fig-CONTENT-temp" class="xref">Figure 9</a>.<a href="#section-7.3-4" class="pilcrow">¶</a></p>
2251 <span id="name-coap-content-response"></span><div id="Fig-CONTENT-temp">
2252 <figure id="figure-9">
2253 <div class="artwork art-text alignLeft" id="section-7.3-5.1">
2254 <pre>
2255 Original message:
2256 =================
2257 0x6145000182ff32332043
2258
2259 Header:
2260 0x6145
2261 01 Ver
2262 10 ACK
2263 0001 TKL
2264 01000101 Successful Response Code 69 "2.05 Content"
2265
2266 0x0001 = mid
2267 0x82 = token
2268
2269 0xFF Payload marker
2270 Payload:
2271 0x32332043
2272
2273 Original message length: 10 bytes
2274 </pre>
2275 </div>
2276 <figcaption><a href="#figure-9" class="selfRef">Figure 9</a>:
2277 <a href="#name-coap-content-response" class="selfRef">CoAP Content Response</a>
2278 </figcaption></figure>
2279 </div>
2280 <p id="section-7.3-6">The SCHC Rules for the Inner Compression include all fields already present in a regular CoAP message. The methods described in <a href="#CoAPcomp" class="xref">Section 4</a> apply to these fields. <a href="#Table-Inner-Rules" class="xref">Table 4</a> provides an example.<a href="#section-7.3-6" class="pilcrow">¶</a></p>
2281 <span id="name-inner-schc-rule"></span><div id="Table-Inner-Rules">
2282 <table class="center" id="table-4">
2283 <caption>
2284 <a href="#table-4" class="selfRef">Table 4</a>:
2285 <a href="#name-inner-schc-rule" class="selfRef">Inner SCHC Rule</a>
2286 </caption>
2287 <thead>
2288 <tr>
2289 <th class="text-left" rowspan="1" colspan="8">RuleID 0</th>
2290 </tr>
2291 <tr>
2292 <th class="text-center" rowspan="1" colspan="1">Field</th>
2293 <th class="text-center" rowspan="1" colspan="1">FL</th>
2294 <th class="text-center" rowspan="1" colspan="1">FP</th>
2295 <th class="text-center" rowspan="1" colspan="1">DI</th>
2296 <th class="text-center" rowspan="1" colspan="1">TV</th>
2297 <th class="text-center" rowspan="1" colspan="1">MO</th>
2298 <th class="text-center" rowspan="1" colspan="1">CDA</th>
2299 <th class="text-center" rowspan="1" colspan="1">Sent [bits]</th>
2300 </tr>
2301 </thead>
2302 <tbody>
2303 <tr>
2304 <td class="text-left" rowspan="1" colspan="1">CoAP Code</td>
2305 <td class="text-left" rowspan="1" colspan="1">8</td>
2306 <td class="text-left" rowspan="1" colspan="1">1</td>
2307 <td class="text-left" rowspan="1" colspan="1">Up</td>
2308 <td class="text-left" rowspan="1" colspan="1">1</td>
2309 <td class="text-left" rowspan="1" colspan="1">equal</td>
2310 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2311 <th class="text-left" rowspan="1" colspan="1"></th>
2312 </tr>
2313 <tr>
2314 <td class="text-left" rowspan="1" colspan="1">CoAP Code</td>
2315 <td class="text-left" rowspan="1" colspan="1">8</td>
2316 <td class="text-left" rowspan="1" colspan="1">1</td>
2317 <td class="text-left" rowspan="1" colspan="1">Dw</td>
2318 <td class="text-left" rowspan="1" colspan="1">[69,132]</td>
2319 <td class="text-left" rowspan="1" colspan="1">match-mapping</td>
2320 <td class="text-left" rowspan="1" colspan="1">mapping-sent</td>
2321 <th class="text-left" rowspan="1" colspan="1">c</th>
2322 </tr>
2323 <tr>
2324 <td class="text-left" rowspan="1" colspan="1">CoAP Uri-Path</td>
2325 <td class="text-left" rowspan="1" colspan="1"></td>
2326 <td class="text-left" rowspan="1" colspan="1">1</td>
2327 <td class="text-left" rowspan="1" colspan="1">Up</td>
2328 <td class="text-left" rowspan="1" colspan="1">temperature</td>
2329 <td class="text-left" rowspan="1" colspan="1">equal</td>
2330 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2331 <th class="text-left" rowspan="1" colspan="1"></th>
2332 </tr>
2333 </tbody>
2334 </table>
2335 </div>
2336 <p id="section-7.3-8"><a href="#Fig-Inner-Compression-GET" class="xref">Figure 10</a> shows the Plaintext obtained for the example GET request. The packet follows the process of Inner Compression and encryption until the payload. The Outer OSCORE message adds the result of the Inner process.<a href="#section-7.3-8" class="pilcrow">¶</a></p>
2337 <span id="name-plaintext-compression-and-e"></span><div id="Fig-Inner-Compression-GET">
2338 <figure id="figure-10">
2339 <div class="artwork art-text alignLeft" id="section-7.3-9.1">
2340 <pre>
2341 ________________________________________________________
2342 | |
2343 | OSCORE Plaintext |
2344 | |
2345 | 0x01bb74656d7065726174757265 (13 bytes) |
2346 | |
2347 | 0x01 Request Code GET |
2348 | |
2349 | bb74656d7065726174757265 Option 11: URI_PATH |
2350 | Value = temperature |
2351 |________________________________________________________|
2352
2353 |
2354 |
2355 | Inner SCHC Compression
2356 |
2357 v
2358 _________________________________
2359 | |
2360 | Compressed Plaintext |
2361 | |
2362 | 0x00 |
2363 | |
2364 | RuleID = 0x00 (1 byte) |
2365 | (No Compression Residue) |
2366 |_________________________________|
2367
2368 |
2369 | AEAD Encryption
2370 | (piv = 0x04)
2371 v
2372 _________________________________________________
2373 | |
2374 | encrypted_plaintext = 0xa2 (1 byte) |
2375 | tag = 0xc54fe1b434297b62 (8 bytes) |
2376 | |
2377 | ciphertext = 0xa2c54fe1b434297b62 (9 bytes) |
2378 |_________________________________________________|
2379 </pre>
2380 </div>
2381 <figcaption><a href="#figure-10" class="selfRef">Figure 10</a>:
2382 <a href="#name-plaintext-compression-and-e" class="selfRef">Plaintext Compression and Encryption for GET Request</a>
2383 </figcaption></figure>
2384 </div>
2385 <p id="section-7.3-10">In this case, the original message has no payload, and its resulting Plaintext is compressed up to only 1 byte (the size of the RuleID). The AEAD algorithm preserves this length in its first output and yields a fixed-size tag. SCHC cannot compress the tag, and the OSCORE message must include it without compression.
2386 The use of integrity protection translates into an overhead in total message length, limiting the amount of compression that can be achieved and playing into the cost of adding security to the exchange.<a href="#section-7.3-10" class="pilcrow">¶</a></p>
2387 <p id="section-7.3-11"><a href="#Fig-Inner-Compression-CONTENT" class="xref">Figure 11</a> shows the process for the example Content response. The Compression Residue is 1 bit long.
2388 Note that since SCHC adds padding after the payload, this misalignment causes the hexadecimal code from the payload to differ from the original, even if SCHC cannot compress the tag. The overhead for the tag bytes limits SCHC's performance but brings security to the transmission.<a href="#section-7.3-11" class="pilcrow">¶</a></p>
2389 <span id="name-plaintext-compression-and-en"></span><div id="Fig-Inner-Compression-CONTENT">
2390 <figure id="figure-11">
2391 <div class="artwork art-text alignLeft" id="section-7.3-12.1">
2392 <pre>
2393 ________________________________________________________
2394 | |
2395 | OSCORE Plaintext |
2396 | |
2397 | 0x45ff32332043 (6 bytes) |
2398 | |
2399 | 0x45 Successful Response Code 69 "2.05 Content" |
2400 | |
2401 | ff Payload marker |
2402 | |
2403 | 32332043 Payload |
2404 |________________________________________________________|
2405
2406 |
2407 |
2408 | Inner SCHC Compression
2409 |
2410 v
2411 _________________________________________________
2412 | |
2413 | Compressed Plaintext |
2414 | |
2415 | 0x001919902180 (6 bytes) |
2416 | |
2417 | 00 RuleID |
2418 | |
2419 | 0b0 (1 bit match-mapping Compression Residue) |
2420 | 0x32332043 &gt;&gt; 1 (shifted payload) |
2421 | 0b0000000 Padding |
2422 |_________________________________________________|
2423
2424 |
2425 | AEAD Encryption
2426 | (piv = 0x04)
2427 v
2428 _________________________________________________________
2429 | |
2430 | encrypted_plaintext = 0x10c6d7c26cc1 (6 bytes) |
2431 | tag = 0xe9aef3f2461e0c29 (8 bytes) |
2432 | |
2433 | ciphertext = 0x10c6d7c26cc1e9aef3f2461e0c29 (14 bytes) |
2434 |_________________________________________________________|
2435 </pre>
2436 </div>
2437 <figcaption><a href="#figure-11" class="selfRef">Figure 11</a>:
2438 <a href="#name-plaintext-compression-and-en" class="selfRef">Plaintext Compression and Encryption for Content Response</a>
2439 </figcaption></figure>
2440 </div>
2441 <p id="section-7.3-13">The Outer SCHC Rule (<a href="#Table-Outer-Rule" class="xref">Table 5</a>) must process the OSCORE options fields. Figures <a href="#Fig-Protected-Compressed-GET" class="xref">12</a> and <a href="#Fig-Protected-Compressed-CONTENT" class="xref">13</a> show a dump of the OSCORE messages generated from the example messages. They include the Inner Compressed ciphertext in the payload. These are the messages that have to be compressed via the Outer SCHC Compression scheme.<a href="#section-7.3-13" class="pilcrow">¶</a></p>
2442 <p id="section-7.3-14"><a href="#Table-Outer-Rule" class="xref">Table 5</a> shows a possible set of Outer Rule items to compress the Outer header.<a href="#section-7.3-14" class="pilcrow">¶</a></p>
2443 <span id="name-outer-schc-rule"></span><div id="Table-Outer-Rule">
2444 <table class="center" id="table-5">
2445 <caption>
2446 <a href="#table-5" class="selfRef">Table 5</a>:
2447 <a href="#name-outer-schc-rule" class="selfRef">Outer SCHC Rule</a>
2448 </caption>
2449 <thead>
2450 <tr>
2451 <th class="text-left" rowspan="1" colspan="8">RuleID 0</th>
2452 </tr>
2453 <tr>
2454 <th class="text-center" rowspan="1" colspan="1">Field</th>
2455 <th class="text-center" rowspan="1" colspan="1">FL</th>
2456 <th class="text-center" rowspan="1" colspan="1">FP</th>
2457 <th class="text-center" rowspan="1" colspan="1">DI</th>
2458 <th class="text-center" rowspan="1" colspan="1">TV</th>
2459 <th class="text-center" rowspan="1" colspan="1">MO</th>
2460 <th class="text-center" rowspan="1" colspan="1">CDA</th>
2461 <th class="text-center" rowspan="1" colspan="1">Sent [bits]</th>
2462 </tr>
2463 </thead>
2464 <tbody>
2465 <tr>
2466 <td class="text-left" rowspan="1" colspan="1">CoAP version</td>
2467 <td class="text-left" rowspan="1" colspan="1">2</td>
2468 <td class="text-left" rowspan="1" colspan="1">1</td>
2469 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2470 <td class="text-left" rowspan="1" colspan="1">01</td>
2471 <td class="text-left" rowspan="1" colspan="1">equal</td>
2472 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2473 <th class="text-left" rowspan="1" colspan="1"></th>
2474 </tr>
2475 <tr>
2476 <td class="text-left" rowspan="1" colspan="1">CoAP Type</td>
2477 <td class="text-left" rowspan="1" colspan="1">2</td>
2478 <td class="text-left" rowspan="1" colspan="1">1</td>
2479 <td class="text-left" rowspan="1" colspan="1">Up</td>
2480 <td class="text-left" rowspan="1" colspan="1">0</td>
2481 <td class="text-left" rowspan="1" colspan="1">equal</td>
2482 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2483 <th class="text-left" rowspan="1" colspan="1"></th>
2484 </tr>
2485 <tr>
2486 <td class="text-left" rowspan="1" colspan="1">CoAP Type</td>
2487 <td class="text-left" rowspan="1" colspan="1">2</td>
2488 <td class="text-left" rowspan="1" colspan="1">1</td>
2489 <td class="text-left" rowspan="1" colspan="1">Dw</td>
2490 <td class="text-left" rowspan="1" colspan="1">2</td>
2491 <td class="text-left" rowspan="1" colspan="1">equal</td>
2492 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2493 <th class="text-left" rowspan="1" colspan="1"></th>
2494 </tr>
2495 <tr>
2496 <td class="text-left" rowspan="1" colspan="1">CoAP TKL</td>
2497 <td class="text-left" rowspan="1" colspan="1">4</td>
2498 <td class="text-left" rowspan="1" colspan="1">1</td>
2499 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2500 <td class="text-left" rowspan="1" colspan="1">1</td>
2501 <td class="text-left" rowspan="1" colspan="1">equal</td>
2502 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2503 <th class="text-left" rowspan="1" colspan="1"></th>
2504 </tr>
2505 <tr>
2506 <td class="text-left" rowspan="1" colspan="1">CoAP Code</td>
2507 <td class="text-left" rowspan="1" colspan="1">8</td>
2508 <td class="text-left" rowspan="1" colspan="1">1</td>
2509 <td class="text-left" rowspan="1" colspan="1">Up</td>
2510 <td class="text-left" rowspan="1" colspan="1">2</td>
2511 <td class="text-left" rowspan="1" colspan="1">equal</td>
2512 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2513 <th class="text-left" rowspan="1" colspan="1"></th>
2514 </tr>
2515 <tr>
2516 <td class="text-left" rowspan="1" colspan="1">CoAP Code</td>
2517 <td class="text-left" rowspan="1" colspan="1">8</td>
2518 <td class="text-left" rowspan="1" colspan="1">1</td>
2519 <td class="text-left" rowspan="1" colspan="1">Dw</td>
2520 <td class="text-left" rowspan="1" colspan="1">68</td>
2521 <td class="text-left" rowspan="1" colspan="1">equal</td>
2522 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2523 <th class="text-left" rowspan="1" colspan="1"></th>
2524 </tr>
2525 <tr>
2526 <td class="text-left" rowspan="1" colspan="1">CoAP MID</td>
2527 <td class="text-left" rowspan="1" colspan="1">16</td>
2528 <td class="text-left" rowspan="1" colspan="1">1</td>
2529 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2530 <td class="text-left" rowspan="1" colspan="1">0000</td>
2531 <td class="text-left" rowspan="1" colspan="1">MSB(12)</td>
2532 <td class="text-left" rowspan="1" colspan="1">LSB</td>
2533 <th class="text-left" rowspan="1" colspan="1">MMMM</th>
2534 </tr>
2535 <tr>
2536 <td class="text-left" rowspan="1" colspan="1">CoAP Token</td>
2537 <td class="text-left" rowspan="1" colspan="1">tkl</td>
2538 <td class="text-left" rowspan="1" colspan="1">1</td>
2539 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2540 <td class="text-left" rowspan="1" colspan="1">0x80</td>
2541 <td class="text-left" rowspan="1" colspan="1">MSB(5)</td>
2542 <td class="text-left" rowspan="1" colspan="1">LSB</td>
2543 <th class="text-left" rowspan="1" colspan="1">TTT</th>
2544 </tr>
2545 <tr>
2546 <td class="text-left" rowspan="1" colspan="1">CoAP OSCORE_flags</td>
2547 <td class="text-left" rowspan="1" colspan="1">8</td>
2548 <td class="text-left" rowspan="1" colspan="1">1</td>
2549 <td class="text-left" rowspan="1" colspan="1">Up</td>
2550 <td class="text-left" rowspan="1" colspan="1">0x09</td>
2551 <td class="text-left" rowspan="1" colspan="1">equal</td>
2552 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2553 <th class="text-left" rowspan="1" colspan="1"></th>
2554 </tr>
2555 <tr>
2556 <td class="text-left" rowspan="1" colspan="1">CoAP OSCORE_piv</td>
2557 <td class="text-left" rowspan="1" colspan="1">var</td>
2558 <td class="text-left" rowspan="1" colspan="1">1</td>
2559 <td class="text-left" rowspan="1" colspan="1">Up</td>
2560 <td class="text-left" rowspan="1" colspan="1">0x00</td>
2561 <td class="text-left" rowspan="1" colspan="1">MSB(4)</td>
2562 <td class="text-left" rowspan="1" colspan="1">LSB</td>
2563 <th class="text-left" rowspan="1" colspan="1">PPPP</th>
2564 </tr>
2565 <tr>
2566 <td class="text-left" rowspan="1" colspan="1">CoAP OSCORE_kid</td>
2567 <td class="text-left" rowspan="1" colspan="1">var</td>
2568 <td class="text-left" rowspan="1" colspan="1">1</td>
2569 <td class="text-left" rowspan="1" colspan="1">Up</td>
2570 <td class="text-left" rowspan="1" colspan="1">0x636c69656e70</td>
2571 <td class="text-left" rowspan="1" colspan="1">MSB(52)</td>
2572 <td class="text-left" rowspan="1" colspan="1">LSB</td>
2573 <th class="text-left" rowspan="1" colspan="1">KKKK</th>
2574 </tr>
2575 <tr>
2576 <td class="text-left" rowspan="1" colspan="1">CoAP OSCORE_kidctx</td>
2577 <td class="text-left" rowspan="1" colspan="1">var</td>
2578 <td class="text-left" rowspan="1" colspan="1">1</td>
2579 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2580 <td class="text-left" rowspan="1" colspan="1">b''</td>
2581 <td class="text-left" rowspan="1" colspan="1">equal</td>
2582 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2583 <th class="text-left" rowspan="1" colspan="1"></th>
2584 </tr>
2585 <tr>
2586 <td class="text-left" rowspan="1" colspan="1">CoAP OSCORE_flags</td>
2587 <td class="text-left" rowspan="1" colspan="1">8</td>
2588 <td class="text-left" rowspan="1" colspan="1">1</td>
2589 <td class="text-left" rowspan="1" colspan="1">Dw</td>
2590 <td class="text-left" rowspan="1" colspan="1">b''</td>
2591 <td class="text-left" rowspan="1" colspan="1">equal</td>
2592 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2593 <th class="text-left" rowspan="1" colspan="1"></th>
2594 </tr>
2595 <tr>
2596 <td class="text-left" rowspan="1" colspan="1">CoAP OSCORE_piv</td>
2597 <td class="text-left" rowspan="1" colspan="1">var</td>
2598 <td class="text-left" rowspan="1" colspan="1">1</td>
2599 <td class="text-left" rowspan="1" colspan="1">Dw</td>
2600 <td class="text-left" rowspan="1" colspan="1">b''</td>
2601 <td class="text-left" rowspan="1" colspan="1">equal</td>
2602 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2603 <th class="text-left" rowspan="1" colspan="1"></th>
2604 </tr>
2605 <tr>
2606 <td class="text-left" rowspan="1" colspan="1">CoAP OSCORE_kid</td>
2607 <td class="text-left" rowspan="1" colspan="1">var</td>
2608 <td class="text-left" rowspan="1" colspan="1">1</td>
2609 <td class="text-left" rowspan="1" colspan="1">Dw</td>
2610 <td class="text-left" rowspan="1" colspan="1">b''</td>
2611 <td class="text-left" rowspan="1" colspan="1">equal</td>
2612 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2613 <th class="text-left" rowspan="1" colspan="1"></th>
2614 </tr>
2615 </tbody>
2616 </table>
2617 </div>
2618 <span id="name-protected-and-inner-schc-co"></span><div id="Fig-Protected-Compressed-GET">
2619 <figure id="figure-12">
2620 <div class="artwork art-text alignLeft" id="section-7.3-16.1">
2621 <pre>
2622 Protected message:
2623 ==================
2624 0x4102000182d8080904636c69656e74ffa2c54fe1b434297b62
2625 (25 bytes)
2626
2627 Header:
2628 0x4102
2629 01 Ver
2630 00 CON
2631 0001 TKL
2632 00000010 Request Code 2 "POST"
2633
2634 0x0001 = mid
2635 0x82 = token
2636
2637 Options:
2638 0xd8080904636c69656e74 (10 bytes)
2639 Option 21: OBJECT_SECURITY
2640 Value = 0x0904636c69656e74
2641 09 = 000 0 1 001 flag byte
2642 h k n
2643 04 piv
2644 636c69656e74 kid
2645
2646 0xFF Payload marker
2647 Payload:
2648 0xa2c54fe1b434297b62 (9 bytes)
2649 </pre>
2650 </div>
2651 <figcaption><a href="#figure-12" class="selfRef">Figure 12</a>:
2652 <a href="#name-protected-and-inner-schc-co" class="selfRef">Protected and Inner SCHC Compressed GET Request</a>
2653 </figcaption></figure>
2654 </div>
2655 <span id="name-protected-and-inner-schc-com"></span><div id="Fig-Protected-Compressed-CONTENT">
2656 <figure id="figure-13">
2657 <div class="artwork art-text alignLeft" id="section-7.3-17.1">
2658 <pre>
2659 Protected message:
2660 ==================
2661 0x6144000182d008ff10c6d7c26cc1e9aef3f2461e0c29
2662 (22 bytes)
2663
2664 Header:
2665 0x6144
2666 01 Ver
2667 10 ACK
2668 0001 TKL
2669 01000100 Successful Response Code 68 "2.04 Changed"
2670
2671 0x0001 = mid
2672 0x82 = token
2673
2674 Options:
2675 0xd008 (2 bytes)
2676 Option 21: OBJECT_SECURITY
2677 Value = b''
2678
2679 0xFF Payload marker
2680 Payload:
2681 0x10c6d7c26cc1e9aef3f2461e0c29 (14 bytes)
2682 </pre>
2683 </div>
2684 <figcaption><a href="#figure-13" class="selfRef">Figure 13</a>:
2685 <a href="#name-protected-and-inner-schc-com" class="selfRef">Protected and Inner SCHC Compressed Content Response</a>
2686 </figcaption></figure>
2687 </div>
2688 <p id="section-7.3-18">For the flag bits, some SCHC compression methods are useful, depending on the application. The most straightforward alternative is to
2689 provide a fixed value for the flags, combining a MO of "equal" and a CDA of "not-sent".
2690 This SCHC definition saves most bits but could prevent flexibility. Otherwise, SCHC could use a "match-mapping" MO to choose from several configurations for the exchange. If not, the SCHC description may use an "MSB" MO to mask off the three hard-coded most significant bits.<a href="#section-7.3-18" class="pilcrow">¶</a></p>
2691 <p id="section-7.3-19">Note that fixing a flag bit will limit the choices of CoAP options that can be used in the exchange, since the values of these choices are dependent on specific options.<a href="#section-7.3-19" class="pilcrow">¶</a></p>
2692 <p id="section-7.3-20">The piv field lends itself to having some bits masked off with an "MSB" MO and an "LSB" CDA. This SCHC description could be useful in applications where the message frequency is low, such as LPWAN technologies.
2693 Note that compressing the sequence numbers may reduce the maximum number of sequence numbers that can be used in an exchange.
2694 Once the sequence number exceeds the maximum value, the OSCORE keys need to be re-established.<a href="#section-7.3-20" class="pilcrow">¶</a></p>
2695 <p id="section-7.3-21">The size, s, that is included in the kid context field <span class="bcp14">MAY</span> be masked off with an "LSB" CDA. The rest of the field could have additional bits masked off or have the whole field fixed with a MO of "equal" and a CDA of "not-sent". The same holds for the kid field.<a href="#section-7.3-21" class="pilcrow">¶</a></p>
2696 <p id="section-7.3-22">The Outer Rule of <a href="#Table-Outer-Rule" class="xref">Table 5</a> is applied to the example GET request and Content response.
2697 Figures <a href="#Fig-Compressed-GET" class="xref">14</a> and <a href="#Fig-Compressed-CONTENT" class="xref">15</a> show the resulting messages.<a href="#section-7.3-22" class="pilcrow">¶</a></p>
2698 <span id="name-schc-oscore-compressed-get-"></span><div id="Fig-Compressed-GET">
2699 <figure id="figure-14">
2700 <div class="artwork art-text alignLeft" id="section-7.3-23.1">
2701 <pre>
2702 Compressed message:
2703 ==================
2704 0x001489458a9fc3686852f6c4 (12 bytes)
2705 0x00 RuleID
2706 1489 Compression Residue
2707 458a9fc3686852f6c4 Padded payload
2708
2709 Compression Residue:
2710 0b 0001 010 0100 0100 (15 bits -&gt; 2 bytes with padding)
2711 mid tkn piv kid
2712
2713 Payload
2714 0xa2c54fe1b434297b62 (9 bytes)
2715
2716 Compressed message length: 12 bytes
2717 </pre>
2718 </div>
2719 <figcaption><a href="#figure-14" class="selfRef">Figure 14</a>:
2720 <a href="#name-schc-oscore-compressed-get-" class="selfRef">SCHC-OSCORE Compressed GET Request</a>
2721 </figcaption></figure>
2722 </div>
2723 <span id="name-schc-oscore-compressed-cont"></span><div id="Fig-Compressed-CONTENT">
2724 <figure id="figure-15">
2725 <div class="artwork art-text alignLeft" id="section-7.3-24.1">
2726 <pre>
2727 Compressed message:
2728 ==================
2729 0x0014218daf84d983d35de7e48c3c1852 (16 bytes)
2730 0x00 RuleID
2731 14 Compression Residue
2732 218daf84d983d35de7e48c3c1852 Padded payload
2733 Compression Residue:
2734 0b0001 010 (7 bits -&gt; 1 byte with padding)
2735 mid tkn
2736
2737 Payload
2738 0x10c6d7c26cc1e9aef3f2461e0c29 (14 bytes)
2739
2740 Compressed message length: 16 bytes
2741 </pre>
2742 </div>
2743 <figcaption><a href="#figure-15" class="selfRef">Figure 15</a>:
2744 <a href="#name-schc-oscore-compressed-cont" class="selfRef">SCHC-OSCORE Compressed Content Response</a>
2745 </figcaption></figure>
2746 </div>
2747 <p id="section-7.3-25">In contrast, comparing these results with what would be obtained by SCHC
2748 compressing the original CoAP messages without protecting them with OSCORE is done
2749 by compressing the CoAP messages according to the SCHC Rule in <a href="#Table-NoOsc-Rule" class="xref">Table 6</a>.<a href="#section-7.3-25" class="pilcrow">¶</a></p>
2750 <span id="name-schc-coap-rule-no-oscore"></span><div id="Table-NoOsc-Rule">
2751 <table class="center" id="table-6">
2752 <caption>
2753 <a href="#table-6" class="selfRef">Table 6</a>:
2754 <a href="#name-schc-coap-rule-no-oscore" class="selfRef">SCHC-CoAP Rule (No OSCORE)</a>
2755 </caption>
2756 <thead>
2757 <tr>
2758 <th class="text-left" rowspan="1" colspan="8">RuleID 1</th>
2759 </tr>
2760 <tr>
2761 <th class="text-center" rowspan="1" colspan="1">Field</th>
2762 <th class="text-center" rowspan="1" colspan="1">FL</th>
2763 <th class="text-center" rowspan="1" colspan="1">FP</th>
2764 <th class="text-center" rowspan="1" colspan="1">DI</th>
2765 <th class="text-center" rowspan="1" colspan="1">TV</th>
2766 <th class="text-center" rowspan="1" colspan="1">MO</th>
2767 <th class="text-center" rowspan="1" colspan="1">CDA</th>
2768 <th class="text-center" rowspan="1" colspan="1">Sent [bits]</th>
2769 </tr>
2770 </thead>
2771 <tbody>
2772 <tr>
2773 <td class="text-left" rowspan="1" colspan="1">CoAP version</td>
2774 <td class="text-left" rowspan="1" colspan="1">2</td>
2775 <td class="text-left" rowspan="1" colspan="1">1</td>
2776 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2777 <td class="text-left" rowspan="1" colspan="1">01</td>
2778 <td class="text-left" rowspan="1" colspan="1">equal</td>
2779 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2780 <th class="text-left" rowspan="1" colspan="1"></th>
2781 </tr>
2782 <tr>
2783 <td class="text-left" rowspan="1" colspan="1">CoAP Type</td>
2784 <td class="text-left" rowspan="1" colspan="1">2</td>
2785 <td class="text-left" rowspan="1" colspan="1">1</td>
2786 <td class="text-left" rowspan="1" colspan="1">Up</td>
2787 <td class="text-left" rowspan="1" colspan="1">0</td>
2788 <td class="text-left" rowspan="1" colspan="1">equal</td>
2789 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2790 <th class="text-left" rowspan="1" colspan="1"></th>
2791 </tr>
2792 <tr>
2793 <td class="text-left" rowspan="1" colspan="1">CoAP Type</td>
2794 <td class="text-left" rowspan="1" colspan="1">2</td>
2795 <td class="text-left" rowspan="1" colspan="1">1</td>
2796 <td class="text-left" rowspan="1" colspan="1">Dw</td>
2797 <td class="text-left" rowspan="1" colspan="1">2</td>
2798 <td class="text-left" rowspan="1" colspan="1">equal</td>
2799 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2800 <th class="text-left" rowspan="1" colspan="1"></th>
2801 </tr>
2802 <tr>
2803 <td class="text-left" rowspan="1" colspan="1">CoAP TKL</td>
2804 <td class="text-left" rowspan="1" colspan="1">4</td>
2805 <td class="text-left" rowspan="1" colspan="1">1</td>
2806 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2807 <td class="text-left" rowspan="1" colspan="1">1</td>
2808 <td class="text-left" rowspan="1" colspan="1">equal</td>
2809 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2810 <th class="text-left" rowspan="1" colspan="1"></th>
2811 </tr>
2812 <tr>
2813 <td class="text-left" rowspan="1" colspan="1">CoAP Code</td>
2814 <td class="text-left" rowspan="1" colspan="1">8</td>
2815 <td class="text-left" rowspan="1" colspan="1">1</td>
2816 <td class="text-left" rowspan="1" colspan="1">Up</td>
2817 <td class="text-left" rowspan="1" colspan="1">2</td>
2818 <td class="text-left" rowspan="1" colspan="1">equal</td>
2819 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2820 <th class="text-left" rowspan="1" colspan="1"></th>
2821 </tr>
2822 <tr>
2823 <td class="text-left" rowspan="1" colspan="1">CoAP Code</td>
2824 <td class="text-left" rowspan="1" colspan="1">8</td>
2825 <td class="text-left" rowspan="1" colspan="1">1</td>
2826 <td class="text-left" rowspan="1" colspan="1">Dw</td>
2827 <td class="text-left" rowspan="1" colspan="1">[69,132]</td>
2828 <td class="text-left" rowspan="1" colspan="1">match-mapping</td>
2829 <td class="text-left" rowspan="1" colspan="1">mapping-sent</td>
2830 <th class="text-left" rowspan="1" colspan="1">C</th>
2831 </tr>
2832 <tr>
2833 <td class="text-left" rowspan="1" colspan="1">CoAP MID</td>
2834 <td class="text-left" rowspan="1" colspan="1">16</td>
2835 <td class="text-left" rowspan="1" colspan="1">1</td>
2836 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2837 <td class="text-left" rowspan="1" colspan="1">0000</td>
2838 <td class="text-left" rowspan="1" colspan="1">MSB(12)</td>
2839 <td class="text-left" rowspan="1" colspan="1">LSB</td>
2840 <th class="text-left" rowspan="1" colspan="1">MMMM</th>
2841 </tr>
2842 <tr>
2843 <td class="text-left" rowspan="1" colspan="1">CoAP Token</td>
2844 <td class="text-left" rowspan="1" colspan="1">tkl</td>
2845 <td class="text-left" rowspan="1" colspan="1">1</td>
2846 <td class="text-left" rowspan="1" colspan="1">Bi</td>
2847 <td class="text-left" rowspan="1" colspan="1">0x80</td>
2848 <td class="text-left" rowspan="1" colspan="1">MSB(5)</td>
2849 <td class="text-left" rowspan="1" colspan="1">LSB</td>
2850 <th class="text-left" rowspan="1" colspan="1">TTT</th>
2851 </tr>
2852 <tr>
2853 <td class="text-left" rowspan="1" colspan="1">CoAP Uri-Path</td>
2854 <td class="text-left" rowspan="1" colspan="1"></td>
2855 <td class="text-left" rowspan="1" colspan="1">1</td>
2856 <td class="text-left" rowspan="1" colspan="1">Up</td>
2857 <td class="text-left" rowspan="1" colspan="1">temperature</td>
2858 <td class="text-left" rowspan="1" colspan="1">equal</td>
2859 <td class="text-left" rowspan="1" colspan="1">not-sent</td>
2860 <th class="text-left" rowspan="1" colspan="1"></th>
2861 </tr>
2862 </tbody>
2863 </table>
2864 </div>
2865 <p id="section-7.3-27">The Rule in <a href="#Table-NoOsc-Rule" class="xref">Table 6</a> yields the SCHC compression results as shown in <a href="#Fig-GET-temp-no-oscore" class="xref">Figure 16</a> for the request and
2866 <a href="#Fig-CONTENT-temp-no-oscore" class="xref">Figure 17</a> for the response.<a href="#section-7.3-27" class="pilcrow">¶</a></p>
2867 <span id="name-coap-get-compressed-without"></span><div id="Fig-GET-temp-no-oscore">
2868 <figure id="figure-16">
2869 <div class="artwork art-text alignLeft" id="section-7.3-28.1">
2870 <pre>
2871 Compressed message:
2872 ==================
2873 0x0114
2874 0x01 = RuleID
2875
2876 Compression Residue:
2877 0b00010100 (1 byte)
2878
2879 Compressed message length: 2 bytes
2880 </pre>
2881 </div>
2882 <figcaption><a href="#figure-16" class="selfRef">Figure 16</a>:
2883 <a href="#name-coap-get-compressed-without" class="selfRef">CoAP GET Compressed without OSCORE</a>
2884 </figcaption></figure>
2885 </div>
2886 <span id="name-coap-content-compressed-wit"></span><div id="Fig-CONTENT-temp-no-oscore">
2887 <figure id="figure-17">
2888 <div class="artwork art-text alignLeft" id="section-7.3-29.1">
2889 <pre>
2890 Compressed message:
2891 ==================
2892 0x010a32332043
2893 0x01 = RuleID
2894
2895 Compression Residue:
2896 0b00001010 (1 byte)
2897
2898 Payload
2899 0x32332043
2900
2901 Compressed message length: 6 bytes
2902 </pre>
2903 </div>
2904 <figcaption><a href="#figure-17" class="selfRef">Figure 17</a>:
2905 <a href="#name-coap-content-compressed-wit" class="selfRef">CoAP Content Compressed without OSCORE</a>
2906 </figcaption></figure>
2907 </div>
2908 <p id="section-7.3-30">As can be seen, the difference between applying SCHC + OSCORE as compared to
2909 regular SCHC + CoAP is about 10 bytes.<a href="#section-7.3-30" class="pilcrow">¶</a></p>
2910 </section>
2911 </div>
2912 </section>
2913 </div>
2914 <div id="iana-considerations">
2915 <section id="section-8">
2916 <h2 id="name-iana-considerations">
2917 <a href="#section-8" class="section-number selfRef">8. </a><a href="#name-iana-considerations" class="section-name selfRef">IANA Considerations</a>
2918 </h2>
2919 <p id="section-8-1">This document has no IANA actions.<a href="#section-8-1" class="pilcrow">¶</a></p>
2920 </section>
2921 </div>
2922 <div id="SecConsiderations">
2923 <section id="section-9">
2924 <h2 id="name-security-considerations">
2925 <a href="#section-9" class="section-number selfRef">9. </a><a href="#name-security-considerations" class="section-name selfRef">Security Considerations</a>
2926 </h2>
2927 <p id="section-9-1">The use of SCHC header compression for CoAP header fields only affects
2928 the representation of the header information. SCHC header compression
2929 itself does not increase or decrease the overall level of security of
2930 the communication. When the connection does not use a security protocol
2931 (OSCORE, DTLS, etc.), it is necessary to use a Layer 2
2932 security mechanism to protect the SCHC messages.<a href="#section-9-1" class="pilcrow">¶</a></p>
2933 <p id="section-9-2">If an LPWAN is the Layer 2 technology being used, the SCHC security considerations
2934 discussed in <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span> continue to apply. When using another Layer 2 protocol, the
2935 use of a cryptographic integrity-protection mechanism to protect the
2936 SCHC headers is <span class="bcp14">REQUIRED</span>. Such cryptographic integrity protection is
2937 necessary in order to continue to provide the properties that <span>[<a href="#RFC8724" class="xref">RFC8724</a>]</span>
2938 relies upon.<a href="#section-9-2" class="pilcrow">¶</a></p>
2939 <p id="section-9-3">When SCHC is used with OSCORE, the security considerations discussed in <span>[<a href="#RFC8613" class="xref">RFC8613</a>]</span>
2940 continue to apply.<a href="#section-9-3" class="pilcrow">¶</a></p>
2941 <p id="section-9-4">When SCHC is used with the OSCORE Outer headers, the Initialization
2942 Vector (IV) size in the Compression Residue must be carefully selected.
2943 There is a trade-off between compression efficiency (with a longer "MSB"
2944 MO prefix) and the frequency at which the Device must renew its key
2945 material (in order to prevent the IV from expanding to an uncompressible
2946 value). The key-renewal operation itself requires several message
2947 exchanges and requires energy-intensive computation, but the optimal
2948 trade-off will depend on the specifics of the Device and expected usage
2949 patterns.<a href="#section-9-4" class="pilcrow">¶</a></p>
2950 <p id="section-9-5">If an attacker can introduce a corrupted SCHC-compressed packet onto a
2951 link, DoS attacks can be mounted by causing excessive resource consumption
2952 at the decompressor. However, an attacker able to inject packets at the
2953 link layer is also capable of other, potentially more damaging, attacks.<a href="#section-9-5" class="pilcrow">¶</a></p>
2954 <p id="section-9-6">SCHC compression emits variable-length Compression Residues for some
2955 CoAP fields. In the representation of the compressed header, the length field
2956 that is sent is not the length of the original header field but rather
2957 the length of the Compression Residue that is being transmitted. If a
2958 corrupted packet arrives at the decompressor with a longer or shorter
2959 length than the original compressed representation possessed, the SCHC
2960 decompression procedures will detect an error and drop the packet.<a href="#section-9-6" class="pilcrow">¶</a></p>
2961 <p id="section-9-7">SCHC header compression Rules <span class="bcp14">MUST</span> remain tightly coupled between the
2962 compressor and the decompressor. If the compression Rules get out of sync,
2963 a Compression Residue might be decompressed differently at the receiver
2964 than the initial message submitted to compression procedures.
2965 Accordingly, any time the context Rules are updated on an OSCORE
2966 endpoint, that endpoint <span class="bcp14">MUST</span> trigger OSCORE key re-establishment.
2967 Similar procedures may be appropriate to signal Rule updates when other
2968 message-protection mechanisms are in use.<a href="#section-9-7" class="pilcrow">¶</a></p>
2969 </section>
2970 </div>
2971 <section id="section-10">
2972 <h2 id="name-normative-references">
2973 <a href="#section-10" class="section-number selfRef">10. </a><a href="#name-normative-references" class="section-name selfRef">Normative References</a>
2974 </h2>
2975 <dl class="references">
2976 <dt id="RFC2119">[RFC2119]</dt>
2977 <dd>
2978 <span class="refAuthor">Bradner, S.</span>, <span class="refTitle">"Key words for use in RFCs to Indicate Requirement Levels"</span>, <span class="seriesInfo">BCP 14</span>, <span class="seriesInfo">RFC 2119</span>, <span class="seriesInfo">DOI 10.17487/RFC2119</span>, <time datetime="1997-03" class="refDate">March 1997</time>, <span>&lt;<a href="https://www.rfc-editor.org/info/rfc2119">https://www.rfc-editor.org/info/rfc2119</a>&gt;</span>. </dd>
2979 <dd class="break"></dd>
2980 <dt id="RFC5116">[RFC5116]</dt>
2981 <dd>
2982 <span class="refAuthor">McGrew, D.</span>, <span class="refTitle">"An Interface and Algorithms for Authenticated Encryption"</span>, <span class="seriesInfo">RFC 5116</span>, <span class="seriesInfo">DOI 10.17487/RFC5116</span>, <time datetime="2008-01" class="refDate">January 2008</time>, <span>&lt;<a href="https://www.rfc-editor.org/info/rfc5116">https://www.rfc-editor.org/info/rfc5116</a>&gt;</span>. </dd>
2983 <dd class="break"></dd>
2984 <dt id="RFC7252">[RFC7252]</dt>
2985 <dd>
2986 <span class="refAuthor">Shelby, Z.</span>, <span class="refAuthor">Hartke, K.</span>, and <span class="refAuthor">C. Bormann</span>, <span class="refTitle">"The Constrained Application Protocol (CoAP)"</span>, <span class="seriesInfo">RFC 7252</span>, <span class="seriesInfo">DOI 10.17487/RFC7252</span>, <time datetime="2014-06" class="refDate">June 2014</time>, <span>&lt;<a href="https://www.rfc-editor.org/info/rfc7252">https://www.rfc-editor.org/info/rfc7252</a>&gt;</span>. </dd>
2987 <dd class="break"></dd>
2988 <dt id="RFC7641">[RFC7641]</dt>
2989 <dd>
2990 <span class="refAuthor">Hartke, K.</span>, <span class="refTitle">"Observing Resources in the Constrained Application Protocol (CoAP)"</span>, <span class="seriesInfo">RFC 7641</span>, <span class="seriesInfo">DOI 10.17487/RFC7641</span>, <time datetime="2015-09" class="refDate">September 2015</time>, <span>&lt;<a href="https://www.rfc-editor.org/info/rfc7641">https://www.rfc-editor.org/info/rfc7641</a>&gt;</span>. </dd>
2991 <dd class="break"></dd>
2992 <dt id="RFC7959">[RFC7959]</dt>
2993 <dd>
2994 <span class="refAuthor">Bormann, C.</span> and <span class="refAuthor">Z. Shelby, Ed.</span>, <span class="refTitle">"Block-Wise Transfers in the Constrained Application Protocol (CoAP)"</span>, <span class="seriesInfo">RFC 7959</span>, <span class="seriesInfo">DOI 10.17487/RFC7959</span>, <time datetime="2016-08" class="refDate">August 2016</time>, <span>&lt;<a href="https://www.rfc-editor.org/info/rfc7959">https://www.rfc-editor.org/info/rfc7959</a>&gt;</span>. </dd>
2995 <dd class="break"></dd>
2996 <dt id="RFC7967">[RFC7967]</dt>
2997 <dd>
2998 <span class="refAuthor">Bhattacharyya, A.</span>, <span class="refAuthor">Bandyopadhyay, S.</span>, <span class="refAuthor">Pal, A.</span>, and <span class="refAuthor">T. Bose</span>, <span class="refTitle">"Constrained Application Protocol (CoAP) Option for No Server Response"</span>, <span class="seriesInfo">RFC 7967</span>, <span class="seriesInfo">DOI 10.17487/RFC7967</span>, <time datetime="2016-08" class="refDate">August 2016</time>, <span>&lt;<a href="https://www.rfc-editor.org/info/rfc7967">https://www.rfc-editor.org/info/rfc7967</a>&gt;</span>. </dd>
2999 <dd class="break"></dd>
3000 <dt id="RFC8174">[RFC8174]</dt>
3001 <dd>
3002 <span class="refAuthor">Leiba, B.</span>, <span class="refTitle">"Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"</span>, <span class="seriesInfo">BCP 14</span>, <span class="seriesInfo">RFC 8174</span>, <span class="seriesInfo">DOI 10.17487/RFC8174</span>, <time datetime="2017-05" class="refDate">May 2017</time>, <span>&lt;<a href="https://www.rfc-editor.org/info/rfc8174">https://www.rfc-editor.org/info/rfc8174</a>&gt;</span>. </dd>
3003 <dd class="break"></dd>
3004 <dt id="RFC8613">[RFC8613]</dt>
3005 <dd>
3006 <span class="refAuthor">Selander, G.</span>, <span class="refAuthor">Mattsson, J.</span>, <span class="refAuthor">Palombini, F.</span>, and <span class="refAuthor">L. Seitz</span>, <span class="refTitle">"Object Security for Constrained RESTful Environments (OSCORE)"</span>, <span class="seriesInfo">RFC 8613</span>, <span class="seriesInfo">DOI 10.17487/RFC8613</span>, <time datetime="2019-07" class="refDate">July 2019</time>, <span>&lt;<a href="https://www.rfc-editor.org/info/rfc8613">https://www.rfc-editor.org/info/rfc8613</a>&gt;</span>. </dd>
3007 <dd class="break"></dd>
3008 <dt id="RFC8724">[RFC8724]</dt>
3009 <dd>
3010 <span class="refAuthor">Minaburo, A.</span>, <span class="refAuthor">Toutain, L.</span>, <span class="refAuthor">Gomez, C.</span>, <span class="refAuthor">Barthel, D.</span>, and <span class="refAuthor">JC. Zúñiga</span>, <span class="refTitle">"SCHC: Generic Framework for Static Context Header Compression and Fragmentation"</span>, <span class="seriesInfo">RFC 8724</span>, <span class="seriesInfo">DOI 10.17487/RFC8724</span>, <time datetime="2020-04" class="refDate">April 2020</time>, <span>&lt;<a href="https://www.rfc-editor.org/info/rfc8724">https://www.rfc-editor.org/info/rfc8724</a>&gt;</span>. </dd>
3011 <dd class="break"></dd>
3012 </dl>
3013 </section>
3014 <div id="acknowledgements">
3015 <section id="appendix-A">
3016 <h2 id="name-acknowledgements">
3017 <a href="#name-acknowledgements" class="section-name selfRef">Acknowledgements</a>
3018 </h2>
3019 <p id="appendix-A-1">The authors would like to thank (in alphabetic order):
3020 <span class="contact-name">Christian Amsuss</span>, <span class="contact-name">Dominique Barthel</span>, <span class="contact-name">Carsten Bormann</span>, <span class="contact-name">Theresa Enghardt</span>,
3021 <span class="contact-name">Thomas Fossati</span>, <span class="contact-name">Klaus Hartke</span>, <span class="contact-name">Benjamin Kaduk</span>, <span class="contact-name">Francesca Palombini</span>, <span class="contact-name">Alexander Pelov</span>, <span class="contact-name">Göran Selander</span>, and
3022 <span class="contact-name">Éric Vyncke</span>.<a href="#appendix-A-1" class="pilcrow">¶</a></p>
3023 </section>
3024 </div>
3025 <div id="authors-addresses">
3026 <section id="appendix-B">
3027 <h2 id="name-authors-addresses">
3028 <a href="#name-authors-addresses" class="section-name selfRef">Authors' Addresses</a>
3029 </h2>
3030 <address class="vcard">
3031 <div dir="auto" class="left"><span class="fn nameRole">Ana Minaburo</span></div>
3032 <div dir="auto" class="left"><span class="org">Acklio</span></div>
3033 <div dir="auto" class="left"><span class="street-address">1137A avenue des Champs Blancs</span></div>
3034 <div dir="auto" class="left">
3035 <span class="postal-code">35510</span> <span class="locality">Cesson-Sevigne Cedex</span>
3036 </div>
3037 <div dir="auto" class="left"><span class="country-name">France</span></div>
3038 <div class="email">
3039 <span>Email:</span>
3040 <a href="mailto:[email protected]" class="email">[email protected]</a>
3041 </div>
3042 </address>
3043 <address class="vcard">
3044 <div dir="auto" class="left"><span class="fn nameRole">Laurent Toutain</span></div>
3045 <div dir="auto" class="left"><span class="org">Institut MINES TELECOM; IMT Atlantique</span></div>
3046 <div dir="auto" class="left"><span class="extended-address">CS 17607</span></div>
3047 <div dir="auto" class="left"><span class="street-address">2 rue de la Chataigneraie</span></div>
3048 <div dir="auto" class="left">
3049 <span class="postal-code">35576</span> <span class="locality">Cesson-Sevigne Cedex</span>
3050 </div>
3051 <div dir="auto" class="left"><span class="country-name">France</span></div>
3052 <div class="email">
3053 <span>Email:</span>
3054 <a href="mailto:[email protected]" class="email">[email protected]</a>
3055 </div>
3056 </address>
3057 <address class="vcard">
3058 <div dir="auto" class="left"><span class="fn nameRole">Ricardo Andreasen</span></div>
3059 <div dir="auto" class="left"><span class="org">Universidad de Buenos Aires</span></div>
3060 <div dir="auto" class="left"><span class="street-address">Av. Paseo Colon 850</span></div>
3061 <div dir="auto" class="left">
3062 <span class="postal-code">C1063ACV</span> <span class="locality">Ciudad Autonoma de Buenos Aires</span>
3063 </div>
3064 <div dir="auto" class="left"><span class="country-name">Argentina</span></div>
3065 <div class="email">
3066 <span>Email:</span>
3067 <a href="mailto:[email protected]" class="email">[email protected]</a>
3068 </div>
3069 </address>
3070 </section>
3071 </div>
3072 <script>const toc = document.getElementById("toc");
3073 toc.querySelector("h2").addEventListener("click", e => {
3074 toc.classList.toggle("active");
3075 });
3076 toc.querySelector("nav").addEventListener("click", e => {
3077 toc.classList.remove("active");
3078 });
3079 </script>
3080 </body>
3081 </html>