rfc-8824

Static Context Header Compression (SCHC) for the Constrained Application Protocol (CoAP)

A. Minaburo, L. Toutain, R. Andreasen
date2021-06 streamIETF areaint wglpwan statusPROPOSED STANDARD pages30 canonicalhttps://www.rfc-editor.org/rfc/rfc8824 doi10.17487/RFC8824 errataview
This document defines how to compress Constrained Application Protocol (CoAP) headers using the Static Context Header Compression and fragmentation (SCHC) framework. SCHC defines a header compression mechanism adapted for Constrained Devices. SCHC uses a static description of the header to reduce the header's redundancy and size. While RFC 8724 describes the SCHC compression and fragmentation framework, and its application for IPv6/UDP headers, this document applies SCHC to CoAP headers. The CoAP header structure differs from 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. This specification gives guidance on applying SCHC to flexible headers and how to leverage the asymmetry for more efficient compression Rules.

Extracted elements (29)

design-rationale §5.3.1

Because SCHC fixes the number of Uri-Path/Uri-Query elements at Rule creation time, variable-length paths are handled by either creating multiple Rules for each possible element count or by using a zero-length Compression Residue entry to signal an absent Uri-Path element, at a cost of 4 additional bits per empty entry.

design-rationale §3.1

CoAP's asymmetric message format—where requests and responses carry different options (e.g., Uri-Path in requests only, Content-Format in responses only)—required introducing the Direction Indicator (DI) in SCHC Field Descriptors, allowing a single Rule to process upstream and downstream headers differently rather than requiring separate Rules per direction.

design-rationale §3.1

CoAP's repeatable options (e.g., Uri-Path) can appear multiple times in a single header. SCHC uses the Field Position (FP) to identify each instance within a Rule, removing the ambiguity that would otherwise exist in the Matching Operator evaluation.

design-rationale §7.2

OSCORE compression is split into Inner and Outer stages to compress all fields of the original CoAP message while preserving end-to-end encryption. Inner compression reduces the plaintext before encryption; Outer compression reduces the OSCORE envelope including ciphertext as opaque payload, enabling proxy operation without decryption.

security, crypto

design-rationale §3.1

Unlike IPv6/UDP where all fields are fixed-length, CoAP headers include variable-length fields such as Token (0–8 bytes) and options using TLV encoding. SCHC handles this by allowing Field Length to be specified as a variable in the Rule, with the compressed field's length then carried in the Compression Residue.

interoperability-note §6.1

CoAP Block-level fragmentation (RFC 7959) and SCHC fragmentation are complementary mechanisms; a node may use both for the same packet as needed, and Block option content must always be sent as a Compression Residue.

interoperability-note §2

SCHC compression for CoAP MAY be performed independently of lower-layer (IPv6/UDP) SCHC compression, or in conjunction with it. The two compression techniques are independent and follow the same SCHC principles defined in RFC 8724.

normative-requirement §9 MUST

Any time the context Rules are updated on an OSCORE endpoint, that endpoint MUST trigger OSCORE key re-establishment to prevent mismatched decompression of protected messages.

security, crypto

normative-requirement §5.5 MUST

For ETag, If-Match, If-None-Match, Location-Path, and Location-Query options, the Rule description MUST always send these values in the Compression Residue; a Rule entry cannot store these fields' values.

normative-requirement §4.5 MUST

For the Token Value field, the Rule MUST use the specific function 'tkl' to complete the Field Descriptor. During decompression, this function returns the value contained in the Token Length field.

normative-requirement §5 MUST

If CoAP introduces a new option, the new FID description MUST be assigned to allow its compression; otherwise SCHC sends the CoAP header without compression.

normative-requirement §4.2 SHOULD

SCHC compression SHOULD elide the CoAP Type field if a client is sending only Non-confirmable or only Confirmable messages. For RST messages, SCHC may use a dedicated Rule.

normative-requirement §9 MUST

SCHC header compression Rules MUST remain tightly coupled between the compressor and the decompressor. If Rules get out of sync, a Compression Residue might be decompressed differently than the original message submitted to compression.

security

normative-requirement §4.5 MUST NOT

SCHC MUST NOT send the Token Value as variable-length data in the Compression Residue, to avoid ambiguity with the Token Length field. Instead, SCHC MUST use the Token Length value to define the size of the Compression Residue for the Token Value.

normative-requirement §5.3 MUST

SCHC MUST set the Field Length for Uri-Path and Uri-Query options to a variable value, regardless of whether the length is known when the Rule is defined. The Compression Residue size is expressed in bytes.

normative-requirement §4.1 MUST

The CoAP Version field is bidirectional and MUST be elided during SCHC compression, since it always contains the same value. If a new CoAP version is defined, new Rules will be needed.

normative-requirement §6.1 MUST

When a packet uses a Block option, SCHC compression MUST send its content in the Compression Residue. The SCHC Rule describes an empty TV with MO set to 'ignore' and CDA set to 'value-sent'.

normative-requirement §3 MUST

When the SCHC compressor does not find a matching Rule to compress a CoAP header, the packet MUST be sent uncompressed using the RuleID dedicated to that purpose, with the Compression Residue being the complete header of the packet.

realtime, rtp

normative-requirement §9 REQUIRED

When using a Layer 2 protocol other than LPWAN, the use of a cryptographic integrity-protection mechanism to protect SCHC headers is REQUIRED, in order to continue to provide the properties that RFC 8724 relies upon.

security, crypto

protocol-element §7.2

For OSCORE-protected messages, SCHC applies compression in two independent stages: Inner SCHC compression is applied to the OSCORE Plaintext before encryption, and Outer SCHC compression is applied to the resulting OSCORE message (including ciphertext as payload) after encryption.

security, crypto

protocol-element §6.4

The OSCORE option is split by SCHC into four distinct Field Descriptors for compression: CoAP OSCORE_flags (the flag byte), CoAP OSCORE_piv (Partial Initialization Vector), CoAP OSCORE_kidctx (kid context, including size octet s), and CoAP OSCORE_kid (the key identifier).

security, crypto

protocol-element §4.5

The 'tkl' function is a designated SCHC function used in the Field Descriptor for the Token Value. At decompression time it returns the value from the Token Length field, resolving the size of the Token Value Compression Residue without ambiguity.

protocol-element §2

Three deployment architectures are defined: (1) SCHC at the LPWAN boundary compressing the full IPv6/UDP/CoAP stack at the NGW; (2) end-to-end standalone CoAP SCHC compression with DTLS protection; (3) two-level OSCORE compression with separate Inner and Outer SCHC Rules and contexts.

security

protocol-element §5.3

Variable-length CoAP options (e.g., Uri-Path, Uri-Query) use SCHC's Field Position (FP) to distinguish multiple instances of the same option in a single header, and may be grouped in a 'match-mapping' MO for more efficient compression.

security-consideration §9

An attacker able to inject corrupted SCHC-compressed packets can mount DoS attacks by causing excessive resource consumption at the decompressor. If a corrupted packet arrives with an incorrect length, SCHC decompression procedures detect the error and drop the packet.

security

security-consideration §9

SCHC header compression for CoAP does not increase or decrease the overall security level of the communication. When no higher-level security protocol (OSCORE, DTLS, etc.) is used, a Layer 2 security mechanism must protect the SCHC messages.

security

security-consideration §9

When compressing OSCORE Outer headers, the Initialization Vector (IV) size in the Compression Residue involves a trade-off: a longer MSB prefix improves compression efficiency but reduces the key lifetime, as the Device must re-establish keys before the IV grows beyond the compressed range.

security, crypto

wire-format §5

CoAP options use Delta-Type (D-T), Length (L), Value (V) encoding. In SCHC Rules, the option number is derived from the D-T field and placed in the FID, the option value goes in the TV, and option length handling follows RFC 8724 Sections 7.4.1 and 7.4.2. Length coding differs between CoAP options and SCHC variable-size Compression Residue.

wire-format §6.4

The OSCORE option value begins with a 1-byte flag field (bits: 000|h|k|nnn) where h indicates kid context presence, k indicates kid presence, and n (3 bits) encodes the length of the piv field. This is followed by piv (n bytes), a 1-byte length s and kid context (if h=1), and kid (if k=1).

security, crypto