Notice of Use and Disclosure
Copyright © Connectivity Standards Alliance (2021). All rights reserved. This information within this document is the property of the Connectivity Standards Alliance and its use and disclosure are restricted.
Elements of Connectivity Standards Alliance specifications may be subject to third party intellectual property rights, including without limitation, patent, copyright or trademark rights (such a third party may or may not be a member of the Connectivity Standards Alliance). The Connectivity Standards Alliance is not responsible and shall not be held responsible in any manner for identifying or failing to identify any or all such third party intellectual property rights.
This document and the information contained herein are provided on an "AS IS" basis and the Connectivity Standards Alliance DISCLAIMS ALL WARRANTIES EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO (A) ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OF THIRD PARTIES (INCLUDING WITHOUT LIMITATION ANY INTELLECTUAL PROPERTY RIGHTS INCLUDING PATENT, COPYRIGHT OR TRADEMARK RIGHTS) OR (B) ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT. IN NO EVENT WILL THE CONNECTIVITY STANDARDS ALLIANCE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF BUSINESS, LOSS OF USE OF DATA, INTERRUPTION OF BUSINESS, OR FOR ANY OTHER DIRECT, INDIRECT, SPECIAL OR EXEMPLARY, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL DAMAGES OF ANY KIND, IN CONTRACT OR IN TORT, IN CONNECTION WITH THIS DOCUMENT OR THE INFORMATION CONTAINED HEREIN, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
All company, brand and product names may be trademarks that are the sole property of their respective owners.
This legal notice must be included on all copies of this document that are made.
Connectivity Standards Alliance
508 Second Street, Suite 206
Davis, CA 95616, USA
Participants
Agrawal, Amit |
Alexander, Rob |
Ananthakrishnan, Krithika |
Axelsson, Ulf |
Azria, Shana |
Bak, Naama |
Balducci, Alex |
Bao, Yongming |
Bartolome, Diego |
Bauer-Schwan, Stefan |
Beach, Chris |
Becker, Markus |
Ben, Thomas |
Bhetanabottla, Sriram |
Bonnell, Corey |
C, Rajashree |
Carlin, Broderick |
Carmel-Veilleux, Tennessee |
Casallas, Ricardo |
Chalmers, Andrew |
Chan, Osborn |
Chandarana, Janak |
Cheshire, Stuart |
Chudinov, Adrian |
Chupp, Anton |
Coppock, Kevin |
Cowan, Michael |
Cragie, Robert |
Crettenand, Alexander |
Cuyckens, Thomas |
Damle, Makarand |
Darling, Don |
Decenzo, Chris |
Dhayagude, Hrishikesh |
Ding, Li-An |
Dok, Hrishikesh |
Dolan, David |
Dong, Kangping |
Duda, Łukasz |
Dyck, Nathan |
Erickson, Grant |
Feraru, Eugen |
Freeman, Cecille |
Fu, Kenneth |
Fyall, Ian |
Garbus, Mathias Kielgast |
Garg, Pankaj |
Gucea, Doru |
Guiheneuf, Robin-Charles |
Guo, Jiacheng |
Guo, Song |
Haefner, Kyle |
Hamilton, Ryan |
Hanna, John |
Hanna, Steve |
Haque, Asad |
Harris, Will |
Heide, Janus |
Hernandez-Palomares, Martin |
Hoang, Minhhoa |
Holbrook, Trevor |
Hollebeek, Tim |
Houtepen, Rob |
Hui, Jonathan |
Hui, Li |
Jain, Amit |
Jain, Ankur |
Jandhyala, Chaitanya |
Jayakumar, Liju |
Johns, Jerry |
Josefsen, René |
KY, Suma |
Kardous, Mathieu |
Kasperczyk, Kamil |
Katira, Utsav |
Knörzer, Clemens |
Kohr, John |
Kommareddi, Naveen |
Kontra, Andrew |
Kovacic, Lazar |
Krawetz, Bryan |
Królik, Damian |
Kumar, Sandeep |
Kumar, Saurabh |
Lazar, Alin |
Le Tutour, Jean |
Lee, Byungjoo |
Lepage, Marc |
Liang, Deng |
Lindeman, Ryan |
Litvin, Andrei |
Lyu, Rashid |
Maes, Timothy |
Mamo, Fesseha |
Manley, Tom |
Mann, Bryan |
Mansour, Peter |
Margolis, Evgeni |
Martinez, Junior |
Matignon, Florent |
Matosian, Dan |
Melo, Sara |
Menzopol, Andrei |
Moneta, Daniel |
Montenegro, Gabriel |
Morales, Victor |
Morozov, Evgeniy |
Mégevand, Jonathan |
Nadathur, Anush |
Nicolas, Vivien |
Nuyts, Wim |
P, Aswathy |
Pan, Liam |
Pan, Shaofeng |
Parausanu, Dragos |
Patil, Shubham |
Penven, Jean-Francois |
Po, Kevin |
Powell, Ken |
Pyasi, Madhur |
Rempel, David |
Rhees, Jon |
Rosenberg, Aron |
Rozendaal, Leo |
Rupp, Michael |
S, Sowmya |
Sallas, Sal |
Sambles, Philip |
Sandstedt, Michael |
Sarma, Bhaskar |
Schiller, Bill |
Schoinas, Yannis |
Segal, Oren |
Sena, Joe |
She, Chengqiang |
Shreve, Erik |
Smirl, Jon |
Smith, Bill |
Smith, David |
Smith, Matt |
Soloway, Alan |
Son, Jae |
Szablowski, Michał |
Szatmary-Ban, Zoltan |
Szczodrak, Marcin |
Szewczyk, Robert |
Trayer, Mark |
Turon, Martin |
Vauclair, Marc |
Verma, Lochan |
Wang, David |
Wang, Yufeng |
Wang, Yunhan |
Wei, Qingyun |
Weil, Jason |
Weinshel, Ben |
Weir, Tristan |
Williams, Cam |
Wood, Justin |
Xu, Yakun |
Yang, Carol |
Zbarsky, Boris |
Zgrablic, Leonard |
Zang, Mingjie |
Zhang, Xili |
Zhao, Betty |
Zhao, Ru |
Zhodzishsky, Victor |
Document Control
The Matter specification is made of individual chapters such as this one. See Chapter 1 for the list of all chapters. References between chapters are made using a X.Y notation where X is the chapter and Y is the sub-section within that chapter. References to external documents are contained in Chapter 1 and are made using [Rn] notation. An update to any of these chapters will be reflected in an update to the source document list below.
Chapter 01 — Introduction |
|
Chapter 02 — Architecture |
|
Chapter 03 — Cryptographic Primitives |
|
Chapter 04 — Secure Channel |
|
Chapter 05 — Commissioning |
|
Chapter 06 — Device Attestation |
|
Chapter 07 — Data Model |
|
Chapter 08 — Interaction Model |
|
Chapter 09 — System Model |
|
Chapter 10 — Interaction Encoding |
|
Chapter 11 — Device Management |
|
Chapter 12 — Multiple Fabrics |
|
Chapter 13 — Security Requirements |
1. Introduction
The Matter specification defines fundamental requirements to enable an interoperable application layer solution for smart home devices over the Internet Protocol.
1.1. Scope and Purpose
This specification details everything necessary to implement an application and transport layer stack. It is intended to be used by implementers as a complete specification but where necessary other references are noted with details on how these references apply to this specification.
In case of discrepancies between this specification and the SDK, this specification SHALL take precedence.
1.2. Acronyms and Abbreviations
Acronym | Definition |
---|---|
ACL |
Access Control List |
AGID |
Application Group Identifier |
AEAD |
Authenticated Encryption with Associated Data |
AES |
Advanced Encryption Standard (from FIPS 197) |
AP |
Access Point |
API |
Application Programming Interface |
ASN.1 |
Abstract Syntax Notation 1 (from ITU ASN.1) |
BLE |
Bluetooth Low Energy |
BDX |
Bulk Data Exchange |
BTP |
Bluetooth Transport Protocol |
CA |
Certificate Authority (also known as Certification Authority) |
CASE |
Certificate Authenticated Session Establishment |
CAT |
CASE Authenticated Tag |
CBC-MAC |
Cipher Block Chaining Message Authentication Code |
CCM |
Counter mode of encryption with CBC-MAC (AEAD mode) (from NIST 800-38C) |
CD |
Certification Declaration |
CMS |
Cryptographic Message Syntax |
CN |
Common Name (from X.520) |
CSR |
Certificate Signing Request |
CTR |
Counter Mode (AES block cipher mode) (from NIST 800-38A) |
DAC |
Device Attestation Certificate |
DER |
Distinguished Encoding Rule (from X.690) |
DN |
Distinguished Name (from X.520) |
DNS |
Domain Name System |
DNS-SD |
DNS Based Service Discovery (from RFC 6763) |
DRBG |
Deterministic Random Bit Generator (from NIST 800-90A) |
ECC |
Elliptic Curve Cryptography (from SEC 1) (also "Error Correction Code") |
ECDHE |
Elliptic Curve Ephemeral Diffie-Hellman (from SEC 1) |
ECDSA |
Elliptic Curve Digital Signature Algorithm (from SEC 1) |
EUI |
Extended Unique Identifier |
EUI-64 |
64-bit EUI |
GATT |
Bluetooth Generic Attribute Profile |
GID |
Group Identifier (also referred to as "Group ID") |
GKH |
Group Key Hash |
GUA |
Global Unicast Address |
HMAC |
Keyed-Hash Message Authentication Code (from FIPS 198-1) |
ID |
Identifier |
IP |
Internet Protocol |
IPK |
Identity Protection Key (a Universal Group key shared across a Fabric) |
KDF |
Key Derivation Function (from NIST 800-56C) |
KDM |
Key Derivation Method (from NIST 800-56C) |
LLA |
Link local address |
LLN |
Low power and Lossy Network |
MAC |
Medium Access Control (or "Message Authentication Code") |
MCSP |
Message Counter Synchronization Protocol |
MIC |
Message Integrity Code (used as synonym for MAC (Message Authentication Code) to avoid confusion with MAC (Medium Access Control) as used in network addressing contexts) |
MRP |
Message Reliability Protocol |
NFC |
Near Field Communication |
NOC |
Node Operational Certificate |
NOCSR |
Node Operational Certificate Signing Request |
OID |
Object Identifier (from ITU ASN.1) |
OTA |
Over-the-air (used mostly in context of "Over-the-air Software Update") |
PAA |
Product Attestation Authority |
PAI |
Product Attestation Intermediate |
PAKE |
Password-Authenticated Key Exchange (from SPAKE2+) |
PASE |
Passcode-Authenticated Session Establishment |
PBKDF |
Password-Based Key Derivation Function (from NIST 800-132) |
PDU |
Protocol Data Unit |
PKI |
Public Key Infrastructure |
PID |
Product Identifier (also Product ID) |
PIN |
Personal Identification Number |
QR code |
Quick Response (code) |
SDU |
Service Data Unit |
SED |
Sleepy End Device |
SHA |
Secure Hash Algorithm (from FIPS 180-4) |
SRP |
Service Registration Protocol (from SRP) |
TCP |
Transmission Control Protocol |
TFTP |
Trivial File Transfer Protocol (from RFC 1350) |
TLV |
Tag Length Value (refers mostly to Tag-length-value (TLV) Encoding Format) |
TRNG |
True Random Number Generator (from NIST 800-90B) |
UDP |
User Datagram Protocol |
UGID |
Universal Group Identifier |
ULA |
Unique local address |
UTC |
Universal Time Coordinated |
UUID |
Universally Unique Identifier |
VID |
Vendor Identifier (also Vendor ID) |
ZCL |
Zigbee Cluster Library |
1.3. Definitions
Term | Definition |
---|---|
Access Control List |
A list of entries in the Access Control Cluster expressing individual rules which grant privileges to access cluster elements. |
Administrator |
A Node having Administer privilege over at least the Access Control Cluster of another Node. |
Advertising Data |
A data container used in BLE Advertisements to convey a logical grouping of information. |
Attribute |
A data entity which represents a physical quantity or state. This data is communicated to other Nodes using commands. |
Binding |
A persistent attachment between an instance on one Node to one-or-more corresponding instances on another (or the same) Node. |
Border Router |
A router, also known as Edge Router, that provides routing services between two IP subnets (typically, between a hub network and a peripheral network). |
Bridge |
A Node that represents one or more non-Matter devices on the Fabric. |
Bridged Device |
A non-Matter device that is represented on the Fabric by a Bridge so it can be used by Nodes on the Fabric. |
Broadcast |
The transmission of a message to every Node in a particular broadcast domain, be it all Nodes on a Ethernet or Wi-Fi link, and/or all Nodes on a Thread mesh. |
Certificate Authority (CA) |
An entity that issues digital certificates such as a DAC or NOC |
Certification Declaration |
A digitally signed token that conveys Matter certification status of a vendor’s certified Device. |
Client |
A Cluster interface that typically sends commands that manipulate the attributes on the corresponding server cluster. A client cluster communicates with a corresponding remote server cluster with the same cluster identifier. |
Cluster |
A specification defining one or more attributes, commands, behaviors and dependencies, that supports an independent utility or application function. The term may also be used for an implementation or instance of such a specification on an endpoint. |
Command |
Requests for action on a value with an expected response which may have parameters and a response with a status and parameters. |
Commission |
To bring a Node into a Fabric. |
Commissionable Node |
A Node that is able to be commissioned. Specific actions such as a button press may be required to put a Commissionable Node into Commissioning Mode in order for it to allow Commissioning. |
Commissionable Node Discovery |
Discovery of a Node that is able to be Commissioned, but not necessarily in Commissioning Mode, for the purpose of performing Commissioning. The Node may be brand new, after factory reset, or it may have have already been Commissioned. |
Commissioner |
A Role of a Node that performs Commissioning. |
Commissioner Discovery |
Discovery of a Commissioner. |
Commissionee |
An entity that is being Commissioned to become a Node. |
Commissioning |
Sequence of operations to bring a Node into a Fabric by assigning an Operational Node ID and Node Operational credentials. |
Commissioning Channel |
A Secure Channel used to perform Commissioning. |
Commissioning Mode |
The mode of a Node in which it allows Commissioning. |
Controller |
A Role of a Node that has permissions to enable it to control one or more Nodes. |
Controlee |
A Role of a Node that has permissions defined to enable it to be controlled by one or more Nodes. |
Device |
A piece of equipment containing one or more Nodes. |
Device Attestation Certificate |
An RFC 5280 compliant X.509 v3 document with attestable attributes. |
Discriminator |
A 12-bit value used to discern between multiple commissionable Matter device advertisements. See Discriminator value. |
Endpoint |
A particular component within a Node that is individually addressable. |
Endpoint Address |
The address assigned to an Endpoint. |
Fabric |
A logical collection of communicating Nodes, sharing a common root of trust, and a common distributed configuration state. |
Information Element |
A Wi-Fi (IEEE 802.11-2020) data container used to convey various information regarding a particular Wi-Fi network’s capabilities and operation. |
Key Center |
A system component which takes the NOCSR from a Commissioner and allocates an Operational Node ID that is unique to the Fabric, inserts this Operational Node ID as the DN into the NOC, and signs the NOC. |
Manual Pairing Code |
An 11-digit or 21-digit numeric code that can be manually entered/spoken instead of scanning a QR code, which contains the information needed to commission a Matter device. |
Network |
A set of nodes that have addressability, connectivity, and reachability to one another via Internet Protocol. |
Node |
An addressable entity which supports the Matter protocol stack and (once Commissioned) has its own Operational Node ID and Node Operational credentials. A Device MAY host multiple Nodes. |
Operational Discovery |
Discovery of a previously commissioned Node for the purpose of performing operations with that Node. |
Onboarding Payload |
The information needed to start the process of commissioning a Device. |
OTA Provider |
A Node implementing the OTA Software Update Provider role (see OTA Software Update Provider Cluster Definition). |
OTA Requestor |
A Node implementing the OTA Software Update Requestor role (see OTA Software Update Requestor Cluster Definition). |
Product Attestation Authority |
An entity which operates a root level Certificate Authority for the purpose of Device Attestation. |
Product Attestation Intermediate |
An entity which operates an intermediate level Certificate Authority for the purpose of Device Attestation. |
Product ID (PID) |
A 16-bit number that identifies the type of a Device, uniquely among the product types made by a given vendor. See Product ID. |
QR Code |
A machine-readable optical label that contains information about the item to which it is attached (see QR Code). |
Role |
Some set of (related) behaviors of a Node. Each Node can have multiple roles. |
Router |
A device that provides routing services in its network in cooperation with other Routers. |
Soft-AP |
A device utilizing Wi-Fi (IEEE 802.11-2020) Access Point (AP) functionality to advertise its presence and allow IP-bearing connections but does not offer Internet connectivity. |
Secure Channel |
A channel in which messages are encrypted and authenticated. Unicast secure channels also provide authentication of each peer. |
Server |
A Cluster interface that typically supports all or most of the attributes of the Cluster. A Server Cluster communicates with a corresponding remote Client Cluster with the same Cluster identifier. |
Service Discovery |
The ability of a Node to locate services of interest. |
Software Image |
A data blob, equivalent to a file, utilized by a Node to update its software. For the purposes of OTA Software Update, this further refers to files conforming to the OTA Software Image File Format. |
Thread |
A low-power IEEE 802.15.4-based IPv6 mesh networking technology (see Thread specification). |
Vendor |
The organization that made a Device. |
Vendor ID (VID) |
A 16-bit number that uniquely identifies the Vendor of the Device. See Vendor ID. |
1.4. Standards Terminology Mapping
Matter | HomeKit | Weave | Thread | Zigbee |
---|---|---|---|---|
Administrator |
Admin |
Fabric provisioner |
Commissioner |
Coordinator |
Attribute |
Characteristics |
Property |
Attribute |
|
Binding |
Event subscription |
Subscription |
Link |
Binding |
Broadcast |
Broadcast |
Broadcast |
||
Client |
Service client |
Client |
Client |
|
Cluster |
Services |
interface |
Cluster |
|
Cluster |
Trait |
Service |
Cluster |
|
Command |
Command |
Command |
Command |
Command |
Commissioning |
Pairing |
Pairing |
Commissioning |
Association |
Commissioner |
Admin |
Fabric provisioner |
Commissioner |
Coordinator |
Device |
Accessory |
Device |
Device |
Device |
End Device |
End Device |
End Device |
||
Endpoint |
Profile |
Resource |
Interface |
Endpoint |
Endpoint Address |
Device ID |
Resource ID |
Endpoint Identifier |
Endpoint address |
Fabric |
Network |
Fabric |
Partition |
Network |
Network Manager |
Device / Controller |
Nest Service |
Leader |
Network manager |
Node |
Accessory |
Node |
Node |
Node |
Router |
Router |
Router |
||
Server |
Service host |
Server |
Server |
|
Service Discovery |
Service directory |
Service Discovery |
1.5. Conformance Levels
The key words below are usually capitalized in the document to make the requirement clear.
Key Word | Description |
---|---|
MAY |
A key word that indicates flexibility of choice with no implied preference. |
NOT |
A key word that used to describe that the requirement is the inverse of the behavior specified (i.e. SHALL NOT, MAY NOT, etc) |
SHALL |
A key word indicating a mandatory requirement. Designers are required to implement all such mandatory requirements. |
SHOULD |
A key word indicating flexibility of choice with a strongly preferred alternative. Equivalent to the phrase is recommended. |
1.6. References
The following standards and specifications contain provisions, which through reference in this document constitute provisions of this specification. All the standards and specifications listed are normative references. At the time of publication, the editions indicated were valid. All standards and specifications are subject to revision, and parties to agreements based on this specification are encouraged to investigate the possibility of applying the most recent editions of the standards and specifications indicated below.
1.6.1. CSA Reference Documents
Reference | Reference Location/URL | Description |
---|---|---|
CSA Manufacturer Code Database |
||
https://github.com/CHIP-Specifications/connectedhomeip-spec/raw/build-sample/pdf/appclusters.pdf |
Application Clusters - Under development |
|
Matter Brand Guidelines |
1.6.2. External Reference Documents
Reference | Reference Location/URL | Description |
---|---|---|
Advertising Proxy for DNS-SD SRP |
||
ANSI C18 Standards on Portable Cells and Batteries |
||
https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=441541 |
Bluetooth® Core Specification 4.2 |
|
NIST FIPS 180-4 Secure Hash Standard (SHS), August 2015 |
||
NIST FIPS 186-4 Digital Signature Standard (DSS), July 2013 |
||
NIST FIPS 197 Advanced Encryption Standard (AES), November 2001 |
||
NIST FIPS 198-1 The Keyed-Hash Message Authentication Code (HMAC), July 2008 |
||
IEC 60086 standard for Primary Batteries |
||
"IEEE Standard for Floating-Point Arithmetic," in IEEE Std 754-2019 (Revision of IEEE 754-2008) July 2019, doi: 10.1109/IEEESTD.2019.8766229. |
||
IEEE 802.11-2020 - IEEE Standard for Information Technology - Telecommunications and Information Exchange between Systems - Local and Metropolitan Area Networks - Specific Requirements - Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications |
||
Information technology - Automatic identification and data capture techniques - QR Code bar code symbology specification |
||
ITU ASN.1 Project |
||
Data Exchange Format (NDEF) Technical Specification, NFC Forum |
||
Record Type Definition (RTD) Technical Specification, NFC Forum |
||
URI Record Type Definition Technical Specification, NFC Forum |
||
https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38a.pdf |
NIST SP 800-38A Recommendation for Block Cipher Modes of Operation: Methods and Techniques, December 2001 |
|
https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-38c.pdf |
NIST SP 800-38C Recommendations for Block Cipher Mode of Operation: The CCM Mode for Authentication and Confidentiality, Morris Dworkin, May 2004 (errata update 2007) |
|
https://csrc.nist.gov/publications/detail/sp/800-56c/rev-2/final |
NIST SP 800-56C Recommendation for Key-Derivation Methods in Key-Establishment Schemes, Revision 2, August 2020 |
|
https://csrc.nist.gov/publications/detail/sp/800-90a/rev-1/final |
NIST SP 800-90A Rev. 1 Recommendation for Random Number Generation Using Deterministic Random Bit Generators |
|
NIST SP 800-90B Recommendation for the Entropy Sources Used for Random Bit Generation |
||
https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf |
NIST SP 800-132 Recommendation for Password-Based Key Derivation, Part 1: Storage Applications, December 2010 |
|
https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-186-draft.pdf |
NIST Draft SP 800-186 Recommendation for Discrete Logarithm-Based Cryptography, October 2019 |
|
The TFTP Protocol (Revision 2) |
||
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997 |
||
A DNS RR for specifying the location of services (DNS SRV) |
||
PKCS #10: Certification Request Syntax Specification Version 1.7 |
||
Unicast-Prefix-based IPv6 Multicast Addresses |
||
IPv6 Global Unicast Address Format |
||
Uniform Resource Identifier (URI) |
||
IPv6 Scoped Address Architecture |
||
Default Router Preferences and More-Specific Routes |
||
Unique Local IPv6 Unicast Addresses (ULA) |
||
IPv6 Addressing Architecture |
||
XDR: External Data Representation Standard |
||
The Base16, Base32, and Base64 Data Encodings |
||
Neighbor Discovery for IP version 6 (IPv6) |
||
IPv6 Stateless Address Autoconfiguration |
||
Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile |
||
Principles of Internet Host Configuration |
||
Cryptographic Message Syntax (CMS) |
||
Service Name and Port Number Procedures |
||
Replacement of AppleTalk NBP |
||
Multicast DNS |
||
DNS-Based Service Discovery |
||
Naming Things with Hashes |
||
Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing |
||
IPv6 Multicast Address Scopes |
||
Textual Encodings of PKIX, PKCS, and CMS Structures |
||
Scalable DNS-SD Requirements |
||
Happy Eyeballs Version 2: Better Connectivity Using Concurrency |
||
DNS Stateful Operations |
||
DNS Push Notifications |
||
Discovery Proxy |
||
https://datatracker.ietf.org/doc/html/draft-lemon-stub-networks-02 |
Connecting Stub Networks to Existing Infrastructure |
|
SEC 1: Elliptic Curve Cryptography, Version 2.0, Certicom Research, May 2009 |
||
SEC 2: Recommended Elliptic Curve Domain Parameters, Version 2.0, Certicom Research, January 2010 |
||
Krawczyk H. (2003) SIGMA: The ‘SIGn-and-MAc’ Approach to Authenticated Diffie-Hellman and Its Use in the IKE Protocols. In: Boneh D. (eds) Advances in Cryptology - CRYPTO 2003. CRYPTO 2003. Lecture Notes in Computer Science, vol 2729. Springer, Berlin, Heidelberg. |
||
SPAKE2+, an Augmented PAKE (Draft 02, 10 December 2020) |
||
Service Registration Protocol |
||
Thread 1.3.0 Specification |
||
Verhoeff, J. (1969). Error detecting decimal codes. MC Tracts. Centrum Voor Wiskunde en Informatica. |
||
ITU X.501 : Information technology - Open Systems Interconnection - The Directory: Models |
||
ITU X.509 : Information technology - Open Systems Interconnection - The Directory: Public-key and attribute certificate frameworks |
||
ITU X.520 : Information technology - Open Systems Interconnection - The Directory: Selected attribute types |
||
ITU X.680 : Information technology - Abstract Syntax Notation One (ASN.1): Specification of basic notation |
||
ITU X.690 : Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER) |
1.7. Informative References
1.7.1. CSA Reference Documents
Reference | Reference Location/URL | Description |
---|---|---|
Dotdot Architecture Model, document 13-0589, revision 14, February 2019 |
||
Zigbee Cluster Library Specification, document 07-5123, revision 8, December 2019 |
||
Organizational Processes and Procedures, 13-0625, revision 8, November 2021 |
1.8. Conventions
The following conventions are used in this document.
1.8.1. Enumerations and Reserved Values
An undefined value or range of an enumeration, field, or identifier SHALL be considered reserved for future revisions of this standard and SHALL not be available for implementation.
A value or range of an enumeration, field, or identifier that is available for non-standard implementation SHALL be described as “manufacturer specific”, “ms”, or “MS”.
A value or range of an enumeration, field, or identifier that is available for other parts of this standard SHALL be described as such.
A value or range of an enumeration, field, or identifier that is deprecated, and not available for implementation, SHALL be described as “Deprecated” or “D”.
1.8.2. Reserved Bit Fields
Each full or partial data field (e.g., message data field), of any bit length, that is undefined, SHALL be considered reserved for future revisions of this standard and SHALL not be available for implementation.
An implementation of a revision where a bit is reserved SHALL indicate that bit as zero when conveying that bit in a message, and ignore that bit when conveyed from another implementation.
1.8.3. Number Format
In this specification, hexadecimal numbers are prefixed with the designation “0x” and binary numbers are prefixed with the designation “0b”. All other numbers are assumed to be decimal unless indicated otherwise within the associated text.
Binary numbers are specified as successive groups of 4 bits, separated by a space (“ “) character from the most significant bit (next to the 0b prefix and leftmost on the page) to the least significant bit (rightmost on the page), e.g. the binary number 0b0000 1111 represents the decimal number 15. Where individual bits are indicated (e.g. "bit 3") the bit numbers are relative to the least significant bit which is bit 0.
When a bit is specified as having a value of either 0 or 1 it is specified with an “x”, e.g. “0b0000 0xxx” indicates that the lower 3 bits can take any value but the upper 5 bits must each be set to 0.
1.8.4. Provisional
Per [CSA-PNP], when a specification is completed there may be sections of specification text (or smaller pieces of a section) that are not certifiable at this stage. These sections (or smaller pieces of a section) are marked as provisional prior to publishing the specification. This specification uses well-defined notation to mark Provisional Conformance or notes a section of text with the term "provisional".
2. Architecture
2.1. Overview
Matter aims to build a universal IPv6-based communication protocol for smart home devices. The protocol defines the application layer that will be deployed on devices as well as the different link layers to help maintain interoperability. The following diagram illustrates the normal operational mode of the stack:
2.2. Layered Architecture
The architecture is divided into layers to help separate the different responsibilities and introduce a good level of encapsulation amongst the various pieces of the protocol stack. The vast majority of interactions flow through the stack captured in the following Figure.
The Application layer corresponds to the high order business logic of a device. For example, an application that is focused on lighting might contain logic to handle turning on/off a light bulb, as well as its color characteristics.
The Data Model layer corresponds to the data and verb elements that help support the functionality of the application. The Application operates on these data structures when there is intent to interact with the device.
The Interaction Model layer defines a set of interactions that can be performed between a client and server device. For example, reading or writing attributes on a server device would correspond to application behavior on the device. These interactions operate on the elements defined at the data model layer.
Once an action is constructed using the Interaction Model, it is serialized into a prescribed packed binary format to encode for network transmission. This process is handled in the Action Framing layer.
An encoded action frame is then processed by the Security Layer: the message is encrypted and appended with a message authentication code. These actions ensure the data remain confidential and authentic between sender and receiver of the message.
With an interaction now serialized, encrypted, and signed, the Message Layer constructs the payload format with required and optional header fields, which specify properties of the message as well logical routing information.
After the final payload has been constructed by the Message Layer, it is sent to the underlying transport protocol (TCP or Matter’s Message Reliability Protocol) for IP management of the data.
Once the data is received on the peer device, it travels up the protocol stack, where the various layers reverse the operations on the data performed by the sender, to finally deliver the message to the Application for consumption.
In addition to the data flows captured above, this specification defines secure session establishment protocols based on operational certificates (see Section 4.13.2, “Certificate Authenticated Session Establishment (CASE)”), or passcodes (see Section 4.13.1, “Passcode-Authenticated Session Establishment (PASE)”), group communication (see Section 4.14, “Group Communication”), a bulk data transfer protocol (BDX) suitable for sending bulk data between Nodes, and provisions for defining manufacturer-specific protocols.
2.3. Network Topology
In principle, any IPv6-bearing network is suitable for Matter deployment, subject to supporting a few core IPv6 standards. In this version of the specification, we focus on three link layer technologies: Ethernet, Wi-Fi and Thread. We restrict the specification to the above so that the specification can suitably cover provisioning of these link layers, and so that the amount of testing in certification is suitably bounded.
Matter treats networks as shared resources: it makes no stipulation of exclusive network ownership or access. As a result, it is possible to overlay multiple Matter networks over the same set of constituent IP networks.
This protocol may operate in the absence of globally routable IPv6 infrastructure. This requirement enables operation in a network disconnected or firewalled from the global Internet. It also enables deployment in situations where the Internet Service Provider either does not support IPv6 on consumer premises or where the support proves otherwise limiting, for example, if the delegated prefix cannot accommodate all the networks and devices on premises.
This protocol supports local communications spanning one or more IPv6 subnets. Canonical networks supporting a fabric may include a Wi-Fi/Ethernet subnet, or one or more low power and lossy networks (LLN) subnets. In this version of the specification, Thread is the supported LLN standard.
2.3.1. Single network
In the single network topology, all Matter devices are connected to a single logical network. This could be a Thread/802.15.4 network, a Wi-Fi network or an Ethernet network. In the case of Wi-Fi/Ethernet, the network could in fact span multiple Wi-Fi and/or Ethernet segments provided that all the segments are bridged at the link layer. A Node is a single instance of a Matter device within a fabric, operationally available on an IP network.
Each Node in the single-network topology communicates with every other Node in the Fabric via a single network interface.
2.3.2. Star network topology
The star network topology consists of multiple peripheral networks joined together by a central hub network. The hub network will typically be the customer’s home network (Wi-Fi/Ethernet network), while the peripheral networks can be of any supported network type. A peripheral network MUST always be joined directly to the hub network via one or more Border Routers.
Architecturally, any number of peripheral networks may be present in a single Fabric, including multiple networks of the same type. Nodes MAY have interfaces onto any network (hub or peripheral), and MAY communicate directly to other Nodes on the same network. However, any communication that must cross a network boundary to reach its destination MUST flow through a Border Router.
This protocol places a set of requirements on the Border Router. These requirements pertain to address assignment, route assignment and advertisement, multicast support, and discovery proxying.
Note that in this version of the specification, Thread is the primary supported LLN. In many cases, customer installations will attempt to maintain a simple network topology, with a single Wi-Fi/Ethernet subnet, and a single Thread network. However, more than one Thread network is possible and supported.
To support home automation interoperability, this protocol supports the concept of bridging which makes available, through a data model node, devices implementing other home automation technologies, transports and link layers.
2.4. Scoped names
The Matter protocol explicitly supports multiple administrators, unrelated by any common roots of trust (multi-admin). This functionality is addressed via multiple fabrics and is enabled by the core aspects of name scoping (see below), and key considerations enabling multiple fabrics in onboarding, secure communication, and aspects of the data model (such as fabric-scoped data).
A Fabric is a collection of Matter devices sharing a trusted root. The root of trust in Matter is the Root CA that issues the NOCs which underpin node identities. Within the fabric, each node is uniquely identified by a stable Node ID. The scoped selection and allocation of these constructs within Matter ensures the uniqueness of identifiers and gives clear guidance on ownership and management of namespaces.
The operational root of trust — the root certificate authority (CA) as identified by its public key (Root PK) — is responsible for the allocation of correctly scoped fabric identifiers. The security of all public key infrastructures (PKI) depends on the private key of the CA being protected and neither guessable nor obtainable; that property, in turn, implies that the public key is globally unique. Within any root CA, the fabrics — identified by a 64-bit number — are unique. The uniqueness mechanism emerges from the collaboration of the commissioner and the root CA associated with that particular commissioner. Matter wraps the collaboration between the commissioner and its associated root CA and other possible data stores into a concept called the "administrative domain manager" (ADM). The algorithmic details and policies within the administrative domain manager are out of the scope of the specification as long as the allocation of all identifiers obeys the uniqueness and scoping criteria. Fabrics are uniquely identified by the tuple of their root CA’s public key and a Fabric ID. Similarly, within each fabric, the administrative domain manager is responsible for assigning a unique and stable Operational Node ID to every node.
The scoping strategy as outlined here ensures that each scoped identifier can be allocated solely by the entities responsible for the scoping, without consideration for collisions or forgeries. For example, two different CAs may allocate the same fabric identifiers and this would not create any problems for the devices within the network. Scoped delegation of responsibility also provides for clear guidelines for the removal of specific identifiers.
A Matter device may be a member of multiple fabrics and thus have multiple associated node IDs. The scoping strategy also naturally lends itself towards unambiguous resolution of names and credentials and places a clearly defined responsibility for managing the namespaces on each fabric’s associated administrative domain manager service.
Prior to the first commissioning, such as in factory-reset state, a typical device contains no pre-allocated operational roots of trust, and no operational identities in the form of fabric IDs and node IDs. Yet, various interactions expect the fabric ID, or a node ID. These identifiers emerge in a number of internal constructs — from address discovery, through identifying secure sessions, to evaluating access control privileges. In order to regularize all interactions with the device and solve the bootstrapping problem, a special primordial fabric ID is reserved, and associates a set of initial access control privileges with any communication that would be associated with the initial commissioning sessions.
2.5. Identifiers
2.5.1. Fabric References and Fabric Identifier
As described above, a Fabric ID is a 64-bit number that uniquely identifies the Fabric within the scope of a particular root CA. Conceptually, the fully qualified fabric reference consists of the tuple containing the public key of the root certificate authority, and the Fabric ID. Because the fully qualified fabric reference is cumbersome to use, a number of mechanisms for compression of the reference are defined. The Fabric reference, in compressed form, is used during operational discovery to provide operational naming separation, a form of namespacing, between unrelated collections of devices.
Fabric ID 0
is reserved across all fabric root public key scopes. This fabric ID SHALL NOT be used as the identifier of a fabric.
A fabric is defined in the Data Model as a set of nodes that interact by accessing Data Model elements as defined in the Interaction Model (see Section 7.5, “Fabric”).
The layers below the data model, that convey data model interactions as messages, SHALL always indicate either the fabric associated with the message, or that there is no fabric associated with the message.
For example: A Data Model message that is conveyed over a message channel that uses the reserved fabric ID '0' does not have a fabric associated with it.
2.5.2. Vendor Identifier (Vendor ID, VID)
A Vendor Identifier (Vendor ID or VID) is a 16-bit number that uniquely identifies a particular product manufacturer, vendor, or group thereof. Each Vendor ID is statically allocated by the Connectivity Standards Alliance (see [CSA Manufacturer Code Database]).
The following Vendor IDs are reserved:
Range | Type |
---|---|
0x0000 |
Matter Standard |
0x0001 - 0xFFF0 |
reserved for individual Manufacturer Codes as per CSA Manufacturer Code Database |
0xFFF1 |
Test Vendor #1 |
0xFFF2 |
Test Vendor #2 |
0xFFF3 |
Test Vendor #3 |
0xFFF4 |
Test Vendor #4 |
All other allocations of Vendor ID are specified in CSA Manufacturer Code Database.
Note
|
The Test Vendor IDs are reserved for test and development by device manufacturers or hobbyists. Commissioners SHOULD NOT commission devices using one of these VIDs onto an operational Fabric under normal operation unless the user is made fully aware of the security risks of providing an uncertified device with operational and networking credentials. |
2.5.3. Product Identifier (Product ID, PID)
A Product Identifier (Product ID or PID) is a 16-bit number that uniquely identifies a product of a vendor. The Product ID is assigned by the vendor and SHALL be unique for each product within a Vendor ID. Once a Product ID has been used, it SHALL NOT be reused by a different product type under the same Vendor ID. These Product IDs SHOULD NOT be specific to a unique physical device; rather they describe the product type, which might have many manufactured instances (e.g. multiple colors of the same product type).
A value of 0x0000 SHALL NOT be assigned to a product since Product ID = 0x0000 is used for these specific cases:
-
To announce an anonymized Product ID as part of device discovery (see Section 5.4.2, “Announcement by Device”).
-
To indicate an OTA software update file applies to multiple Product IDs equally.
-
To avoid confusion when presenting the Onboarding Payload for ECM with multiple nodes.
2.5.4. Group Identifier (GID)
A Group Identifier (Group ID or GID) is a 16-bit number that identifies a set of Nodes across a Fabric at the message layer (see Section 4.15, “Group Key Management”). A Group ID can further be bound to one or more Endpoints within each Node in the group at the interaction layer.
The Group ID space is allocated as described in Table 2, “Group ID Allocations”:
Range | Type |
---|---|
0xFF00 - 0xFFFF |
Universal Group ID range reserved for static multicast and anycast identifiers |
0x0001 - 0xFEFF |
Application Group ID, assigned by fabric Administrator |
0x0000 |
Null or unspecified Group ID |
2.5.4.1. Universal Group ID
A Universal Group ID (UGID) is one that resides in the 16-bit subrange of Group ID that is reserved for groups that are common across this standard. These special multicast, groupcast, or anycast destinations are constant and known to all Nodes on any Fabric. The Universal Group ID space is allocated as described in Table 3, “Universal Group ID Allocations”:
Range | Type |
---|---|
0xFFFF |
|
0xFFFE |
|
0xFFFD |
|
0xFF00-0xFFFC |
Reserved for future use |
The Commissioner SHALL configure one or more shared keys for these groups on all Nodes within the Fabric. Because the keys and IPv6 multicast prefixes are different across Fabrics, Universal Groups only enable communication within a specific Fabric.
All non-sleepy Nodes Group
This group is used to message all power-capable Nodes in a Fabric. Sleepy Nodes SHALL NOT subscribe to this group.
All Proxies Group
This group is used to discover Proxy Nodes during Section 9.15.4, “Proxy Subscriptions”.
2.5.5. Node Identifier
A Node Identifier (Node ID) is a 64-bit number that uniquely identifies an individual Node or a group of Nodes on a Fabric. The Node Identifier space is allocated as described in Table 4, “Node Identifier Allocations”:
Range | Type |
---|---|
0xFFFF_FFFF_FFFF_xxxx |
Group Node ID |
0xFFFF_FFFF_0000_0000 to 0xFFFF_FFFF_FFFE_FFFF |
Reserved for future use |
0xFFFF_FFFE_xxxx_xxxx |
Temporary Local Node ID |
0xFFFF_FFFD_xxxx_xxxx |
CASE Authenticated Tag |
0xFFFF_FFFC_xxxx_xxxx to 0xFFFF_FFFC_FFFF_FFFF |
Reserved for future use |
0xFFFF_FFFB_xxxx_xxxx |
PAKE key identifiers |
0xFFFF_FFF0_0000_0000 to 0xFFFF_FFFA_FFFF_FFFF |
Reserved for future use |
0x0000_0000_0000_0001 to 0xFFFF_FFEF_FFFF_FFFF |
Operational Node ID |
0x0000_0000_0000_0000 |
Unspecified Node ID |
Node IDs are used for core messaging, within the internal APIs, within the data model, and to resolve the operational IPv6 addresses of Nodes (see Section 4.3.2, “Operational Discovery”).
The span of Node IDs from 0xFFFF_FFF0_0000_0000 to 0xFFFF_FFFF_FFFF_FFFF, as well as the value 0x0000_0000_0000_0000 are both reserved for special uses.
2.5.5.1. Operational Node ID
An Operational Node ID is a 64-bit number that uniquely identifies an individual Node on a Fabric. All messages must have an Operational Node ID as the source address. All unicast messages must have an Operational Node ID as the destination address.
While source or destination address MAY be elided from a message, it MUST remain unambiguously derivable from the Session ID.
2.5.5.2. Group Node ID
A Group Node ID is a 64-bit Node ID that contains a particular Group ID in the lower half of the Node ID.
2.5.5.3. Temporary Local Node ID
A Temporary Local Node ID is a 64-bit Node ID that contains an implementation-dependent value in its lower 32 bits. This allows implementations to keep track of connections or transport-layer links and similar housekeeping internal usage purposes in contexts where an Operational Node ID is unavailable.
2.5.5.4. PAKE key identifiers
This subrange of Node ID is used to assign an access control subject to a particular PAKE key as specified in Section 6.6.2.1.1, “PASE and Group Subjects”. An example usage would be to create an ACL entry to provide administrative access to any commissioner communicating via a PASE session established with a particular pincode.
2.5.5.5. CASE Authenticated Tag
This subrange of Node ID is used to assign an access control subject to a group of peer nodes that share a single CASE session as specified in Section 6.6.2.1.2, “Subjects identified by CASE Authenticated Tag”.
2.5.6. IPv6 Addressing
This protocol uses IPv6 addressing for its operational communication. Node IDs and Fabric IDs are resolved to various types of IPv6 addresses [RFC 4291].
2.5.6.1. IPv6 Unicast Address
An IPv6 Unicast Address is one that uniquely identifies and addresses a single Node on an IPv6 network. A primary design goal for this standard is to allow Nodes to leverage native IPv6 technologies. As such, an operational IPv6 Unicast address that provides connectivity and routability between Nodes SHALL be used. This includes a global unicast address (GUA), a link-local address (LLA), or a unique local address (ULA).
2.5.6.2. IPv6 Multicast Address
An IPv6 Multicast Address is formed using Unicast-Prefix-based IPv6 Multicast Addresses [RFC 3306]:
-
The first 12 bits are defined by [RFC 3306] and are 0xFF3.
-
The next 4 bits are "scop" (scope) and set based on [RFC 7346] Section 2 to:
-
Site-Local (0x5) - spans all networks in the Fabric, including Thread, Ethernet, and Wi-Fi.
-
-
The next 8 bits are reserved (0x00).
-
The next 8 bits are "plen", and set to 0x40 to indicate a 64-bit long network prefix field.
The network prefix portion of the Multicast Address is the 64-bit bitstring formed by concatenating:
-
0xFD to designate a locally assigned ULA prefix per [RFC 4193] Section 3.1
-
The upper 56-bits of the Fabric ID for the network in big-endian order
The 32-bit group identifier portion of the Multicast Address is the 32-bits formed by:
-
The lower 8-bits of the Fabric ID
-
0x00
-
The next 16-bits are the Group Identifier for the group, as specified in Group Identifier in big-endian order
An example of the site local scoped multicast address for a given <Fabric ID> and <Group ID>:
FF35:0040:FD<Fabric ID>00:<Group ID>
Note
|
though Site-Local scope is always used, the effective scope MAY be limited by setting the IPv6 hop count. |
The Multicast Address formation ensures a low probability of a node receiving a multicast message it is not interested in. If a collision does occur on the multicast address (which requires two identical 64-bit Fabric IDs and two identical 16-bit Group IDs), processing of the message disambiguates which fabric and group is relevant by checking which operational group key leads to the message’s 64-bit MIC.
2.6. Device identity
Each Matter device holds a number of certificate chains.
A Device Attestation Certificate (DAC) proves the authenticity of the manufacturer and a certification status of the device’s hardware and software. The Device Attestation Certificate is used during the commissioning process by the Commissioner to ensure that only trustworthy devices are admitted into a Fabric. The details of the device attestation process are captured in Section 6.2, “Device Attestation”.
Each Matter device is issued an Operational Node ID and a Node Operational Certificate (NOC) for that Operational Node ID. The NOC enables a Node to identify itself within a Fabric by cryptographically binding a unique Node Operational Key Pair to the operational identity of its subject, attestable through the signature of a trusted Certificate Authority (CA). Operational Node IDs are removed on factory reset or removal of Fabrics. A NOC is issued during the commissioning process of a device into a Fabric. These steps help to protect the privacy of the end-user and to adapt to different trust models.
The format of the Node Operational credentials and protocols for generating those credentials are detailed in Section 6.4, “Node Operational Credentials Specification” and Section 6.5, “Operational Certificate Encoding” sections.
2.7. Security
Matter deploys modern security practices to protect the Fabric. Matter designates a core set of security primitives detailed in Chapter 3, Cryptographic Primitives to provide comprehensive protection. Elliptic curve cryptography, based on the NIST P-256 curve (secp256r1) serves as the foundation for public key cryptography and digital signatures. Commonly available AES modes of operation have been selected to provide shared key cryptographic operations. In scenarios involving an out-of-band passcode-based authentication, Matter uses SPAKE2+, an efficient augmented PAKE algorithm.
The core cryptographic primitives form the basis of a number of complementary secure protocols used within Matter. All unicast Node-to-Node messages are secured, authenticated, and provide replay protection. Building on top of IPv6 multicast, Matter also provides group messaging facilities, useful for efficiently addressing on an LLN. The group messaging features prioritize low latency of packet processing.
2.8. Device Commissioning
Device commissioning (see Chapter 5, Commissioning) is the process of joining a device to a Fabric. The device being commissioned is referred to as the Commissionee and the device administering commissioning is referred to as the Commissioner. Device commissioning consists of the following steps:
-
Device discovery (see Section 5.4, “Device Discovery” and see Section 5.1, “Onboarding Payload”): The Commissioner discovers commissionable devices on network interfaces such as Bluetooth Low Energy, Wi-Fi, or other connected IP network. The Commissioner obtains the out-of-band secret (Passcode) from the commissionable device’s QR Code, Manual Pairing Code, NFC Tag or other means. This secret is used by Passcode-Authenticated Session Establishment (PASE) to establish a secure commissioning session. The order of discovering commissionable devices and obtaining the out-of-band secret from commissionable device is not critical.
-
Security setup with PASE (see Section 4.13.1, “Passcode-Authenticated Session Establishment (PASE)”): Establish encryption keys between the Commissioner and Commissionee using PASE. All messages exchanged between the Commissioner and Commissionee are encrypted using these PASE-derived keys. The process also establishes an attestation challenge used during the device attestation procedure.
-
Device attestation verification (see Section 6.2, “Device Attestation”): Commissioner establishes the authenticity of the Commissionee as a certified device, notifying the user if the device is not certified.
-
Information configuration (see Section 6.4, “Node Operational Credentials Specification”, Section 11.9, “General Commissioning Cluster” and Section 11.17, “Node Operational Credentials Cluster”): The Commissioner provides Commissionee with information such as regulatory domain, UTC time, Operational Certificate and network interfaces configuration.
-
Join network (see Section 11.8, “Network Commissioning Cluster” and Section 4.3.2, “Operational Discovery”): The Commissioner triggers the Commissionee to connect to the operational network unless the Commissionee is already on the operational network. The Node’s/Commissionee’s IPv6 address is then either used (if already known) or discovered (if not known) by the Commissioner or Administrator.
-
Security setup with CASE (see Section 4.13.2, “Certificate Authenticated Session Establishment (CASE)”): Derive encryption keys used to establish secure communication between the Commissioner or Administrator and Node with CASE. All unicast messages between a Commissioner or Administrator and a Node are encrypted using these CASE-derived keys.
-
Commissioning complete message exchange (see Section 11.9, “General Commissioning Cluster”): A message exchange encrypted using CASE-derived encryption keys on the operational network that indicates successful completion of commissioning process.
A commissioner can reconfigure the Commissionee multiple times over the operational network after the commissioning is complete or over the commissioning channel after PASE-derived encryption keys are established during commissioning. The commissioning flows are described in Section 5.5, “Commissioning Flows”.
2.9. Sleepy End Device (SED)
One goal of this standard is to provide support for low energy Nodes running on limited power sources such as batteries or limited energy scavenging. The Sleepy End Device (SED) operating mode is defined to help extend and optimize battery lifetimes for such Nodes. The SED operating mode mirrors and aligns with Thread SED behavior, but may be leveraged over other supported IP interfaces, including Wi-Fi. The steady state behavior of a SED Node is to disable its IP interface (and underlying radio or link technology). A SED then periodically wakes to communicate with some infrastructure device in order to participate on the network. In the case of a Thread network (see [Thread specification]]), the infrastructure device is a parent Thread Router. For Wi-Fi, the access point provides the required infrastructure support. Two intervals are defined:
-
Idle mode, or slow-polling, sets the maximum time a SED will sleep before polling. This parameter affects both the minimum power consumption and maximum latency. The SLEEPY_IDLE_INTERVAL parameter communicates the maximum sleep interval of a node in idle mode.
-
Active mode sets the SED into a fast-polling interval for maximum responsiveness when the Node is engaged in ongoing communication, such as an active Exchange. The SLEEPY_ACTIVE_INTERVAL parameter communicates the maximum sleep interval of a node in active mode.
A SED SHALL indicate it is a sleepy device to peer nodes by setting its SLEEPY_IDLE_INTERVAL to a value greater than the default and advertising that value per [Discovery_SII].
Note
|
Because parent infrastructure devices have limited buffering space to cache messages on behalf of sleepy devices, SED communication patterns SHOULD be designed such that the SED is predominantly the initiator. |
A Node determines whether it is in Active or Idle mode based on whether it has any outstanding Exchanges in the Message Layer. While there are Exchanges active, a node will remain in Active mode and poll at the fast-polling interval if it is a SED. Once all Exchanges are closed, a node SHOULD transition into Idle mode and poll at the slow-polling interval if it is a SED and the node has no other outstanding reasons for staying awake.
2.10. Data Model Root
-
Endpoint 0 (zero) SHALL be the root node endpoint.
-
Endpoint 0 (zero) SHALL support the Root Node device type.
2.11. Stack Limits
2.11.1. System Model Limits
2.11.1.1. Access Control Limits
-
A node SHALL guarantee that there are at least three Access Control Entries available for every fabric supported by the node.
-
Device types MAY impose additional constraints on the number of ACL entries that need to be supported.
2.11.1.2. Group Limits
-
A node SHALL support at least one group key per fabric for managing the IPK.
-
If the node implements one or more device types with support for the Groups cluster, the node SHALL additionally support the maximum number of the required groups as specified by all of these implemented device types.
-
A node SHALL support one IPv6 multicast group membership for every operational group it supports.
-
Support for GroupKeyMulticastPolicy field in GroupKeySetStruct is provisional.
2.11.2. Interaction Model Limits
2.11.2.1. Read Interaction Limits
-
A server SHALL ensure that every fabric the node is commissioned into can handle a single Read Interaction from a client on that fabric containing up to 9 paths.
-
A server MAY permit Read Interactions even when there is no accessing fabric, subject to available resources (e.g over PASE).
2.11.2.2. Subscribe Interaction Limits
-
A publisher SHALL ensure that every fabric the node is commissioned into can support at least three Subscribe Interactions to the publisher and that each subscription SHALL support at least 3 attribute/event paths.
-
A server MAY permit Subscribe Interactions even when there is no accessing fabric, subject to available resources (e.g over PASE).
-
Device type specifications MAY require a larger number of supported subscriptions or paths.
-
SUBSCRIPTION_MAX_INTERVAL_PUBLISHER_LIMIT
defines the upper limit for the publisher-selected maximum interval for any subscription. This SHALL be set to 60 minutes. -
The minimal supported capabilities, subject to the minimal constraints above, are reported in the CapabilityMinima attribute of the Basic Information cluster.
2.11.2.3. Invoke Interaction Limits
-
An Invoke Request action SHALL be limited to a single concrete command path.
2.12. List of Provisional Items
The following is a list of provisional items.
2.12.1. Invoke Multiple Paths
-
Support for an Invoke Interaction with multiple paths or wildcard paths is provisional.
2.12.3. Proxy Service
The Proxy Architecture, the Proxy Config and Proxy Discovery clusters are provisional.
2.12.4. Time Synchronization
The Time Synchronization feature is provisional.
2.12.5. Parameters and Constants
Table 5, “Glossary of parameters” is a glossary of parameters used in this chapter with a brief description for each parameter. A Node SHALL use the provided default value for each parameter unless the message recipient Node advertises an alternate value for the parameter via Operational Discovery.
Parameter Name | Description | Default Value |
---|---|---|
SLEEPY_IDLE_INTERVAL |
Maximum sleep interval of node when in idle mode. |
300 milliseconds |
SLEEPY_ACTIVE_INTERVAL |
Maximum sleep interval of node when in active mode. |
300 milliseconds |
SLEEPY_ACTIVE_THRESHOLD |
Minimum amount the node SHOULD stay awake after network activity. |
4000 milliseconds |
These parameters are encoded in the following TLV format when included in CASE / PASE session establishment:
sed-parameter-struct => STRUCTURE [ tag-order ] { SLEEPY_IDLE_INTERVAL [1, optional] : UNSIGNED INTEGER [ range 32-bits ], SLEEPY_ACTIVE_INTERVAL [2, optional] : UNSIGNED INTEGER [ range 32-bits ], }
3. Cryptographic Primitives
This chapter introduces the various cryptographic primitives, algorithms and protocol building blocks used in this protocol. It introduces for each of them a functional abstraction that can be referred to in the other chapters of this specification. This chapter also maps those cryptographic primitives to specific instances with the corresponding appropriate informative or normative references. Wherever relevant, it also gives necessary or relevant information about the use of these mappings in a specific context to achieve a compliant implementation.
Given a version of the Message Format, the cryptographic primitives are mapped to specific instances. There is no cryptosuite negotiation in this protocol: one version of the Message Format has one cryptosuite as defined in this chapter.
Each section defines cryptographic primitives generically, together with concrete mappings to specific instances of these cryptographic primitives for version 1.0 of the Message Format. This chapter can also be used as guidance about which cryptographic primitives need to be supported by a device, but it must be noted that not all devices will have to support all of them. For example, a device may not require the Crypto_PBKDF()
primitive, as values based on this operation could in some instances be precomputed and stored during the manufacturing process of the device. The proposed functional mapping in this chapter is normative with respect to the values computed by the functions but informative with respect to the way the functions are interfaced within implementations. For example, a function returning both a boolean
to indicate success and a value if the operation is successful could also be implemented using exception mechanisms instead of returning a boolean
.
It must also be noted that not all cryptographic primitives are exposed to the other parts of the specification. For example, the Crypto_TRNG()
primitive SHALL NOT be called outside of the Crypto_DRBG()
implementation.
The cryptographic primitives discussed below operate on data local to the host. Where more complex data types are present and their external representation is applicable, the chapter notes the details of the encoding. Simple multi-byte data types without any additional context are assumed to be in host byte order when they are used internally to a procedure, unless otherwise stated.
All octet strings are presented with first octet having index 0, and presented from left to right for indices 0 through N-1 for an octet string of length N.
3.1. Deterministic Random Bit Generator (DRBG)
This protocol relies on random numbers for many security purposes. For example, random numbers are used in generating secret keys, counters, cryptographic signature generation random secrets, etc. Those random numbers SHALL be generated using the Crypto_DRBG()
function.
Function and description |
---|
bit[len] Crypto_DRBG(int len) Returns an array of |
Mapping (Version 1.0) |
---|
|
3.2. True Random Number Generator (TRNG)
A TRNG (aka. Entropy Source) is required to provide an entropy seed as an input to the DRBG algorithm.
Function and description |
---|
bit[len] Crypto_TRNG(int len) Returns an array of |
Mapping (Version 1.0) |
---|
|
In accordance with good security practices, the Crypto_TRNG()
SHALL never be called directly but rather SHALL be used in the implementation of Crypto_DRBG()
.
3.3. Hash function (Hash)
Crypto_Hash()
computes the cryptographic hash of a message.
Function and description |
---|
byte[CRYPTO_HASH_LEN_IN_BYTES] Crypto_Hash(byte[] message) Returns the cryptographic hash digest of the |
Mapping (Version 1.0) |
---|
|
|
|
Crypto_Hash(message) := byte[CRYPTO_HASH_LEN_BYTES] SHA-256(M := message)
|
3.4. Keyed-Hash Message Authentication Code (HMAC)
Crypto_HMAC()
computes the cryptographic keyed-hash message authentication code of a message.
Function and description |
---|
byte[CRYPTO_HASH_LEN_BYTES] Crypto_HMAC(byte[] key, byte[] message) Returns the cryptographic keyed-hash message authentication code of a |
Mapping (Version 1.0) |
---|
Crypto_HMAC(key, message) := byte[CRYPTO_HASH_LEN_BYTES] HMAC(K := key, text := message)
|
3.5. Public Key Cryptography
Matter specifies the following scheme and parameters for public key cryptography.
3.5.1. Group
The public key cryptography of Matter relies on the group defined in the following mapping table.
Mapping (Version 1.0) |
---|
Matter public key cryptography SHALL be based on Elliptic Curve Cryptography (ECC) with the elliptic curve: |
|
|
|
|
|
struct { PublicKey publicKey; PrivateKey privateKey; } KeyPair; |
3.5.2. Key generation
Crypto_GenerateKeyPair()
is the function to generate a key pair.
Function and description |
---|
KeyPair Crypto_GenerateKeyPair() Generates a key pair and returns a |
Mapping (Version 1.0) |
---|
Crypto_GenerateKeypair() := KeyPair ECCGenerateKeypair()
|
3.5.3. Signature and verification
Crypto_Sign()
is used to sign a message, and Crypto_Verify()
is used to verify a signature on a message.
These functions either generate or verify a signature of type Signature
defined by the following mapping.
Mapping (Version 1.0) |
---|
struct { byte[CRYPTO_GROUP_SIZE_BYTES] r, byte[CRYPTO_GROUP_SIZE_BYTES] s } Signature |
3.5.3.1. Signature
Function and description |
---|
Signature Crypto_Sign( PrivateKey privateKey, byte[] message) Returns the signature of the |
Mapping (Version 1.0) |
---|
Crypto_Sign(privateKey, message) := Signature ECDSASign(dU := privateKey, M := message)
|
3.5.3.2. Signature verification
Function and description |
---|
boolean Crypto_Verify( PublicKey publicKey, byte[] message, Signature signature) Verifies the |
Mapping (Version 1.0) |
---|
Crypto_Verify(publicKey, message, signature) := boolean ECDSAVerify(QU := publicKey, M := message, S := signature)
|
3.5.4. ECDH
Crypto_ECDH()
is used to compute a shared secret from the Elliptic Curve Diffie-Hellman (ECDH) protocol.
Function and description |
---|
byte[CRYPTO_GROUP_SIZE_BYTES] Crypto_ECDH( PrivateKey myPrivateKey, PublicKey theirPublicKey) Computes a shared secret using Elliptic Curve Diffie-Hellman. |
Mapping (Version 1.0) |
---|
Crypto_ECDH(myPrivateKey, theirPublicKey) := byte[CRYPTO_GROUP_SIZE_BYTES] ECDH(dU := myPrivateKey, QV := theirPublicKey) The output of |
3.5.5. Certificate validation
Crypto_VerifyChain()
is used to verify Matter certificates.
Crypto_VerifyChainDER()
is used to verify public key X.509 v3 certificates in X.509 v3 DER format.
Function and description |
---|
boolean Crypto_VerifyChain(MatterCertificate[] certificates) Given Matter certificates, |
boolean Crypto_VerifyChainDER(DERCertificate[] certificates) Given a list of DER-encoded certificates in RFC 5280 format, starting at the end-entity (leaf) certificate, and following the chain of trust towards the root, |
Mapping (Version 1.0) |
---|
Crypto_VerifyChain(certificates) := boolean verified
|
Crypto_VerifyChainDER(certificates) := boolean verified
|
The primitives as described above verify cryptographic integrity of the certificate chains. This specification imposes a number of additional constraints on certificates discussed below in sections on Device Attestation Certificates, Node Operational Certificates and Certificate Common Conventions.
3.5.6. Time and date considerations for certificate path validation
The Basic Path Validation algorithm in RFC 5280 mandates the consideration of the "current time" against the validity period (notBefore
, notAfter
fields) when validating paths. The usage of "current time" assumes that such a time is available and correct, which is a strong assumption when considering some constrained devices or devices only locally reachable on a network in the absence of infrastructure to synchronize time against a global real-time reference.
When the Crypto_VerifyChain
primitive is used, rather than overriding the Basic Path Validation algorithm of RFC 5280, Nodes SHALL consider the following definition of "current time" that accounts for the possible lack of a real time reference:
-
If a Node has a current real-time clock value which is trusted according to implementation-defined means to be accurate with regard to global real-time, whether using Time Synchronization features of this specification or other means, then it SHALL use that time;
-
Otherwise, the current time SHALL be set to the last-known-good UTC time.
Upon failure to validate a certificate path, where the only reason for failure is an invalid validity period of a path element, a Node MAY apply a policy of its choice to determine whether to ignore this failure and still consider the path valid.
3.5.6.1. Last Known Good UTC Time
Nodes SHALL maintain a stored Last Known Good UTC Time. This time is used as a fallback for cryptographic credentials expiry enforcement, if all other available time synchronization mechanisms fail.
The last known good UTC time SHALL be updated at commissioning and MAY be updated after a successful time synchronization, or by an embedded time in an OTA. Nodes SHOULD store a Last Known Good UTC Time value to persistent storage at least once a month. A Node’s initial out-of-box Last Known Good UTC time SHALL be the compile-time of the firmware.
A Node MAY adjust the Last Known Good UTC Time backwards if it believes the current Last Known Good UTC Time is incorrect and it has a good time value from a trusted source. The Node SHOULD NOT adjust the Last Known Good UTC to a time before the later of:
-
The build timestamp of its currently running software image
-
The not-before timestamp of any of its operational certificates (see Section 6.4.5, “Node Operational Credentials Certificates”).
If a Node has used the Last Known Good UTC Time, it SHOULD recheck its security materials and existing connections if it later achieves time synchronization.
3.6. Data Confidentiality and Integrity
Symmetric block ciphers are used to provide message security.
All unicast and multicast messages between Nodes requiring protection for confidentiality and integrity with data origin authentication SHALL use Authenticated Encryption with Associated Data (AEAD) as primitive to protect those messages.
Mapping (Version 1.0) |
---|
Data confidentiality and integrity SHALL use the AES-CCM mode as defined in NIST 800-38C with the following parameters:
|
|
3.6.1. Generate and encrypt
Function and description |
---|
byte[lengthInBytes(P) + CRYPTO_AEAD_MIC_LENGTH_BYTES] Crypto_AEAD_GenerateEncrypt( SymmetricKey K, byte[lengthInBytes(P)] P, byte[] A, byte[CRYPTO_AEAD_NONCE_LENGTH_BYTES] N) Performs the generate and encrypt computation on payload |
Mapping (Version 1.0) |
---|
Crypto_AEAD_GenerateEncrypt(K, P, A, N) := byte[lengthInBytes(P) + CRYPTO_AEAD_MIC_LENGTH_BYTES] AES-CCM-GenerateEncrypt(K := K, P := P, A := A, N := N, Tlen := CRYPTO_AEAD_MIC_LENGTH_BITS)
|
3.6.2. Decrypt and verify
Function and description |
---|
{boolean success, byte[lengthInBytes(P)] payload} Crypto_AEAD_DecryptVerify( SymmetricKey K, byte[lengthInBytes(P) + CRYPTO_AEAD_MIC_LENGTH_BYTES] C, byte[] A, byte[CRYPTO_AEAD_NONCE_LENGTH_BYTES] N) Performs the decrypt and verify computation on the combined ciphertext and tag This function has two outcomes:
|
Mapping (Version 1.0) |
---|
Crypto_AEAD_DecryptVerify(K, C, A, N) := {boolean, byte[lengthInBytes(P)]} AES-CCM-DecryptVerify(K := K, C := C, A := A, N := N, Tlen := CRYPTO_AEAD_MIC_LENGTH_BITS)
|
3.7. Message privacy
Message privacy is implemented using a block cipher in CTR mode.
Mapping (Version 1.0) |
---|
Message privacy SHALL use the AES-CTR mode as defined in NIST 800-38A with the following parameters:
|
3.7.1. Privacy encryption
Function and description |
---|
byte[lengthInBytes(M)] Crypto_Privacy_Encrypt( SymmetricKey K, byte[lengthInBytes(M)] M, byte[CRYPTO_PRIVACY_NONCE_LENGTH_BYTES] N) Performs the encryption of the message |
Mapping (Version 1.0) |
---|
Crypto_Privacy_Encrypt(K, M, N) := byte[lengthInBytes(M)] AES-CTR-Encrypt(K := K, P := M, N := N)
|
3.7.2. Privacy decryption
Function and description |
---|
byte[lengthInBytes(C)] Crypto_Privacy_Decrypt( SymmetricKey K, byte[lengthInBytes(C)] C, byte[CRYPTO_PRIVACY_NONCE_LENGTH_BYTES] N) Performs the decryption of |
Mapping (Version 1.0) |
---|
Crypto_Privacy_Decrypt(K, C, N) := byte[lengthInBytes(C)] AES-CTR-Decrypt(K := K, C := C, N := N)
|
3.8. Key Derivation Function (KDF)
Matter specifies the following key derivation function to generate encryption keys.
Function and description |
---|
bit[len] Crypto_KDF( byte[] inputKey, byte[] salt, byte[] info, int len) Returns the key of |
Mapping (Version 1.0) |
---|
Crypto_KDF(inputKey, salt, info, len) := bit[len] KDM(Z := inputKey, OtherInput := {salt := salt, L := len, FixedInfo := info})
|
When multiple keys of the same length are generated by a single KDF call, the following shorthand notation can be used:
Key1 || Key2 || Key3 = Crypto_KDF ( inputKey = inputKeyMaterial, salt = [], info = [], // 3 below matches number of keys expressed in concatenated output len = 3 * CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
This is equivalent to the following:
Keys = Crypto_KDF ( inputKey = inputKeyMaterial, salt = [], info = [], len = 3 * CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
-
Set
Key1
to theCRYPTO_SYMMETRIC_KEY_LENGTH_BITS
most significant bits ofKeys
. -
Set
Key2
to the nextCRYPTO_SYMMETRIC_KEY_LENGTH_BITS
significant bits ofKeys
. -
Set
Key3
to theCRYPTO_SYMMETRIC_KEY_LENGTH_BITS
least significant bits ofKeys
.
3.9. Password-Based Key Derivation Function (PBKDF)
Matter specifies the following password-based key derivation function to compute a derived key from a cryptographically weak password.
Function and description |
---|
bit[len] Crypto_PBKDF( byte[] input, byte[] salt, int iterations, int len) Returns a value of |
Type and description |
---|
STRUCTURE Crypto_PBKDFParameterSet Maintains the set of parameters exchanged between a Commissioner and a Commissionee during their pairing. |
Mapping (Version 1.0) |
---|
|
|
Crypto_PBKDF(input, salt, iterations, len) := bit[len] PBKDF2(P := input, S := salt, C := iterations, kLen := len)
|
Crypto_PBKDFParameterSet => STRUCTURE [ tag-order ] { iterations [1] : UNSIGNED INTEGER [ range 32-bits ], salt [2] : OCTET STRING [ length 16..32 ], }
|
3.10. Password-Authenticated Key Exchange (PAKE)
This protocol uses password-authenticated key exchange (PAKE) for the PASE protocol.
Mapping (Version 1.0) |
---|
Matter uses SPAKE2+ as described in SPAKE2+ as PAKE with:
|
CRYPTO_W_SIZE_BYTES := CRYPTO_GROUP_SIZE_BYTES + 8 CRYPTO_W_SIZE_BITS := CRYPTO_W_SIZE_BYTES * 8 byte w0s[CRYPTO_W_SIZE_BYTES] || byte w1s[CRYPTO_W_SIZE_BYTES] = (byte[2 * CRYPTO_W_SIZE_BYTES]) bit[2 * CRYPTO_W_SIZE_BITS] Crypto_PBKDF(passcode, salt, iterations, 2 * CRYPTO_W_SIZE_BITS) byte w0[CRYPTO_GROUP_SIZE_BYTES] = w0s mod p byte w1[CRYPTO_GROUP_SIZE_BYTES] = w1s mod p where:
|
byte w0s[CRYPTO_W_SIZE_BYTES] || byte w1s[CRYPTO_W_SIZE_BYTES] = (byte[2 * CRYPTO_W_SIZE_BYTES]) bit[2 * CRYPTO_W_SIZE_BITS] Crypto_PBKDF(passcode, salt, iterations, 2 * CRYPTO_W_SIZE_BITS) byte w0[CRYPTO_GROUP_SIZE_BYTES] = w0s mod p byte w1[CRYPTO_GROUP_SIZE_BYTES] = w1s mod p byte L[CRYPTO_PUBLIC_KEY_SIZE_BYTES] = w1 * P where:
|
3.10.3. Computation of transcript TT
Mapping (Version 1.0) |
---|
Crypto_Transcript(PBKDFParamRequest, PBKDFParamResponse, pA, pB) := byte[] TT
Context := Crypto_Hash("Matter PAKE V1 Commissioning" || PBKDFParamRequest || PBKDFParamResponse) TT := lengthInBytes(Context) || Context || 0x0000000000000000 || 0x0000000000000000 || lengthInBytes(M) || M || lengthInBytes(N) || N || lengthInBytes(pA) || pA || lengthInBytes(pB) || pB || lengthInBytes(Z) || Z || lengthInBytes(V) || V || lengthInBytes(w0) || w0
Note the two Note in case |
3.10.4. Computation of cA, cB and Ke
Mapping (Version 1.0) |
---|
Crypto_P2(TT, pA, pB) := {byte cA[CRYPTO_HASH_LEN_BYTES], byte cB[CRYPTO_HASH_LEN_BYTES], byte Ke[CRYPTO_HASH_LEN_BYTES/2]}
|
4. Secure Channel
4.1. General Description
The Secure Channel and Message Layer provides a consistent networking service substrate to allow Nodes to communicate securely with one another.
During commissioning and unicast communication, a discovery mechanism is provided to determine peer IPv6 addresses and operational parameters. Secure session establishment mechanisms are provided using either certificates (CASE) or shared passcodes (PASE).
4.1.1. Messages
Communication is performed using messages. Messages are either secured or unsecured.
Each message has a Session Type and Session ID in order to identify whether it is secured and how it is to be decrypted and authenticated if it is. Each message has a Message Counter field in order to uniquely identify the message for the purposes of security and duplicate detection.
Operational communication is defined as traffic that uses the secured Matter message format between commissioned nodes over an IP transport. All operational communication has message security enabled. Operational communication between Nodes can be either unicast or multicast.
Unsecured communication is strictly limited to:
-
Discovery, which does not use the Matter message format.
-
User Directed Commissioning (UDC), which uses unsecured messages to initiate the commissioning process.
-
Session establishment, which uses unsecured messages to establish a CASE or PASE session.
4.1.1.1. Message Types
Messages are defined as either a control message or data message. Most messages are data messages. Control messages are reserved for internal protocols such as MCSP to initialize security. Both message types are identical in format, but use separate message counter domains so they can operate securely over the same security key.
4.1.1.2. Message Transports
Messages are of finite size and are sent as individual packets over the supported transports:
-
UDP transports each message as a separate datagram. Messages support a basic reliability protocol called MRP for use when the underlying transport (in this case UDP) doesn’t provide such features.
-
TCP transports each message with a length prepended, performing segmentation and reassembly as needed.
-
BTP transports each message over BLE as a separate SDU, performing segmentation and reassembly as needed.
BTP is provided as a transport protocol for commissioning. TCP and MRP (UDP with added reliability) are provided as transport protocols for operational messaging.
4.1.1.3. Message Exchanges
Messages provide an Exchange Layer to track related messages that make up small, discrete transactions. The Exchange Layer provides this transaction tracking facility to the Interaction Model Layer above, providing a means to multiplex multiple such concurrent transactions over a given underlying session. The Exchange Layer also integrates the Message Reliability Protocol (MRP) as a service for use over UDP transports. This Message Layer architecture is shown below in Figure 6, “Message Layer Stack”:
4.2. IPv6 Reachability
This section describes IPv6 network configuration requirements to enable IPv6 reachability between Nodes. As described in Section 2.3, “Network Topology”, a Matter network may be composed of one or more IPv6 networks.
In a single network configuration, all Matter Nodes are attached to the same IPv6 link. A single network configuration may consist of a single bridged Wi-Fi / Ethernet network where all nodes attached to that network are part of the same broadcast domain. When all Matter Nodes are attached to the same Wi-Fi / Ethernet network, link-local IPv6 addressing is sufficient - no additional IPv6 network infrastructure is required.
In a multiple network configuration, a Matter network is composed of (typically one) infrastructure network and one or more stub networks. Unlike an infrastructure network, stub networks do not serve as transit networks. Typically, the infrastructure network is a bridged Wi-Fi / Ethernet network and the Thread networks are stub networks. A stub router connects a stub network to an infrastructure network and provides IPv6 reachability between the two networks.
4.2.1. Stub Router Behavior
A stub router SHALL implement [draft-lemon-stub-networks]. In a multiple network configuration, both the infrastructure and stub networks require routable IPv6 addresses to communicate across networks. A routable IPv6 address SHALL have global scope (e.g. GUA or ULA) [RFC 4007] and SHALL be constructed out of a prefix advertised as on-link. If there is no routable prefix on a given network, the stub router SHALL provide its own routable prefix. Note that Thread’s "on-mesh prefix" is equivalent to Wi-Fi / Ethernet’s "on-link prefix".
Stub routers SHALL advertise reachability to all routable prefixes on the adjacent network. A stub router connecting a Thread network SHALL advertise reachability to all of the Thread network’s routable prefixes to the adjacent infrastructure network using Route Information Options [RFC 4191] contained in Router Advertisements [RFC 4861]. That same stub router SHALL also advertise reachability to all of the infrastructure network’s routable prefixes to the adjacent Thread network in the Thread Network Data [Thread specification].
4.2.2. Matter Node Behavior
Matter Nodes SHALL configure a link-local IPv6 address. In addition, Nodes SHALL support configuration of at least three routable IPv6 addresses (in addition to the link-local and, in the case of Thread, mesh-local addresses). On a Wi-Fi / Ethernet interface, ICMPv6 Router Advertisement (RA) messages advertise prefixes for use on the link [RFC 4861]. On a Thread interface, the Thread Network Data contains prefixes for use on the link [Thread specification]. If a Node receives an on-link prefix that allows autonomous configuration on a given interface and the Node has fewer than three routable IPv6 addresses configured, the Node SHALL autonomously configure an IPv6 address out of that prefix.
Matter Nodes SHALL also configure routes to adjacent networks. On Wi-Fi / Ethernet networks, Nodes SHALL process Route Information Options [RFC 4191] and configure routes to IPv6 prefixes assigned to stub networks via stub routers. Wi-Fi / Ethernet interfaces SHALL support maintaining at least 16 different routes configured using Route Information Options. On Thread networks, Nodes SHALL route according to routing information provided in the Thread Network Data [Thread specification]. Thread devices SHALL support as many routes as can be encoded in the Thread Network Data.
Matter Nodes SHALL support a number of IPv6 neighbor cache entries at least as large as the number of supported CASE sessions plus the number of supported routes.
4.3. Discovery
This section describes Service Advertising and Discovery for Matter.
Service Advertising and Discovery is used within Matter in the following contexts:
-
Commissionable Node Discovery
-
Operational Discovery
-
Commissioner Discovery
-
User Directed Commissioning
Service Advertising and Discovery for Matter uses IETF Standard DNS-Based Service Discovery (DNS‑SD) [RFC 6763]. Matter requires no modifications to IETF Standard DNS‑SD.
Using DNS‑SD means that both the unicast IPv6 address and port of the offered service are discovered, freeing Matter from requiring a single preallocated fixed port. This also makes it possible to run multiple instances of Matter software on a single device, because each instance has its own dynamically allocated port, instead of conflicting over attempting to use the same preallocated fixed port.
On Wi‑Fi and Ethernet networks today, DNS‑SD [RFC 6763] uses Multicast DNS [RFC 6762] for zero-configuration operation.
Since Matter protocols must support IPv6 at a minimum, Matter software discovering other Matter instances SHALL process DNS AAAA (IPv6 address) records, but also MAY process DNS A (IPv4 address) records.
Because of this, where feasible in the underlying service discovery API, Matter software advertising the availability of a service SHOULD indicate that announcements and answers for this service need include only IPv6 address records, not IPv4 address records. On a general-purpose dual-stack host that supports both IPv4 and IPv6, this can be achieved by having Matter-related SRV records reference a Matter-specific target hostname that has only IPv6 address records attached. This allows a general-purpose dual-stack host to offer discoverable IPv4 addresses for legacy client software that still requires IPv4, while offering optimized IPv6-only address discovery for Matter purposes.
Similarly, since Matter does not use IPv4, Matter software discovering other Matter instances SHOULD NOT expect any IPv4 addresses included in responses.
These two items address the content of service discovery messages. When using Multicast DNS similar efficiency questions arise related to the delivery of those service discovery messages, sent over IPv4, IPv6, or both.
Where supported in the underlying service discovery API, Matter software using Multicast DNS to advertise the availability of a service SHOULD indicate that announcements and answers for this service need only be performed over IPv6.
Similarly, where supported in the underlying service discovery API, Matter application software using Multicast DNS to issue service discovery queries SHOULD indicate that these queries need only be performed over IPv6.
These optimizations reduce both the size and the number of multicast packets, which is particularly beneficial on Wi‑Fi networks. A Matter device that only supports IPv6 gets these optimizations automatically, simply by virtue of not supporting IPv4 at all.
For Thread mesh networks, where excessive use of multicast would be detrimental [RFC 7558], DNS‑SD uses Unicast DNS instead, leveraging capabilities of the Thread Service Registry on the Thread Border Router [draft-lemon-stub-networks].
Conceptually, the DNS‑SD [RFC 6763] information being communicated is identical to when Multicast DNS [RFC 6762] is being used, except that the information is communicated in unicast packets to and from a designated Service Registry, rather than being communicated in multicast packets to and from every other node in the same broadcast domain.
Using Service Registration Protocol [SRP] and an Advertising Proxy [AdProx] running on the Thread Border Router, Matter Nodes on a Thread mesh can be discovered by other Matter Nodes on an adjacent Ethernet or Wi‑Fi link, without the cost of using multicast on the Thread mesh. All Thread-connected Matter Nodes SHALL implement Service Registration Protocol.
Thread Border Routers advertise available SRP servers in the Thread Network Data [Thread specification]. Thread devices SHALL register their services using an available SRP server [Thread specification].
When Matter Nodes issue short-lived requests to other Matter Nodes, the response is sent back to the source IPv6 address and port of the request. When Matter Nodes issue long-lived requests to other Matter Nodes, by the time the response is generated the requester may have changed IPv6 address or port, so the responder may have to discover the current IPv6 address and port of the initiator in order to send the response.
A Thread Border Router SHALL implement DNS‑SD Discovery Proxy [RFC 8766] to enable clients on the Thread mesh (e.g., other Nodes) to discover services (e.g., Matter Nodes) advertised using Multicast DNS on an adjacent Ethernet or Wi‑Fi link, also without the cost of using multicast on the Thread mesh [draft-lemon-stub-networks]. For short-lived instantaneous queries, these queries can be performed using unicast DNS over UDP to the DNS‑SD Discovery Proxy. For long-lived queries with ongoing change notification, DNS Push Notifications [RFC 8765] with DNS Stateful Operations [RFC 8490] allows clients on the Thread mesh to be notified of changes to the set of discovered services without expensive polling.
In principle, the Thread mesh Service Registry can be run on any capable Node(s) within (or even outside) the Thread mesh, though in practice the Thread Border Router is an attractive candidate to offer the Service Registry. Thread Border Router devices are typically AC-powered, and typically have more capable CPUs with greater flash storage and RAM than more constrained battery-powered Thread Nodes. Matter devices on Thread are dependent on Thread providing reliable service for those Thread devices on the Thread mesh. This is similar to how Matter devices on Wi‑Fi are dependent on the Wi‑Fi access point (AP) providing reliable service for those Wi‑Fi devices using that Wi‑Fi access point.
4.3.1. Commissionable Node Discovery
The Matter protocol family supports UDP and TCP for Matter commissioning of Commissionees already on the customer’s IP network (such as Ethernet-connected Nodes, or Wi‑Fi Nodes already associated to the Wi‑Fi network via other means), and for the commissioning of Commissionees in conjunction with Wi‑Fi Soft-AP (for Wi‑Fi Nodes not already on the customer’s IP network, when the Node does not support Matter commissioning using BLE).
For these Commissionees, Matter Commissionable Node Discovery is performed using IETF Standard DNS-Based Service Discovery (DNS‑SD) [RFC 6763] as described below.
For Matter Commissionable Node Discovery
in the already-on-network and Soft-AP cases,
the DNS‑SD instance name SHALL be a dynamic,
pseudo-randomly selected, 64-bit temporary unique identifier,
expressed as a fixed-length sixteen-character hexadecimal string,
encoded as ASCII (UTF-8) text
using capital letters, e.g., DD200C20D25AE5F7
.
A new instance name SHALL be selected when the Node boots.
A new instance name SHALL be selected whenever the Node enters Commissioning mode.
A new instance name MAY be selected at other times, as long as the instance name does not change while the Node is in commissioning mode.
When a Node receives either the OpenCommissioningWindow or the OpenBasicCommissioningWindow command, the Node SHALL only beacon on the IP network using the relevant DNS-SD properties described below.
The Matter Commissionable Node Discovery DNS‑SD instance name
SHALL be unique within the namespace of the local network
(the .local
link-local namespace
of the Ethernet and Wi‑Fi links [RFC 6762],
or the unicast domain selected by the Thread Border Router
for devices on the Thread mesh).
In the rare event of a collision in the selection of the 64-bit temporary unique identifier, the existing DNS‑SD name conflict detection mechanism will detect this collision, and a new pseudo-randomly selected 64-bit temporary unique identifier SHALL be generated by the Matter Commissionee that is preparing for commissioning. Name conflict detection is described in Section 9 ("Conflict Resolution") of the Multicast DNS specification [RFC 6762] and Section 2.4.3.1 ("Validation of Adds") of the Service Registration Protocol specification [SRP].
The DNS‑SD service type [RFC 6335] for Matter Commissionable Node Discovery
is _matterc._udp
.
For link-local Multicast DNS
the service domain SHALL be local
.
For Unicast DNS such as used on Thread
the service domain SHALL be
as configured automatically by the Thread Border Router.
4.3.1.1. Host Name Construction
For DNS‑SD a target host name is required,
in addition to the instance name.
The target host name SHALL be constructed using one of the
available link-layer addresses,
such as a 48-bit device MAC address (for Ethernet and Wi‑Fi)
or a 64-bit MAC Extended Address (for Thread)
expressed as a fixed-length twelve-character
(or sixteen-character) hexadecimal string,
encoded as ASCII (UTF-8) text
using capital letters, e.g., B75AFB458ECD.<domain>
.
In the event that a device performs MAC address randomization
for privacy, then the target host name SHALL use the
privacy-preserving randomized version and the hostname SHALL
be updated in the record every time the underlying link-layer address rotates.
Note that it is legal to reuse the same hostname on
more than one interface, even if the underlying link-layer address
does not match the hostname on that interface, since the
goal of using a link-layer address is to ensure local uniqueness
of the generated hostname.
If future link layers are supported by Matter that do
not use 48-bit MAC addresses or 64-bit MAC Extended Address identifiers,
then a similar rule will be defined for those technologies.
4.3.1.2. Extended Discovery
A Matter Commissionee that advertises Commissionable Node Discovery service records is not necessarily in a state that will allow Commissioning (this state is referred to below as "in Commissioning Mode"). While Section 5.4.2.3, “Announcement Duration” is limited for some forms of device advertisement, a Matter device MAY advertise Matter Commissionable Node Discovery service records for longer periods, possibly permanently. Advertising Commissionable Node Discovery when not in Commissioning Mode is referred to here as Extended Discovery. Extended Discovery is allowed only for DNS-SD advertisements and not for the other forms of Device Discovery such as BLE Commissioning Discovery and Wi-Fi Temporary Access Point Commissioning Discovery.
To protect customer privacy on public networks, a Matter Commissionee SHALL provide a way for the customer to set a timeout on Extended Discovery, or otherwise disable Extended Discovery. The default behavior for Commissionable Node Discovery SHOULD default to limiting announcement as defined in Section 5.4.2.3, “Announcement Duration” unless the Manufacturer wishes to enable longer periods for specific use cases.
4.3.1.3. Commissioning Subtypes
The following subtypes for Matter Commissionable Node Discovery are defined:
-
_L<dddd>
, where<dddd>
provides the full 12-bit discriminator, encoded as a variable-length decimal number in ASCII text, omitting any leading zeroes. -
_S<dd>
, where<dd>
provides the upper 4 bits of the discriminator, encoded as a variable-length decimal number in ASCII text, omitting any leading zeroes. -
_V<ddddd>
, where<ddddd>
provides the 16-bit Vendor ID, encoded as a variable-length decimal number in ASCII text, omitting any leading zeroes. -
_T<ddd>
, where<ddd>
provides the device type identifier for the device, encoded as a variable-length decimal number in ASCII (UTF-8) text, omitting any leading zeroes. In case the device combines multiple device types, the manufacturer SHOULD choose the device type identifier of the primary function of the device for which the device wishes to be discoverable. -
_CM
, which represents "currently in Commissioning Mode" (due to any method, for example, a factory new device that has just been put into commissioning mode by the user, or an already-commissioned device which has just received the Open Commissioning Window command).
The long discriminator subtype (e.g., _L840
)
enables filtering of results
to find only Commissionees that match the full discriminator code,
as provided in the onboarding payload.
The short discriminator subtype (e.g., _S3
)
enables filtering of results
to find only Commissionees that match the upper 4 bits of the discriminator code,
as provided in the manual pairing code.
The optional Vendor ID subtype (e.g., _V123
)
enables a vendor-specific app to achieve
filtering of results to find only Nodes that match that Vendor ID.
The Commissioning Mode subtype (e.g., _CM
)
enables filtering of results
to find only Nodes that are currently in Commissioning Mode.
Note that the subtype is _CM
regardless of whether the TXT record for commissioning mode is set to 1 (CM=1
) or 2 (CM=2
).
A Commissionee that is not in commissioning mode (CM=0
) SHALL NOT publish this subtype.
The optional device type subtype (e.g., _T10
)
enables filtering of results
to find only Nodes that match the device type,
generally used for the User-Initiated Beacon Detection, Not Yet Commissioned Device
and the User-Initiated Beacon Detection, Already Commissioned Device
use cases.
In the event that a vendor-specific app wishes to show the user only some of that vendor’s Commissionees awaiting commissioning but not all of them, any desired filtering logic (based upon arbitrary criteria, not only Product ID) MAY be implemented within that vendor’s proprietary commissioning app.
4.3.1.4. TXT Records
After discovery, IPv6 addresses are returned in the AAAA records and key/value pairs are returned in the DNS‑SD TXT record.
Nodes SHALL publish AAAA records for all available IPv6 addresses upon which they are willing to accept Matter commissioning messages.
TXT records available for Commissionable Node Discovery include the common TXT record key/value pairs defined in Section 4.3.4, “Common TXT Key/Value Pairs”.
Commissioners SHALL silently ignore TXT record keys that they do not recognize. This is to facilitate future evolution of this specification without breaking backwards compatibility with existing Commissioners that do not implement the new functionality.
The following subsections describe key/value pairs that are defined specifically for Commissionable Node discovery.
4.3.1.5. TXT key for discriminator (D
)
The key D
SHALL provide the full 12-bit discriminator for the Commissionable
Node and SHALL be present in the DNS-SD TXT record.
The discriminator value SHALL be encoded as a variable-length decimal number in ASCII text, with up to four digits, omitting any leading zeroes.
Any key D
with a value mismatching the aforementioned format
SHALL be silently ignored.
As an example, value D=840
would indicate that this Commissionable Node
has decimal long discriminator 840
.
When needed, the upper 4 bits of the discriminator
provided by the manual pairing code can be
algorithmically derived from the full discriminator.
4.3.1.6. TXT key for Vendor ID and Product ID (VP
)
The optional key VP
, if present, MAY provide Vendor ID and Product ID information of the device.
A vendor MAY choose not to include it at all, for privacy reasons.
If the VP
key is present then it MAY take two forms:
-
VP=123
gives Vendor ID -
VP=123+456
gives Vendor ID + Product ID
The Vendor ID and Product ID SHALL both be expressed as variable-length decimal numbers, encoded as ASCII text, omitting any leading zeroes, and of maximum length of 5 characters each to fit their 16-bit numerical range.
If the Product ID is present, it SHALL be separated from the Vendor ID using a ‘+’ character.
If the VP
key is present without a Product ID,
the value SHALL contain only the Vendor ID alone, with no ‘+’ character.
If the VP
key is present, the value SHALL contain at least the Vendor ID.
If the VP
key is present, it SHALL NOT have a missing or empty value.
4.3.1.7. TXT key for commissioning mode (CM
)
The key CM
(Commissioning Mode) SHALL indicate whether or not the publisher of the record
is currently in Commissioning Mode and available for immediate commissioning.
When in commissioning mode, the value associated with the CM
key indicates the source of the passcode.
Four situations are legal:
-
The absence of key
CM
SHALL imply a value of 0 (CM=0
). -
The key/value pair
CM=0
SHALL indicate that the publisher is not currently in Commissioning Mode. -
The key/value pair
CM=1
SHALL indicate that the publisher is currently in Commissioning Mode and requires use of a passcode for commissioning provided by the Commissionee (e.g., printed on a label or displayed on screen), such as when the device is in a factory-new state or when the Open Basic Commissioning Window command has been used to enter commissioning mode. -
The key/value pair
CM=2
SHALL indicate that the publisher is currently in Commissioning Mode and requires use of a dynamically generated passcode for commissioning corresponding to the verifier that was passed to the device using the Open Commissioning Window command.
A key value of 2 MAY be used to disambiguate collisions of discriminators between uncommissioned Nodes and commissioned Nodes announcing after a commissioning window was opened. A key value of 2 serves as a hint to Commissioners to possibly expect multiple Nodes with the same discriminator (see Commissioning Discriminator), and to instruct the user to enter the Onboarding Payload presented by another Administrator rather than a code provided by the Commissionee.
Since Extended Discovery can be disabled by the customer, a key value of 0 may not ever be returned by a publisher. When Extended Discovery is disabled and the publisher is not in commissioning mode, then the publisher will not respond to Commissionable Node Discovery.
4.3.1.8. TXT key for device type (DT
)
The optional key DT
MAY provide the publisher’s
primary device type (see Section 11.22.5.3, “DeviceTypeID”).
In case the device combines multiple device types, the manufacturer SHOULD choose the device type identifier of the primary function of the device for which the device wishes to be discoverable.
If present, it SHALL be encoded as a variable-length
decimal number in ASCII text, omitting any leading zeroes.
For example, the DT=10
key/value pair would indicate that the primary device type is 10 (0x000a),
which is the device type identifier for a Door Lock.
4.3.1.9. TXT key for device name (DN
)
The optional key DN
MAY provide a device advertisement name.
If present, it SHALL be encoded as a valid UTF-8 string with a maximum length of 32 bytes
(matching the maximum length of the NodeLabel string in the Basic Information Cluster).
When provided, the source of this value SHALL be editable by the user with use clearly designated as being for on-network advertising and MAY be the value stored in the NodeLabel attribute of the Basic Information Cluster) of the Node.
To protect customer privacy on public networks, if a Commissionee supports this key/value pair, then the Commissionee SHALL provide a way for the customer to disable its inclusion.
A Commissionee SHOULD NOT include this field unless doing so for specific use cases which call for it.
For example, the DN=Living Room
key/value pair indicates that the advertisement name
specified by the user is 'Living Room'.
4.3.1.10. TXT key for rotating device identifier (RI
)
The optional key RI
MAY provide a Rotating Device Identifier.
If present, the value associated with the RI
key SHALL
contain the octets of the Rotating Device Identifier octet string encoded as the
concatenation of each octet’s value as a 2-digit uppercase hexadecimal number.
The resulting ASCII string SHALL NOT be longer than 100 characters, which implies a Rotating Device Identifier of at most 50 octets.
4.3.1.11. TXT key for pairing hint (PH
)
The optional key PH
MAY provide a pairing hint.
If present, it SHALL be encoded as a variable-length decimal number in ASCII text, omitting any leading zeroes.
The pairing hint represents a base-10 numeric value for a bitmap of methods supported by the Commissionee in its current state for putting it in Commissioning Mode.
For example, the PH=5
key/value pair
represents a hint value with bits 0 and 2 are set.
This value MAY change during the lifecycle of the device.
For example, a device may have a value with bit 0 (Power Cycle) set and bit 2 (Administrator app) unset when in a factory reset state, and then have a value with bit 0 unset and bit 2 set after it has been Commissioned.
The bitmap of methods is defined in Table 6, “Pairing Hint Values”.
If the Commissionee has enabled Extended Discovery,
then it SHALL include the key/value pair for PH
in the DNS‑SD TXT record
when not in Commissioning Mode (CM=0
).
This key/value pair MAY be returned when in Commissioning Mode (CM=1
).
If the Commissioner does not recognize this value, for example, if the value indicates bit indices defined in a newer version of this specification than the version which the Commissioner implements, then the Commissioner MAY utilize the bits that it does understand and MAY utilize additional data sets available for assisting the user. For example, when a Vendor ID and Product ID are available to the Commissioner, the Section 11.22, “Distributed Compliance Ledger” may also provide a URL for the Device User Guide which can contain additional information to help in Commissioning this Commissionee.
Some of the pairing hints MAY require additional information to be
encoded for proper expression of their meaning. This is accomplished
with the PI
TXT key, described in a following section.
Dependency on usage of the PI
key is expressed by the PI Dependency
column
in the table below.
The following fields in the bitmap are currently defined for values of the PH
key:
Bit index | Name | PI Dependency | Description |
---|---|---|---|
0 |
Power Cycle |
False |
The Device will automatically enter Commissioning Mode upon power cycle (unplug/re-plug, remove/re-insert batteries). This bit SHALL be set to 1 for devices using Standard Commissioning Flow, and set to 0 otherwise. |
1 |
Device Manufacturer URL |
False |
This SHALL be set to 1 for devices requiring Custom Commissioning Flow before they can be available for Commissioning by any Commissioner. For such a flow, the user SHOULD be sent to the URL specified in the |
2 |
Administrator |
False |
The Device has been commissioned. Any Administrator that commissioned the device provides a user interface that may be used to put the device into Commissioning Mode. |
3 |
Settings menu on the Node |
False |
The settings menu on the Device provides instructions to put it into Commissioning Mode. |
4 |
Custom Instruction |
True |
The PI key/value pair describes a custom way to put the Device into Commissioning Mode. This Custom Instruction option is NOT recommended for use by a Device that does not have knowledge of the user’s language preference. |
5 |
Device Manual |
False |
The Device Manual provides special instructions to put the Device into Commissioning Mode (see Section 11.22.5.8, “UserManualUrl”). This is a catch-all option to capture user interactions that are not codified by other options in this table. |
6 |
Press Reset Button |
False |
The Device will enter Commissioning Mode when reset button is pressed. |
7 |
Press Reset Button with application of power |
False |
The Device will enter Commissioning Mode when reset button is pressed when applying power to it. |
8 |
Press Reset Button for N seconds |
True |
The Device will enter Commissioning Mode when reset button is pressed for N seconds. The exact value of N SHALL be made available via PI key. |
9 |
Press Reset Button until light blinks |
True |
The Device will enter Commissioning Mode when reset button is pressed until associated light blinks. Information on color of light MAY be made available via PI key (see Note 1). |
10 |
Press Reset Button for N seconds with application of power |
True |
The Device will enter Commissioning Mode when reset button is pressed for N seconds when applying power to it. The exact value of N SHALL be made available via PI key. |
11 |
Press Reset Button until light blinks with application of power |
True |
The Device will enter Commissioning Mode when reset button is pressed until associated light blinks when applying power to the Device. Information on color of light MAY be made available via PI key (see Note 1). |
12 |
Press Reset Button N times |
True |
The Device will enter Commissioning Mode when reset button is pressed N times with maximum 1 second between each press. The exact value of N SHALL be made available via PI key. |
13 |
Press Setup Button |
False |
The Device will enter Commissioning Mode when setup button is pressed. |
14 |
Press Setup Button with application of power |
False |
The Device will enter Commissioning Mode when setup button is pressed when applying power to it. |
15 |
Press Setup Button for N seconds |
True |
The Device will enter Commissioning Mode when setup button is pressed for N seconds. The exact value of N SHALL be made available via PI key. |
16 |
Press Setup Button until light blinks |
True |
The Device will enter Commissioning Mode when setup button is pressed until associated light blinks. Information on color of light MAY be made available via PI key (see Note 1). |
17 |
Press Setup Button for N seconds with application of power |
True |
The Device will enter Commissioning Mode when setup button is pressed for N seconds when applying power to it. The exact value of N SHALL be made available via PI key. |
18 |
Press Setup Button until light blinks with application of power |
True |
The Device will enter Commissioning Mode when setup button is pressed until associated light blinks when applying power to the Device. Information on color of light MAY be made available via PI key (see Note 1). |
19 |
Press Setup Button N times |
True |
The Device will enter Commissioning Mode when setup button is pressed N times with maximum 1 second between each press. The exact value of N SHALL be made available via PI key. |
Note 1: When the PH
key indicates a light to blink (one or more of bits 9, 11, 16 or 18 is set),
information on color of light MAY be made available via PI
key.
When using such color indication in PI
key,
only basic primary and secondary colors that could unambiguously be decoded
by a commissioner and understood by an end-user, but without worry of localization,
SHOULD be used, e.g. white, red, green, blue, orange, yellow, purple.
Note 2: Any undefined values are reserved for future use.
Note 3: A Commissionee can indicate multiple ways of being put into Commissioning Mode by setting multiple bits in the bitmap at the same time. However, only one method can be specified which has a dependency on the PI key (PI Dependency=True) at a time.
For example:
-
A
PH
value of 33 (bits 0 and 5 are set) indicates that the user can cause the Commissionee to enter Commissioning Mode by either power cycling it or by following special instructions provided in the Device Manual. -
A
PH
value of 9 (bits 0 and 3 are set) indicates that the user can cause the Commissionee to enter Commissioning Mode by either power cycling it or going to the settings menu and following instructions there. -
A
PH
value of 1 (bit 0 is set) indicates that the user can cause the Commissionee to enter Commissioning Mode only by power cycling it. -
A
PH
value of 16 (bit 4 is set) indicates that the user can cause the Commissionee to enter Commissioning Mode following a custom procedure described by the value of the PI key. -
A
PH
value of 256 (bits 8 is set) indicates that the user can cause the Commissionee to enter Commissioning Mode by pressing the reset button for a duration of time in seconds specified via by the value of the PI key.
When the PH
key is provided,
at least one bit in the above bitmap SHALL be set. That is, a PH
value of 0 is
undefined and illegal.
When the PH
key is provided,
the Commissioner SHOULD take its value into account when providing guidance to the user
regarding steps required to put the Commissionee into Commissioning Mode.
4.3.1.12. TXT key for pairing instructions (PI
)
The optional key PI
MAY give the pairing instruction.
If present, the value SHALL be encoded as a valid UTF-8 string with a maximum length of 128 bytes.
The meaning of this key is dependent upon the PH
key value, see Table 6, “Pairing Hint Values”.
For example, given PH=256
, bit 8 is set which indicates "Press Reset Button for N seconds". Therefore, a value of PI=10
would indicate that N is 10 in that context.
When bit 4 of the value expressed by the PH
key is set, indicating presence of a custom string,
the Commissionee SHALL be responsible for localization (translation to user’s preferred language)
as required using the Device’s currently configured locale. The Custom Instruction option is NOT recommended for use by a Commissionee that does not have knowledge of the user’s language preference.
It is RECOMMENDED to keep the length of PI field small and adhere to the guidance given in section 6.2 of [RFC 6763].
This key/value pair SHALL only be returned in the DNS‑SD TXT record if
the PH
bitmap value has a bit set which has PI Dependency = True
, see Table 6, “Pairing Hint Values”. The PH
key SHALL NOT not have more than one bit set which has a dependency on the PI
key (PI Dependency = True
) to avoid ambiguity in PI
key usage.
4.3.1.13. Examples
The examples below simulate a Node in commissioning mode advertising its availability for commissioning.
Examples are shown using both the dns-sd
command-line test tool and the avahi
command-line test tool. The dns-sd
command-line test tool is included in all versions of macOS. It is installed as a DOS command with Bonjour for Windows, and is available on Linux by installing the mDNSResponder package. The Avahi package of command line tools is available from the Avahi project for most Linux distributions.
These examples are given for illustrative purposes only. Real Matter Commissionees and Commissioners would not use a command-line test tool for advertising and discovery. Real Matter Commissionees and Commissioners would use the appropriate DNS‑SD APIs in their respective chosen programming languages.
Consider a device on Wi-Fi using the 48-bit device MAC address of B75AFB458ECD
as its host name and a value of DD200C20D25AE5F7
as its commissionable service instance name. DNS-SD records for it can be set up as follows:
dns-sd -R DD200C20D25AE5F7 _matterc._udp,_S3,_L840,_CM . 11111 D=840 CM=2
or
avahi-publish-service --subtype=_S3._sub._matterc._udp --subtype=_L840._sub._matterc._udp DD200C20D25AE5F7 --subtype=_CM._sub._matterc._udp _matterc._udp 11111 D=840 CM=2
-
Short discriminator is filterable through
_S3
subtype and algorithmically throughD=840
TXT key. -
Long discriminator is filterable through
_L840
subtype and directly throughD=840
TXT key. -
The Commissionee is currently in Commissioning Mode after an Administrator having opened a commissioning window (see Section 4.3.1.7, “TXT key for commissioning mode (
CM
)”), as shown byCM=2
TXT key and availability by browsing the_CM
subtype.-
Had the Commissionee been discoverable for initial commissioning rather than subsequent additional commissioning, a
CM=1
TXT key would have been published instead.
-
Avahi only sends a single AAAA record. To force the link-local address to be used, use avahi-publish-address. For example:
avahi-publish-address B75AFB458ECD.local fe80::f515:576f:9783:3f30
The DNS‑SD service registration commands shown above results in the creation of the following Multicast DNS records:
_matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
_S3._sub._matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
_L840._sub._matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
_CM._sub._matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
DD200C20D25AE5F7._matterc._udp.local. SRV 0 0 11111 B75AFB458ECD.local.
DD200C20D25AE5F7._matterc._udp.local. TXT "D=840" "CM=2"
B75AFB458ECD.local. AAAA fe80::f515:576f:9783:3f30
Consider a device on Wi-Fi using the 48-bit device MAC address of B75AFB458ECD as its host name. DNS-SD records for it can be set up as follows, when it is in Commissionable Node Discovery.
dns-sd -R DD200C20D25AE5F7 _matterc._udp,_S3,_L840,_V123,_CM,_T81 . 11111 D=840 VP=123+456 CM=2 DT=81 DN="Kitchen Plug" PH=256 PI=5
or
avahi-publish-service --subtype=_S3._sub._matterc._udp --subtype=_L840._sub._matterc._udp --subtype=_V123._sub._matterc._udp --subtype=_CM._sub._matterc._udp --subtype=_T81._sub._matterc._udp DD200C20D25AE5F7 _matterc._udp 11111 D=840 VP=123+456 CM=2 DT=81 DN="Kitchen Plug" PH=256 PI=5
-
Short discriminator is
3
, long discriminator is840
. -
Vendor ID is
123
, Product ID is456
. -
Commissioning Mode is
2
, indicating the Commissionee is currently in Commissioning Mode due to the Open Commissioning Window command. -
Device type is
81
which is a Smart Plug (Device Type Identifier 0x0051). -
Device name is
Kitchen Plug
. -
Pairing hint is
256
which indicates that the Commissionee’s reset button must be held down for 5 seconds to enter Commissioning Mode where the value 5 is obtained by reading the value of the PI key. -
Pairing instruction is
5
.
Avahi only sends a single AAAA record. To force the link-local address to be used, use avahi-publish-address. For example:
avahi-publish-address B75AFB458ECD.local fe80::f515:576f:9783:3f30
The DNS‑SD service registration commands shown above results in the creation of the following Multicast DNS records:
_matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
_S3._sub._matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
_L840._sub._matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
_V123._sub._matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
_CM._sub._matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
_T81._sub._matterc._udp.local. PTR DD200C20D25AE5F7._matterc._udp.local.
DD200C20D25AE5F7._matterc._udp.local. TXT "D=840" "VP=123+456" "CM=1" "DT=81" "DN=Kitchen Plug" "PH=256" "PI=5"
DD200C20D25AE5F7._matterc._udp.local. SRV 0 0 11111 B75AFB458ECD.local.
B75AFB458ECD.local. AAAA fe80::f515:576f:9783:3f30
The port number 11111 is given here purely as an example. One of the benefits of using DNS‑SD is that services are not constrained to use a single predetermined well-known port. The port, along with the IPv6 address, is discovered by Commissioners at run time.
A Commissioner can discover all available Commissionees awaiting commissioning:
dns-sd -B _matterc._udp
or
avahi-browse _matterc._udp -r
A Commissioner can discover Commissionees awaiting commissioning with short discriminator 3:
dns-sd -B _matterc._udp,_S3
or
avahi-browse _S3._sub._matterc._udp -r
A Commissioner can discover Commissionees awaiting commissioning with long discriminator 840:
dns-sd -B _matterc._udp,_L840
or
avahi-browse _L840._sub._matterc._udp -r
A Commissioner can discover Commissionees awaiting commissioning with Vendor ID 123:
dns-sd -B _matterc._udp,_V123
or
avahi-browse _V123._sub._matterc._udp -r
A Commissioner can discover all Commissionees in commissioning mode:
dns-sd -B _matterc._udp,_CM
or
avahi-browse _CM._sub._matterc._udp -r
A commissioner can discover Matter Nodes with Device Type 81:
dns-sd -B _matterc._udp,_T81
or
avahi-browse _T81._sub._matterc._udp -r
A Commissioner can discover Nodes
that are currently in Commissioning Mode as a result of a commissioning window opened by a current Administrator as a result of invoking either the Open Commissioning Window command or the Open Basic Commissioning Window command, using the presence of the _CM
subtype as a browsing filter:
dns-sd -B _matterc._udp,_CM
or
avahi-browse _CM._sub._matterc._udp -r
4.3.1.14. Efficiency Considerations
Discovering and using an offered service on the network typically involves several steps:
-
Enumeration of instances available on the network ("browsing")
-
Lookup of a selected instance’s port number, host name, and other additional information, communicated in DNS‑SD using SRV and TXT records ("resolving")
-
Lookup of the IPv6 address(es) associated with the desired target host.
-
Use of IPv6 Neighbor Discovery and/or IPv6 routing to translate from destination IPv6 address to the next-hop link-layer address for that communication.
-
Establishing a cryptographically secure communication channel between the two endpoints, and then engaging in useful communication.
Although the first three steps are exposed in some APIs as separate steps, at a protocol level they usually require only a single network round-trip. When a PTR query is issued to discover service instances, the usual DNS Additional Record mechanism, where packet space permits, automatically places the related SRV, TXT, and address records into the Additional Record section of the reply. These additional records are stored by the client, to enable subsequent steps in the sequence to be performed without additional redundant network operations to learn the same information a second time.
DNS‑SD over Multicast DNS works by receiving replies from other Nodes attached to the same local link, Nodes that may have been previously completely unknown to the requester. Because of this, Multicast DNS, like IPv6 Neighbor Discovery, does not have any easy way to distinguish genuine replies from malicious or fraudulent replies. Consequently, application-layer end-to-end security is essential. Should a malicious device on the same local link give deliberately malicious or fraudulent replies, the misbehavior will be detected when the device is unable to establish a cryptographically secure application-layer communication channel. This reduces the threat to a Denial-of-Service attack, which can be remedied by physically removing the offending device.
4.3.2. Operational Discovery
For Matter Nodes that have already been commissioned onto a Matter Fabric, run-time dynamic discovery of operational Matter Nodes is used, rather than assuming a fixed unchanging IPv6 address and port for the lifetime of the product. This is done to allow for greater flexibility, so that the underlying IPv6 network can grow and evolve over time as needed without breaking Matter functionality. This is the same reason that other networked consumer electronics products do not assume a single fixed unchanging IP address for the lifetime of the product [RFC 5505].
4.3.2.1. Operational Instance Name
For Matter operational discovery the DNS‑SD instance name is
constructed from a 64-bit compressed Fabric identifier, and
a 64-bit Node identifier, as assigned by the commissioner,
each expressed as a fixed-length sixteen-character hexadecimal string,
encoded as ASCII (UTF-8) text using capital letters,
separated by a hyphen.
For example,
a Matter Node with
Matter compressed fabric identifier 2906-C908-D115-D362
and
Matter Node identifier 8FC7-7724-01CD-0696
has Matter operational discovery DNS‑SD instance name
2906C908D115D362-8FC7772401CD0696
.
The Matter operational discovery DNS‑SD instance name
needs to be unique within the namespace of the local network
(the .local
link-local namespace
of the Ethernet and Wi‑Fi links [RFC 6762],
or the unicast domain selected by the Thread Border Router
for devices on the Thread mesh).
This uniqueness is assumed to be guaranteed by
appropriate selection of a unique Matter fabric identifier
and unique Node identifier within that Matter fabric.
4.3.2.2. Compressed Fabric Identifier
In order to reduce the very large size of a full Fabric Reference which would need to be used as the scoping construct in the instance name, a 64-bit compressed version of the full Fabric Reference SHALL be used. The computation of the Compressed Fabric Identifier SHALL be as follows:
byte CompressedFabricInfo[16] = /* "CompressedFabric" */ {0x43, 0x6f, 0x6d, 0x70, 0x72, 0x65, 0x73, 0x73, 0x65, 0x64, 0x46, 0x61, 0x62, 0x72, 0x69, 0x63} CompressedFabricIdentifier = Crypto_KDF( inputKey := TargetOperationalRootPublicKey, salt:= TargetOperationalFabricID, info := CompressedFabricInfo, len := 64)
Where:
-
TargetOperationalRootPublicKey
is the raw uncompressed elliptical curve public key of the root certificate for the advertised Node’s Operational Certificate chain, without any format marker prefix byte (i.e. after removing the first byte of theec-pub-key
field in the Operational Certificate’s root). -
TargetOperationalFabricID
is the octet string for the Fabric ID as it appears in the advertised Node’s Operational Certificate'ssubject
field, under the 1.3.6.1.4.1.37244.1.5 RDN, that is, a 64-bit unsigned integer scalar in big-endian byte order.
For example, if the root public key for a given Operational Certificate chain containing the identity to be advertised were the following:
pub: 04:4a:9f:42:b1:ca:48:40:d3:72:92:bb:c7:f6:a7:e1: 1e:22:20:0c:97:6f:c9:00:db:c9:8a:7a:38:3a:64:1c: b8:25:4a:2e:56:d4:e2:95:a8:47:94:3b:4e:38:97:c4: a7:73:e9:30:27:7b:4d:9f:be:de:8a:05:26:86:bf:ac: fa
Then the value for TargetOperationalRootPublicKey
to use in the derivation of the
compressed Fabric Identifier would be without the leading 04
:
4a:9f:42:b1:ca:48:40:d3:72:92:bb:c7:f6:a7:e1:1e: 22:20:0c:97:6f:c9:00:db:c9:8a:7a:38:3a:64:1c:b8: 25:4a:2e:56:d4:e2:95:a8:47:94:3b:4e:38:97:c4:a7: 73:e9:30:27:7b:4d:9f:be:de:8a:05:26:86:bf:ac:fa
If using the above TargetOperationalRootPublicKey
and a TargetOperationalFabricID
value of 0x2906_C908_D115_D362 (octet string 29:06:c9:08:d1:15:d3:62
in big-endian), then the
CompressedFabricIdentifier
to use in advertising would be
87E1B004E235A130
(octet string 87:e1:b0:04:e2:35:a1:30
).
4.3.2.3. Operational Service Type
The DNS‑SD service type [RFC 6335] for Matter Operational Discovery
is _matter._tcp
.
Note that the string _tcp
is boilerplate text
inherited from the original DNS SRV specification [RFC 2782],
and doesn’t necessarily mean that
the advertised application-layer protocol runs only over TCP.
It is merely mnemonic text which is there to
help human readers, and in no way affects software advertising or
using the application-layer protocol identified by that unique
IANA-recorded service type string.
The following subtype is defined:
-
Compressed Fabric Identifier
_I<hhhh>
, where<hhhh>
is the Compressed Fabric Identifier encoded as exactly 16 uppercase hexadecimal characters, for example_I87E1B004E235A130
for the Compressed Fabric Identifier example of the previous section. This subtype enables filtering of devices per Fabric if service enumeration (browsing) is attempted, to reduce the set of results to Nodes of interest with operational membership in a given Fabric..
4.3.2.4. Operational Service Domain and Host Name
For link-local Multicast DNS
the service domain SHALL be local
.
For Unicast DNS such as used on Thread
the service domain SHALL be
as configured automatically by the Thread Border Router.
For DNS‑SD a target host name is required,
in addition to the instance name.
The target host name SHALL be constructed using one of the
available link-layer addresses,
such as a 48-bit device MAC address (for Ethernet and Wi‑Fi)
or a 64-bit MAC Extended Address (for Thread)
expressed as a fixed-length twelve-character
(or sixteen-character) hexadecimal string,
encoded as ASCII (UTF-8) text
using capital letters, e.g., B75AFB458ECD.<domain>
.
In the event that a device performs MAC address randomization
for privacy, then the target host name SHALL use the
privacy-preserving randomized version and the hostname SHALL
be updated in the record every time the underlying link-layer address rotates.
Note that it is legal to reuse the same hostname on
more than one interface, even if the underlying link-layer address
does not match the hostname on that interface, since the
goal of using a link-layer address is to ensure local uniqueness
of the generated hostname.
If future link layers are supported by Matter that do
not use 48-bit MAC addresses or 64-bit MAC Extended Address identifiers,
then a similar rule will be defined for those technologies.
4.3.2.5. Operational Discovery Service Records
After discovery, IPv6 addresses are returned in the AAAA records and key/value pairs are returned in the DNS‑SD TXT record. The TXT record MAY be omitted if no keys are defined.
Nodes SHALL publish AAAA records for all available IPv6 addresses upon which they are willing to accept operational messages.
Only the common TXT record key/value pairs defined in Section 4.3.4, “Common TXT Key/Value Pairs” are defined for use in Operational Discovery.
Nodes SHALL silently ignore TXT record keys that they do not recognize.
4.3.2.6. Performance Recommendations
To improve overall performance of operational discovery, especially in large installations, the following recommendations SHOULD be taken in account:
-
Nodes SHOULD cache the last-known IPv6 address and port for each peer Node with which they interact from their SRV record resolved using DNS-SD, to save the cost of a run-time network lookup operation when not needed. When the IPv6 address and port for a peer Node is not known, or an attempt to communicate with a peer Node at its last-known IPv6 address and port does not appear to be succeeding within the expected network round-trip time (i.e., the retransmission timeout value for the first message packet) a Node SHOULD then perform a run-time discovery in parallel, to determine whether the desired Node has acquired a new IPv6 address and/or port [RFC 8305].
-
Nodes SHOULD respond to nonspecific service enumeration queries for the generic Matter Operational Discovery service type (
_matter._tcp
), but these queries SHOULD NOT be used in routine operation, and instead it is RECOMMENDED that they only be used for diagnostics purposes or to determine new membership within a fabric. When used, it is RECOMMENDED that service enumeration employ the_I<HHHH>
Fabric-specific subtype to only enumerate the desired Nodes on the Fabric of interest in the local network. Moreover, Known Answer Suppression [RFC 6762] SHOULD be employed in such cases to further minimize the number of unnecessary responses to such a query. -
When resolving the operational service record of another Node, a Node SHOULD use an SRV query for the desired operational service instance rather than doing general enumeration of all nodes (e.g. PTR query) followed by filtering for the desired service instance. This recommendation reduces the amount of multicast traffic generated on-link when Multicast DNS is used, and reduces latency to successful service resolution.
-
Since proxied DNS-SD service discovery MAY be in use within a given network, and service record caching is expected of DNS-SD clients, Nodes SHOULD NOT use DNS-SD as an operational liveness determination method. This is because there may be stale records not yet expired after a Node becomes unreachable which may still be available.
4.3.2.7. Operational Discovery DNS-SD Examples
The example below simulates a commissioned Matter Node advertising its availability for control via the Matter protocol.
Examples are shown using both the dns-sd
command-line test tool and the avahi
command-line test tool. The dns-sd
command-line test tool is included in all versions of macOS. It is installed as a DOS command with Bonjour for Windows, and is available on Linux by installing the mDNSResponder package. The avahi
command line-test tool is available from the Avahi project for most Linux distributions.
This example is given for illustrative purposes only. Real Matter Nodes and controllers would not use a command-line test tool for advertising and discovery. Real Matter Nodes and controllers would use the appropriate DNS‑SD APIs in their respective chosen programming languages.
Consider a device on Wi-Fi using the 48-bit device MAC address of B75AFB458ECD as its host name. DNS-SD records for can be set up as follows:
dns-sd -R 87E1B004E235A130-8FC7772401CD0696 _matter._tcp . 22222
or
avahi-publish-service 87E1B004E235A130-8FC7772401CD0696 _matter._tcp 22222
The port number 22222 is given here purely as an example. One of the benefits of using DNS‑SD is that services are not constrained to use a single predetermined well-known port. This means that multiple instances of the Matter Node control service can run on the same device at the same time, listening on different ports [RFC 6760]. The port, along with the IPv6 address, is discovered by the Matter controller at run time.
Avahi only sends a single AAAA record. To force the link-local address to be used, use avahi-publish-address. For example:
avahi-publish-address B75AFB458ECD.local fe80::f515:576f:9783:3f30
A Matter controller can discover the current IPv6 address and port for a known commissioned Matter Node:
dns-sd -L 87E1B004E235A130-8FC7772401CD0696 _matter._tcp
87E1B004E235A130-8FC7772401CD0696._matter._tcp.local. can be reached at B75AFB458ECD.local.:22222
dns-sd -Gv6 B75AFB458ECD.local
fe80::f515:576f:9783:3f30
or
avahi-browse _matter._tcp -r
hostname = [B75AFB458ECD.local]
address = [fe80::f515:576f:9783:3f30]
port = [22222]
4.3.3. Commissioner Discovery
A Commissionee MAY initiate the commissioning process by discovering Commissioners on the network (see Initiating Commissioning from an Existing Device). This MAY be done using Commissioner Discovery described in this section.
With Commissioner Discovery, a Commissionee, upon user interaction, MAY discover Commissioners on the network and obtain a list of information for each which may include Vendor ID, Product ID and friendly name. A Commissionee with a user interface, such as a Television, Thermostat or Video Player device, MAY display the list of discovered commissioners to the user for selection. Once selected, the Commissionee MAY use the User Directed Commissioning protocol with the Commissioner to indicate that the user has selected it for commissioning of the Commissionee. The Commissioner Discovery service records thus enable a form of "door bell" protocol to allow a Commissionee to request Commissioning.
The Commissioner Discovery feature is optional for both the Commissionee and the Commissioner. Any mandatory requirements described in this section SHALL apply only if the Node or the Commissioner supports this feature. To protect customer privacy on public networks, a Matter Commissioner SHALL provide a way for the customer to set a timeout on Commissioner Discovery, or otherwise disable Commissioner Discovery.
For Commissioner Discovery, the DNS-SD instance name is generated the same way it is done for Commissionable Node Discovery and has the same requirements (uniqueness on local network, and collision detection and recovery) as those in Commissionable Node Discovery, but the requirements for when a new instance name is selected from Commissionable Node Discovery do not apply to Commissioner Discovery. The instance name for Commissioner Discovery MAY be selected whenever the Commissioner deems necessary.
The DNS-SD service type [RFC 6335] is _matterd._udp
.
The port advertised by a _matterd._udp
service record SHALL
be different than any port associated with other advertised
_matterc._udp
, _matter._tcp
or _matterd._udp
services, in order to ensure
that the session-less messaging employed by the
User Directed Commissioning protocol
does not cause invalid message handling from fully operational
Matter nodes at the same address. In other words, each _matterd._udp
service
instance needs to be independent from other services to ensure unambiguous
processing of the incoming User Directed Commissioning messages.
The following subtype is defined:
-
\_T<ddd>
where<ddd>
is the device type identifier (see Data Model Device Types), encoded as a variable-length decimal number in ASCII (UTF-8) text, without leading zeroes. This optional Device Type subtype enables filtering of results to find only Commissioners that match a device type, for example, to discover Commissioners of type Video Player (35 is decimal representation for Video Player device type identifier 0x0023). For such a Video Player filter, subtype_T35
would be used.
For link-local Multicast DNS
the service domain SHALL be local
.
For Unicast DNS such as used on Thread
the service domain SHALL be
as configured automatically by the Thread Border Router.
The target host name is generated the same way it is done for Commissionable Node Discovery (see Host Name Construction).
After discovery, IPv6 addresses are returned in the AAAA records and key/value pairs are returned in the DNS‑SD TXT record. The TXT record MAY be omitted if no keys are defined.
Nodes SHALL publish AAAA records for all their available IPv6 addresses.
In addition to the common TXT record key/value pairs defined in Section 4.3.4, “Common TXT Key/Value Pairs”, the following key/value pairs are defined specifically for Commissioner discovery:
-
The optional key
VP
gives vendor and product information. This key is optional for a vendor to provide, and optional for a commissioner to use. This value takes the same format described for theVP
key in Commissionable Node Discovery (see Section 4.3.1.6, “TXT key for Vendor ID and Product ID (VP
)”). This key/value pair MAY be returned in the DNS‑SD TXT record. -
The optional key
DT
gives the device type identifier for the Commissioner (see Data Model Device Types). This value takes the same format described for theDT
key in Commissionable Node Discovery (see Commissioning Device Type). This key/value pair MAY be returned in the DNS‑SD TXT record. -
The optional key
DN
gives the device name. This value takes the same format described for theDN
key in Commissionable Node Discovery (see Commissioning Device Name). This key/value pair MAY be returned in the DNS‑SD TXT record. To protect customer privacy on public networks, a Matter Commissioner SHALL provide a way for the customer to disable inclusion of this key.
Commissionees SHALL silently ignore TXT record keys that they do not recognize. This is to facilitate future evolution of the Matter Commissioner Discovery protocol specification without breaking backwards compatibility with existing Commissionees that do not implement the new functionality.
4.3.3.1. Examples
The examples below simulate a Matter Commissioner advertising that it is present on the network.
Examples are shown using both the dns-sd
command-line test tool and the avahi
command-line test tool.
The dns-sd
command-line test tool is included in all versions of macOS.
It is installed as a DOS command with Bonjour for Windows, and is available on Linux by installing the
mDNSResponder package.
The avahi
command line-test tool is available from the Avahi project
for most Linux distributions.
These examples are given for illustrative purposes only.
Consider a device on Wi-Fi using the 48-bit device MAC address of B75AFB458ECD as its host name. DNS-SD records for can be set up as follows:
dns-sd -R DD200C20D25AE5F7 _matterd._udp,_V123,_T35 . 33333 VP=123+456 DT=35 DN="Living Room TV"
or
avahi-publish-service --subtype=_V123._sub._matterd._udp DD200C20D25AE5F7 _matterd._udp 33333 VP=123+456 DT=35 DN="Living Room TV"
This produces DNS-SD messages with the following characteristics:
-
Vendor ID is
123
, Product ID is456
. -
Device type is
35
which is a Video Player (Device Type Identifier 0x0023). -
Device name is
Living Room TV
.
Avahi only sends a single AAAA record. To force the link-local address to be used, use avahi-publish-address. For example:
avahi-publish-address B75AFB458ECD.local fe80::f515:576f:9783:3f30
The DNS‑SD service registration command shown above results in the creation of the following Multicast DNS records:
_matterd._udp.local. PTR DD200C20D25AE5F7._matterd._udp.local.
_V123._sub._matterd._udp.local. PTR DD200C20D25AE5F7._matterd._udp.local.
_T35._sub._matterd._udp.local. PTR DD200C20D25AE5F7._matterd._udp.local.
DD200C20D25AE5F7._matterd._udp.local. TXT "VP=123+456" "DT=35" "DN=Living Room TV"
DD200C20D25AE5F7._matterd._udp.local. SRV 0 0 33333 B75AFB458ECD.local.
B75AFB458ECD.local. AAAA fe80::f515:576f:9783:3f30
The port number 33333 is given here purely as an example.
A Commissionee can discover all Commissioners:
dns-sd -B _matterd._udp
or
avahi-browse _matterd._udp -r
A Commissionee can discover Commissioners with device type 35:
dns-sd -B _matterd._udp,_T35
or
avahi-browse _T35._sub._matterd._udp -r
A Commissionee can discover Commissioners with Vendor ID 123:
dns-sd -B _matterd._udp,_V123
or
avahi-browse _V123._sub._matterd._udp -r
4.3.4. Common TXT Key/Value Pairs
The TXT records provided during Commissionable, Operational and Commissioner discovery MAY contain the following optional key/value pairs which are common to every discovery method:
-
The optional key
SII
indicates the SLEEPY_IDLE_INTERVAL of the Node. This key MAY optionally be provided by a Node to override sleepy defaults. If the key is not included or invalid, the Node querying the service record SHALL use the default SED parameter value. TheSII
value is an unsigned integer with units of milliseconds and SHALL be encoded as a variable-length decimal number in ASCII encoding, omitting any leading zeros. TheSII
value SHALL NOT exceed 3600000 (1 hour in milliseconds).-
Example:
SII=5300
to override the initial retry interval value to 5.3 seconds.
-
-
The optional key
SAI
indicates the SLEEPY_ACTIVE_INTERVAL of the Node. This key MAY optionally be provided by a Node to override SED defaults. If the key is not included or invalid, the Node querying the service record SHALL use the default MRP parameter value. TheSAI
value is an unsigned integer with units of milliseconds and SHALL be encoded as a variable-length decimal number in ASCII encoding, omitting any leading zeros. TheSAI
value SHALL NOT exceed 3600000 (1 hour in milliseconds).-
Example:
SAI=1250
to override the active retry interval value to 1.25 seconds.
-
-
The optional key
T
indicates whether the Node supports TCP. This key MAY optionally be provided by a Node that does not support TCP. If the key is not included or invalid, the Node querying the service record SHALL assume the default value ofT=0
indicating TCP is not supported. TheT
key, if included, SHALL have one of two valid values: '0' to indicate "TCP not supported", or '1' to indicate "TCP supported".-
Example:
T=1
to announce TCP is supported by the advertising Node.
-
4.4. Message Frame Format
This section describes the encoding of the Matter message format. The Matter message format provides flexible support for various communication paradigms, including unicast secure sessions, multicast group messaging, and session establishment itself. The process of encrypting Matter messages is the same in all modes of communication, and assumes symmetric keys are shared between communicating parties. Unencrypted messages are used only for protocols which bootstrap secure messaging, such as session establishments.
Matter messages are used by Matter applications, as well as the Matter protocol stack itself, to convey application-specific data and/or commands. The Protocol portion of a Matter message contains a Protocol ID and Protocol Opcode which identify both the semantic meaning of the message as well as the structure of any associated application payload data. Matter messages also convey an Exchange ID, which relates the message to a particular exchange (i.e. conversation) taking place between two nodes. Finally, certain types of Matter messages can convey information that acknowledges the reception of an earlier message. This is used as part of the Message Reliability Protocol to provide guaranteed delivery of messages over unreliable transports.
All multi-byte integer fields are transmitted in little-endian byte order unless otherwise noted in the field description.
Matter messages are structured as follows:
Note
|
[] denotes the field is optional.
|
Length | Field |
---|---|
2 bytes |
[ Message Length ] |
1 byte |
|
2 bytes |
|
1 byte |
|
4 bytes |
|
0/8 bytes |
[ Source Node ID ] |
0/2/8 bytes |
|
variable |
[ Message Extensions . . . ] |
Message Payload |
|
variable |
[ Message Payload . . . ] (encrypted) |
variable |
The Message Payload of a Matter message SHALL contain a Protocol Message with format as follows:
Length | Field |
---|---|
1 byte |
|
1 byte |
|
2 bytes |
|
2 bytes |
|
2 bytes |
|
4 bytes |
|
variable |
[ Secured Extensions . . . ] |
Application Payload |
|
variable |
[ Application Payload . . . ] |
4.4.1. Message Header Field Descriptions
4.4.1.1. Message Length (16 bits)
An optional, unsigned integer value specifying the overall length of the message in bytes, not including the size of the Message Length field itself. This field SHALL only be present when the message is being transmitted over a stream-oriented channel such as TCP. When transmitted over a message-oriented channel, the message length is conveyed by the underlying channel. For example, when transmitted over UDP, the message length is equal to the payload length of the UDP packet.
4.4.1.2. Message Flags (8 bits)
An unsigned integer bit field containing the following subfields:
bit 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|
Version |
- |
S |
DSIZ |
Note
|
All unused bits in the Message Flags field are reserved and SHALL be set to zero on transmission and SHALL be silently ignored on reception. |
Version (4 bits, positions 4-7)
An unsigned integer specifying the version of the Matter Message format used to encode the message. Currently only one version is defined:
-
0 — Matter Message Format version 1.0
-
1-15 — Reserved for future use
Messages with version field set to reserved values SHALL be dropped without sending a message-layer acknowledgement.
Note
|
The Version field conveys information solely about the structure of the Matter message itself, not about the structure of the application payload or the interpretation of the message’s type. Thus, changes to how an application handles or interprets a message do not result in the creation of a new message format version number. |
S Flag (1 bit, position 2)
A single bit field which SHALL be set if and only if the Source Node ID field is present.
DSIZ Field (2 bits, position 0-1)
This field SHALL indicate the size and meaning of the Destination Node ID field.
-
0 — Destination Node ID field is not present
-
1 — Destination Node ID field is present as a 64-bit Node ID
-
2 — Destination Node ID field is present as a 16-bit Group ID
-
3 — Reserved for future use
Messages with DSIZ field set to reserved values SHALL be dropped without sending a message-layer acknowledgement.
4.4.1.3. Session ID (16 bits)
An unsigned integer value identifying the session associated with this message. The session identifies the particular key used to encrypt a message out of the set of available keys (either session or group), and the particular encryption/message integrity algorithm to use for the message. The Session ID field is always present. For details on derivation of this field, see respective sections on unicast and group session ID derivation.
4.4.1.4. Security Flags (8 bits)
An unsigned integer bit field containing the following subfields:
bit 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|
P |
C |
MX |
Reserved |
Session Type |
Note
|
All unused bits in the Security Flags field are reserved and SHALL be set to zero on transmission and SHALL be silently ignored on reception. |
P Flag (1 bit, position 7)
The Privacy (P) flag is a single bit field which, when set, SHALL identify that the message is encoded with privacy enhancements as specified in Section 4.8.3, “Privacy Processing of Outgoing Messages”.
C Flag (1 bit, position 6)
The Control message (C) flag is a single bit field which, when set, SHALL identify that the message is a control message, such as for the Message Counter Synchronization Protocol, and uses the control message counter for the nonce field as specified in Section 4.7.1.1, “Nonce”.
MX Flag (1 bit, position 5)
The Message Extensions (MX) flag is a single bit field which, when set, SHALL indicate that the Message Extensions portion of the message is present and has non-zero length. Version 1.0 Nodes SHALL set this flag to zero.
Session Type (2 bit, position 0-1)
An unsigned integer specifying the type of session associated with the message. The following values are defined:
-
0 — Unicast Session
-
1 — Group Session
-
2-3 — Reserved for future use
Messages with Session Type set to reserved values are not valid and SHALL be dropped without sending a message-layer acknowledgement.
The Session Type defines how the Session ID is to be interpreted.
The Unsecured Session SHALL be indicated when both Session Type and Session ID are set to 0
.
The Unsecured Session SHALL have no encryption, privacy, or message integrity checking.
A Secure Unicast Session SHALL be indicated when Session Type is Unicast Session and Session ID is NOT 0
.
4.4.1.5. Message Counter (32 bits)
An unsigned integer value uniquely identifying the message from the perspective of the sending node. The message counter is generated based on the Session Type and increases monotonically for each unique message generated. When messages are retransmitted, using the reliable messaging capabilities, the counter remains the same, as logical retransmission is of a given message as identified by its message counter. Similarly, acknowledgements refer to values of the message counter being acknowledged.
Note
|
The Message Counter field is scoped to a given Encryption Key. Also, the Message Counter values are independent for control messages and data messages, as indicated by the C Flag. So it is possible to have the same Message Counter for two messages encrypted with different keys, as well as two messages encrypted with the same key but different values of the C Flag. |
4.4.1.6. Source Node ID (64 bits)
An optional sequence of 8 bytes containing the unique identifier of the source node. The Source Node ID field SHALL only be present in a message when the S Flag in the Message Flags field is set to 1.
4.4.1.7. Destination Node ID
The optional Destination Node ID field contains the unique Node Identifier of the destination Node or group to which the message is being sent. The size and encoding of the Destination Node ID field depends on the value of the DSIZ field.
4.4.1.8. Message Extensions (variable)
The Message Extensions field is a variable length block of data for providing backwards compatible extensibility. The format of the Message Extensions block is shown in Table 11, “Message Extensions block format definition”. The Message Extensions block SHALL be present only if the MX Flag is set to 1 in the Security Flags field.
Version 1.0 Nodes SHALL ignore the contents of the Message Extensions payload.
The Message Extensions block SHALL be authenticated and privacy obfuscated based on the Security Flags settings.
Length | Field |
---|---|
2 bytes |
Message Extensions Payload Length, in bytes |
variable |
[ Message Extensions Payload ] |
4.4.2. Message Footer Field Descriptions
4.4.2.1. Message Integrity Check (variable length)
A sequence of bytes containing the message integrity check value (a.k.a. tag or MIC) for the message. The length and byte order of the field depend on the integrity check algorithm in use as specified in Section 3.6, “Data Confidentiality and Integrity”.
The Message Integrity Check field SHALL be present for all messages except those of Unsecured Session Type.
The MIC is calculated as described in Section 4.7.2, “Security Processing of Outgoing Messages”.
4.4.3. Protocol Header Field Descriptions
4.4.3.1. Exchange Flags (8 bits)
An unsigned integer bit field containing the following subfields:
bit 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|
- |
- |
- |
V |
SX |
R |
A |
I |
Note
|
All unused bits in the Exchange Flags field are reserved and SHALL be set to zero on transmission and SHALL be silently ignored on reception. |
I Flag (1 bit, position 0)
The Initiator (I) flag is a single bit field which, when set, SHALL indicate that the message was sent by the initiator of the exchange.
A Flag (1 bit, position 1)
The Acknowledgement (A) flag is a single bit field which, when set, SHALL indicate that the message serves as an acknowledgement of a previous message received by the current message sender.
R Flag (1 bit, position 2)
The Reliability (R) flag is a single bit field which, when set, SHALL indicate that the message sender wishes to receive an acknowledgement for the message.
SX Flag (1 bit, position 3)
The Secured Extensions (SX) flag is a single bit field which, when set, SHALL indicate that the Secured Extensions portion of the message is present and has non-zero length. Version 1.0 Nodes SHALL set this flag to zero.
4.4.3.2. Protocol Opcode (8 bits)
An unsigned integer value identifying the type of the message. The Protocol Opcode is interpreted relative to the Matter protocol specified in the Protocol ID field.
Opcodes are defined by the corresponding Protocol specification, for example Secure Channel Protocol.
4.4.3.3. Exchange ID (16 bits)
An unsigned integer value identifying the exchange to which the message belongs. An Exchange ID is allocated by the initiator of the exchange, and is unique within the initiator exchange number space as specified in Section 4.9.2, “Exchange ID”.
4.4.3.4. Protocol ID (16 bits)
An unsigned integer value identifying the protocol in which the Protocol Opcode of the message is defined.
When the Protocol Vendor ID is the Matter Standard Vendor ID, the Protocol ID SHALL have one of the values specified by Table 13, “Protocol IDs for the Matter Standard Vendor ID”.
Range | Type | Message Specification |
---|---|---|
0x0000 |
||
0x0001 |
||
0x0002 |
||
0x0003 |
||
0x0004 |
Reserved for bespoke protocols run in an isolated test environment. |
|
0x0005 - 0xFFFF |
reserved |
reserved |
4.4.3.5. Protocol Vendor ID (16 bits)
An optional, unsigned integer value that contains the Vendor ID namespacing for the Protocol ID field. This field SHALL only be present when the V Flag is set; otherwise the default is 0, corresponding to the Matter Standard Vendor ID.
4.4.3.6. Acknowledged Message Counter (32 bits)
An optional, unsigned integer value containing the message counter of a previous message that is being acknowledged by the current message. The Acknowledged Message Counter field is SHALL only be present when the A Flag in the Exchange Flags field is 1.
4.4.3.7. Secured Extensions (variable)
The Secured Extensions field is a variable length block of data for providing backwards compatible extensibility. The format of the Secured Extensions block is shown in Table 14, “Secured Extensions block format definition”. The Secured Extensions block SHALL be present only if the SX Flag is set to 1 in the Exchange Flags field.
Version 1.0 Nodes SHALL ignore the contents of the Secured Extensions payload.
The Secured Extensions block SHALL be encrypted and authenticated based on the Security Flags settings.
Length | Field |
---|---|
2 bytes |
Secured Extensions Payload Length, in bytes. |
variable |
[ Secured Extensions Payload ] |
4.4.4. Message Size Requirements
Support for IPv6 fragmentation is not mandatory in Matter, and the expected supported MTU is 1280 bytes, the minimum required by IPv6. Therefore, all messages, including transport headers, SHALL fit within that minimal IPv6 MTU. This message size limit SHALL apply to the UDP transport. A message received over UDP that exceeds this message size limit SHALL NOT be processed. Messages sent over TCP or BTP over BLE transports MAY exceed the message size limit if both nodes are capable of supporting larger message sizes.
4.5. Message Counters
All messages contain a 32-bit message counter assigned by the sender of the message. Message counters are assigned sequentially, by monotonically increasing the counter value maintained by the sender of the message. Message counters serve several purposes:
-
Duplicate Message Detection – Receiving systems use message counters to detect messages that have been retransmitted by the sender, e.g. in response to packet loss in the network.
-
Message Acknowledgement – In the Message Reliability Protocol (MRP), message counters provide a way for receivers to identify messages for the purpose of acknowledging their receipt.
-
Encryption Nonces – When encrypted messages are sent, message counters provide an encryption nonce that ensures each message is encrypted in a unique manner.
-
Replay Prevention – Related to encryption, message counters also provide a means for detecting and preventing the replay of encrypted messages.
4.5.1. Message Counter Types
All Nodes implement three global 32-bit counters to vend message counters for certain types of messages:
-
Global Unencrypted Message Counter
-
Global Group Encrypted Data Message Counter
-
Global Group Encrypted Control Message Counter
Additionally, Nodes implement a separate 32-bit counter for each session as part of secure session state:
-
Secure Session Message Counter
Technical details for how each counter type works are described in the following sections. Table 15, “Message Counter Type Overview” is provided to summarize higher-level differences between Message Counter Types:
Message Counter Type | Session Type | Lifetime | Rollover Policy | Nonvolatile |
---|---|---|---|---|
Unlimited |
Allowed |
Optional |
||
Operational Group Key |
Allowed |
Mandatory |
||
Operational Group Key |
Allowed |
Mandatory |
||
Session Key |
Expires |
Optional |
4.5.1.1. Message Counter Initialization
All message counters SHALL be initialized with a random value using the Crypto_DRBG(len = 28) + 1
primitive.
Message counters are initialized to a random number to increase the difficulty of traffic analysis attacks by making it harder to determine how long a particular session has been open.
The random initializer ranges from 1 to 228 in order to maximize initial entropy while still reserving the vast majority of the range to actual counter values (roughly 232 - 228).
4.5.1.2. Global Unencrypted Message Counter
All Nodes SHALL implement an unencrypted message counter, which is used to generate counters for unencrypted messages.
Typically, Nodes store the Global Unencrypted Message Counter in RAM. This makes the counter subject to loss whenever the system reboots or otherwise loses its state. This is permissible because retaining the Global Unencrypted Message Counter is not essential to the confidentiality or integrity of the message. In the event that the Global Unencrypted Message Counter for a Node is lost, Nodes SHALL randomize the initial value of this counter on startup per Section 4.5.1.1, “Message Counter Initialization”.
4.5.1.3. Global Group Encrypted Message Counters
The Global Group Encrypted Message Counters are used to generate the counter for messages encrypted using group keys. There are two such counters:
-
The Global Group Encrypted Data Message Counter is used to encode regular data messages encrypted with a group key.
-
The Global Group Encrypted Control Message Counter is used to encode control messages encrypted with a group key.
Some Nodes might not be required to implement communication using group keys, in which case they MAY omit the Global Group Encrypted Message Counters. In contrast to the Global Unencrypted Message Counter, Nodes are required to persist the Global Group Encrypted Message Counters in durable storage. In particular, Nodes are required to ensure that the value of the Global Group Encrypted Message Counters never rolls back and that it is monotonic within the bounds of its range for its use for a given group key. A Node SHALL randomize the initial value of this counter on factory reset per Section 4.5.1.1, “Message Counter Initialization”.
While Global Group Encrypted Message Counters are shared by many group keys to generate nonces, rollover is not an issue as long as the Epoch Key that generates each operational group key rotates frequently enough.
Note
|
If a nonce is duplicated for a given key, the security consequences are isolated only to the specific key with which the duplicate nonce occurred — a key that has not been updated prior to rollover and has been presumably abandoned or aged out. |
4.5.2. Secure Session Message Counters
A Secure Session Message Counter is a per-session, 32-bit, ephemeral counter that is used by the encoding of any encrypted messages using an associated session key. Each peer in a Secure Unicast Session SHALL maintain its own message counters, with independent counters being used for each unique session used. Session Message Counters SHALL exist for as long as the associated security session is in effect. A Node SHALL randomize the initial value of this counter on session establishment per Section 4.5.1.1, “Message Counter Initialization”.
The Secure Session Message Counter history window SHALL be maintained for the lifetime of the session, and SHALL be deleted at the same time as the session keys, when the session ends.
Sessions SHALL be discarded and re-established before any Secure Session Message Counter overflow or repetition occurs.
4.5.3. Message Counters as Encryption Nonces
In the context of encrypted messages, message counters serve as nonces for the encryption algorithm, ensuring that every message is encrypted in a unique manner. The uniqueness of an encrypted message’s counter is vital to the confidentiality of the message, as the encryption algorithm makes it trivial for an eavesdropper to decrypt messages if the attacker can find two different messages with the same message counter that were encrypted using the same key. Specifically, an attacker can XOR the two different messages that share the same key and nonce to obtain a "block key" which can be used to decrypt any message that uses that key and nonce.
Nodes SHOULD rotate their encryption keys on a regular basis, to ensure that old encryption keys are retired before a Global Group Encrypted Message Counter has a chance to wrap to a value previously used with the encryption key. In practice, the frequency of message transmission is such that encryption keys generally rotate at a rate that is much faster than the rate at which a Global Group Encrypted Message Counter wraps. In the event that a Global Group Encrypted Message Counter wraps before the associated keys are rotated, all keys associated with that Global Group Encrypted Message Counter are considered exhausted and are no longer valid to use. In such cases, a new unicast session SHALL be established to the Matter Node to rotate such retired keys before secure communication can resume. Given the importance of confidentiality and message integrity, every effort SHOULD be made to ensure that keys are rotated on a regular basis.
4.5.4. Replay Prevention and Duplicate Message Detection
Beyond their role as encryption nonces, message counters also serve as a means to detect repeated reception of the same message. Message duplication may occur for a number of reasons: out-of-order arrival, network latency, malicious attack, or network error. For example, a duplicate can be caused when a sender retransmits a message after failing to receive an acknowledgement, or because a malicious third party attempted to replay an old message to gain some advantage. To detect duplicate messages, Nodes maintain a history window of the message counters they have received from a particular sender (see Message Reception State). Whenever a message is received, its message counter is checked against the history window of message counters from that sender to determine whether it is a duplicate. The Message Layer SHALL discard duplicate messages before they reach the application layer.
4.5.4.1. Message Reception State
The state maintained by a Node about the messages it has received from a particular peer is referred to as message reception state. Nodes use this state information to determine whether a newly arrived message is a duplicate of a previous message. Message reception state is maintained on a per-peer or per-session basis, depending on the type of message encryption being used.
At a conceptual level, message reception state consists of a set of integers corresponding to the counters of all the messages that have been received from a particular peer. To limit the amount of memory required to store this state, Nodes employ a lossy compression scheme that takes advantage of the fact that message counters are generated sequentially by the sender. The scheme allows for a limited amount of out-of-order message arrivals due to network effects without inducing false detection of duplicates.
In the compressed form, message reception state is structured as a pair of values: a integer representing the largest valid, or maximum message counter received from the peer (max_message_counter
), and a bitmap of size MSG_COUNTER_WINDOW_SIZE indicating which messages immediately prior to the max message have been received.
The offset into the bitmap equates to the difference between the corresponding message counter and the max message counter, i.e. the first bit in the bitmap indicates whether the message with the counter of max_message_counter - 1
has been received, the second indicates whether message max_message_counter - 2
has been received, and so on.
A message counter is within the range of the bitmap, also known as the message counter window, when the counter value is between [(max_message_counter - MSG_COUNTER_WINDOW_SIZE) to (max_message_counter - 1) mod 232]
.
As messages arrive, the message reception state is queried to determine if an arriving message is new or duplicate.
If a message is new, the state is then updated to reflect the arrival of the message.
When a message arrives with a message counter that is logically greater than the current maximum message counter for that peer, the maximum message counter value for the peer is updated and the bitmap shifted accordingly.
4.5.4.2. Use of Message Reception State for Encrypted Messages
The algorithm for querying and updating message reception state varies slightly depending on whether the system is tracking reception of encrypted messages or unencrypted messages.
Message Counters with maximum
For encrypted messages of Secure Unicast Session Type, any arriving message with a counter in the range [(max_message_counter + 1) to (232 - 1)]
SHALL be considered new, and cause the max_message_counter
value to be updated.
Message counters within the range of the bitmap SHALL be considered duplicate if the corresponding bit offset is set to true.
All other message counters SHALL be considered duplicate.
Message Counters with rollover
A message counter with rollover is a free running message counter that monotonically increases, but rolls over to zero when it exceeds the maximum value of the counter (32-bits). Group keys are secured by a shared, global message counter with rollover as described in Section 4.5.1.3, “Global Group Encrypted Message Counters”.
For encrypted messages of Group Session Type, any arriving message with a counter in the range [(max_message_counter + 1) to (max_message_counter + 231 - 1)] (modulo 232)
SHALL be considered new, and cause the max_message_counter
value to be updated.
Messages with counters from [(max_message_counter - 231) to (max_message_counter - MSG_COUNTER_WINDOW_SIZE - 1)] (modulo 232)
SHALL be considered duplicate.
A message counter equal to max_message_counter
SHALL be considered duplicate.
Message counters within the range of the bitmap SHALL be considered duplicate if the corresponding bit offset is set to true.
This scheme for encrypted messages effectively divides the message counter space in half: those counters that are forward of the max message counter, which are considered new, and those counters that are behind the max message counter, which are considered duplicates unless indicated otherwise by the values in the bitmap.
4.5.4.3. Use of Message Reception State for Unencrypted Messages
For unencrypted messages, the algorithms for tracking messages and detecting duplicates are similar to, but more permissive than for encrypted messages using Section 4.5.4.2.2, “Message Counters with rollover”. This reflects the fact that duplicate detection of unencrypted messages is not done for security reasons, but rather to catch duplicates caused by network errors (e.g. loss of an ack), which are generally more bounded in time. The more relaxed algorithm for unencrypted duplicate detection also relaxes the durability requirement on the sender’s message counter, allowing senders to store the counter in RAM.
For unencrypted messages, any message counter equal to max_message_counter
or within the message counter window, where the corresponding bit is set to true SHALL be considered duplicate.
All other message counters, whether behind the window or ahead of max_message_counter
, are considered new and shall update max_message_counter
and shift the window accordingly.
Messages with a counter behind the window are likely caused by a node rebooting and are thus processed as rolling back the window to the current location.
Note that when max_message_counter
is close to the minimum of the range, the window shall roll back to cover message counters near the maximum of the range.
4.5.4.4. Message Reception State Initialization
To initialize Message Reception State for a given Peer Node ID, initial max_message_counter
, Message Type (control or data), Encryption Level (encrypted or unencrypted), and Encryption Key (for any Encryption Level except unencrypted):
-
The Message Reception State fields SHALL be set as follows:
-
The Peer Node ID SHALL reference the given Peer Node ID.
-
The Message Type SHALL be the given Message Type.
-
The Encryption Level SHALL be the given Encryption Level.
-
If the Encryption Level is NOT unencrypted, the Encryption Key SHALL reference the given key.
-
The
max_message_counter
SHALL be set to the givenmax_message_counter
. -
The Message Counter bitmap SHALL be set to all
1
, indicating that only new messages with counter greater thanmax_message_counter
SHALL be accepted.
-
4.5.5. Counter Processing of Outgoing Messages
-
Obtain the outgoing message counter of the sending Node for the given Security Flags, Session Id, and Encryption Key:
-
A message of Unsecured Session Type SHALL use the current Global Unencrypted Message Counter.
-
A message of Secure Unicast Session Type SHALL use the current Secure Session Message Counter for the session associated with the Session ID.
-
A message of Group Session Type SHALL use:
-
-
The outgoing message counter from step 1 SHALL be incremented by 1.
-
Store the incremented outgoing message counter in the OutgoingMessageCounter element associated with the Session Context for the message.
-
If the message counter wraps around from 0xFFFF_FFFF to 0x0000_0000 and the message is of Secure Unicast Session Type:
-
The Encryption Key SHALL be expired in the Session Context. The session will need to be renegotiated to resume communication after transmission of this final message.
-
-
4.5.6. Counter Processing of Incoming Messages
-
Determine the Message Reception State for the sending peer and get the current
max_message_counter
.-
Given a decrypted message of Unicast Session Type:
-
Get the session-specific Message Reception State from the Secure Unicast Session Context.
-
-
Given a decrypted message of Group Session Type:
-
Extract the Source Node ID from the Message Header.
-
If there is no Source Node ID for the message, drop the message.
-
-
Get the Message Reception State for the Source Node ID of the given message:
-
If there is no Message Reception State for the groupcast message, initiate Section 4.16.4, “Unsynchronized Message Processing”.
-
-
Given an unencrypted message:
-
Get the Message Reception State associated with the Unsecured Session Context.
-
If there is no Message Reception State for the unencrypted message, create it with the information from the given message.
-
-
-
If the Message Counter is outside the valid message counter window, the message SHALL be marked as a duplicate. Note that while messages may be outside of the window for reasons other than being a duplicate, and we always mark them as such.
-
If the message is a duplicate:
-
If the message is marked as encrypted, follow Section 4.5.4.2, “Use of Message Reception State for Encrypted Messages”.
-
If the message is marked as unencrypted, follow Section 4.5.4.3, “Use of Message Reception State for Unencrypted Messages”.
-
If the message is encrypted and marked as a duplicate, i.e. Message Counter is outside the valid message counter window or marked as previously received in the Message Reception State:
-
Perform Section 4.11.5.2, “Reliable Message Processing of Incoming Messages” on the duplicate message.
-
-
Otherwise, update the Message Reception State as detailed in Section 4.5.4.1, “Message Reception State”, and accept the message for further processing.
-
4.6. Message Processing
This sub-clause describes the fundamental procedures for transmission and reception.
4.6.1. Message Transmission
To prepare a message for transmission with a given Session ID, Destination Node ID (which may be a group node id or an operational node id) and Security Flags, the following steps SHALL be performed, in order:
-
Process the message as described in Section 4.5.5, “Counter Processing of Outgoing Messages”.
-
If the message’s Session Type is a Unicast Session:
-
Set
SessionTimestamp
to a timestamp from a clock which would allow for the eventual determination of the last session use relative to other sessions. -
Process the message as described in Section 4.7.2, “Security Processing of Outgoing Messages”.
-
Process the message as described in Section 4.8.3, “Privacy Processing of Outgoing Messages”.
-
4.6.2. Message Reception
To process a received message, the following steps SHALL be performed in order:
-
Perform validity checks on the message; if any fail, processing of the message SHALL stop, and a 'message invalid' error SHOULD be indicated to the next higher layer:
-
The Version field SHALL be
0
. -
If the message is of Secure Unicast Session Type:
-
The DSIZ field SHALL NOT indicate a Group ID is present.
-
-
If the message is of Group Session Type:
-
-
If the message is NOT of Unsecured Session Type:
-
Obtain the Privacy and Encryption Keys associated with the given Session ID:
-
If no keys are found, security processing SHALL indicate a failure to the next higher layer with a status of 'message security failed' and no further security processing SHALL be done on this message.
-
-
For each Privacy and Encryption Key, of which there may be more than one in the case of group messages:
-
If the P Flag is set, follow Section 4.8.4, “Privacy Processing of Incoming Messages” to deobfuscate the message.
-
Follow Section 4.7.3, “Security Processing of Incoming Messages” to decrypt and authenticate the message.
-
-
-
Follow Section 4.5.6, “Counter Processing of Incoming Messages” to enforce replay protection and duplicate detection.
-
If the message transport is UDP, follow Section 4.11.5.2, “Reliable Message Processing of Incoming Messages” to process message reliability.
-
If the message’s Session Type is a Unicast Session:
-
Set
SessionTimestamp
andActiveTimestamp
to a timestamp from a clock which would allow for the eventual determination of the last session use relative to other sessions.
-
-
The received message is then delivered to Section 4.9.5, “Exchange Message Processing”.
4.7. Message Security
The detailed steps involved in security processing of outgoing and incoming Matter messages are described in Section 4.7.2, “Security Processing of Outgoing Messages” and Section 4.7.3, “Security Processing of Incoming Messages” respectively. Section 4.7.1, “Data confidentiality and integrity with data origin authentication parameters” defines how the cryptographic parameters are set for securing Matter messages.
4.7.1. Data confidentiality and integrity with data origin authentication parameters
This section specifies the parameters to use the data confidentiality and integrity cryptographic primitive as defined in Section 3.6, “Data Confidentiality and Integrity”.
The parameters in this section SHALL apply for all encrypted messages, i.e. all messages except those of Unsecured Session Type.
4.7.1.1. Nonce
The nonce SHALL be formatted as specified in Table 16, “Nonce”.
Octets: 1 | 4 | 8 |
---|---|---|
Security Flags |
Message Counter |
Source Node ID |
The nonce used for the Authenticated Encryption with Additional Data (AEAD) algorithm (see Section 3.6, “Data Confidentiality and Integrity”) for a given message SHALL be defined as the concatenation of the Security Flags, the Message Counter, and the Source Node ID of that message. The scalar fields in the nonce, namely the Message Counter and the Source Node ID SHALL be encoded in little-endian byte order for the purposes of serialization within the nonce, that is, in the same byte ordering as the segment of the message from which its data originates.
The Source Node ID field used in the nonce SHALL be set to the Operational Node ID of the node originating security protection of the message:
-
If the message is of Secure Unicast Session Type:
-
For a CASE session, the Nonce Source Node ID SHALL be determined via the Secure Session Context associated with the Session Identifier.
-
For a PASE session, the Nonce Source Node ID SHALL be Unspecified Node ID.
-
-
If the message is of Group Session Type:
-
The S Flag of the message SHALL be
1
and the Nonce Source Node ID SHALL be the Source Node ID of the message. -
If the S Flag of the message is
0
the message SHALL be dropped.
-
Note
|
Because PASE negotiates strong one-time keys per session and the I2RKey and R2IKey are distinct for each direction of communication, the use of the Unspecified Node ID as the Nonce Source Node ID remains semantically secure.
|
4.7.2. Security Processing of Outgoing Messages
The process for encrypting Matter messages is depicted graphically in Figure 8, “Matter Message Encryption” with color code conventions described in Figure 9, “Matter Message Encryption Legend”.
To prepare a secure message for transmission with a given Session ID, Destination Node ID (which may be a group node id or an operational node id) and Security Flags, the Node SHALL perform the following steps:
-
Obtain the Encryption Key associated with the Session ID and Destination Node ID and the Session Type associated with the Destination Node ID:
-
If no key is found for the given Session ID, security processing SHALL fail and no further security processing SHALL be done on this message.
-
-
Obtain the outgoing message counter of the sending Node as per Section 4.5.5, “Counter Processing of Outgoing Messages”.
-
Set the Security fields as follows:
-
The Session ID field SHALL be set to the value provided to step 1.
-
The Security Flags field SHALL be set to the value provided to step 1 with the following subfields updated:
-
The Session Type field SHALL be set to the value obtained from step 1.
-
-
-
Set the Message Flags, Destination Node ID, and Source Node ID fields as follows:
-
If the Session Type is a unicast session:
-
Set S Flag to 0.
-
Set DSIZ to 0.
-
Omit both Destination Node ID, and Source Node ID.
-
-
Else if the Session Type is a group session:
-
Set S Flag to 1.
-
Set DSIZ to 2.
-
Set Source Node ID field to the operational node id of the sending node.
-
Set Destination Node ID field to the 16-bit Group ID derived from the Destination Node ID.
-
-
-
Set the Message Counter field to the outgoing message counter from step 2.
-
Execute the AEAD generate and encrypt operation, as specified in Section 3.6.1, “Generate and encrypt”, with the following instantiations:
-
The bit string key K SHALL be the Encryption Key obtained from step 1;
-
The nonce N SHALL be the
CRYPTO_AEAD_NONCE_LENGTH_BYTES
-octet string constructed according to Table 16, “Nonce”; -
The parameter P SHALL be the Message Payload;
-
The additional data octet string A SHALL be the Message Header contents, using little-endian byte order for all scalars, exactly as they appear in the message segments from which they originate:
Message Flags || Session ID || Security Flags || Message Counter
with the optional fields appended according to the Message Flags:
[Source Node ID] || [Destination Node ID] || [Message Extensions]
-
C = Crypto_AEAD_GenerateEncrypt(K, P, A, N)
-
-
If the AEAD operation invoked in step 6 results in an error, then security processing SHALL fail and no further security processing SHALL be done on this message.
-
Let C be the output from step 6. C contains the tag of
CRYPTO_AEAD_MIC_LENGTH_BITS
bits (Message Integrity Check (MIC)) as specified by Section 3.6.1, “Generate and encrypt”. The secured outgoing message SHALL be:A || C
4.7.3. Security Processing of Incoming Messages
All incoming message processing SHALL occur in a serialized manner. If an implementation chooses to process messages in a parallel manner, it must ensure that the behavior is opaque-box identical to a serialized processing implementation.
If the transport layer receives a secured message as indicated by the Session ID, it SHALL perform the following steps:
-
Determine the Session Type, Session ID, and Message Counter from the message header of the received message.
-
Obtain the Encryption Key associated with the Session Context of the given Session ID and Session Type:
-
If no key is found for the given Session ID, security processing SHALL indicate a failure to the next higher layer with a status of 'message security failed' and no further security processing SHALL be done on this message.
-
-
Execute the AEAD decryption and verification operation as specified in Section 3.6.2, “Decrypt and verify” with the following instantiations:
-
The bit string key K SHALL be the Encryption Key obtained from step 2;
-
The nonce N SHALL be the
CRYPTO_AEAD_NONCE_LENGTH_BYTES
-octet string constructed according to Table 16, “Nonce”; -
The parameter C SHALL be the encrypted and authenticated Message Payload;
-
The additional data octet string A SHALL be the authenticated Message Header:
-
{success, P} = Crypto_AEAD_DecryptVerify(K, C, A, N)
-
-
Return the result
{success, P}
of the AEAD operation:-
If the
success
isFALSE
, security processing SHALL fail and further processing SHALL NOT be performed on this message. An appropriate error SHOULD be raised to the upper layer to indicate the error. -
Otherwise, set the octet string PlaintextMessage to the string
A || P
-
-
PlaintextMessage now represents the deciphered, authenticated, received message.
-
NOTE: The message has not yet undergone counter processing nor replay detection.
-
The PlaintextMessage SHALL be marked as successfully security processed and SHALL be released to the next processing layer.
-
4.8. Message Privacy
Privacy processing of a message describes the obfuscation and deobfuscation of the message header fields after encryption and before decryption.
The detailed steps involved in privacy processing of outgoing and incoming Matter messages are described in Section 4.8.3, “Privacy Processing of Outgoing Messages” and Section 4.8.4, “Privacy Processing of Incoming Messages” respectively. They rely on the cryptographic primitives in Section 3.7, “Message privacy”.
4.8.1. Privacy Key
The Privacy Key is a symmetric key specifically used for Privacy Processing that is derived from the EncryptionKey
used for Security Processing of a given message. Given a Session ID reference to a specific Encryption Key, the Privacy Key is derived as follows:
PrivacyKey = Crypto_KDF ( InputKey = EncryptionKey, Salt = [], Info = "PrivacyKey", Length = CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
4.8.2. Privacy Nonce
The Privacy Nonce is a nonce specifically used for Privacy Processing that is derived from the SessionId
and MIC
of the message.
The Privacy Nonce SHALL be the CRYPTO_AEAD_NONCE_LENGTH_BYTES
-octet string constructed as the 16-bit Session ID (in big-endian format) concatenated with the lower 11 (i.e. CRYPTO_AEAD_MIC_LENGTH_BYTES-5)
bytes of the MIC:
PrivacyNonce = Session ID || MIC[5..15]
For example if Session ID is 42 (i.e. 0x002A) and the computed MIC is c5:a0:06:3a:d5:d2:51:81:91:40:0d:d6:8c:5c:16:3b
:
Session ID = 00:2a MIC = c5:a0:06:3a:d5:d2:51:81:91:40:0d:d6:8c:5c:16:3b MIC[5..15] = d2:51:81:91:40:0d:d6:8c:5c:16:3b PrivacyNonce = SessionID || MIC[5..15] = 00:2a || d2:51:81:91:40:0d:d6:8c:5c:16:3b PrivacyNonce = 00:2a:d2:51:81:91:40:0d:d6:8c:5c:16:3b
4.8.3. Privacy Processing of Outgoing Messages
The process for privacy encoding Matter message headers is depicted graphically in Figure 10, “Matter Message Privacy”.
To apply privacy obfuscation to an encrypted message prepared for transmission by Section 4.6.1, “Message Transmission”, apply obfuscation steps as follows:
-
If P Flag is not set, do nothing.
-
Obtain the Privacy Key for the Encryption Key used to secure the message.
-
Execute the encryption operation as specified in Section 3.7.1, “Privacy encryption” with the following instantiations:
-
The bit string key K SHALL be the Privacy Key obtained from step 1;
-
The MIC SHALL be the last
CRYPTO_AEAD_MIC_LENGTH_BYTES
bytes of theC
outcome of the message security protection as specified in Section 4.7.2, “Security Processing of Outgoing Messages” (MIC = C[(CRYPTO_AEAD_MIC_LENGTH_BYTES-1)..0]
) -
The nonce N SHALL be the PrivacyNonce of the message.
-
The parameter M SHALL be the message header fields where optional fields are only present in M if they are present in the message:
M = Message Counter || [Source ID] || [Destination ID] || [Message Extensions]
-
CP = Crypto_Privacy_Encrypt(K, M, N)
-
-
Let CP be the obfuscated output from step 2. CP SHALL be used in the final private message in place of the message header fields.
4.8.4. Privacy Processing of Incoming Messages
To deobfuscate a private message received by Section 4.6.2, “Message Reception” with a given Privacy Key, perform security processing as follows:
-
If P Flag is not set, do nothing.
-
With the given Privacy Key, execute the decryption as specified in Section 3.7.2, “Privacy decryption” with the following instantiations:
-
The bit string key K SHALL be the Privacy Key obtained from step 1;
-
The MIC SHALL be the last
CRYPTO_AEAD_MIC_LENGTH_BYTES
bytes of theC
outcome of the message security protection as specified in Section 4.7.3, “Security Processing of Incoming Messages” (MIC = C[(CRYPTO_AEAD_MIC_LENGTH_BYTES-1)..0]
) -
The nonce N SHALL be the PrivacyNonce of the message.
-
The parameter CP SHALL be the message header fields where optional fields are only present in CP if they are present in the message:
CP = Message Counter || [Source ID] || [Destination ID] || [Message Extensions]
-
M = Crypto_Privacy_Decrypt(K, CP, N)
-
-
Let M be the deobfuscated output from step 2.
-
M SHALL be used in the final private message in place of the message header fields.
-
The first successfully validated message, M, by Section 4.7.3, “Security Processing of Incoming Messages” SHALL terminate iteration through Privacy Keys in step 2.
-
4.9. Message Exchanges
An Exchange provides a way to group related messages together, organize communication flows, and enable higher levels of the communication stack to track semantically relevant groupings of messages.
An Exchange SHALL be bound to exactly one underlying session that will transport all associated Exchange messages for the life of that Exchange. The underlying session SHALL be one of the following session types: secure unicast (as established by PASE or CASE), unsecured (as is used for the initial session establishment phase of a PASE/CASE session), secure group, or MCSP.
When used with reliability, Exchanges assume basic flow control by the upper layer. The Exchange Layer SHALL not accept a message from the upper layer when there is an outbound reliable message pending on the same Exchange.
4.9.1. Exchange Role
The first Node to send a message in an Exchange is said to be in the Initiator role, and all the other Nodes that subsequently participate in the Exchange are said to be in a Responder role. An Exchange is always between one Initiator and one or more peer Responder Nodes. An Exchange does not survive a reboot of one of the participants. Adjacent layers MAY close an Exchange at any time.
4.9.2. Exchange ID
An Exchange of messages is identified by the Exchange ID field described in Section 4.4.3.3, “Exchange ID (16 bits)”.
The Exchange ID is allocated by the Initiator.
The first message the Initiator sends in a new Exchange SHALL contain a fresh value for the Exchange ID field.
The Exchange is then identified by the tuple {Session Context
, Exchange ID
, Exchange Role
} where Session Context is one of an Unsecured, Secured, Groupcast or MCSP session context.
All messages that are part of a given Exchange, whether they are sent by the Initiator or not, share the same Exchange ID, allowing the Initiator and Responder Nodes to match responses to requests or otherwise group messages together that are part of more complex transactions.
The first Exchange ID for a given Initiator Node SHALL be a random integer.
All subsequent Exchange IDs created by that Initiator SHALL be the last Exchange ID it created incremented by one.
An Exchange ID is an unsigned integer that rolls over to zero when its maximum value is exceeded.
4.9.3. Exchange Context
An Exchange context is the metadata tracked for an Exchange by all exchange participants. An Exchange context tracks the following data:
4.9.3.1. Protocol ID Registration
The Interaction Model layer indicates to the Exchange Layer which Protocols it will accept. Any message for a Protocol ID that is not registered with the Exchange Layer SHALL be dropped.
4.9.4. Exchange Message Dispatch
When sending a message to the Exchange Layer, the next higher layer SHALL specify whether the message is part of an existing Exchange, or the first of a new Exchange. For the case of a first message, the Initiator creates a new Exchange. The Node in the Initiator role SHALL always set the I Flag in the Exchange Flags of every message it sends in that Exchange.
Each Node in a Responder role for an Exchange SHALL use the Exchange ID received in previous messages for the Exchange. Each Node in the Responder role SHALL NOT set the I Flag in the Exchange Flags of every message it sends in that Exchange. Each Node in a Responder role SHALL NOT set the Destination Node ID field to a value that identifies any Node other than the Node in the Initiator role for the Exchange.
Processing SHALL then proceed to Section 4.11.5.1, “Reliable Message Processing of Outgoing Messages”.
4.9.5. Exchange Message Processing
After completion of Section 4.6.2, “Message Reception”, if the message matches an existing Exchange, it is dispatched to the appropriate protocol handler in the next higher layer. Messages for an existing Exchange are dispatched to the handler for that Exchange. Otherwise, the unsolicited message that created the Exchange is dispatched to the unsolicited message handler.
4.9.5.1. Exchange Message Matching
Upon receipt of a message, the Exchange Layer attempts to match the message to an existing Exchange. A given message is part of an Exchange if it satisfies all the following criteria:
-
The message was received over the session associated with the Exchange.
-
The Exchange ID of the message matches the Exchange ID of the Exchange,
-
The message has the I Flag set and the Exchange Role of the Exchange is Responder,
OR the message does not have the I Flag set and the Exchange Role of the Exchange is Initiator.
If the message does not match an existing Exchange, the message is considered an unsolicited message.
4.9.5.2. Unsolicited Message Processing
An unsolicited message is processed as follows:
-
If the unsolicited message is not marked as having a duplicate message counter, has a registered Protocol ID, and the I Flag is set:
-
Create a new exchange from the incoming message.
-
The new exchange will be used by the upper layer for generating responses and subsequent processing of the message.
-
-
Otherwise, if the message has the R Flag set:
-
Create an ephemeral exchange from the incoming message and send an immediate standalone acknowledgement.
-
The message SHALL NOT be forwarded to the upper layer, and excluding the sending of an immediate standalone acknowledgment, SHALL be ignored.
-
The ephemeral exchange created for such duplicate or unknown messages with R Flag set is automatically closed in Section 4.11.5.2.2, “Standalone acknowledgement processing”.
-
-
Otherwise, processing of the message SHALL stop.
Creating an Exchange based on an Incoming Message
The steps to create a new Exchange based on an incoming message are as follows:
-
A new Exchange and Exchange Context SHALL be created with the following settings:
-
The Exchange ID SHALL be set to the Exchange ID of the message.
-
The Exchange Role SHALL be set to the inverse of the incoming message I Flag, for example set the Exchange Role to Responder if the message is from an Initiator.
-
The Session Context SHALL be set to the Session on which the message was received.
-
A node SHOULD limit itself to a maximum of 5 concurrent exchanges over a unicast session. This is to prevent a node from exhausting the message counter window of the peer node.
4.9.5.3. Closing an Exchange
An Exchange MAY be closed by the application layer or a fatal connection error from the lower message layer. The process of closing an Exchange follows:
-
Any pending acknowledgements associated with the Exchange SHALL be flushed. If there is a pending acknowledgment in the acknowledgement table for the Exchange and it has
StandaloneAckSent
set to false:-
Immediately send a standalone acknowledgement for the pending acknowledgement.
-
Remove the acknowledgement table entry for the pending acknowledgement.
-
-
Wait for all pending retransmissions associated with the Exchange to complete.
-
If the retransmission list for the Exchange is empty, remove the Exchange.
-
Otherwise, leave the Exchange open and only close it once the retransmission list is empty.
-
These steps are depicted in Figure 11, “Exchange close flow”.
4.10. Secure Channel Protocol
This section specifies the formal protocol definition for the Secure Channel Protocol. Secure Channel Protocol defines the control plane for secure channel communication and security.
4.10.1. Secure Channel Protocol Messages
Secure Channel Protocol is composed of a collection of sub-protocols, including:
-
Message Counter Synchronization Protocol (MCSP)
-
Message Reliability Protocol (MRP)
-
Passcode Based Session Establishment (PASE)
-
Certificate Based Session Establishment (CASE)
The protocol opcodes for messages within the Secure Channel Protocol are grouped based on the underlying sub-protocol that uses the message type. Table 17, “Secure Channel Protocol Opcodes” lists the messages defined by Secure Channel Protocol.
Protocol Opcode | Protocol Command Name | Description |
---|---|---|
0x00 |
The Message Counter Synchronization Request message queries the current message counter from a peer to bootstrap replay protection. |
|
0x01 |
The Message Counter Synchronization Response message provides the current message counter from a peer to bootstrap replay protection. |
|
0x10 |
This message is dedicated for the purpose of sending a stand-alone acknowledgement when there is no other data message available to piggyback an acknowledgement on top of. |
|
0x20 |
The request for PBKDF parameters necessary to complete the PASE protocol. |
|
0x21 |
The PBKDF parameters sent in response to PBKDFParamRequest during the PASE protocol. |
|
0x22 |
The first PAKE message of the PASE protocol. |
|
0x23 |
The second PAKE message of the PASE protocol. |
|
0x24 |
The third PAKE message of the PASE protocol. |
|
0x30 |
The first message of the CASE protocol. |
|
0x31 |
The second message of the CASE protocol. |
|
0x32 |
The third message of the CASE protocol. |
|
0x33 |
The second resumption message of the CASE protocol. |
|
0x40 |
The Status Report message encodes the result of an operation in the Secure Channel as well as other protocols. |
4.10.1.1. Session Establishment - Out of Resources
After a successful session establishment using CASE or PASE, a responder may not have enough resources to save all of the session context information. To free resources, a responder SHALL evict an existing session using the following procedure:
-
Use the
SessionTimestamp
to determine the least-recently used session. -
Determine the session that was least-recently used then:
-
Send a status report:
StatusReport(GeneralCode: SUCCESS, ProtocolId: SECURE_CHANNEL, ProtocolCode: CLOSE_SESSION)
message to the peer node -
Remove all state associated with the session (see Section 4.12.2.1, “Secure Session Context”). The Node MAY save state necessary to perform Session Resumption, see Section 4.13.2.2.1, “Session Resumption State” for more details.
-
-
Respond to the initiator with the appropriate session establishment message
4.10.1.2. Status Report
The Status Report message is sent from protocol handlers to convey the status of an operation using a common format as defined in Appendix D, Status Report Messages. The StatusReport message is a part of the Secure Channel protocol, but embeds an additional context-specific ProtocolID field in its message-specific payload. In this way, the StatusReport can convey status for any protocol handler.
4.10.1.3. Secure Channel Status Report Messages
Status Reports specific to the Secure Channel are designated by embedding the PROTOCOL_ID_SECURE_CHANNEL
in the ProtocolId field of the StatusReport body.
All Secure Channel Status Report Messages SHALL use the PROTOCOL_ID_SECURE_CHANNEL
protocol id. For example, a failure to find a common root of trust may be written in the specification as follows: StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: NO_SHARED_TRUST_ROOTS)
.
There are several cases for which the secure channel layer may emit a status report:
-
To indicate successful session establishment
-
In response to errors during session establishment
-
In response to errors after session establishment
-
To indicate that a Node is terminating a session
For each of these cases, a Secure Channel Status Report message SHALL be sent with an appropriate ProtocolCode
as detailed below.
The following table describes the Secure Channel Status Report Protocol Specific codes. Each entry in the list details the appropriate General Code to be utilized with the message and whether it may be sent unencrypted. Secure Channel Status Report messages which are marked as encrypted below SHALL only be sent encrypted in a session established with CASE or PASE.
Protocol Code | Error | General Code | Encrypted | Additional Data | Description |
---|---|---|---|---|---|
0x0000 |
SUCCESS |
N |
N |
Indication that the last session establishment message was successfully processed. |
|
0x0001 |
FAILURE |
N |
N |
Failure to find a common set of shared roots. |
|
0x0002 |
FAILURE |
N |
N |
Generic failure during session establishment. |
|
0x0003 |
SUCCESS |
Y |
N |
Indication that the sender will close the current session. See Section 4.10.1.4, “CloseSession” for more details. |
|
0x0004 |
BUSY |
N |
Y |
Indication that the sender cannot currently fulfill the request. See Section 4.10.1.5, “Busy” for more details. |
4.10.1.4. CloseSession
A node may choose to close a session for a variety of reasons including, but not limited to, the following:
-
The interaction between nodes is complete
-
The node needs to free up resources for a new session
-
Fabric configuration associated with the CASE session was removed with the RemoveFabric command invoked by an Administrator while the session was open
The CloseSession
StatusReport SHALL only be sent encrypted within an exchange associated with a PASE or CASE session. The CloseSession
StatusReport SHALL be sent within a new exchange and SHALL NOT set the R Flag.
If a Node has either sent or received a CloseSession
StatusReport, that Node SHALL remove all state associated with the session (see Section 4.12.2.1, “Secure Session Context”). The Node MAY save state necessary to perform Session Resumption, see Section 4.13.2.2.1, “Session Resumption State” for more details.
4.10.1.5. Busy
When a receiver receives a request to start a new secure session via a Sigma1 or PBKDFParamRequest message, the receiver MAY respond with the BUSY StatusReport when it is unable to fulfill the request. The BUSY StatusReport SHALL:
-
Set the R Flag to 0
-
Set the S Flag to 0
-
Set the StatusReport
ProtocolData
to a 16-bit (two byte) little-endian value indicating the minimum time in milliseconds to wait before retrying the original request. -
Set the Exchange ID to the Exchange ID present in the Sigma1 or PBKDFParamRequest message which triggered this response.
For example, a responder wishing to indicate they are unable to fulfill the request and that the initiator should wait 500 milliseconds before trying again would send StatusReport(GeneralCode: BUSY, ProtocolId: SECURE_CHANNEL, ProtocolCode: BUSY, ProtocolData: [0xF4, 0x01])
.
The BUSY StatusReport SHALL NOT be sent in response to any message except for Sigma1 or PBKDFParamRequest.
An initiator receiving a BUSY StatusReport from a responder SHALL wait for at least a period of t
milliseconds before retrying the request where t
is the value obtained from the Busy StatusReport ProtocolData
field.
If the initiator sends a new session establishment request after receiving a BUSY StatusReport, the request SHALL contain new values for all randomized parameters.
4.10.2. Parameters and Constants
Table 19, “Glossary of constants” is a glossary of constants used in the secure channel protocol, along with a brief description and the default for each constant.
Constant Name | Description | Value |
---|---|---|
MSG_COUNTER_WINDOW_SIZE |
Maximum number of previously processed message counters to accept from a given Node and key. |
32 |
MSG_COUNTER_SYNC_REQ_JITTER |
Maximum amount of random delay before sending a MsgCounterSyncReq when the synchronization request is triggered by receipt of a multicast message. |
500 milliseconds |
MSG_COUNTER_SYNC_TIMEOUT |
The maximum amount of time (in milliseconds) which a Node SHALL wait for a MsgCounterSyncRsp after sending a MsgCounterSyncReq. |
400 milliseconds |
4.11. Message Reliability Protocol (MRP)
The Message Reliability Protocol (MRP) provides confirmation of delivery for messages that require reliability. The protocol is optimized for constrained devices that may not be able to receive a message at the point it is due to be delivered to them. Reliable messaging MAY be enabled on an individual message basis as required by the protocol design of the higher layer application. Reliability is achieved through time-bounded delivery confirmation, ensuring best effort delivery of critical messages over what may be an inherently lossy and unreliable communication medium.
Flow control mechanisms are not incorporated in MRP because it is intended to be used for short interactions with small numbers of messages in them.
4.11.1. Reliable Messaging Header Fields
The following fields are defined in the Exchange Flags for use exclusively by MRP:
-
Indicates a reliable message. This flag SHALL be set by the sender when a message being sent requires the receiver to send back an acknowledgment. To support unreliable messages, this flag bit MAY be clear, so that no acknowledgements are requested from the receiver.
-
Indicates the message is acting as an acknowledgement. This flag MAY be set on any message. When set, the Acknowledged Message Counter field SHALL be present and valid. This flag SHALL always be set for MRP Standalone Acknowledgement messages.
-
This field SHALL be set to the Message Counter of the message that is being acknowledged.
4.11.2. Reliable transfer
When the reliability bit is set, the reliable message is transmitted at most MRP_MAX_TRANSMISSIONS times until an acknowledgement of receipt is received from the peer or a timeout.
4.11.2.1. Retransmissions
Senders provide an automatic retransmission mechanism for reliable messages. In order for the receiver to receive a message reliably, the sender SHALL trigger the automatic retry mechanism after a period of mrpBackoffTime milliseconds without receiving an acknowledgement, where mrpBackoffTime is calculated according to the formula below. The sender SHALL retry up to a configured maximum number of times (MRP_MAX_TRANSMISSIONS - 1) before giving up and notifying the application.
Messages sent to a Node can be lost for various reasons such as lossy network or insufficient buffer space at the receiver. In the case of sleepy end devices, which wake up infrequently to receive messages destined for them, a sender must be aware of the characteristics of the recipient to ensure it does not attempt to send at a rate beyond the recipient’s capability. Therefore, the sender SHALL choose retransmission timeouts based on the sleepy characteristics of the destination Node using Section 4.3.2, “Operational Discovery”.
At each sender, a retransmission timer is started each time a reliable message is transmitted. The duration of the retransmission timer SHALL be calculated as follows:
Where:
For each unique Exchange, the sender SHALL wait for the acknowledgement message until the retransmission timer, mrpBackoffTime, expires.
A sleepy sender SHOULD increase t
to also account for its own sleepy interval required to receive the acknowledgment.
The base interval, i
, SHALL be set according to the active state of the peer node as stored in the Session Context of the session (either the Secure Session Context or the Unsecured Session Context depending on the Session Type).
The backoff base interval SHALL be set to a value at least 10% greater than the sleep interval of the destination:
-
If
PeerActiveMode
in the Session Context is true:-
i = SLEEPY_ACTIVE_INTERVAL
of the peer
-
-
Else the peer is in idle mode:
-
i = SLEEPY_IDLE_INTERVAL
of the peer
-
-
i = MRP_BACKOFF_MARGIN * i
The MRP_BACKOFF_THRESHOLD parameter creates a two-phase scheme which begins with linear backoff to improve initial latency when congestion is not the cause of packet drops, and then transitions to exponential backoff to provide convergence when the network is congested. If a positive acknowledgment is received before the retransmission timer expires, the retransmission timer is stopped. Otherwise, if the retransmission timer expires, the message is retransmitted and the timer started again.
The following table illustrates minimum, maximum, and cumulative retransmission times using default parameters.
Metric | Transmission Time [ms] | ||||
---|---|---|---|---|---|
Min Jitter |
330 |
330 |
528 |
845 |
1352 |
Max Jitter |
413 |
413 |
660 |
1056 |
1690 |
Min Total |
330 |
660 |
1188 |
2033 |
3385 |
Max Total |
413 |
825 |
1485 |
2541 |
4231 |
Transmission # |
0 |
1 |
2 |
3 |
4 |
The sender SHOULD initiate Section 4.3.2, “Operational Discovery” in parallel with the first retry to re-resolve the address of the destination Node if the initial transmission fails after one expected round trip. The sender SHOULD use the latest MRP parameters for the destination that result from subsequent Operational Discovery.
4.11.2.2. Acknowledgements
A receiver SHALL acknowledge a reliable message by either using a "piggybacked" acknowledgment in the next message destined to the peer, or a standalone acknowledgment, or both.
The acknowledgement message SHALL set the Acknowledged Message Counter field to the value of the Message Counter of the reliable message to be acknowledged.
Piggybacking Acknowledgments on Responses
Acknowledgements MAY be conveyed at the same time (i.e. piggybacked) as data in a response message. The receiver tries to optimize message transmission by deferring acknowledgments when a reliable message is received (see Section 4.11.5.2.2, “Standalone acknowledgement processing”) and piggybacking outstanding acknowledgments on messages that it needs to send back (see Section 4.11.5.1.1, “Piggyback acknowledgment processing” for more details).
Duplicate Message Detection
Since the reliable messaging protocol has a provision for the sender to retransmit messages, there is a significant chance that a duplicate message may arrive at the receiver. The receiver SHALL detect and mark duplicate messages that it receives using the standard authentication and replay protection mechanisms of the secure message layer (see Section 4.5.4, “Replay Prevention and Duplicate Message Detection”). The receiver SHALL send an acknowledgment message to the sender for each instance of an authenticated, reliable message, including duplicates. The reliability layer SHALL only propagate the first instance of a message to the next higher layer. Any message marked as a duplicate SHALL be dropped by the reliability layer.
4.11.3. Peer Exchange Management
The Reliable Messaging Protocol operates within the scope of an Exchange between two Nodes. MRP SHALL support one pending acknowledgement and one pending retransmission per Exchange.
MRP control parameters, detailed in Table 21, “Glossary of parameters”, are computed outside of the Exchange communication itself; instead, they are valid for the duration of a secure session. The SLEEPY_ACTIVE_INTERVAL
and SLEEPY_IDLE_INTERVAL
, used in computation of MRP control parameters, are determined during Operational Discovery or Section 4.3.1, “Commissionable Node Discovery”. Additionally, the initiator of a secure session MAY provide these parameters in the initial CASE Sigma1 or PASE PBKDFParamRequest messages, and the responder MAY provide its parameters in the corresponding protocol messages <ref_Sigma2, CASE Sigma2>> or PBKDFParamResponse.
4.11.5. Reliable Message Processing
4.11.5.1. Reliable Message Processing of Outgoing Messages
To prepare a given Protocol Message for transmission, the message SHALL be processed as follows:
Piggyback acknowledgment processing
-
Determine if there is a matching pending acknowledgement in the acknowledgement table for the given message by checking all of the following conditions:
-
If the Destination Node Id and Exchange Id of the given message and pending acknowledgement are the same
-
AND either
-
the Session Id and underlying Session Credentials of the given message and pending acknowledgement are the same
-
OR both the given message and pending acknowledgement are of Unsecured Session Type.
-
-
-
If there is a matching pending acknowledgement, the A Flag SHALL be set on the outbound message so it will serve as a piggybacked acknowledgement.
-
For such a piggybacked acknowledgement, the Acknowledgment Message Counter field SHALL be set to the message counter of the received message for which an acknowledgement was pending.
-
If the message being prepared is not a standalone acknowledgement, remove the matching entry from the acknowledgement table.
-
If the message being prepared is a standalone acknowledgement, set the
StandaloneAckSent
field of the matching entry in the acknowledgement table to true.
-
Message retransmission processing
-
If the outbound message is marked to be delivered reliably over a UDP transport, the R Flag SHALL be set on the given message to request an acknowledgement from the peer upon receipt.
-
Any message flagged for reliable delivery (R Flag set) SHALL be stored in the retransmission table to track the message until it has been successfully acknowledged by the peer.
-
-
Perform Section 4.6.1, “Message Transmission” processing step on the message to send the message to the peer:
-
The same Session ID, Destination Node ID, Security Flags, and transport as were used for the initial message transmission SHALL be used.
-
-
If the transport interface returns an error on the send attempt, the error is assessed to determine whether the message can be retried.
-
If the error is fatal, the application is notified and the message removed from the retransmission table.
-
If there is no error, or a non-fatal error such as no memory, the message is resent
-
Update the retransmission table to reflect the send count.
-
Start a retransmission timer to track the maximum time to wait before attempting another retransmission.
-
For each retry, the retransmission table is updated to track the number of retries until the maximum number is attempted, at which point the message is evicted from the retransmission table.
-
-
Send flow state diagram
The MRP send flow described above is depicted in the control flow diagram Figure 12, “MRP send flow”.
4.11.5.2. Reliable Message Processing of Incoming Messages
A message received from Section 4.6.2, “Message Reception” for reliability processing SHALL be processed as follows:
-
Verify the message has a legal combination of reliability flags:
-
If the R Flag is set:
-
If Group Session Type AND C Flag =
0
, drop the message.
-
-
If the A Flag is set:
-
If Group Session Type AND C Flag =
0
, drop the message.
-
-
-
Proceed to Section 4.9.5.1, “Exchange Message Matching”.
-
Proceed to Section 4.11.5.2.1, “Received acknowledgement processing”.
Received acknowledgement processing
-
If the A Flag is set:
-
Query the retransmission table for the Acknowledgement Message Counter contained in the received message.
-
If there is a match:
-
Remove the entry from the retransmission table.
-
Stop the retransmission timer for that entry.
-
-
If there is no match, it indicates that this is either a duplicate acknowledgment or the Exchange context does not exist.
-
-
-
Proceed to Section 4.11.5.2.2, “Standalone acknowledgement processing”.
Standalone acknowledgement processing
-
If the R Flag is set, the received message is requesting an acknowledgement be sent back:
-
If the message is marked as a duplicate:
-
Immediately send a standalone acknowledgment.
-
If the Exchange is marked as an ephemeral exchange the Exchange SHALL be closed.
-
Drop the message.
-
-
Otherwise, instead of sending an acknowledgement immediately upon the receipt of a reliable message from a peer, the receiver SHOULD wait for a time no longer than MRP_STANDALONE_ACK_TIMEOUT before sending a standalone acknowledgment:
-
Add the message counter of the received message to the acknowledgement table to signal that an outbound acknowledgement is pending. There can be only one outstanding acknowledgement at a time on a single Exchange. If a pending acknowledgement already exists for the Exchange, and it has
StandaloneAckSent
set to false, a standalone acknowledgment SHALL be sent immediately for that pending message counter, and the acknowledgement table entry SHALL be replaced for the new message. -
Start the acknowledgement timer for the Exchange.
-
If the timer triggers before being cancelled, a standalone acknowledgment SHALL be sent to the source of the message. Sending this standalone acknowledgment SHALL NOT remove the acknowledgement table entry and SHALL set the
StandaloneAckSent
field of the entry to true.
-
-
-
-
The received message is then delivered to the next processing step of Section 4.6.2, “Message Reception”.
Receive flow state diagram
The MRP receive flow described above is depicted in Figure Figure 13, “MRP receive flow”.
4.11.6. Reliable Message State
4.11.6.1. Retransmission Table
For retransmissions, the sender maintains a retransmission table of context records containing information on all reliable messages sent that have acknowledgments still pending. Each such reliable message context record includes the following fields:
-
Reference to Exchange Context
-
Message Counter
-
Reference to fully formed, encoded and encrypted message buffer
-
Send count
-
Retransmission timeout counter
Each time a message that requires acknowledgment is sent, a new retransmission context record is inserted into the retransmission table or an existing record is updated to increment its send count. The message is sent a configurable maximum number of times (MRP_MAX_TRANSMISSIONS) and, if still undelivered, the application is notified of the failure.
4.11.6.2. Acknowledgement Table
The receiver maintains an acknowledgement table of context records containing information on each reliable message for which an acknowledgment SHALL be sent. Each such reliable message context record includes the following fields:
-
Reference to Exchange Context
-
Message Counter
-
A boolean,
StandaloneAckSent
, indicating whether a standalone acknowledgement has been sent for this message counter. Initially false.
An entry SHALL remain in the table until one of the following things happens:
-
The exchange associated with the entry is closed. See Section 4.9.5.3, “Closing an Exchange”.
-
The exchange associated with the entry has switched to track a pending acknowledgement for a new message counter value. See Section 4.11.5.2.2, “Standalone acknowledgement processing”.
-
A message that is not a standalone acknowledgement is sent which serves as an acknowledgement for the entry. See Section 4.11.5.1.1, “Piggyback acknowledgment processing”.
4.11.7. MRP Messages
4.11.7.1. MRP Standalone Acknowledgement
The MRP Standalone Acknowledgement message SHALL be formed as follows:
-
The application payload SHALL be empty.
-
The A Flag SHALL be set to
1
. -
The Acknowledged Message Counter SHALL be included in the header.
-
The Protocol ID SHALL be set to
PROTOCOL_ID_SECURE_CHANNEL
. -
The Protocol Opcode SHALL be set to MRP Standalone Acknowledgement.
The rules for when to send this message are detailed in Section 4.11.5.2.2, “Standalone acknowledgement processing”.
4.11.8. Parameters and Constants
Table 21, “Glossary of parameters” is a glossary of parameters used in this chapter with a brief description for each parameter. A Node SHALL use the provided default value for each parameter unless the message recipient Node advertises an alternate value for the parameter via Operational Discovery.
Parameter Name | Description | Default Value |
---|---|---|
MRP_MAX_TRANSMISSIONS |
The maximum number of transmission attempts for a given reliable message. The sender MAY choose this value as it sees fit. |
5 |
MRP_BACKOFF_BASE |
The base number for the exponential backoff equation. |
1.6 |
MRP_BACKOFF_JITTER |
The scaler for random jitter in the backoff equation. |
0.25 |
MRP_BACKOFF_MARGIN |
The scaler margin increase to backoff over the peer sleepy interval. |
1.1 |
MRP_BACKOFF_THRESHOLD |
The number of retransmissions before transitioning from linear to exponential backoff. |
1 |
MRP_STANDALONE_ACK_TIMEOUT |
Amount of time to wait for an opportunity to piggyback an acknowledgement on an outbound message before falling back to sending a standalone acknowledgement. |
200 milliseconds |
4.12. Unicast Communication
This section specifies the semantics of establishing a unicast session and the lifecycle of a unicast session.
Unicast sessions exist in one of two phases:
-
Session Establishment Phase: A series of well-defined unencrypted messages that aim to establish a shared key.
-
Application Data Phase: A series of ad-hoc encrypted messages exchanging interaction model protocol actions, application data, etc.
4.12.1. Session Establishment Phase
CASE SHALL be used as a session establishment mechanism for all sessions except:
-
Communication for the purpose of commissioning when NOC has not yet been installed
PASE SHALL only be used for session establishment mechanism during device commissioning. PASE SHALL NOT be used as a session establishment mechanism for any other session. BTP MAY be used as the transport for device commissioning. BTP SHALL NOT be used as a transport for operational purposes.
Unless otherwise specified, the CASE, PASE, User-Directed Commissioning protocol, and Secure Channel Status Report messages SHALL be the only allowed unencrypted messages.
This phase aims to:
-
Authenticate peers (CASE-based sessions only).
-
Derive shared secrets to encrypt subsequent session data.
-
Choose session identifiers to identify the subsequent session.
4.12.1.1. Unsecured Session Context
The following session context data SHALL be utilized to associate messages to a particular peer and recover context during unencrypted sessions:
-
Session Role
: Records whether the node is the session initiator or responder. -
Ephemeral Initiator Node ID
: Randomly selected for each session by the initiator from the Operational Node ID range and enclosed by initiator as Source Node ID and responder as Destination Node ID.-
Initiators SHALL select a new random ephemeral node ID for each unsecured session, and SHALL select an ID that does not conflict with any ephemeral node IDs for any other ongoing unsecured sessions opened by the initiator.
-
-
Message Reception State
: Provides tracking for the Unencrypted Message Counter of the remote peer.
Matching and responder creation of Unsecured Session Contexts
SHALL be as follows:
-
Given an incoming unencrypted message
-
Locate any
Unsecured Session Context
with matchingEphemeral Initiator Node ID
-
If any is located, the incoming message SHALL be assumed to be associated with this
Unsecured Session Context
-
-
Else if the message carries a Source Node ID
-
Create a new
Unsecured Session Context
-
Set
Session Role
toresponder
-
Record the incoming message’s Source Node ID as
Ephemeral Initiator Node ID
-
-
Else discard the message
-
Initiator creation of Unsecured Session Contexts
SHALL be as follows:
-
Given the first outgoing message of an unencrypted exchange
-
Create a new
Unsecured Session Context
-
Set
Session Role
toinitiator
-
Randomly select a node ID from the Operational Node ID range that does not collide with any ephemeral node IDs for any other ongoing unsecured sessions opened by the initiator and record this as
Ephemeral Initiator Node ID
-
4.12.1.2. Session Establishment over IP
When establishing a session over IP, the initiator SHALL use TCP when both of the following are true:
-
The initiator supports TCP
-
The responder supports TCP as indicated by the
T
flag
If one or both nodes do not support TCP, the initiator SHALL use MRP to establish the session.
The choice of transport used during session establishment SHALL be used for the transport of messages of the established session.
4.12.1.3. Shared Secrets
Both CASE and PASE produce two shared keys: I2RKey
and R2IKey
. These keys will be saved to the session’s context and used to encrypt and decrypt messages during the Session Data Phase.
Nodes that support the CASE session resumption SHALL also save to the session’s context the SharedSecret
computed during the CASE protocol execution.
4.12.1.4. Choosing Secure Unicast Session Identifiers
Both CASE and PASE allow each participant the ability to choose a unicast session identifier for the subsequent encrypted session. The session identifier SHALL be used to look up the relevant encryption keys and any other metadata for a particular session.
Messages using a unicast session identifier SHALL set the Session Type field to 0
.
Each peer SHALL specify a Session Identifier
unique in reference to their own active sessions.
There SHALL NOT be overlap between the Session ID values allocated for PASE and CASE sessions, as the Session Identifier
space is shared across both session establishment methods.
For example, if the initiator has two active sessions with session identifiers 0x0001 and 0x0002, it could choose any non-zero session identifier besides 0x0001 and 0x0002.
If there are no available session identifiers (i.e. the participant has 65,535 open sessions), the Node SHALL terminate an existing session to free a session identifier.
4.12.2. Application Data Phase
When the last CASE or PASE protocol message is sent or received and successfully processed, session establishment has completed.
4.12.2.1. Secure Session Context
During the Application Data Phase, the following conceptual session context data SHALL be utilized to securely process subsequent messages:
-
Session Type
: Records whether the session was established using CASE or PASE. -
Session Role
: Records whether the node is the session initiator or responder. -
Local Session Identifier
: Individually selected by each participant in secure unicast communication during session establishment and used as a unique identifier to recover encryption keys, authenticate incoming messages and associate them to existing sessions.-
On a given Node, this is the identifier that SHALL be used to map from an incoming message’s Session ID field to the session context data.
-
-
Peer Session Identifier
: Assigned by the peer during session establishment.-
On a given Node, this is the identifier that SHALL be used in the Session ID field of every outgoing message associated with the session, so that it can be interpreted as the
Local Session Identifier
by the remote peer.
-
-
I2RKey
: Encrypts data in messages sent from the initiator of session establishment to the responder. -
R2IKey
: Encrypts data in messages sent from the session establishment responder to the initiator. -
SharedSecret
: Computed during the CASE protocol execution and re-used when CASE session resumption is implemented. -
Local Message Counter
: Secure Session Message Counter for outbound messages.-
At successful session establishment, the
Local Message Counter
SHALL be initialized per Section 4.5.1.1, “Message Counter Initialization”.
-
-
Message Reception State
: Provides tracking for the Secure Session Message Counter of the remote peer. -
Local Fabric Index
: Records the local Index for the session’s Fabric, which MAY be used to look up Fabric metadata related to the Fabric for which this session context applies.-
This field SHALL contain the "no Fabric" value of 0 when the
SessionType
isPASE
and successful invocation of the AddNOC command has not yet occurred during commissioning.
-
-
Peer Node ID
: Records the authenticated node ID of the remote peer, when available.-
This field SHALL contain the "Unspecified Node ID" value of 0 when the
SessionType
isPASE
.
-
-
Resumption ID
: The ID used when resuming a session between the local and remote peer. -
SessionTimestamp
: A timestamp indicating the time at which the last message was sent or received. This timestamp SHALL be initialized with the time the session was created. See Section 4.10.1.1, “Session Establishment - Out of Resources” for more information. -
ActiveTimestamp
: A timestamp indicating the time at which the last message was received. This timestamp SHALL be initialized with the time the session was created. -
The following sleepy parameters (see Table 5, “Glossary of parameters”):
-
SLEEPY_IDLE_INTERVAL
-
SLEEPY_ACTIVE_INTERVAL
-
PeerActiveMode
: A boolean that tracks whether the peer node is in Active or Idle mode as defined in Section 2.9, “Sleepy End Device (SED)”.PeerActiveMode
is set as follows:
-
Note that the Local Fabric Index
and Peer Fabric Index
reported in the NOC Response MAY differ in value, while still referring to the same Fabric, since for a given complete Fabric Reference, the short Fabric Index allocated during commissioning of the respective Nodes on the same Fabric MAY be different. This possible difference is due to the order in which the Fabric in question was joined in the lifecycle of the respective Nodes. See the section on AddNOC command behavior for details on Fabric Index allocation behavior over time.
There SHALL also be reservation of storage to support CASE Authenticated Tag (CAT) fields. The CAT
fields are 32-bit values that MAY have been present in RDN case-authenticated-tag of the remote peer’s operational certificate, during CASE.
The CAT
fields are used to cache Operational Certificate data so that it can be used by the ACL processing logic to support CASE Authenticated Tags.
Since these fields MAY be omitted from NOCs, they MAY be marked as absent in the context, such that they are not taken into account when missing. When present, they SHALL be stored. Maximum up to 3 CAT
fields SHALL be supported.
Their value is unused in PASE session contexts.
4.13. Session Establishment
4.13.1. Passcode-Authenticated Session Establishment (PASE)
This section describes session establishment using a shared passcode together with an augmented Password-Authenticated Key Exchange (PAKE), in which only one party knows the passcode beforehand, to generate shared keys. This protocol is only used when commissioning a Node (i.e. the Commissionee).
4.13.1.1. Protocol Overview
The Passcode-Authenticated Session Establishment (PASE) protocol aims to establish the first session between a Commissioner and a Commissionee using a known passcode provided out-of-band. The pairing is performed using Section 3.10, “Password-Authenticated Key Exchange (PAKE)” and relies on a Password-Based Key Derivation Function (PBKDF) where the passcode is used as password.
This session establishment protocol provides a means to:
-
Communicate PBKDF parameters.
-
Derive PAKE bidirectional secrets.
The Commissioner is the Initiator and the Commissionee is the Responder.
It is assumed that the initiator has somehow obtained the passcode and that the responder has the relevant Crypto_PAKEValues_Responder
corresponding to the passcode before starting a PASE session establishment protocol.
4.13.1.2. Protocol Details
Message format
All PASE messages SHALL be structured as specified in Section 4.4, “Message Frame Format”.
All PASE messages are unsecured at the message layer:
-
The Session ID field SHALL be set to
0
. -
The Session Type bits of the Security Flags SHALL be set to
0
. -
The S Flag and DSIZ fields of the Message Flags SHALL be set to
0
.
For each PASE message, the application payload is the TLV encoding of the message structure as defined below:
Message Name | Payload TLV Encoding |
---|---|
PBKDFParamRequest |
|
PBKDFParamResponse |
|
Pake1 |
|
Pake2 |
|
Pake3 |
|
PakeFinished |
N/A (encoded via StatusReport) |
The other fields of the Message format are not specific to the PASE messages.
For all TLV-encoded PASE messages, any context-specific tags not listed in the associated TLV schemas SHALL be reserved for future use, and SHALL be silently ignored if seen by a recipient which cannot understand them.
Message Exchange
The PBKDFParamRequest
, PBKDFParamResponse
, Pake1
, Pake2
, Pake3
, and PakeFinished
of a distinct session establishment are part of the same message exchange. The initiator and responder SHALL NOT send encrypted application data in the newly established session until PakeFinished
is received by the initiator within the unencrypted session used for establishment.
Each message SHALL use PROTOCOL_ID_SECURE_CHANNEL
as Protocol ID and the corresponding Protocol Opcode as defined in Table 17, “Secure Channel Protocol Opcodes”.
The flags of the Exchange Flags of the Protocol Header are defined as follows per PASE message:
Message | I Flag |
---|---|
PBKDFParamRequest |
1 |
PBKDFParamResponse |
0 |
Pake1 |
1 |
Pake2 |
0 |
Pake3 |
1 |
All PASE messages SHALL be sent reliably. This may be implicit (e.g. TCP) or explicit (e.g. MRP reliable messaging) in the underlying transport.
The other fields of the Protocol Header are not specific to the PASE messages.
PBKDFParamRequest
This message serves to request the PBKDF parameters, with a payload that follows this TLV schema:
pbkdfparamreq-struct => STRUCTURE [ tag-order ] { initiatorRandom [1] : OCTET STRING [ length 32 ], initiatorSessionId [2] : UNSIGNED INTEGER [ range 16-bits ], passcodeId [3] : UNSIGNED INTEGER [ length 16-bits ], hasPBKDFParameters [4] : BOOLEAN, initiatorSEDParams [5, optional] : sed-parameter-struct }
-
The initiator SHALL generate a random number
InitiatorRandom = Crypto_DRBG(len = 32 * 8)
. -
The initiator SHALL generate a session identifier (
InitiatorSessionId
) for subsequent identification of this session. TheInitiatorSessionId
field SHALL NOT overlap with any other existing PASE or CASE session identifier in use by the responder. See Section 4.12.1.4, “Choosing Secure Unicast Session Identifiers” for more details. The initiator SHALL set theLocal Session Identifier
in the Session Context to the valueInitiatorSessionId
. -
The initiator SHALL choose a passcode identifier (
PasscodeId
) corresponding to a particular PAKE passcode verifier installed on the responder. A value of 0 for the passcodeID SHALL correspond to the PAKE passcode verifier for the currently-open commissioning window, if any. Non-zero values are reserved for future use. For example, for initial commissioning, the verifier would be the built-in verifier matching the Onboarding Payload's passcode or, equivalently, the multi-fabric Basic Commissioning Method passcode if that method is supported. For the multi-fabric Enhanced Commissioning Method, the verifier would match the verifier provided through the OpenCommissioningWindow command. -
The initiator SHALL indicate whether the PBKDF parameters (salt and iterations) are known for the particular
passcodeId
(for example from the QR code) by settingHasPBKDFParameters
. IfHasPBKDFParameters
is set toTrue
, the responder SHALL NOT return the PBKDF parameters. IfHasPBKDFParameters
is set toFalse
, the responder SHALL return the PBKDF parameters. -
The initiator SHALL send a message with the appropriate Protocol Id and Protocol Opcode from Table 17, “Secure Channel Protocol Opcodes” whose payload is the TLV-encoded pbkdfparamreq-struct
PBKDFParamRequest
with an anonymous tag for the outermost struct.PBKDFParamRequest = { initiatorRandom (1) = InitiatorRandom, initiatorSessionId (2) = InitiatorSessionId, passcodeID (3) = PasscodeId, hasPBKDFParameters (4) = HasPBKDFParameters, }
PBKDFParamResponse
pbkdfparamresp-struct => STRUCTURE [ tag-order ] { initiatorRandom [1] : OCTET STRING [ length 32 ], responderRandom [2] : OCTET STRING [ length 32 ], responderSessionId [3] : UNSIGNED INTEGER [ range 16-bits ], pbkdf_parameters [4] : Crypto_PBKDFParameterSet, responderSEDParams [5, optional] : sed-parameter-struct }
On receipt of PBKDFParamRequest
, the responder SHALL:
-
Verify
passcodeID
is set to 0. If verification fails, the responder SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
Generate a random number
ResponderRandom = Crypto_DRBG(len = 32 * 8)
. -
Generate a session identifier (
ResponderSessionId
) for subsequent identification of this session. TheResponderSessionId
field SHALL NOT overlap with any other existing PASE or CASE session identifier in use by the responder. See Section 4.12.1.4, “Choosing Secure Unicast Session Identifiers” for more details. The responder SHALL set theLocal Session Identifier
in the Session Context to the valueResponderSessionId
. -
Set the
Peer Session Identifier
in the Session Context to the valuePBKDFParamRequest.initiatorSessionId
. -
Construct the appropriate
Crypto_PBKDFParameterSet
(PBKDFParameters
). IfPBKDFParamRequest.hasPBKDFParameters
isTrue
the responder SHALL NOT include the PBKDF parameters (i.e. salt and iteration count) in theCrypto_PBKDFParameterSet
. IfMsg1.hasPBKDFParameters
isFalse
the responder SHALL include the PBKDF parameters (i.e. salt and iteration count) in theCrypto_PBKDFParameterSet
. -
Send a message with the appropriate Protocol Id and Protocol Opcode from Table 17, “Secure Channel Protocol Opcodes” whose payload is the TLV-encoded pbkdfparamresp-struct
PBKDFParamResponse
with an anonymous tag for the outermost struct.PBKDFParamResponse = { initiatorRandom (1) = PBKDFParamRequest.initiatorRandom, responderRandom (2) = ResponderRandom, responderSessionId (3) = ResponderSessionId, pbkdf_parameters (4) = PBKDFParameters }
Pake1
pake-1-struct => STRUCTURE [ tag-order ] { pA [1] : OCTET STRING [ length CRYPTO_PUBLIC_KEY_SIZE_BYTES ], }
On receipt of PBKDFParamResponse
, the initiator SHALL:
-
Set the
Peer Session Identifier
in the Session Context to the valuePBKDFParamResponse.responderSessionId
. -
Generate the
Crypto_PAKEValues_Initiator
according to thePBKDFParamResponse.pbkdf_parameters
-
Using
Crypto_PAKEValues_Initiator
, generatepA := Crypto_pA(Crypto_PAKEValues_Initiator)
-
Send a message with the appropriate Protocol Id and Protocol Opcode from Table 17, “Secure Channel Protocol Opcodes” whose payload is the TLV-encoded pake-1-struct
Pake1
with an anonymous tag for the outermost struct.Pake1 = { pA (1) = pA, }
Pake2
pake-2-struct => STRUCTURE [ tag-order ] { pB [1] : OCTET STRING [ length CRYPTO_PUBLIC_KEY_SIZE_BYTES ], cB [2] : OCTET STRING [ length CRYPTO_HASH_LEN_BYTES], }
On receipt of Pake1
, the responder SHALL:
-
Compute
pB := Crypto_pB(Crypto_PAKEValues_Responder)
using the passcode verifier indicated inPBKDFParamRequest
-
Compute
TT := Crypto_Transcript(PBKDFParamRequest, PBKDFParamResponse, Pake1.pA, pB)
-
Compute
(cA, cB, Ke) := Crypto_P2(TT, Pake1.pA, pB)
-
Send a message with the appropriate Protocol Id and Protocol Opcode from Table 17, “Secure Channel Protocol Opcodes” whose payload is the TLV-encoded pake-2-struct
Pake2
with an anonymous tag for the outermost struct.Pake2 = { pB (1) = pB, cB (2) = cB, }
Pake3
pake-3-struct => STRUCTURE [ tag-order ] { cA [1] : OCTET STRING [length CRYPTO_HASH_LEN_BYTES], }
On receipt of Pake2
, the initiator SHALL:
-
Compute
TT := Crypto_Transcript(PBKDFParamRequest, PBKDFParamResponse, Pake1.pA, Pake2.pB)
-
Compute
(cA, cB, Ke) := Crypto_P2(TT, Pake1.pA, Pake2.pB)
-
Verify
Pake2.cB
againstcB
. If verification fails, the initiator SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
Send a message with the appropriate Protocol Id and Protocol Opcode from Table 17, “Secure Channel Protocol Opcodes” whose payload is the TLV-encoded pake-3-struct
Pake3
with an anonymous tag for the outermost struct.Pake3 = { cA (1) = cA, }
-
The initiator SHALL NOT send any encrypted application data until it receives
PakeFinished
from the responder.
On reception of Pake3
, the responder SHALL:
-
Verify
Pake3.cA
againstcA
. If verification fails, the responder SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
The responder SHALL set
SessionTimestamp
to a timestamp from a clock which would allow for the eventual determination of the last session use relative to other sessions. -
The responder SHALL encode and send PakeFinished.
PakeFinished
To indicate the successful completion of the protocol, the responder SHALL send a status report: StatusReport(GeneralCode: SUCCESS, ProtocolId: SECURE_CHANNEL, ProtocolCode: SESSION_ESTABLISHMENT_SUCCESS)
.
The initiator SHALL set SessionTimestamp
to a timestamp from a clock which would allow for the eventual determination of the last session use relative to other sessions.
Session Encryption Keys
After verification of Pake3
, each party can compute their sending and receiving session keys as described below:
byte SEKeys_Info[] = /* "SessionKeys" */ {0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73} I2RKey || R2IKey || AttestationChallenge = Crypto_KDF ( inputKey = Ke, salt = [], info = SEKeys_Info, len = 3 * CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
-
Each key is exactly
CRYPTO_SYMMETRIC_KEY_LENGTH_BITS
bits. -
The initiator SHALL use
I2RKey
to encrypt and integrity protect messages and the `R2IKey' to decrypt and verify messages. -
The responder SHALL use
R2IKey
to encrypt and integrity protect messages and the `I2RKey' to decrypt and verify messages. -
The
AttestationChallenge
SHALL only be used as a challenge during device attestation. See Section 6.2.3, “Device Attestation Procedure” for more details.
Upon initial installation of the new PASE Session Keys:
-
The Node SHALL initialize its Local Message Counter in the Session Context per Section 4.5.1.1, “Message Counter Initialization”.
-
The Node SHALL initialize the Message Reception State in the Session Context` and set the synchronized
max_message_counter
of the peer to0
.
where ||
indicates message concatenation and []
a zero-length array.
4.13.2. Certificate Authenticated Session Establishment (CASE)
This section describes a certificate-authenticated session establishment (CASE) protocol using Node Operational credentials. This session establishment mechanism provides an authenticated key exchange between exactly two peers while maintaining privacy of each peer. A resumption mechanism allows bootstrapping a new session from a previous one, dramatically reducing the computation required as well as reducing the number of messages exchanged.
4.13.2.1. Protocol Overview
This session establishment protocol provides a means to:
-
Mutually authenticate both peer Nodes
-
Generate cryptographic keys to secure subsequent communication within a session
-
Exchange operational parameters for the session, such as Session Identifier and MRP parameters
The cryptographic protocol mirrors the [SIGMA] protocol and uses the Identity Protection Key (IPK) to provide better identity protection. Briefly, the protocol will:
-
Exchange ephemeral elliptic curve public keys (
Sigma1.initiatorEphPubKey
andSigma2.responderEphPubKey
) to generate a shared secret -
Exchange certificates to prove identities (
Sigma2.encrypted2.responderNOC
andSigma3.encrypted3.initiatorNOC
) -
Prove possession of the NOC private key by signing the ephemeral keys and NOC (
sigma-2-tbsdata
andsigma-3-tbsdata
)
The basic protocol can be achieved within 2 round trips as shown below:
4.13.2.2. Session Resumption
The protocol also provides a means to quickly resume a session using a previously established session. Resumption does not require expensive signature creation and verification which significantly reduces the computation time. Because of this, resumption is favoured for low-powered devices when applicable. Session resumption SHOULD be used by initiators when the necessary state is known to the initiator.
The nomenclature Sigma1 with Resumption
in the following subsections implies a Sigma1
message with both the optional resumptionID
and initiatorResumeMIC
fields populated in sigma-1-struct
.
In the case where a Responder is not able to resume a session as requested by a Sigma1 with Resumption
, the information included in the Sigma1 with Resumption
message SHALL be processed as a Sigma1
message without any resumption fields to construct a Sigma2
message and continue the standard session establishment protocol without resumption.
To make the resumption succeed, both the Initiator and the Responder SHALL have remembered the SharedSecret
they have computed during the previous execution of the CASE session establishment. It SHALL be that SharedSecret
that is used to compute the resumption ID.
Session Resumption State
To perform session resumption, the following state from the previous session context must be known to the initiator and responder:
4.13.2.3. Protocol Details
Message format
All CASE messages SHALL be structured as specified in Section 4.4, “Message Frame Format”.
All CASE messages are unsecured at the message layer:
-
The Session ID field SHALL be set to
0
. -
The Session Type bits of the Security Flags SHALL be set to
0
. -
The S Flag and DSIZ fields of the Message Flags SHALL be set to
0
.
For each CASE message, the application payload is the TLV encoding of the message structure as defined below:
Message Name | Payload TLV Encoding |
---|---|
Sigma1 |
|
Sigma2 |
|
Sigma3 |
|
Sigma2_Resume |
|
SigmaFinished |
N/A (encoded via StatusReport) |
The other fields of the Message format are not specific to the CASE messages.
Message Exchange
The Sigma1
, Sigma2
, Sigma3
, and SigmaFinished
of a distinct session establishment are part of the same message exchange. The Sigma1 with resumption
, Sigma2_Resume
and SigmaFinished
of a distinct session resumption are part of the same message exchange. The Sigma1 with resumption
, Sigma2
, Sigma3
and SigmaFinished
of a distinct session resumption that failed to perform the resumption are part of the same message exchange.
Each message SHALL use PROTOCOL_ID_SECURE_CHANNEL
as Protocol ID and the corresponding Protocol Opcode as defined in Table 17, “Secure Channel Protocol Opcodes”.
The Exchange Flags of the Protocol Header are defined as follows per CASE message:
Message | I Flag |
---|---|
CASE Sigma1 |
1 |
CASE Sigma2 |
0 |
CASE Sigma3 |
1 |
CASE Sigma2_Resume |
0 |
For the SigmaFinished
message the value of the I Flag is set depending on whether the status message is sent by the Initiator or the Responder.
All CASE messages SHALL be sent reliably. This may be implicit (e.g. TCP) or explicit (e.g. MRP reliable messaging) in the underlying transport.
The other fields of the Exchange format are not specific to the CASE messages.
Generate and Send Sigma1
The initiator encodes and sends a Sigma1
message, with a payload that follows this TLV schema:
sigma-1-struct => STRUCTURE [ tag-order ] { initiatorRandom [1] : OCTET STRING [ length 32 ], initiatorSessionId [2] : UNSIGNED INTEGER [ range 16-bits ], destinationId [3] : destination-identifier, initiatorEphPubKey [4] : ec-pub-key, initiatorSEDParams [5, optional] : sed-parameter-struct, resumptionID [6, optional] : OCTET STRING [ length 16 ], initiatorResumeMIC [7, optional] : OCTET STRING [ length CRYPTO_AEAD_MIC_LENGTH_BYTES ] }
-
The initiator SHALL generate a random number
InitiatorRandom = Crypto_DRBG(len = 32 * 8)
. -
The initiator SHALL generate a session identifier (
InitiatorSessionId
) for subsequent identification of this session. TheInitiatorSessionId
field SHALL NOT overlap with any other existing PASE or CASE session identifier in use by the initiator. See Section 4.12.1.4, “Choosing Secure Unicast Session Identifiers” for more details. -
The initiator SHALL generate a destination identifier (
DestinationId
) according to Destination Identifier to enable the responder to properly select a mutual Fabric and trusted root for the secure session. -
The initiator SHALL generate an ephemeral key pair
InitiatorEphKeyPair = Crypto_GenerateKeypair()
. -
The initiator MAY encode any relevant MRP parameters.
-
Any context-specific tags not listed in the above TLV schemas SHALL be reserved for future use, and SHALL be silently ignored if seen by a responder which cannot understand them.
-
If the initiator is resuming a session from a previous execution of the CASE with the same peer, the initiator SHALL:
-
Note the
ResumptionID
of the previous session. -
Generate the
S1RK
key. -
Generate the
initiatorResumeMIC
using theSharedSecret
from the previous session:byte Resume1MIC_P[] = {} byte Resume1MIC_A[] = {} byte Resume1MIC_Nonce[13] = /* "NCASE_SigmaR1" */ {0x4e, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x69, 0x67, 0x6d, 0x61, 0x53, 0x31} InitiatorResume1MIC = Crypto_AEAD_GenerateEncrypt( K = S1RK, P = Resume1MIC_P, A = Resume1MIC_A, N = Resume1MIC_Nonce )
-
-
The initiator SHALL send a message with
Secure Channel
Protocol ID andSigma1
Protocol Opcode from Table 17, “Secure Channel Protocol Opcodes” whose payload is the TLV-encoded Sigma1Msg1
with an anonymous tag for the outermost struct.Msg1 = { initiatorRandom (1) = InitiatorRandom, initiatorSessionId (2) = InitiatorSessionId, destinationId (3) = DestinationId, initiatorEphPubKey (4) = InitiatorEphKeyPair.publicKey initiatorSEDParams (5) = sed-parameter-struct (optional), resumptionID (6) = ResumptionID (optional, only present if performing resumption), initiatorResumeMIC (7) = InitiatorResume1MIC (optional, only present if performing resumption) }
Validate Sigma1
On receipt of Msg1
, the responder SHALL perform the following:
-
If
Msg1
contains either aresumptionID
or aninitiatorResumeMIC
field but not both, the responder SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
Set the
Peer Session Identifier
in the Session Context to the valueMsg1.initiatorSessionId
. -
If
Msg1
contains both theresumptionID
andinitiatorResumeMIC
fields, the responder SHALL search for an existing session that has aResumption ID
equal to the incomingresumptionID
. If a single such session exists, the responder SHALL follow the steps in Section 4.13.2.3.10, “Validate Sigma1 with Resumption” rather than continue the steps outlined in Section 4.13.2.3.5, “Validate Sigma1 Destination ID”. -
If
Msg1
does not contain aresumptionID
andinitiatorResumeMIC
field, the responder SHALL continue the steps in Section 4.13.2.3.5, “Validate Sigma1 Destination ID”.
Validate Sigma1 Destination ID
-
The responder SHALL validate the incoming
destinationId
:-
The responder SHALL traverse all its installed Node Operational Certificates (NOC), gathering the associated trusted roots' public keys from the associated chains and SHALL generate a
candidateDestinationId
based on the procedure in Section 4.13.2.4.1, “Destination Identifier” for that tuple of <Root Public Key, Fabric ID, Node ID>. -
The responder SHALL verify that the incoming
destinationId
matches one of thecandidateDestinationId
generated above. Upon such a match, the associated trusted root, Fabric ID, Node ID and IPK SHALL be recorded for subsequent use. -
Note that at the initiator, only the current Epoch Key for the IPK will have been used. At the receiver, several IPK Epoch Keys may be installed, requiring several
candidateDestinationId
to be computed, one per available IPK Operational Key, per NOC.
-
-
If there is no
candidateDestinationId
matching the incomingdestinationId
, the responder SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: NO_SHARED_TRUST_ROOTS)
and perform no further processing. -
Otherwise, if a match was found for the
destinationId
, the matched NOC, ICAC (if present), and associated trusted root SHALL be used for selection of theresponderNOC
andresponderICAC
in the steps for Sigma2.
Generate and Send Sigma2
If validation is successful, the responder encodes and sends a Sigma2
message.
sigma-2-tbsdata => STRUCTURE [ tag-order ] { responderNOC [1] : OCTET STRING, responderICAC [2, optional] : OCTET STRING, responderEphPubKey [3] : ec-pub-key, initiatorEphPubKey [4] : ec-pub-key, } sigma-2-tbedata => STRUCTURE [ tag-order ] { responderNOC [1] : OCTET STRING, responderICAC [2, optional] : OCTET STRING, signature [3] : ec-signature, resumptionID [4] : OCTET STRING [ length 16 ], } sigma-2-struct => STRUCTURE [ tag-order ] { responderRandom [1] : OCTET STRING [ length 32 ], responderSessionId [2] : UNSIGNED INTEGER [ range 16-bits ], responderEphPubKey [3] : ec-pub-key, encrypted2 [4] : OCTET STRING, responderSEDParams [5, optional] : sed-parameter-struct }
Note
|
sigma-2-tbsdata is NOT transmitted but is instead signed; the signature will be encrypted and transmitted.
|
-
The responder SHALL generate a random resumption ID
ResumptionID = Crypto_DRBG(len = 16 * 8)
.-
The responder SHALL set the
Resumption ID
in the Session Context to the valueResumptionID
.
-
-
The responder SHALL use the Node Operational Key Pair
ResponderNOKeyPair
,responderNOC
, andresponderICAC
(if present) corresponding to the NOC obtained in Section 4.13.2.3.4, “Validate Sigma1”. -
The responder SHALL generate an ephemeral key pair
ResponderEphKeyPair = Crypto_GenerateKeypair()
. -
The responder SHALL generate a shared secret:
-
The responder SHALL encode the following items as a sigma-2-tbsdata with an anonymous tag:
-
responderNOC
as a matter-certificate -
responderICAC
(if present) as a matter-certificate -
ResponderEphKeyPair.publicKey
-
Msg1.initiatorEphPubKey
-
ResumptionID
-
-
The responder SHALL generate a signature:
TBSData2Signature = Crypto_Sign( message = sigma-2-tbsdata, privateKey = ResponderNOKeyPair.privateKey )
-
The responder SHALL encode the following items as a sigma-2-tbedata, where the encoding of
responderNOC
andresponderICAC
items SHALL be byte-for-byte identical to the encoding insigma-2-tbsdata
:-
responderNOC
as a matter-certificate. This encoding SHALL be byte-for-byte identical to the encoding insigma-2-tbsdata
. -
responderICAC
(if present) as a matter-certificate. This encoding SHALL be byte-for-byte identical to the encoding insigma-2-tbsdata
. -
TBSData2Signature
-
-
The responder SHALL generate the
S2K
key. -
The responder SHALL generate the encrypted and integrity protected data:
byte TBEData2_A[] = {} byte TBEData2_Nonce[13] = /* "NCASE_Sigma2N" */ {0x4e, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x69, 0x67, 0x6d, 0x61, 0x32, 0x4e} TBEData2Encrypted = Crypto_AEAD_GenerateEncrypt( K = S2K, P = TBEData2, A = TBEData2_A, N = TBEData2_Nonce )
-
The responder SHALL generate a random number
Random = Crypto_DRBG(len = 32 * 8)
. -
The responder SHALL generate a session identifier (
ResponderSessionId
) for subsequent identification of this secured session. TheResponderSessionId
field SHALL NOT overlap with any other existing PASE or CASE session identifier in use by the responder. See Section 4.12.1.4, “Choosing Secure Unicast Session Identifiers” for more details. The responder SHALL set theLocal Session Identifier
in the Session Context to the valueResponderSessionId
. -
The responder SHALL use the Fabric IPK configured as described in Section 4.13.2.6.1, “Identity Protection Key (IPK)”.
-
Any context-specific tags not listed in the above TLV schemas SHALL be reserved for future use, and SHALL be silently ignored if seen by an initiator which cannot understand them.
-
The responder SHALL send a message with
Secure Channel
Protocol ID andSigma2
Protocol Opcode from Table 17, “Secure Channel Protocol Opcodes” whose payload is the TLV-encoded Sigma2Msg2
with an anonymous tag for the outermost struct.Msg2 = { responderRandom (1) = Random, responderSessionId (2) = ResponderSessionId, responderEphPubKey (3) = ResponderEphKeyPair.publicKey, encrypted2 (4) = TBEData2Encrypted, responderSEDParams (5) = sed-parameter-struct (optional) }
Validate Sigma2
On receipt of Msg2
, the initiator SHALL perform the following:
-
The initiator SHALL generate a shared secret:
SharedSecret = Crypto_ECDH( privateKey = InitiatorEphKeyPair.privateKey, publicKey = Msg2.responderEphPubKey, )
-
The initiator SHALL generate the
S2K
key. -
The initiator SHALL generate the decrypted data:
byte TBEData2_A[] = {} byte TBEData2_Nonce[13] = /* "NCASE_Sigma2N" */ {0x4e, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x69, 0x67, 0x6d, 0x61, 0x32, 0x4e} Success, TBEData2 = Crypto_AEAD_DecryptVerify( K = S2K, C = Msg2.encrypted2, A = TBEData2_A, N = TBEData2_Nonce )
-
If the value of
Success
is FALSE, the initiator SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
The initiator SHALL verify that the NOC in
TBEData2.responderNOC
and ICAC inTBEData2.responderICAC
(if present) fulfills the following constraints:-
The Fabric ID and Node ID SHALL match the intended identity of the receiver Node, as included in the computation of the Destination Identifier when generating Sigma1.
-
If an ICAC is present, and it contains a Fabric ID in its subject, then it SHALL match the FabricID in the NOC leaf certificate.
-
The certificate chain SHALL chain back to the Trusted Root CA Certificate
TrustedRCAC
whose public key was used in the computation of the Destination Identifier when generating Sigma1. -
All the elements in the certificate chain SHALL respect the Matter Certificate DN Encoding Rules, including range checks for identifiers such as Fabric ID and Node ID.
-
-
If any of the validations from the previous step fail, the initiator SHALL send a status report:
StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
The initiator SHALL verify
TBEData2.responderNOC
using:-
Success = Crypto_VerifyChain(certificates = [TBEData2.responderNOC, TBEData2.responderICAC, TrustedRCAC])
, whenTBEData2.responderICAC
is present, or -
Success = Crypto_VerifyChain(certificates = [TBEData2.responderNOC, TrustedRCAC])
, whenTBEData2.responderICAC
is not present.
-
-
If the value of
Success
isFALSE
, the initiator SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
The initiator SHALL encode the following items as a sigma-2-tbsdata with an anonymous tag:
-
responderNOC
as copied fromTBEData2
-
responderICAC
(if present) as copied fromTBEData2
-
Msg2.responderEphPubKey
-
InitiatorEphKeyPair.publicKey
-
-
The initiator SHALL verify
TBEData2.signature
(see RFC 5280):Success = Crypto_Verify( publicKey = Public key obtained from responderNOC, message = sigma-2-tbsdata, signature = TBEData2.signature )
-
If the value of
Success
isFALSE
, the initiator SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
Set the
Resumption ID
in the Session Context to the valueTBEData2.resumptionID
. -
Set the
Peer Session Identifier
in the Session Context to the valueMsg2.responderSessionId
.
Generate and Send Sigma3
If validation is successful, the initiator encodes and sends a Sigma3
message.
sigma-3-tbsdata => STRUCTURE [ tag-order ] { initiatorNOC [1] : OCTET STRING, initiatorICAC [2, optional] : OCTET STRING, initiatorEphPubKey [3] : ec-pub-key, responderEphPubKey [4] : ec-pub-key, } sigma-3-tbedata => STRUCTURE [ tag-order ] { initiatorNOC [1] : OCTET STRING, initiatorICAC [2, optional] : OCTET STRING, signature [3] : ec-signature, } sigma-3-struct => STRUCTURE [ tag-order ] { encrypted3 [1] : OCTET STRING, }
Note
|
sigma-3-tbsdata is NOT transmitted but is instead signed; the signature will be encrypted and transmitted.
|
-
The initiator SHALL select its Node Operational Key Pair
InitiatorNOKeyPair
, Node Operational CertificatesinitiatorNOC
andinitiatorICAC
(if present), and Trusted Root CA CertificateTrustedRCAC
corresponding to the chosen Fabric as determined by the Destination Identifier from Sigma1. -
The initiator SHALL encode the following items as a sigma-3-tbsdata with an anonymous tag:
-
initiatorNOC
as a matter-certificate -
initiatorICAC
(if present) as a matter-certificate -
InitiatorEphKeyPair.publicKey
-
Msg2.responderEphPubKey
-
-
The initiator SHALL generate a signature:
TBSData3Signature = Crypto_Sign( message = sigma-3-tbsdata, privateKey = InitiatorNOKeyPair.privateKey )
-
The initiator SHALL encode the following items as a sigma-3-tbedata:
-
initiatorNOC
as a matter-certificate. This encoding SHALL be byte-for-byte identical to the encoding insigma-3-tbsdata
. -
initiatorICAC
(if present) as a matter-certificate. This encoding SHALL be byte-for-byte identical to the encoding insigma-3-tbsdata
. -
TBSData3Signature
-
-
The initiator SHALL generate the
S3K
key. -
The initiator SHALL generate the encrypted and integrity protected data:
byte TBEData3_A[] = {} byte TBEData3_Nonce[13] = /* "NCASE_Sigma3N" */ {0x4e, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x69, 0x67, 0x6d, 0x61, 0x33, 0x4e} TBEData3Encrypted = Crypto_AEAD_GenerateEncrypt( K = S3K, P = TBEData3, A = TBEData3_A, N = TBEData3_Nonce )
-
Any context-specific tags not listed in the above TLV schemas SHALL be reserved for future use, and SHALL be silently ignored if seen by a responder which cannot understand them.
-
The initiator SHALL send a message with
Secure Channel
Protocol ID andSigma3
Protocol Opcode from Table 17, “Secure Channel Protocol Opcodes” whose payload is the TLV-encoded Sigma3Msg3 = { encrypted3 (1) = TBEData3Encrypted }
with an anonymous tag for the outermost struct. -
The initiator SHALL generate the session encryption keys using the method described in Section 4.13.2.6.6, “Session Encryption Keys”.
Validate Sigma3
On receipt of Msg3
, the responder SHALL perform the following:
-
The responder SHALL generate the
S3K
key. -
The responder SHALL generate the decrypted data:
byte TBEData3_A[] = {} byte TBEData3_Nonce[13] = /* "NCASE_Sigma3N" */ {0x4e, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x69, 0x67, 0x6d, 0x61, 0x33, 0x4e} Success, TBEData3 = Crypto_AEAD_DecryptVerify( K = S3K, C = Msg3.encrypted3, A = TBEData3_A, N = TBEData3_Nonce )
-
If the value of
Success
is FALSE, the responder SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
The responder SHALL verify that the NOC in
TBEData3.responderNOC
and the ICAC inTBEData3.responderICAC
fulfill the following constraints:-
The Fabric ID SHALL match the Fabric ID matched during processing of the Destination Identifier after receiving Sigma1.
-
If an ICAC is present, and it contains a Fabric ID in its subject, then it SHALL match the FabricID in the NOC leaf certificate.
-
The certificate chain SHALL chain back to the Trusted Root CA Certificate
TrustedRCAC
whose public key was matched during processing of the Destination Identifier after receiving Sigma1. -
All the elements in the certificate chain SHALL respect the Matter Certificate DN Encoding Rules, including range checks for identifiers such as Fabric ID and Node ID.
-
-
If any of the validations from the previous step fail, the responder SHALL send a status report:
StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
The responder SHALL verify
TBEData3.initiatorNOC
using:-
Success = Crypto_VerifyChain(certificates = [TBEData3.initiatorNOC, TBEData3.initiatorICAC, TrustedRCAC])
, whenTBEData3.initiatorICAC
is present, or -
Success = Crypto_VerifyChain(certificates = [TBEData3.initiatorNOC, TrustedRCAC])
, whenTBEData3.initiatorICAC
is not present.
-
-
If the value of
Success
isFALSE
, the responder SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER_)
and perform no further processing. -
The responder SHALL encode the following items as a sigma-3-tbsdata with an
anonymous tag
:-
initiatorNOC
as copied fromTBEData3
-
initiatorICAC
(if present) as copied fromTBEData3
-
Msg1.initiatorEphPubKey
-
ResponderEphKeyPair.publicKey
-
-
The responder SHALL verify
TBEData3.signature
(see RFC 5280):Success = Crypto_Verify( publicKey= public key obtained from initiatorNOC, message = sigma-3-tbsdata, signature = TBEData3.signature )
-
If the value of
Success
isFALSE
, the responder SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER)
and perform no further processing. -
The responder SHALL generate the session keys as described in Section 4.13.2.6.6, “Session Encryption Keys”.
-
The responder SHALL initialize its Local Message Counter in the Session Context per Section 4.5.1.1, “Message Counter Initialization”.
-
The responder SHALL initialize the Message Reception State in the Session Context` and set the synchronized
max_message_counter
of the peer to0
. -
The responder SHALL set
SessionTimestamp
to a timestamp from a clock which would allow for the eventual determination of the last session use relative to other sessions. -
The responder SHALL encode and send SigmaFinished.
Validate Sigma1 with Resumption
The responder SHALL continue validating the Sigma1
message Msg1
as follows:
-
Obtain the
SharedSecret
from the Section 4.12.2.1, “Secure Session Context” of the resumed session. -
Generate the
S1RK
key. -
Verify the
Resume1MIC
by decrypting the following values:byte Resume1MIC_A[] = {} byte Resume1MIC_Nonce[13] = /* "NCASE_SigmaR1" */ {0x4e, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x69, 0x67, 0x6d, 0x61, 0x53, 0x31} Success, Resume1MICPayload = Crypto_AEAD_DecryptVerify( K = S1RK, C = Msg1.sigma1ResumeMIC, A = Resume1MIC_A, N = Resume1MIC_Nonce )
-
If the value of
Success
is FALSE, the responder SHALL continue processingSigma1
as if it didn’t include any resumption information by continuing the steps in Section 4.13.2.3.5, “Validate Sigma1 Destination ID”. -
If the value of
Success
is TRUE, the responder SHALL:-
Set the
Peer Session Identifier
in the in the Session Context to the valueMsg1.initiatorSessionId
. -
Send a Sigma2_Resume message.
-
Generate and Send Sigma2_Resume
The responder SHALL encode and send a Sigma2_Resume
message in response to a valid Sigma1
with response.
sigma-2-resume-struct => STRUCTURE [ tag-order ] { resumptionID [1] : OCTET STRING [ length 16 ], sigma2ResumeMIC [2] : OCTET STRING [ length 16 ], responderSessionID [3] : UNSIGNED INTEGER [ range 16-bits ], responderSEDParams [4, optional] : sed-parameter-struct }
-
The responder SHALL generate a new resumption ID
ResumptionID = Crypto_DRBG(len = 128)
. -
The responder SHALL generate a session identifier (
ResponderSessionId
) for subsequent identification of this session. TheResponderSessionId
field SHALL NOT overlap with any other existing PASE or CASE session identifier in use by the responder. See Section 4.12.1.4, “Choosing Secure Unicast Session Identifiers” for more details. The responder SHALL set theLocal Session Identifier
in the Session Context to the valueResponderSessionId
. -
The responder SHALL generate the
S2RK
key. -
The responder SHALL generate a resumption MIC:
byte Resume2MIC_P[] = {} byte Resume2MIC_A[] = {} byte Resume2MIC_Nonce[13] = /* "NCASE_SigmaR2" */ {0x4e, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x69, 0x67, 0x6d, 0x61, 0x53, 0x32} Resume2MIC = Crypto_AEAD_GenerateEncrypt( K = S2RK, P = Resume2MIC_P, A = Resume2MIC_A, N = Resume2MIC_Nonce )
-
Any context-specific tags not listed in the above TLV schemas SHALL be reserved for future use, and SHALL be silently ignored if seen by an initiator which cannot understand them.
-
The responder SHALL send a message with the
Secure Channel
Protocol ID andSigma2Resume
Protocol Opcode from Table 17, “Secure Channel Protocol Opcodes” whose payload is the TLV-encoded Sigma2_ResumeResumeMsg2
with an anonymous tag for the outermost struct.ResumeMsg2 = { resumptionID (1) = ResumptionID, sigma2ResumeMIC (2) = ResumeMIC2, responderSessionID (3) = ResponderSessionId, responderSEDParams (4) = sed-parameter-struct (optional) }
-
The responder SHALL generate the session keys as described in Section 4.13.2.6.7, “Resumption Session Encryption Keys”.
Validate Sigma2_Resume
On receipt of ResumeMsg2
, the initiator SHALL perform the following:
-
The initiator SHALL generate the
S2RK
key. -
The initiator SHALL verify the
Resume2MIC
by decrypting the following values:byte Resume2MIC_A[] = {} byte Resume2MIC_Nonce[13] = /* "NCASE_SigmaR2" */ {0x4e, 0x43, 0x41, 0x53, 0x45, 0x5f, 0x53, 0x69, 0x67, 0x6d, 0x61, 0x53, 0x32} Success, Resume2MICPayload = Crypto_AEAD_DecryptVerify( K = S2RK, C = ResumeMsg2.sigma2ResumeMIC, A = Resume2MIC_A, N = Resume2MIC_Nonce )
-
If
Success
is FALSE, the initiator SHALL send a status report:StatusReport(GeneralCode: FAILURE, ProtocolId: SECURE_CHANNEL, ProtocolCode: INVALID_PARAMETER_)
and perform no further processing. -
The initiator SHALL set the
Resumption ID
in the Session Context to the valueResume2Msg.resumptionID
. -
The initiator SHALL generate the session keys as described in Section 4.13.2.6.7, “Resumption Session Encryption Keys”.
-
The initiator SHALL reset its Local Message Counter in the Session Context per Section 4.5.1.1, “Message Counter Initialization”.
-
The initiator SHALL reset the Message Reception State of the Session Context` and set the synchronized
max_message_counter
of the peer to0
. -
The initiator SHALL set
SessionTimestamp
to a timestamp from a clock which would allow for the eventual determination of the last session use relative to other sessions. -
The initiator SHALL set the
Peer Session Identifier
in the in the Session Context to the valueResumeMsg2.responderSessionId
. -
The initiator SHALL send Section 4.13.2.3.13, “SigmaFinished”.
SigmaFinished
To indicate the successful completion of the protocol, the Node receiving Sigma3 (if a new session is being established) or Sigma2_Resume (if a session is being resumed) SHALL send a status report: StatusReport(GeneralCode: SUCCESS, ProtocolId: SECURE_CHANNEL, ProtocolCode: SESSION_ESTABLISHMENT_SUCCESS)
.
On successful receipt of SigmaFinished
:
-
The receiving node SHALL initialize the Local Message Counter according to Section 4.5.1.1, “Message Counter Initialization” for the newly established secure session whose success is acknowledged by this message.
-
The receiving node SHALL set
SessionTimestamp
to a timestamp from a clock which would allow for the eventual determination of the last session usage relative to other sessions.
If this message is received out-of-order or unexpectedly, then it SHALL be ignored.
4.13.2.4. Field Descriptions
Destination Identifier
destination-identifier => OCTET STRING [length CRYPTO_HASH_LEN_BYTES]
The Destination Identifier field enables the initiator of the Sigma1 message to unambiguously express the following, in a privacy-preserving manner:
-
Which shared Trusted Root to select
-
Which Fabric ID to use for validation of initiator and responder operational certificates
-
Which Node ID is targeted in the given Fabric
This serves several purposes:
-
It requires an initiator to have knowledge of both the IPK and one of the full identities of the responder Node before it forces the responder node to generate a costly Sigma2 message
-
Note that the replay of previously recorded initiator messages is possible, and therefore a Node MAY choose to keep memory of some prior destination identifiers which it would later reject if seen again, for additional replay protection
-
-
It ensures that there is no ambiguity on the responder as to which Fabric was selected for communication
-
It hides which Fabric was chosen by the initiator
A destination identifier is generated by:
-
Concatenating the following octet strings for subsequent usage as a
destinationMessage
:-
initiatorRandom
: The value ofinitiatorRandom
that will be used in the same message as the Destination Identifier -
rootPublicKey
: The public key of the root of trust of the desired fabric, from theec-pub-key
field of the Matter Certificate of that root, as an uncompressed elliptic curve point as defined in section 2.3.3 of SEC1 -
fabricId
: The Fabric ID of the destination, matching thematter-fabric-id
field of the Matter Certificate of the desired destination’s NOC, and encoding the 64-bit scalar as a little-endian byte order octet string -
nodeId
: The Node ID of the destination, matching thematter-node-id
field of the Matter Certificate of the desired destination’s NOC, and encoding the 64-bit scalar as a little-endian byte order octet string
-
-
Obtaining the appropriate Identity Protection Key (
IPK
) Operational Group Key for the associated Fabric under Group Key Set index 0 within the Group Key Management Cluster. -
Computing an identifier
destinationIdentifier
of lengthCRYPTO_HASH_LEN_BYTES
usingCrypto_HMAC()
with theIPK
as thekey
anddestinationMessage
as themessage
The above steps can be summarized as:
destinationMessage = initiatorRandom || rootPublicKey || fabricId || nodeId destinationIdentifier = Crypto_HMAC(key=IPK, message=destinationMessage)
For example, given the following:
-
Root public key for the common Fabric, in uncompressed elliptical curve point form:
RootPublicKey := // Raw uncompressed point form 04:4a:9f:42:b1:ca:48:40:d3:72:92:bb:c7:f6:a7:e1: 1e:22:20:0c:97:6f:c9:00:db:c9:8a:7a:38:3a:64:1c: b8:25:4a:2e:56:d4:e2:95:a8:47:94:3b:4e:38:97:c4: a7:73:e9:30:27:7b:4d:9f:be:de:8a:05:26:86:bf:ac: fa
-
Common Fabric ID of 0x2906_C908_D115_D362 scalar (octets "62:d3:15:d1:08:c9:06:29" in little-endian)
-
Desired Destination Node ID of 0xCD55_44AA_7B13_EF14 (octets "14:ef:13:7b:aa:44:55:cd" in little-endian)
-
Identity Protection Key Epoch Key value of:
IPKEpochKey := 4a:71:cd:d7:b2:a3:ca:90:24:f9:6f:3c:96:a1:9d:ee
-
Note that this is the octet string of a group Epoch Key as would be provided in the IpkValue field of the AddNOC command in the Node Operational Credentials Cluster, or in one of the
EpochKey
fields of the KeySetWrite command in the Group Key Management Cluster. -
The derived Operational Group Key to be used for computation of a destination identifier, given the above values of root public key, Fabric ID and Identity Protection Key Epoch Key, would be:
IPK := 9b:c6:1c:d9:c6:2a:2d:f6:d6:4d:fc:aa:9d:c4:72:d4
-
-
Initiator Random value of:
7e:17:12:31:56:8d:fa:17:20:6b:3a:cc:f8:fa:ec:2f: 4d:21:b5:80:11:31:96:f4:7c:7c:4d:eb:81:0a:73:dc
Then, using the above procedure would yield the following:
-
DestinationMessage octets:
7e:17:12:31:56:8d:fa:17:20:6b:3a:cc:f8:fa:ec:2f: 4d:21:b5:80:11:31:96:f4:7c:7c:4d:eb:81:0a:73:dc: 04:4a:9f:42:b1:ca:48:40:d3:72:92:bb:c7:f6:a7:e1: 1e:22:20:0c:97:6f:c9:00:db:c9:8a:7a:38:3a:64:1c: b8:25:4a:2e:56:d4:e2:95:a8:47:94:3b:4e:38:97:c4: a7:73:e9:30:27:7b:4d:9f:be:de:8a:05:26:86:bf:ac: fa:62:d3:15:d1:08:c9:06:29:14:ef:13:7b:aa:44:55: cd
-
DestinationIdentifier octets:
dc:35:dd:5f:c9:13:4c:c5:54:45:38:c9:c3:fc:42:97: c1:ec:33:70:c8:39:13:6a:80:e1:07:96:45:1d:4c:53
Public Key
ec-pub-key => OCTET STRING [ length CRYPTO_PUBLIC_KEY_SIZE_BYTES ]
A public key ec-pub-key
is the byte string representation of an uncompressed elliptic curve point as defined in section 2.3.3 of SEC1.
4.13.2.5. Signature
An ec-signature
is the encoding of the signature as defined in Section 3.5.3, “Signature and verification”.
ec-signature => OCTET STRING [ length (CRYPTO_GROUP_SIZE_BYTES * 2) ]
4.13.2.6. Cryptographic Keys
Identity Protection Key (IPK)
The Identity Protection Key (IPK) SHALL be the operational group key under GroupKeySetID of 0
for the fabric associated with the originator’s chosen destination.
The IPK SHALL be exclusively used for Certificate Authenticated Session Establishment. The IPK SHALL NOT be used for operational group communication.
For the generation of the Destination Identifier, the originator SHALL use the operational group key with the second newest EpochStartTime, if one exists, otherwise it SHALL use the single operational group key available.
The operational group key index to use to follow the "second newest EpochStartTime" rule is illustrated below:
Number of keys in Group Key Set | Operational key index | Epoch Key |
---|---|---|
1 |
0 |
EpochKey0 |
2 |
0 |
EpochKey0 |
3 |
1 |
EpochKey1 |
Sigma2 Key (S2K)
-
A transcript hash SHALL be generated:
TranscriptHash = Crypto_Hash(message = Msg1)
-
The Sigma2 key SHALL be generated:
byte S2K_Info[] = /* "Sigma2" */ {0x53, 0x69, 0x67, 0x6d, 0x61, 0x32} S2K = Crypto_KDF( inputKey = SharedSecret, salt = IPK || Responder Random || Responder Ephemeral Public Key || TranscriptHash, info = S2K_Info, len = CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
where ||
indicates message concatenation and IPK
is generated according to Section 4.13.2.6.1, “Identity Protection Key (IPK)”.
Sigma3 Key (S3K)
-
A transcript hash SHALL be generated:
TranscriptHash = Crypto_Hash(message = Msg1 || Msg2)
-
The Sigma3 key SHALL be generated:
byte S3K_Info[] = /* "Sigma3" */ {0x53, 0x69, 0x67, 0x6d, 0x61, 0x33} S3K = Crypto_KDF( inputKey = SharedSecret, salt = IPK || TranscriptHash, info = S3K_Info, len = CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
where ||
indicates message concatenation and IPK
is generated according to Section 4.13.2.6.1, “Identity Protection Key (IPK)”.
Sigma1 Resumption Key
The Sigma1 resumption key SHALL be generated:
byte S1RK_Info[] = /* "Sigma1_Resume" */ {0x53, 0x69, 0x67, 0x6d, 0x61, 0x31, 0x5f, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65} S3K_Info S1RK = Crypto_KDF( inputKey = SharedSecret, salt = Sigma1.initiatorRandom || ResumptionID, info = S1RK_Info, len = CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
where ||
indicates message concatenation and ResumptionID
is the identifier for the previous session.
Sigma2 Resumption Key
The Sigma2 resumption key SHALL be generated:
byte S2RK_Info[] = /* "Sigma2_Resume" */ {0x53, 0x69, 0x67, 0x6d, 0x61, 0x32, 0x5f, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x65} S2RK = Crypto_KDF( inputKey = SharedSecret, salt = Sigma1.initiatorRandom || ResumptionID, info = S2RK_Info, len = CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
where ||
indicates message concatenation and ResumptionID
is the new identifier for the this session.
Session Encryption Keys
-
A transcript hash SHALL be generated:
TranscriptHash = Crypto_Hash(message = Msg1 || Msg2 || Msg3)
-
The session encryption keys SHALL be generated:
byte SEKeys_Info[] = /* "SessionKeys" */ {0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73} I2RKey || R2IKey || AttestationChallenge = Crypto_KDF( inputKey = SharedSecret, salt = IPK || TranscriptHash, info = SEKeys_Info, len = 3 * CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
-
Each key is exactly
CRYPTO_SYMMETRIC_KEY_LENGTH_BITS
bits. -
The initiator SHALL use
I2RKey
to encrypt and integrity protect messages and the `R2IKey' to decrypt and verify messages. -
The responder SHALL use
R2IKey
to encrypt and integrity protect messages and the `I2RKey' to decrypt and verify messages. -
The
AttestationChallenge
SHALL only be used as a challenge during device attestation. See Section 6.2.3, “Device Attestation Procedure” for more details.
where ||
indicates message concatenation.
Resumption Session Encryption Keys
-
The resumption session encryption keys SHALL be generated:
byte RSEKeys_Info[] = /* "SessionResumptionKeys" */ {0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x75, 0x6d, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73} I2RKey || R2IKey || AttestationChallenge = Crypto_KDF( inputKey = SharedSecret, salt = Sigma1.initiatorRandom || ResumptionID, info = RSEKeys_Info, len = 3 * CRYPTO_SYMMETRIC_KEY_LENGTH_BITS )
-
Each key is exactly
CRYPTO_SYMMETRIC_KEY_LENGTH_BITS
bits. -
The initiator SHALL use
I2RKey
to encrypt and integrity protect messages and the `R2IKey' to decrypt and verify messages. -
The responder SHALL use
R2IKey
to encrypt and integrity protect messages and the `I2RKey' to decrypt and verify messages. -
The
AttestationChallenge
SHALL only be used as a challenge during device attestation. See Section 6.2.3, “Device Attestation Procedure” for more details.
where ||
indicates message concatenation and ResumptionID
is the new identifier for the this session.
4.13.2.7. Session Context Storage
After the session is established successfully at both peers, some fields SHALL be recorded in the secure session context for later use (see Section 4.12.2, “Application Data Phase”), in addition to the Session Encryption Keys:
-
The peer NOC's
matter-node-id
(1.3.6.1.4.1.37244.1.1) from the subject field -
The Section 2.5.1, “Fabric References and Fabric Identifier” for the Fabric within which this secure session is being established
-
All peer NOC's
case-authenticated-tag
(1.3.6.1.4.1.37244.1.6) from the subject field, if present
These fields MAY be recorded at any opportune point during the protocol, but SHALL only be committed to the secure session context once the session is established successfully at both peers.
4.13.2.8. Minimal Number of CASE Sessions
A node SHALL support at least 3 CASE session contexts per fabric. Device type specifications MAY require a larger minimum. Unless the device type specification says otherwise, a minimum number it defines is a per-fabric minimum.
The minimal supported capabilities, subject to the minimal constraints above, are reported in the CapabilityMinima of the Basic Information cluster.
-
Example: If a device type requires at least 4 CASE session contexts, and a node supports 7 fabrics, the node would support at least 28 CASE session contexts, and ensure that each fabric could use at least 4 of them.
4.14. Group Communication
This section specifies the semantics of sending and receiving multicast group messages and the lifecycle of such groupcast sessions. Multicast addressing is accomplished using the 16-bit Group ID field as the destination address. A multicast group is a collection of Nodes, all registered under the same multicast Group ID. A multicast message is sent to a particular destination group and is received by all members of that group.
4.14.1. Groupcast Session Context
Groupcast sessions are conceptually long-running, lasting the duration of a node’s membership in a group. Group membership is tracked in the Group Key Management Cluster. However, on ingress of each groupcast message, the following ephemeral context SHALL be constructed to inform upper layers of groupcast message provenance:
-
Fabric Index
: Records the local Fabric Index for the Fabric to which an incoming message’s group is scoped. -
Group ID
: Captures the Group ID to which a groupcast message was sent. -
Source Node ID
: The Source Node ID enclosed by the sender of a groupcast message.-
Together, Fabric Index, Group ID and Source Node ID comprise a unique identifier that upper layers may use to understand the source and destination of groupcast messages.
-
-
Source IP Address
: The unicast source IP address for the originator of the message. -
Source Port
: The source port for the originator of the message.-
The source IP address and port MAY be used for unicast responses to group communication peers, as are required for the Message Counter Synchronization Protocol.
-
-
Operational Group Key
: The Operational Group Key that was used to encrypt the incoming group message. -
Group Session ID
: Records the Group Session ID derived from the Operational Group Key used to encrypt the message.
Once a Groupcast Session Context with trust-first policy is created to track authenticated messages from a given Source Node ID, that record SHALL NOT be deleted or recycled until the node reboots. This is to prevent replay attacks that first exhaust the memory allocated to group session counter tracking and then inject older messages as valid, and enforces that trust-first authentication works as intended within the full duration of a boot cycle. Any message from a source that cannot be tracked SHALL be dropped.
4.14.2. Sending a group message
To prepare a multicast message to a Group ID with a given GroupKeySetID and IPv6 hop count parameter, the Node SHALL:
-
Obtain, for the given GroupKeySetID, the current Operational Group Key as the Encryption Key, and the associated Group Session ID.
-
If no key is found for the given GroupKeySetID, security processing SHALL fail and no further security processing SHALL be done on this message.
-
-
Perform Section 4.6.1, “Message Transmission” processing steps on the message with the following arguments:
-
The Destination Node Id argument SHALL be the Group Node Id corresponding to the given Group ID.
-
The Session Id argument SHALL be the Group Session ID from step 1.
-
The Security Flags SHALL have only the P Flag set.
-
The transport SHALL be a site-local routable IPv6 interface.
-
Next, prepare the message as an IPv6 packet:
-
Set the private, secured message from step 2 above as the IPv6 payload.
-
Set the IPv6 hop count to the value given.
-
Set the IPv6 destination to the Section 2.5.6.2, “IPv6 Multicast Address” based on the provided destination Group ID, Fabric ID, and Section 11.2.6.2.9, “GroupKeyMulticastPolicy” of the group key.
-
Set the IPv6 source to an operational IPv6 Unicast Address of the sending Node.
-
Set the IPv6 UDP port number to the Matter IPv6 multicast port.
4.14.3. Receiving a group message
All Nodes supporting groups SHALL register to receive on the associated IPv6 multicast address, at the Matter IPv6 multicast port, for each group of which they are a member.
Upon receiving an IPv6 message addressed to one of these Multicast Addresses the Node is registered for, the Node SHALL:
-
Extract the message from the IPv6 payload.
-
Perform Section 4.6.2, “Message Reception” processing steps on the message.
4.15. Group Key Management
This section describes operational group keys, a mechanism for generating, disseminating and managing shared symmetric keys across a group of Nodes in a Fabric. Operational group keys are made available to applications for the purpose of authenticating peers, securing group communications, and encrypting data. These keys allow Nodes to:
-
Prove to each other that they are members of the associated group
-
Exchange messages confidentially, and without fear of manipulation by non-members of the group
-
Encrypt data in such a way that it can only be decrypted by other members of the group
A central feature of operational group keys is the ability to limit access to keys to a trusted set of Nodes. In particular, credentials required to generate operational group keys SHALL only be accessible to Nodes with a certain level of privilege — those deemed a member of the group. Barring software error or compromise of a privileged Node, access to shared keys SHALL be computationally infeasible for non-trusted parties.
Operational group keys are shareable across all types and combinations of Nodes as determined by the Administrator managing the group. Given all Nodes in possession of the current epoch keys for the group can communicate with other Nodes in the group, it is the responsibility of the Administrator managing the group to only compose groups of Nodes where communication is appropriate for the given application and security requirements.
4.15.1. Operational Groups
An operational group is a logical collection of Nodes that are running one or more common application clusters and share a common security domain in the form of a shared, symmetric group key. For example, a set of Nodes running a lighting application can form an operational group by sharing a common operational group key derived from the mechanisms described here. Subgroups can be formed within the operational group by defining distinct Group Identifiers for each set of Nodes, while sharing a common operational group key.
Membership in the security domain of an operational group is determined by a Node’s possession of all the epoch keys required to generate the current, valid operational group key for the group. Individual Nodes can be members of multiple operational groups simultaneously. The set of groups to which a Node belongs can change over time as dictated by application requirements and policies. Groups MAY be introduced or withdrawn over time as need arises. === Operational Group Ids Operational groups are identified uniquely within a Fabric by a Group Identifier. Administrators SHALL assign Group Ids such that no two operational groups within a Fabric have the same Group ID. It is assumed a given Administrator has sufficient access to centralized knowledge, so as to allocate unique Group Ids under a given Fabric such that there are no collisions.
Multiple operational groups MAY share the same operational group key, and thus be used to create logical subgroups over a shared security domain. Operational groups which do not share related functionality, such as a lighting group and a sprinkler group, SHOULD NOT share the same operational key. As an example policy, a lighting application could have all lighting Nodes share a single group key, while organizing lighting subgroups for various rooms or spaces within the structure by assigning a different Group ID to each such subgroup.
4.15.2. Operational Group Key Derivation
An operational group key is a symmetric key used as the Encryption Key during Message Processing for group communication. An operational group key is produced by applying a key derivation function with an epoch key and salt value as inputs as follows:
OperationalGroupKey =
Crypto_KDF
(
InputKey = Epoch Key,
Salt = CompressedFabricIdentifier,
Info = "GroupKey v1.0",
Length = CRYPTO_SYMMETRIC_KEY_LENGTH_BITS
)
where []
denotes a zero-length array.
The Info
portion of the key derivation is specified in Section 4.15.2.1, “Group Security Info”.
The Salt
portion of the key derivation is specified in Section 4.3.2.2, “Compressed Fabric Identifier”.
For example, given:
-
An Epoch Key value of:
23:5b:f7:e6:28:23:d3:58:dc:a4:ba:50:b1:53:5f:4b
-
A CompressedFabricIdentifier value of:
87:e1:b0:04:e2:35:a1:30
After the above derivation following the definition of Crypto_KDF
in Section 3.8, “Key Derivation Function (KDF)”, the resulting operational group key would be: a6:f5:30:6b:af:6d:05:0a:f2:3b:a4:bd:6b:9d:d9:60
.
Group membership is enforced by limiting access to the epoch keys. Only Nodes that possess the input epoch key can derive a given operational key. Lack of possession of a particular epoch key restricts access, based on the distribution policy of the epoch keys.
The following diagram shows the process by which operational keys are derived from the epoch key material:
4.15.2.1. Group Security Info
A hard-coded group security info is used to diversify the set of operational group keys. This value is hard-coded into the standard’s implementation, and thus is distributed with the associated code. Should the standard’s security mechanisms need to evolve (e.g. to upgrade encryption from AES-128 to AES-256), the group security info can be changed to ensure that new keys will be derived for use in the new algorithm. The group security info SHALL be the byte stream "GroupKey v1.0", i.e. 0x47 0x72 0x6f 0x75 0x70 0x4b 0x65 0x79 0x20 0x76 0x31 0x2e 0x30
.
With the exception of the group security info, all input key material SHALL be maintained on a per-Fabric basis.
4.15.2.2. Group Key Set
A group key set limits the key derivation process to Nodes within the respective operational groups. Access to a group key set is limited based on the functionality provided by a Node and/or the privilege afforded to it. For example, certain home security devices, such as a security system or door lock, may have access to a "Physical Access" group key set, while devices such as light bulbs or window coverings would not.
Operational group key lifetime is limited by assigning an expiration time to each epoch key in a given group key set. By constraining the validity of a given epoch key to an epoch, the ability for members to derive and operate with an operational group key can be constrained to particular periods of time. Epoch keys may be rotated on a periodic basis, and denying access to updated versions of these keys serves as a means to eject group members.
4.15.3. Epoch Keys
Epoch keys provide a means for limiting the lifetime of derived operational group keys. They also provide a way for an Administrator to revoke access to Nodes that have been explicitly excluded from an operational group (albeit after a period of time).
Epoch keys are generated, managed, and stored by an Administrator on a per-Fabric basis.
Each key SHALL be a random value of length CRYPTO_SYMMETRIC_KEY_LENGTH_BITS
bits.
EpochKey = Crypto_DRBG(len = CRYPTO_SYMMETRIC_KEY_LENGTH_BITS)
Each epoch key has associated with it a start time that denotes the time at which the key becomes active for use by transmitting Nodes. Epoch key start times are absolute UTC time in microseconds encoded using the epoch-us representation.
4.15.3.1. Using Epoch Keys
Nodes sending group messages SHALL use operational group keys that are derived from the current epoch key (specifically, the epoch key with the latest start time that is not in the future). Nodes that cannot reliably keep track of time calculate the current epoch key as described in Section 4.15.3.4, “Epoch Key Rotation without Time Synchronization”.
Nodes receiving group messages SHALL accept the use of any key derived from one of the currently installed epoch keys. This requirement holds regardless of whether the start time for the key is in the future or the past. This means Nodes continue to accept communication secured under an epoch key until that key is withdrawn by explicitly deleting the key from a Node’s group state by the key distribution Administrator.
Note that there is no end time associated with an epoch key. An epoch key marked with the maximum start time SHALL be disabled and render the corresponding epoch key slot unused.
4.15.3.2. Managing Epoch Keys
The epoch keys are managed using the Group Key Management Cluster. For every group key set published by the key distribution Administrator, there SHALL be at least 1 and at most 3 epoch keys in rotation. Key additions or updates are done using the KeySetWrite command.
Key updates are idempotent operations to ensure the Administrator is always the source of truth. An epoch key update SHALL order the keys from oldest to newest.
Any epoch key update MAY deliver a partial key set but SHALL include EpochKey0
and MAY include EpochKey1
and EpochKey2
.
Any update of the key set, including a partial update, SHALL remove all previous keys in the set, however many were defined.
An Administrator MAY completely remove a group key set from a Node using the KeySetRemove command.
4.15.3.3. Epoch Key Rotation
The key distribution Administrator generates new epoch keys on a regular basis, giving each a unique id and adding them to the list of existing epoch keys within a group. The start time for each new epoch key is scheduled to occur after a configurable key propagation interval. The propagation interval is set sufficiently large such that the Administrator can synchronize all Nodes in the operational group with the new epoch key list within that time.
The rotation rate for epoch keys is expected to be on the order of days to weeks for typical applications, but the rate is configurable as required by the key distribution Administrator. Because of the relatively long rotation interval, and the overlap of active epoch keys, local clock drift within Nodes is generally not a concern.
4.15.3.4. Epoch Key Rotation without Time Synchronization
Although epoch keys are distributed with an associated start time, it is nonetheless possible for Nodes that do not maintain a synchronized clock to participate in key rotation. Specifically, upon receiving a new epoch key list from the key distribution Administrator, such a Node can note which of the keys is the current epoch key by comparing their relative start times and using the current epoch key which has the second newest time. It can then use the current key for all locally initiated security interactions until such time as it makes contact with the distribution Administrator again.
This scheme requires the Node to receive epoch keys from the key distribution Administrator at a rate that is at least as fast as the configured key propagation interval. The Administrator SHOULD provide a sufficient set of epoch keys to Nodes that do not maintain synchronized time so that they can maintain communication with other group members while a key update is in progress. The key distribution Administrator SHOULD update all Nodes without time, such as SEDs, before the new epoch key is activated, and then let Nodes with time all roll to the new epoch key at the synchronized start time.
4.15.3.5. Epoch Key Rotation logic
The full life-cycle of Epoch Key rotation is shown in Figure 18, “Epoch Key Rotation”. For each epoch key slot, the start time of the key is shown as one of the following values:
-
New - a key with a start time in the future.
-
Current - the active key with the newest start time.
-
Previous - the active key with the second newest start time.
-
Old - an active key with the third newest start time.
The diagram shows two types of state transitions:
-
Admin - an update of an old key by the Administrator. Changes made during this state transition are indicated in green.
-
Epoch Activate - activation of an epoch key due to system time becoming greater than the start time. Changes during this state transition are indicated in yellow.
The Admin Refresh
state begins when an entire group key set is freshly written to a Node during commissioning or administration, such as when a new group is added.
The Epoch Activate
state is entered when time progresses to activate a fresh current epoch key, aging out the other epoch key slots.
The Admin Update
state is entered when an Administrator updates an old epoch key with a new epoch key.
When in steady state, the Admin Refresh
state MAY be entered in place of an Admin Update
state transition to update additional keys to the required ones or to completely reset the group security.
Note that in the above diagram, only an example key distribution scheme is illustrated. It is also possible to devise key distribution algorithms that to not rely on time synchronization, or group configurations that never rotate keys in favor or configuring new groups and removing groups and group key sets with expired keys.
Group Key Set ID
The Group Key Set ID is a 16-bit field that uniquely identifies the set of epoch keys used for derivation of an operational group key. Each Group Key Set ID is scoped to a particular Fabric and assigned by an Administrator so as to be unique within a Fabric.
The Group Key Set ID of 0
SHALL be reserved for managing the Identity Protection Key (IPK) on a given Fabric.
It SHALL NOT be possible to remove the IPK Key Set if it exists.
4.15.3.6. Group Session ID
A Group Session ID is a special case of a 16-bit Session ID that is specifically used for group communication. When Session Type is 1, denoting a group session, the Session ID SHALL be a Group Session ID as defined here. The Group Session ID identifies probable operational group keys across a Fabric. The Group Session ID for a given operational group key is derived by treating the output of a Crypto_KDF against the associated Operational Group Key as a big-endian representation of a 16-bit integer, as follows:
GroupKeyHash =
Crypto_KDF
(
InputKey = OperationalGroupKey,
Salt = [],
Info = "GroupKeyHash",
Length = 16 // Bits
)
// GroupKeyHash is an array of 2 bytes (16 bits) per Crypto_KDF
// GroupSessionId is computed by considering the GroupKeyHash as a Big-Endian
// value. GroupSessionId is a scalar. Its use in fields within messages may cause a
// re-serialization into a different byte order than the one used for initial generation.
GroupSessionId = (GroupKeyHash[0] << 8) | (GroupKeyHash[1] << 0)
where []
denotes a zero-length array.
For example, given:
-
An Operational Group Key value of:
a6:f5:30:6b:af:6d:05:0a:f2:3b:a4:bd:6b:9d:d9:60
After the above derivation following the definition of Crypto_KDF
in Section 3.8, “Key Derivation Function (KDF)”, the resulting Group Session ID data would be:
-
Raw output of GroupKeyHash:
b9:f7
-
Group Session ID scalar value to be used for further processing: 0xB9F7 (47607 decimal)
The Group Session ID MAY help receiving nodes efficiently locate the Operational Group Key used to encrypt an incoming groupcast message. It SHALL NOT be used as the sole means to locate the associated Operational Group Key, since it MAY collide within the fabric. Instead, the Group Session ID provides receiving nodes a means to identify Operational Group Key candidates without the need to first attempt to decrypt groupcast messages using all available keys.
On receipt of a message of Group Session Type, all valid, installed, operational group key candidates referenced by the given Group Session ID SHALL be attempted until authentication is passed or there are no more operational group keys to try. This is done because the same Group Session ID might arise from different keys. The chance of a Group Session ID collision is 2-16 but the chance of both a Group Session ID collision and the message MIC matching two different operational group keys is 2-80.
Group Session Ids are sized to fit within the context of the Session Identifier field of a message. When used in this context, the Group Session ID value allows a receiving Node to identify the appropriate message encryption key to use from the set of active operational keys it has currently installed.
4.15.4. Distribution of Key Material
The operational group keys mechanism relies on a key distribution Administrator to reliably distribute select epoch key material to appropriate participants. It is assumed the key distribution Administrator is in possession of all epoch keys, has knowledge of the set of group security domain members which require access to those keys, and is responsible for pushing updates of these credentials to all authorized Nodes in those groups it manages.
Key material is distributed to key holders using the Group Key Management Cluster. In general, the key material of a Node is exposed via Attributes with ACL entries that only allow access by the key distribution Administrator. The information exposed in the Section 11.2, “Group Key Management Cluster” includes the group epoch keys and associated group session identifiers.
4.15.4.1. Installing a Group onto a Newly Commissioned Node
This section provides an example of the operations required to install a group onto a newly commissioned node.
Sequence:
-
Admin:
-
Generate fabric-unique group ID
GID
and random keykey0
for group key set IDK
. -
Write the group key set
K
to the remote node, GroupMember, usingKeySetWrite
command. -
Associate group ID
GID
with key setK
by writing an entry to the GroupKeyMap list attribute.
-
-
GroupMember:
-
Node subscribes to the IPv6 multicast address generated from the fabric ID and group ID.
-
-
Admin:
-
Associate endpoint with group ID
GID
by sending theGroups
cluster’sAddGroup
command to endpoint.
-
4.16. Message Counter Synchronization Protocol (MCSP)
This section describes the protocol used to securely synchronize the message counter used by a sender of messages encrypted with a symmetric group key.
Message counter synchronization is an essential part of enabling secure messaging between members of an operational group. Specifically, it protects against replay attacks, where an attacker replays older messages, which may result in unexpected behaviour if accepted and processed by the receiver.
The recipient of a message encrypted with a group key can trust and process that message only if it has kept the last message counter received from a given sender using that key.
Underlying MCSP is a simple request / response protocol. When a multicast message with unknown counter is received, synchronization via MCSP begins by sending a synchronization request via unicast UDP to the multicast message originator’s unicast IPv6 address. That originator then sends a synchronization response to the unsynchronized node via unicast UDP. After cryptographic verification, the formerly unsynchronized node is now synchronized with the originator’s message counter and can trust the original and subsequent messages from the originator node.
4.16.1. Message Counter Synchronization Methods
There are two methods for synchronizing the message counter of a peer node, which are configurable per-group-key based on the GroupKeySecurityPolicy field of a given group key set (see GroupKeySetStruct).
4.16.1.1. Trust-first policy
The first authenticated message counter from an unsynchronized peer is trusted, and its message counter is used to configure message-counter-based replay protection on future messages from that node. All control messages (any message with C Flag set) use the control message counter and SHALL use Trust-first for synchronization. Note that MCSP is not used for Trust-first synchronization.
This policy provides lower latency for less security-sensitive applications such as lighting.
Warning
|
Trust-first synchronization is susceptible to accepting a replayed message after a Node has been rebooted. |
4.16.1.2. Cache-and-sync policy
The message that triggers message counter synchronization is stored, a message counter synchronization exchange is initiated, and only when the synchronization is completed is the original message processed. Cache-and-sync provides replay protection even in the case where a Node has been rebooted, at the expense of higher latency.
Support for the cache-and-sync policy and MCSP is optional. A node indicates its ability to support this feature via the Group Key Management cluster FeatureMap.
4.16.2. Group Peer State
The Group Peer State Table stores information about every peer with which the node had a group message exchange. For every peer node id the following information is available in the table:
-
Peer’s Encrypted Group Data Message Counter Status:
-
Synchronized Data Message Counter - the largest encrypted data message counter received from the peer, if available.
-
Flag to indicate whether this counter value is valid and synchronized.
-
The message reception state bitmap tracking the recent window of data message counters received from the peer.
-
-
Peer’s Encrypted Group Control Message Counter Status:
-
Synchronized Control Message Counter - the largest encrypted control message counter received from the peer, if available.
-
Flag to indicate whether this counter value is valid and synchronized.
-
The message reception state bitmap tracking the recent window of control message counters received from the peer.
-
There are three scenarios where the receiver of an encrypted message does not know the sender’s last message counter:
-
The encrypted message is the first received from a peer.
-
The device rebooted without persisting the Group Peer State Table content. Note: it is not required to persist the Peer State Table.
-
The entry for the Peer in the Group Peer State Table was expunged due to the table being full.
The next sections describe the functional protocol used to request message counter synchronization with a peer and form responses to such message counter synchronization requests.
4.16.3. MCSP Messages
4.16.3.1. MsgCounterSyncReq - Message Counter Synchronization Request
The Message Counter Synchronization Request (MsgCounterSyncReq) message is sent when a message was received from a peer whose current message counter is unknown.
A MsgCounterSyncReq message SHALL set the C Flag in the message header. The control message counter SHALL be used for message protection.
A MsgCounterSyncReq message SHALL be secured with the group key for which counter synchronization is requested and SHALL set the Session Type to 1
, indicating a group session as per the rules outline in Section 4.16.5, “Message Counter Synchronization Exchange”.
The payload of the MsgCounterSyncReq message takes the format defined in Table 24, “Message Counter Sync Request”:
Field Size | Message Field | Description |
---|---|---|
8 bytes |
Challenge |
The Challenge is a 64-bit random number generated using the DRBG by the initiator of a MsgCounterSyncReq to uniquely identify the synchronization request cryptographically. |
4.16.3.2. MsgCounterSyncRsp - Message Counter Synchronization Response
The Message Counter Synchronization Response (MsgCounterSyncRsp) message is sent in response to a MsgCounterSyncReq.
A MsgCounterSyncRsp message SHALL set the C Flag in the message header. The control message counter SHALL be used for message protection.
The MsgCounterSyncRsp message has the format defined in Table 25, “Message Counter Sync Response”:
Field Size | Message Field | Description |
---|---|---|
4 bytes |
Synchronized Counter |
The current data message counter for the node sending the MsgCounterSyncRsp message. |
8 bytes |
Response |
The Response SHALL be the same as the 64-bit value sent in the Challenge field of the corresponding MsgCounterSyncReq. |
4.16.4. Unsynchronized Message Processing
An unsynchronized message is one that is cryptographically verified from a node whose message counter is unknown. Upon receipt of an unsynchronized message process the message as follows:
-
The message SHALL be of Group Session Type, otherwise discard the message.
-
If C Flag is set to
1
:-
Create a Message Reception State and set its
max_message_counter
to the message counter of the given message, i.e. trust-first. -
Accept the message for further processing.
-
-
If C Flag is set to
0
:-
Determine the Section 11.2.6.2.2, “GroupKeySecurityPolicy” (as set by the Section 11.2, “Group Key Management Cluster”) of the operational group key used to authenticate the message.
-
If the key has a trust-first security policy, the receiver SHALL:
-
Set the peer’s group key data message counter to Message Counter of the message.
-
Clear the Message Reception State bitmap for the group session from the peer.
-
Mark the peer 's group key data message counter as synchronized.
-
-
Process the message.
-
-
If the key has a cache-and-sync security policy, the receiver SHALL:
-
If MCSP is not in progress for the given peer Node ID and group key:
-
Store the message for later processing.
-
Proceed to Section 4.16.5, “Message Counter Synchronization Exchange”.
-
-
Otherwise, do not process the message.
-
An implementation MAY queue the message for later processing after MCSP completes if resources allow.
-
-
-
For each peer Node ID and group key pair there SHALL be at most one synchronization exchange outstanding at a time.
4.16.5. Message Counter Synchronization Exchange
A message synchronization exchange starts by sending the MsgCounterSyncReq message to the peer Node that sent the message with unknown message counter.
When a synchronization request is triggered by an incoming multicast message, the Node SHALL first wait for a uniformly random amount of time between 0
and MSG_COUNTER_SYNC_REQ_JITTER.
The sender of the MsgCounterSyncReq message SHALL:
-
Set the Message Header fields as follows:
-
The S Flag SHALL be set to
1
. -
The DSIZ field SHALL be set to
1
. -
The P Flag SHALL be set to
1
. -
The C Flag SHALL be set to
1
. -
The Session Type field SHALL be set to
1
. -
The Session ID field SHALL be set to the Group Session Id for the operational group key being synchronized.
-
The Source Node ID field SHALL be set to the Node ID of the sender Node.
-
The Destination Node ID field SHALL be set to the Source Node ID of the message that triggered the synchronization attempt.
-
-
Create a new synchronization Exchange.
-
The Exchange ID of the message SHALL be set to match the new Exchange.
-
The I Flag SHALL be set to
1
. -
The A Flag SHALL be set to
0
. -
The R Flag SHALL be set to
1
.
-
-
Set the Challenge field to the value returned by
Crypto_DRBG(len = 8 * 8)
and store that value to resolve synchronization responses from the destination peer. -
Arm a timer to enforce that a synchronization response is received before MSG_COUNTER_SYNC_TIMEOUT.
-
Upon firing of the timer:
-
The synchronization exchange SHALL be closed.
-
Any message waiting on synchronization associated with the exchange SHALL be discarded.
-
-
The timer SHALL be stopped upon receipt of an authenticated MsgCounterSyncRsp message that matches:
-
The Source Node ID field matches the Destination Node ID field of the most recent MsgCounterSyncReq message generated for that Node.
-
The Response field corresponds to the Challenge field of the MsgCounterSyncReq message.
-
-
-
Invoke Section 4.6.1, “Message Transmission” using parameters from step 1 to encrypt and then send the request message over UDP to the IPv6 unicast address of the destination.
-
The request message SHALL use the same operational group key as the message which triggered synchronization.
-
The group key SHALL be known/derivable by both parties (sender and receiver).
-
The receiver of MsgCounterSyncReq SHALL:
-
Verify the Destination Node ID field SHALL match the Node ID of the receiver, otherwise discard the message.
-
Respond with MsgCounterSyncRsp.
The sender of the MsgCounterSyncRsp response message SHALL:
-
Set the Message Header fields as follows:
-
The S Flag SHALL be set to
1
. -
The DSIZ field SHALL be set to
1
. -
The P Flag SHALL be set to
1
. -
The C Flag SHALL be set to
1
. -
The Session Type field SHALL be set to
1
. -
The Session ID field SHALL be set to the Group Session Id for the operational group key being synchronized.
-
The Source Node ID field SHALL be set to the Node ID of the sender Node.
-
The Destination Node ID field SHALL be set to the Source Node ID of the MsgCounterSyncReq.
-
-
Set the MsgCounterSyncRsp payload fields as follows:
-
The Response field SHALL be set to the value of the Challenge field from the MsgCounterSyncReq.
-
The Synchronized Counter field SHALL be set to the current Global Group Encrypted Data Message Counter of the sender.
-
-
Use the same exchange context as the MsgCounterSyncReq being responded to.
-
The Exchange ID of the message SHALL be set to the Exchange ID of the MsgCounterSyncReq.
-
The I Flag SHALL be set to
0
. -
The A Flag SHALL be set to
1
. -
The R Flag SHALL be set to
1
.
-
-
Invoke Section 4.6.1, “Message Transmission” using parameters from step 1 to encrypt and then send the response message over UDP to the IPv6 unicast address of the destination.
The receiver of the MsgCounterSyncRsp message SHALL:
-
Verify the MsgCounterSyncRsp matches a previously sent MsgCounterSyncReq:
-
An active synchronization exchange SHALL exist with the source node.
-
The Exchange ID field SHALL match the Exchange ID used for the original MsgCounterSyncReq message.
-
The Response field SHALL match the Challenge field used for the original MsgCounterSyncReq message.
-
The Destination Node ID field SHALL match the Source Node ID of the original MsgCounterSyncReq message.
-
The Source Node ID field SHALL match the Destination Node ID of the original MsgCounterSyncReq message.
-
-
On verification failure:
-
Silently ignore the MsgCounterSyncRsp message.
-
-
On verification success:
-
Set the peer’s group key data message counter to Synchronized Counter.
-
Clear the Section 4.5.4.1, “Message Reception State” bitmap for the peer.
-
Mark the peer 's group key data message counter as synchronized.
-
Resume processing of any queued message that triggered synchronization according to Section 4.5.6, “Counter Processing of Incoming Messages”.
-
If more than one message is queued from the synchronized peer, using the same operational group key, the messages SHALL be processed in the order received.
-
-
Close the synchronization exchange created for the original MsgCounterSyncReq message.
-
4.16.6. Message Counter Synchronization Session Context
While conducting Message Counter Synchronization with a peer, nodes SHALL maintain the following session context. For nodes initiating message counter synchronization, this context SHALL be maintained throughout the full exchange of MsgCounterSyncReq and MsgCounterSyncRsp messages. For nodes responding to MsgCounterSyncReq messages, the context SHALL only be maintained long enough to generate and successfully transmit the MsgCounterSyncRsp message.
-
Fabric Index
: Records the Index for the Fabric within which nodes are conducting message counter synchronization.-
Fabric Index is derived by identification of an Operational Group Key associated with the fabric through successful decryption with that key and verification of the Message Integrity Check. For nodes initiating counter synchronization, this occurs at decryption of an inbound groupcast message. For nodes in the responder role, this occurs at decryption of an inbound MsgCounterSyncReq message.
-
-
Peer Node ID
: Records the node ID of the peer with which message counter synchronization is being conducted.-
For nodes initiating message counter synchronization, this is the node ID of the responder. For nodes responding to message counter synchronization, this is the node ID of the initiator.
-
-
Role
: Records whether the node is the initiator of or responder to message counter synchronization.-
Together, Fabric Index, Peer Node ID and Role comprise a unique key that can be used to match incoming messages to ongoing MCSP exchanges.
-
-
Message Reception State
: Provides tracking for the Control Message Counter of the remote peer. -
Peer IP Address
: The unicast IP address of the peer. -
Peer Port
: The receiving port of the peer. -
Operational Group Key
: The Operational Group Key that is being used to encrypt messages within the counter synchronization exchange. -
Group Session ID
: Records the Group Session ID derived from the Operational Group Key that is being used to encrypt messages within the counter synchronization exchange.
4.16.7. Sequence Diagram
The following sequence diagram shows an example of how message counter synchronization behaves in the most common scenario.
4.16.7.1. Scenario 1 — Multicast Receiver Initiated
Assumptions:
-
Sender transmits a multicast message.
-
Receiver does not know Sender 's message counter.
Sequence:
-
Sender:
-
Generates, encrypts and sends Msg1 as a multicast message. Msg1 could be:
-
Regular message that starts encrypted group communication with receivers Receiver1 and Receiver2.
-
-
-
Receivers Receiver1 and Receiver2 each:
-
Receive, decrypt, authenticate, and cache Msg1 message for later processing.
-
Generate, encrypt, and send MsgCounterSyncReq message.
-
-
-
Sender:
-
Receives MsgCounterSyncReq message.
-
Generates, encrypts and sends MsgCounterSyncRsp message.
-
-
R1 and R2 each:
-
Receive, decrypt, process, and verify MsgCounterSyncRsp message from Sender.
-
On verification success: marks Sender 's group key message counter as synchronized.
-
Processes cached Msg1 message.
-
-
4.17. Bluetooth Transport Protocol (BTP)
The Bluetooth Transport Protocol (BTP) provides a TCP-like layer of reliable, connection-oriented data transfer on top of GATT. BTP splits individual Service Data Unit (SDU) messages into multiple BTP segments, which are each transmitted via a single GATT write or indication (as shown in Figure 22, “MATTERoBLE: Matter Message / BTP layering”).
While BTP is a generic protocol, Matter specifically uses BTP to define a Matter-over-Bluetooth Low Energy (MATTERoBLE) Interface. A MATTERoBLE Interface MUST implement BTP as a universally compatible transport mode. A MATTERoBLE Interface SHALL only be used to transport Matter messages as the BTP SDU.
The BTP session handshake allows devices to check BTP protocol version compatibility and exchange other data before a BTP session is established. Once established, this session is used to send and receive BTP SDUs (such as Matter messages) as BTP Message Segments. A BTP session MAY open and close with no effect on the state of the underlying Bluetooth LE connection, except in the case where a BTP session is closed by the Peripheral Device. Either the Peripheral or the Central MAY signal the end of a BTP session by closing the underlying BLE connection.
Due chiefly to constraints put on design by resource-limited BLE chipsets, BTP defines a receive window for each side of a session in units of GATT PDUs. Each GATT Write Characteristic Value (ATT_WRITE_REQ) PDU or Indication (ATT_HANDLE_VALUE_IND) PDU is sent with a sequence number which the receiver uses to acknowledge receipt of each packet at the BTP layer and open its receive window from the sender’s perspective.
4.17.1. BTP Session Interface
Conceptually, an open BTP session is exposed to the next-higher session layer as a full-duplex message stream.
4.17.2. BTP Frame Formats
A BTP Frame consists of an 8-bit header followed by one or more optional fields, as detailed below. BTP uses little endian encoding for any header fields larger than one byte in length.
4.17.2.1. BTP Packet Protocol Data Unit
Table 26, “BTP Packet PDU format” defines the BTP Packet PDU format.
Unused fields SHALL be set to '0'.
bit 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
- |
H |
M |
- |
A |
E |
- |
B |
[Management Opcode] |
|||||||
[Ack Number] |
[Sequence Number] |
||||||||||||||
[Message Length] |
|||||||||||||||
[Segment Payload]… |
|||||||||||||||
… |
H (Handshake) bit
Set to '0' for normal BTP packets. When set, this bit indicates a BTP handshake packet for session establishment and has a different packet format described below.
M (Management Message) bit
Indicates the presence ('1') or absence ('0') of the Management Opcode field. All segments of a message MUST set this bit to the same value.
B (Beginning Segment) bit
Set to '1' on the first segment of a BTP SDU and set to '0' for all remaining segments of the same BTP SDU. It indicates the presence of the Message Length field.
E (Ending Segment) bit
Set to '1' on the last segment of a BTP SDU and set to '0' for all other segments of the same BTP SDU. A segment MAY have both the Beginning and Ending bits set indicating that a full BTP SDU is included in the message. When set, the segment payload length is equal to the total remaining unreceived message data. When not set, the segment payload length is equal to the maximum allowable BTP session packet size minus header overhead.
Ack Number
Optional field specified in Section 4.17.3.8, “Packet Acknowledgements”.
Sequence Number
Mandatory field for regular data messages specified in Section 4.17.3.6, “Sequence Numbers”.
4.17.2.2. BTP Control Frames
BTP defines different control frame formats depending on the Management Opcode that is in the BTP Packet PDU header. Valid Management Opcodes for BTP Control Frames are defined in Table 27, “BTP Control codes”.
Management Opcode | Name | Description |
---|---|---|
0x6C |
Handshake |
Request and response for BTP session establishment |
4.17.2.3. BTP Handshake Request
bit 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
H=1 |
M=1 |
0 |
A=0 |
E=1 |
0 |
B=1 |
Management Opcode = 0x6C |
|||||||
Ver[1] |
Ver[0] |
Ver[3] |
Ver[2] |
||||||||||||
Ver[5] |
Ver[4] |
Ver[7] |
Ver[6] |
||||||||||||
Requested ATT_MTU |
|||||||||||||||
Client Window Size |
Ver[i] (Version) nibbles
Used to negotiate the highest version capability between a Device pair. Supported versions are listed once each, newest first, in descending order. Unused version fields are filled with ‘0’.
The following values are defined:
-
0 — Unused field
-
4 — BTP as defined by Matter v1.0
Requested ATT_MTU
Requested ATT_MTU is a 16-bit unsigned integer field containing the size of the GATT PDU (ATT_MTU) that can be received by the sender minus the size of the GATT header (3). This value is obtained via the standard ATT MTU exchange procedure (see Bluetooth® Core Specification 4.2 Vol 3, Part F, Section 3.4.2 "MTU Exchange") and is used to validate that both sides of the BLE connection are using the common minimum value. If BTP is not aware of the negotiated GATT MTU, the value shall be set to '23', indicating the minimum ATT_MTU defined by GATT. If the client has no preference, the value may be set to '0'.
Note
|
Each GATT PDU used by the BTP protocol introduces 3 byte header overhead making the maximum BTP Segment Size for the session equal to negotiated ATT_MTU-3. |
Client Window Size
Value of the maximum receive window size supported by the server, specified in units of BTP packets where each packet may be up to 244 bytes in length. This maximum was chosen so a single BTP segment can fit into a single 255 byte BLE link layer PDU, including all headers from the link layer, L2CAP, GATT, and BTP.
4.17.2.4. BTP Handshake Response
bit 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
H=1 |
M=1 |
0 |
A=0 |
E=1 |
0 |
B=1 |
Management Opcode = 0x6C |
|||||||
Reserved |
Final Protocol Version |
Selected ATT_MTU (low byte)… |
|||||||||||||
…Selected ATT_MTU (high byte) |
Selected Window Size |
4.17.3. BTP GATT Service
4.17.3.1. BTP Channelization
Bluetooth Transport Protocol provides a packetized stream interface over GATT but says nothing about the actual contents of the data packets it transports. The BTP Service UUID is used to specify the actual contents of the packets (see Table 30, “BTP Service UUID”).
BTP Datagram Contents | BTP Service UUID |
---|---|
Matter Message frames |
MATTER_BLE_SERVICE_UUID |
While a single BTP connection may exist between a BTP Client and BTP Server, multiple BTP sessions may be established between various peers.
4.17.3.2. BTP GATT Service
The BTP GATT service is composed of a service with three characteristics—C1, C2 and C3 (see Table 31, “BTP GATT service”). The client SHALL exclusively use C1 to initiate BTP sessions by sending BTP handshake requests and send data to the server via GATT ATT_WRITE_CMD PDUs. While a client is subscribed to allow indications over C2, the server SHALL exclusively use C2 to respond to BTP handshake requests and send data to the client via GATT ATT_HANDLE_VALUE_IND PDUs.
Attribute | Description |
---|---|
BTP Service |
UUID = MATTER_BLE_SERVICE_UUID |
C1 Characteristic |
UUID = 18EE2EF5-263D-4559-959F-4F9C429F9D11 |
C2 Characteristic |
UUID = 18EE2EF5-263D-4559-959F-4F9C429F9D12 |
C3 Characteristic |
UUID = 64630238-8772-45F2-B87D-748A83218F04 |
For all messages sent from the BTP Client to BTP Server, BTP SHALL use the GATT Write Characteristic Value sub-procedure. For all messages sent from the BTP Server to BTP Client, BTP SHALL use the GATT Indications sub-procedure.
The values of C1 and C2 SHALL both be limited to a maximum length of 247 bytes. This constraint is imposed to align with maximum PDU size when LE Data Packet Length Extensions (DPLE) is enabled on Bluetooth 4.2 hardware. Per Bluetooth® Core Specification 4.2 Vol 3, Part F, Section 3.2.9 "Long Attribute Values", the maximum characteristic value length is 512 bytes. The maximum lengths of C1 and C2 may increase in a future version of the BTP specification to allow higher throughput on BLE connections whose ATT_MTU exceeds 247 bytes.
C3 is an optional characteristic that the server MAY use to include additional data required during the provisioning as defined in Section 5.4.2.5.7, “GATT-based Additional Data”.
BTP Clients SHALL perform certain GATT operations synchronously, including GATT discovery, subscribe, and unsubscribe operations. GATT discovery, subscribe, or unsubscribe SHALL NOT be initiated while the result of a previous operation remains outstanding. This requirement is imposed by GATT protocol.
4.17.3.3. Session Establishment
Before a BTP session can be initiated, a central SHALL first establish a BLE connection to a peripheral. Once a BLE connection has been formed, centrals SHALL assume the GATT client role for BTP session establishment and data transfer, and peripherals SHALL assume the GATT server role. If peripheral supports LE Data Packet Length Extension (DPLE) feature it SHOULD perform data length update procedure before establishing a GATT connection.
Before establishing a BTP session, the GATT client SHOULD perform a GATT Exchange MTU procedure.
After that the BTP Client SHALL execute the GATT discovery procedure. The GATT discovery procedure starts with primary service discovery using either the GATT Discover All Primary Services sub-procedure or the GATT Discover Primary Services by Service UUID sub-procedure.
The BTP Client SHALL perform either the GATT Discover All Characteristics of a Service sub-procedure or the GATT Discover Characteristics by UUID sub-procedure in order to discover the C1 and C2 characteristics.
The BTP Client SHALL perform the GATT Discover All Characteristic Descriptors sub-procedure in order to discover the Client Characteristic Configuration descriptor (CCCD) of C2 characteristic.
To initiate a BTP session, a BTP Client SHALL send a BTP handshake request packet to the BTP Server via a ATT_WRITE_CMD PDU on characteristic C1 of the BTP Service. The handshake request packet SHALL include, a list of BTP protocol versions supported by the client, the client’s GATT ATT_MTU, and the client’s maximum receive window size. The list of supported protocol versions SHALL be sorted in descending numerical order. If the client cannot determine the BLE connection’s ATT_MTU, it SHALL specify a value of '23' (the minimum ATT_MTU supported by GATT) for this field in the handshake request. For a detailed specification of the handshake request binary data format, see Section 4.17.2.3, “BTP Handshake Request”.
After the BTP Client acknowledges delivery of the handshake request packet, upon receipt of a GATT Write Response, the BTP Client SHALL enable indications over C2 characteristics by writing value 0x01 to C2’s Client Characteristic Configuration descriptor as described in Bluetooth® Core Specification 4.2 Vol 3, Part C, Section 10.3.1.1 "Handling GATT Indications and Notifications".
Once the GATT server has received a client’s BTP handshake request and confirmed the client’s subscription to C2, it SHALL send a BTP handshake response to the client via a ATT_HANDLE_VALUE_IND PDU on C2. This response SHALL contain the window size, maximum BTP packet size, and BTP protocol version selected by the server. For a detailed specification of the handshake response binary data format, see Section 4.17.2.4, “BTP Handshake Response”.
The server SHALL select a window size equal to the minimum of its and the client’s maximum window sizes. Likewise, the server SHALL select a maximum BTP Segment Size for the BLE connection by taking the minimum of 244 bytes (the maximum characteristic value length of C1 and C2), server’s ATT_MTU-3 and ATT_MTU-3 as declared by the client.
The server SHALL select a BTP protocol version that is the newest which it and the client both support, where newer protocol version numbers are strictly larger than those of older versions. The version number returned in the handshake response SHALL determine the version of the BTP protocol used by client and server for the duration of the session.
If the server determines that it and the client do not share a supported BTP protocol version, the server SHALL close its BLE connection to the client. When a client sends a handshake request, it SHALL start a timer with a globally-defined duration of BTP_CONN_RSP_TIMEOUT seconds. If this timer expires before the client receives a handshake response from the server, the client SHALL close the BTP session and report an error to the application. Likewise, a server SHALL start a timer with the same duration when it receives a handshake request from a client. If this timer expires before the server receives a subscription request on C2, the server SHALL close the BTP session and report an error to the application. The state machine in Figure 23, “BTP session handshake” illustrates the function of these timers as part of the BTP session establishment procedure.
4.17.3.4. Data Transmission
Once a BTP session has been established, the next-higher-layer application on both peers may use this BLE connection to send and receive data via GATT writes or indications, according to a peer’s GATT role. Clients SHALL exclusively use GATT Write Characteristic Value sub-procedure to send data to servers and servers SHALL exclusively use GATT Indication sub-procedure to send data to clients.
All BTP packets sent on an open BLE connection SHALL adhere to the BTP Packet PDU binary data format specified in BTP Frame Formats. All BTP packets SHALL include a header flags byte and an 8-bit unsigned sequence number. All other packet fields are optional. These optional fields include an 8-bit unsigned received packet acknowledgement number, 16-bit unsigned buffer length indication, and variable-length buffer segment payload.
This section is defined entirely within the scope of a single BTP session. Concurrent BTP sessions between the same peer and multiple remote hosts SHALL maintain separate and independent acknowledgement timers, sequence numbers, and receive windows.
4.17.3.5. Message Segmentation and Reassembly
When the session layer (that is, MATTERoBLE) sends a Matter Message as a BTP SDU over a BTP session, that BTP SDU SHALL be split into ordered, non-overlapping BTP segments so the set of all BTP segments may be reassembled into the original BTP SDU (see Figure 22, “MATTERoBLE: Matter Message / BTP layering”). Each BTP segment SHALL be prepended with a BTP packet header and sent as the payload of a single GATT PDU. If a BTP SDU is split into more than one BTP segment, the BTP segments SHALL be sent in order of their position in the original BTP SDU, starting with the BTP segment at the buffer’s head.
At any point in time, only one BTP SDU may be transmitted in each direction over a BTP session. The transmission of BTP segments of any two BTP SDUs SHALL not overlap. If the application attempts to send one BTP SDU while transmission of another BTP SDU is in progress, the new BTP SDU SHALL be appended to a first-in, first-out queue. The next BTP SDU SHALL be dequeued from this queue and transmitted once transmission of the current BTP SDU completes, that is, once all BTP segments of the current BDP SDU have been transmitted and received by the peer via GATT.
The first BTP segment of a BTP SDU sent over a BTP session SHALL have its Beginning Segment header flag set to indicate the beginning of a new BTP SDU (see Table 26, “BTP Packet PDU format”). The presence of this flag SHALL indicate the further presence of a 16-bit unsigned integer field, the Message Length, that provides the receiver with the total length of the BTP SDU. The last BTP segment for a given BTP SDU SHALL have its Ending Segment flag set to indicate the end of the transmitted BTP SDU. A BTP packet that bears an unsegmented BTP SDU—that is, a BTP SDU small enough to fit into a single BTP segment—SHALL have both its Beginning Segment and Ending Segment flags set.
The size of a single BTP SDU sent via BTP is limited to 64KB, that is, the maximum size of the Message Length field in the BTP packet header. The number of segments used to send a buffer is unlimited and delimited by the Beginning Segment and Ending Segment bits in the BTP packet header. The upper layer imposes more stringent requirements over the maximum SDU size, such as Section 4.4.4, “Message Size Requirements”.
The length of the data payload in each BTP segment whose Ending Segment bit is not set SHALL be equal to the session’s maximum BTP packet size minus the size of that packet’s header. If a packet’s Ending Segment bit is set, the length of its BTP segment data payload SHALL equal the size of the original BTP SDU minus the total size of all previously transmitted BTP segments of that BTP SDU. In this way, the length of a SDU’s last BTP segment is implied by its size.
Once a peer receives a complete set of BTP segments, it SHALL reassemble them in the order received, and verify that the reassembled BTP SDU’s total length matches that specified by the Beginning Segment’s Message Length value. If they match, the receiver SHALL pass the reassembled BTP SDU up to the next-higher-layer. If the reassembled buffer’s length does not match that specified by the sender, or if received BTP segment payload size would exceed the maximum BTP packet size, or receiver receives an Ending Segment without the presence of a previous Beginning Segment, or a Beginning Segment when another BTP SDU’s transmission is already in progress, the receiver BTP SHALL close the BTP session and report an error to the application.
4.17.3.6. Sequence Numbers
All BTP packets SHALL be sent with sequence numbers, regardless of whether they contain SDU segments (for example, a packet acknowledgement with no attached segment payload). The purpose of sequence numbers is to facilitate the BTP receive window. A BTP sequence number SHALL be defined as an unsigned 8-bit integer value that monotonically increments by 1 with each packet sent by a given peer. A sequence number incremented past 255 SHALL wrap to zero.
Sequence numbers SHALL be separately defined for either direction of a BTP session. The sequence number of the first packet sent by the client after completion of the BTP session handshake SHALL be zero. The server’s BTP handshake response bears an implied sequence number of zero because it occupies a slot in the client’s receive window. The client acknowledges the server’s BTP handshake response with an acknowledgement sequence of zero. For this reason, the sequence number of the first data packet sent by the server after completion of the BTP session handshake SHALL be 1.
Peers SHALL check to ensure that all received BTP packets properly increment the sender’s previous sequence number by 1. If this check fails, the peer SHALL close the BTP session and report an error to the application.
4.17.3.7. Receive Windows
The purpose of the receive window is to enable flow control at the GATT session layer between BTP peers.
Flow control is required at the GATT transport layer for embedded platforms that use "minimal" BLE chipsets. These platforms may have limited space on the host processor to receive packets from their BLE chipsets. In the case of some dual-chip architectures, writes and indications are received and confirmed by the BLE chip with no input from the host processor. When the BLE chip sends the result of a received GATT PDU to the host processor, that payload and the corresponding BTP packet will be permanently lost if the host does not have enough space to receive it. For this reason, knowledge of a remote host’s ability to reliably receive GATT PDUs is presented at the transport layer in the form of the BTP receive window.
Both peers in a BTP session SHALL define a receive window, where the window’s size indicates the number of GATT PDUs (that is, BTP segments) a peer can reliably receive and store without session-layer acknowledgment. A maximum window size SHALL be established for both peers as part of the BTP session handshake. To prevent sequence number wrap-around, the largest maximum window size any peer may support is 255.
Both peers SHALL maintain a counter to reflect the current size of the remote peer’s receive window. Each peer SHALL decrement this counter when it sends a packet via GATT write or indication and increment this counter when a sent packet is acknowledged.
If a local peer’s counter for a remote peer’s receive window is zero, the window SHALL be considered closed, and the local peer SHALL NOT send packets until the window reopens (is incremented above zero). When a closed window reopens, a local peer SHALL immediately resume any pending BTP packet transmission.
A local peer SHALL also not send packets if the remote peer’s receive window has one slot open and the local peer does not have a pending packet acknowledgement. This is to avoid the situation where the receive windows of both peers are full and neither can send an acknowledgement to reopen its window for the other. Because the server’s handshake response bears an implicit BTP sequence number of zero, a server SHALL initialize its counter for the client’s receive window size at (negotiated maximum window size - 1). A client SHALL initialize its counter for the server’s receive window at the negotiated maximum window size.
Both peers SHALL also keep a counter of their own receive window size based on the sequence number difference between the last packet they received and the last packet they acknowledged. This counter is used to proactively send early packet acknowledgements when a peer’s own receive window is about to close. See Section 4.17.3.8, “Packet Acknowledgements” for details.
An example scenario involving BTP receive windows is depicted in Figure 24, “Example receive window scenario”, complete with packet acknowledgements as specified in Section 4.17.3.8, “Packet Acknowledgements”. In this scenario, the client transmits a three-segment buffer to the server once it receives the server’s handshake request. The handshake request occupies one slot in the client’s initial receive window. The server’s initial receive window is empty. Both client and server have a maximum window size of 4.
4.17.3.8. Packet Acknowledgements
The purpose of sequence numbers and packet receipt acknowledgements is to support the BTP receive window and provide a keep-alive signal when a session is idle to affirm the health and continued operation of a remote BTP stack.
Per BTP Frame Formats, BTP packet receipt acknowledgements SHALL be received as unsigned 8-bit integer values in the header of a BTP packet. The value of this field SHALL indicate the sequence number of the acknowledged packet.
Acknowledgement of a sequence number indicates acknowledgement of the previous sequence number, if it too is unacknowledged. By induction, acknowledgement of a given packet implies acknowledgement of all packets received on the same BTP session prior to the acknowledged packet.
An acknowledgement is invalid if the acknowledged sequence number does not correspond to an outstanding, unacknowledged BTP packet sequence number. In contrast to TCP, BTP acks are not "free." A stand-alone ack—that is, a BTP packet that contains a packet receipt acknowledgement value but no buffer segment payload—consumes a slot in a remote peer’s window just like any other packet. Stand-alone acknowledgement packets SHALL be acknowledged by a remote peer. The implications of this are examined in Section 4.17.3.9, “Idle Connection State”.
Each peer SHALL maintain an acknowledgement-received timer. When a peer sends any BTP packet, it SHALL start this timer if it is not already running. The timer’s duration SHALL be globally defined as BTP_ACK_TIMEOUT seconds, referred to as the acknowledgement timeout interval.
A peer SHALL restart its acknowledgement-received timer when a valid acknowledgement is received for any but its most recently sent unacknowledged packet. A peer SHALL stop its acknowledgement-received timer if it receives an acknowledgement for its most recently sent unacknowledged packet. If a peer’s acknowledgement-received timer expires, or if a peer receives an invalid acknowledgement, the peer SHALL close the BTP session and report an error to the application.
Because the server’s handshake response bears an implicit BTP sequence number of zero, a server SHALL start its acknowledgement-received timer when it sends a handshake response.
Each peer SHALL also maintain a send-acknowledgement timer. When it receives any BTP packet, a peer SHALL record the packet’s sequence number as the corresponding BTP session’s pending acknowledgement value and start the send-acknowledgement timer if it is not already running. The timer’s duration timer SHALL be defined as any value less than one-half the acknowledgement timeout interval. This ensures that on a healthy BLE connection, a peer will always receive acknowledgements for sent packets before its acknowledgement-received timer expires.
A peer SHALL stop its send-acknowledgement timer when any pending acknowledgement is sent, either as a stand-alone BTP packet or piggybacked onto an outgoing buffer segment. If this timer expires and the peer has a pending acknowledgement, the peer SHALL immediately send that acknowledgement. If the peer sends any packet before this timer expires, it SHALL piggyback any pending acknowledgement on the transmitted packet and stop the send-acknowledgement timer.
Because the server’s handshake response bears an implicit BTP sequence number of zero, a client SHALL set its pending acknowledgement value to zero and start its send-acknowledgement timer when it receives the server’s a handshake response. Operation of the send-acknowledgement and acknowledgement-received timers is illustrated in Figure 26, “BTP session lifecycle for Central acting as GATT Client” in Section 4.17.3.11, “Protocol State Diagrams”.
If a peer detects that its receive window has shrunk to two or fewer free slots, it SHALL immediately send any pending acknowledgement as a stand-alone BTP packet. This prevents the session from stalling in the interval between when a peer’s receive window becomes empty and when its send-acknowledgement timer would normally fire.
4.17.3.9. Idle Connection State
When neither side of a BTP session has data to send, BTP packets will still be exchanged every send-acknowledgement interval due to acknowledgements generated by the receipt of previous data or stand-alone acknowledgement packets, as discussed in Section 4.17.3.8, “Packet Acknowledgements”. The behavior of the acknowledgement-received timer in this scenario doubles as a keep-alive mechanism, as it will cause a peer to close a BLE connection automatically if the remote BTP stack crashes or becomes unresponsive. This scenario is illustrated in Figure 25, “Idle connection scenario”.
4.17.3.10. Connection Shutdown
To close a BTP session, a GATT client SHALL unsubscribe from characteristic C2. The GATT server SHALL take this action to indicate closure of any BTP session open to the client.
If a BTP Server needs to close the BTP session, it SHALL terminate its BLE connection to the client.
4.17.3.11. Protocol State Diagrams
Figure 26, “BTP session lifecycle for Central acting as GATT Client” shows the state machine for BTP session management of a BTP Client Device.
Figure 27, “BTP session lifecycle for Peripheral acting as GATT Server” shows the state machine for BTP session management of a BTP Server Device.
Note that in Figure 27, “BTP session lifecycle for Peripheral acting as GATT Server”, the state machine is identical for GATT clients and servers with the distinction that clients send data to servers via confirmed writes, and servers send data to clients via indications.
Figure 28, “State diagram for BTP session post-establishment” shows the state machine for BTP session maintenance at the protocol level, including liveliness enforcement through keep alive messages and automatic teardown if acknowledgements are received before the timeout.
4.17.4. Parameters and Constants
Table 32, “Glossary of constants” is a glossary of constants used in this chapter, along with a brief description and the default for each constant.
Constant Name | Description | Default |
---|---|---|
BTP_CONN_RSP_TIMEOUT |
The maximum amount of time after sending a BTP Session Handshake request to wait for a BTP Session Handshake response before closing the connection. |
5 seconds |
BTP_ACK_TIMEOUT |
The maximum amount of time after receipt of a segment before a stand-alone ACK must be sent. |
15 seconds |
BTP_CONN_IDLE_TIMEOUT |
The maximum amount of time no unique data has been sent over a BTP session before the Central Device must close the BTP session. |
30 seconds |
4.17.5. Bluetooth SIG Considerations
The UUID is provided by Bluetooth SIG, Inc. and may only be used by its members in compliance with all terms and conditions of use issued by the Bluetooth SIG, Inc. For more information, visit https://www.bluetooth.com/specifications/assigned-numbers/16-bit-uuids-for-sdos.
Use of the Bluetooth extensions feature of this specification and specifically the MATTER_BLE_SERVICE_UUID is strictly prohibited unless the product is certified by both the Bluetooth SIG and the Connectivity Standards Alliance by a member of good standing of both organizations.
Constant Name | Description | Value |
---|---|---|
MATTER_BLE_SERVICE_UUID |
The UUID for the Matter-over-BLE service as assigned by the Bluetooth SIG. |
0xFFF6 |
5. Commissioning
5.1. Onboarding Payload
The purpose of this section is to define the contents of the Onboarding Payload needed to allow onboarding a device into a Matter network. It also specifies the representation and encoding of said payload as a QR Code, as a manually entered code, and as content in an NFC tag.
5.1.1. Onboarding Payload Contents
The Onboarding Payload is composed of required and optional information which will be used by the Commissioner to ensure interoperability between commissioners and devices and provide a consistent user experience. Some or all of this content will be encoded into different formats, some human-readable (such as numeric string) and machine-readable (such as QR code and NFC) formats for printing or display on or integration into the device. The following are the elements that may be used in an Onboarding Payload for a Matter device.
5.1.1.1. Version
A version indication provides versioning of the payload and SHALL be included. Version for machine-readable formats is 3 bits with an initial version of 0b000
. Version for Manual Pairing Code is 1 bit with an initial version of 0b0
.
Rationale: This allows a way to introduce changes to the payload as needed going into the future.
5.1.1.2. Vendor ID and Product ID
Vendor ID and Product ID, each a 16-bit value, SHALL be included in machine-readable formats and MAY be included in the Manual Pairing Code.
Rationale: This allows a way to identify the make and model of the device, which is used further during the commissioning flow, such as during the Device Attestation procedure.
These unique identifiers also help to retrieve device model metadata like product name, product description, and firmware update URL from the Distributed Compliance Ledger, as well as information relevant to the commissioning flow (see Section 5.7, “Device Commissioning Flows”).
5.1.1.3. Custom Flow
A 2-bit unsigned enumeration specifying the Device Commissioning Flow SHALL be included in machine-readable formats. For the encoding of Custom Flow in the Manual Pairing Code, see Section 5.1.4.1.2, “Custom Flow for Manual Pairing Code”.
Rationale: This guides the Commissioner as to whether steps are needed before commissioning can take place.
-
A value of
0
indicates that no steps are needed (apart from powering the device). -
A value of
1
indicates that user interaction with the device (pressing a button, for example) is required before commissioning can take place. The specific steps required can be found in the CommissioningModeInitialStepsHint field of the Distributed Compliance Ledger for the given Vendor ID and Product ID. -
A value of
2
indicates that an interaction with a service provided by the manufacturer is required for initial device setup before it is available for commissioning by any Commissioner. The URL for this service can be found in the CommissioningCustomFlowUrl field of the Distributed Compliance Ledger for the given Vendor ID and Product ID.
5.1.1.4. Discovery Capabilities Bitmask
An 8-bit capabilities bitmask SHALL be included in machine-readable formats.
Rationale: The Discovery Capabilities Bitmask contains information about the device’s available technologies for device discovery (see Section 5.4, “Device Discovery”).
5.1.1.5. Discriminator value
A Discriminator SHALL be included as a 12-bit unsigned integer, which SHALL match the value which a device advertises during commissioning. To easily distinguish between advertising devices, this value SHOULD be different for each individual device.
For machine-readable formats, the full 12-bit Discriminator is used. For the Manual Pairing Code, only the upper 4 bits out of the 12-bit Discriminator are used.
Rationale: The Discriminator value helps to further identify potential devices during the setup process and helps to improve the speed and robustness of the setup experience for the user.
5.1.1.6. Passcode
A Passcode
SHALL be included as a 27-bit unsigned integer, which serves as proof of possession during commissioning. The 27-bit unsigned integer encodes an 8-digit decimal numeric value, and therefore shall be restricted to the values 0x0000001
to 0x5F5E0FE
(00000001
to 99999998
in decimal), excluding the invalid Passcode values.
Rationale: The Passcode establishes proof of possession and is also used as the shared secret in setting up the initial secure channel over which further onboarding steps take place.
5.1.1.7. TLV Data
Variable-length TLV data using the TLV format MAY be included in machine-readable formats providing optional information. More details about the TLV can be found in Section 5.1.5, “TLV Content”.
5.1.2. Onboarding Material Representation
In order for the users of Matter products to recognize the onboarding material, and be able to use it easily, it is important to keep the representations of the onboarding material unified and of certain minimum size. To support this the Matter Brand Guidelines specify the characteristics like composition, colors, font, font size, QR Code size and digit-grouping of the Manual Pairing code.
When the onboarding material is printed on product or packaging material it SHALL follow the Matter Brand Guidelines.
Other representations (product display, app, etc) of the onboarding material SHOULD follow the Matter Brand Guidelines.
5.1.3. QR Code
The Onboarding Payload MAY be included on (or with) a device in the form of a QR code. The following sections detail the content, encoding, and formatting of the QR code.
5.1.3.1. Payload
The content of the QR code consists of the concatenation of a prefix string and a Base-38-encoded string containing the required and optional TLV content:
QR code string := <prefix><base-38-content>
Base-38 Content
The required content of the QR code is composed of a Packed Binary Data Structure containing elements of the Onboarding Payload as detailed below. The resulting data is Base-38 encoded (with a specific alphabet) to form a string compatible with alphanumeric QR encoding.
Packed Binary Data Structure
Individual data elements SHALL be placed into the structure in the order detailed in the table below. Elements being packed are not necessarily byte- or word-aligned. The resulting packed structure is presented to the encoder as a multi-byte array (see Encoding section below), which SHALL be padded with '0' bits at the end of the structure to the nearest byte boundary.
The bits of each fixed-size value are placed in the packed binary data structure in order from least significant to most significant. If TLV Data is included, it is appended to the end of the packed binary data.
For example, the first elements in the table below SHALL be packed into the first bytes of the data array as pictured:
lsb Byte 0 msb | Byte 1 | Byte 2 | Byte 3 | … | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
7 |
0 |
7 |
0 |
7 |
0 |
7 |
0 |
||||||||||||||||||||||||||
version |
Vendor ID |
Product ID |
||||||||||||||||||||||||||||||||
0 |
2 |
0 |
15 |
0 |
15 |
Onboarding Payload Element | Size (bits) | Required | Notes |
---|---|---|---|
Version |
3 |
Yes |
3-bit value specifying the QR code payload version. |
Vendor ID |
16 |
Yes |
|
Product ID |
16 |
Yes |
|
Custom Flow |
2 |
Yes |
Device Commissioning Flow |
Discovery Capabilities Bitmask |
8 |
Yes |
Defined in table below. |
Discriminator |
12 |
Yes |
12-bit as defined in Discriminator |
Passcode |
27 |
Yes |
|
Padding |
4 |
Yes |
Bit-padding of '0’s to expand to the nearest byte boundary, thus byte-aligning any TLV Data that follows. |
TLV Data |
Variable |
No |
Variable length TLV data. Zero length if TLV is not included. This data is byte-aligned. |
Bit | Size (bits) | Description |
---|---|---|
0 (lsb) |
1 |
Soft-AP: |
1 |
1 |
BLE: |
2 |
1 |
On IP network: |
3..7 |
5 |
Reserved (SHALL be 0) |
TLV Data
The TLV data is an optional, variable-length payload. The payload is composed of one or more TLV-encoded elements as defined in detail below in the TLV Content section.
Encoding
The Packed Binary Data Structure is Base-38 encoded (with a specific alphabet) to produce an alphanumeric string suitable for use as a QR code payload.
Alphabet
The Base-38 alphabet to be employed is composed of a subset of the 45 available characters (A-Z0-9$%*+./ :-
) in the QR code for alphanumeric encoding as defined by ISO/IEC 18004:2015, with characters $
, %
, *
, +
, /
, <space>
, and :
removed.
Code | Character | Code | Character | Code | Character | Code | Character | Code | Character |
---|---|---|---|---|---|---|---|---|---|
00 |
0 |
09 |
9 |
18 |
I |
27 |
R |
36 |
- |
01 |
1 |
10 |
A |
19 |
J |
28 |
S |
37 |
. |
02 |
2 |
11 |
B |
20 |
K |
29 |
T |
||
03 |
3 |
12 |
C |
21 |
L |
30 |
U |
||
04 |
4 |
13 |
D |
22 |
M |
31 |
V |
||
05 |
5 |
14 |
E |
23 |
N |
32 |
W |
||
06 |
6 |
15 |
F |
24 |
O |
33 |
X |
||
07 |
7 |
16 |
G |
25 |
P |
34 |
Y |
||
08 |
8 |
17 |
H |
26 |
Q |
35 |
Z |
Method
Base-38 encoding is achieved by employing a simplified strategy where every 3 bytes (24 bits) of binary source data are encoded to 5 characters of the Base-38 alphabet.
Data from the Packed Binary Data Structure are encoded starting with the first byte of the structure. Three-byte chunks are formed into a 24-bit unsigned integer for encoding as follows:
The 24-bit value is subsequently converted to Base-38 radix using the alphabet above to produce a 5-character substring, with the least-significant character appearing first (little-endian).
If a single byte of binary source data remains, it shall be converted to Base-38 radix using the alphabet above to produce a 2-character substring, with the least-significant character appearing first.
If two bytes of binary source data remains, they shall be formed into a 16-bit unsigned integer for encoding as follows:
This 16-bit value is subsequently converted to Base-38 radix using the alphabet above to produce a 4-character substring, with the least-significant character appearing first.
The final encoded string is a result of concatenation of all substrings, with the first-encoded substring appearing at the beginning of the concatenated string.
5.1.3.2. QR Code Format
The format selection, which includes the QR code Version and ECC levels as well as size and color, MAY be tailored to the requirements of the manufacturer and their respective product, provided it meets the following requirements:
QR code Version and Encoding
The QR code generated, as defined in ISO/IEC 18004:2015, SHALL be of Version 1 or higher, using alphanumeric encoding. The size of the payload implies a minimum Version, though a higher Version may be needed to allow a higher ECC level. For example, a minimum payload of 22 alphanumeric characters (19 base-38-encoded characters from the packed binary structure plus 3 prefix characters) can be fit into a Version 1 with ECC=L, but for ECC=M, Q or H, the same payload requires a Version 2 QR code. This allows the Manufacturer to balance between ECC, pixel size and overall size.
Example QR Code Sizes and Payloads
QR Code Version | Module Size | ECC Level | Alphanumeric capacity (chars) | Total available payload, excluding prefix (bits) | Available payload for TLV data (bits) |
---|---|---|---|---|---|
1 |
21x21 |
L |
25 |
104 |
16 |
2 |
25x25 |
L |
47 |
208 |
120 |
M |
38 |
168 |
80 |
||
Q |
29 |
120 |
32 |
||
3 |
29x29 |
L |
77 |
352 |
264 |
M |
61 |
272 |
184 |
||
Q |
47 |
208 |
120 |
||
H |
35 |
152 |
64 |
||
4 |
33x33 |
L |
114 |
528 |
440 |
M |
90 |
416 |
328 |
||
Q |
67 |
304 |
216 |
||
H |
50 |
224 |
136 |
||
5 |
37x37 |
L |
154 |
720 |
632 |
M |
122 |
568 |
480 |
||
Q |
87 |
400 |
312 |
||
H |
64 |
288 |
200 |
Note
|
Version 1 codes with ECC levels M, Q, and H and version 2 codes with ECC level H have insufficient capacity |
Note
|
Total available payload, excluding prefix = (trunc((N-3) / 5) * 24) where N is the number of alphanumeric characters which fit in the QR code. This formula uses N-3 to account for the prefix characters, and then determines how many groups of 5 base-38-encoded characters can fit; each such group carrying 24 bits of payload.This formula fills groups of 5 characters after the MT: prefix. If there are 2,3 or 4 characters left after these groups, an additional 8 bits (for 2,3 characters) or 16 bits (for 4 characters) of TLV data can be accommodated. So the entries in the table take this into account.Available payload for TLV data = (Total available payload, excluding prefix - 88) since the minimum payload for the Packed Binary Data Structure is 84 bits before padding, or 88 bits with padding.
|
ECC Level
The QR code SHOULD employ level M or higher ECC.
Note
|
A higher level ECC does not help against typical 'reading' issues like shiny surfaces, bad contrast or issues with camera resolution/focus, and lack of camera-app processing dedicated for QR codes. Therefore, in certain situations ECC=L MAY be used as well (e.g. to prevent having to move to a higher Version to fit the payload). |
5.1.4. Manual Pairing Code
This section describes the content and format of the Manual Pairing Code, which can be used in certain situations next to or instead of the QR code described above.
5.1.4.1. Content
Payload
The payload of the Manual Pairing Code consists of the following required and optional data elements.
Element | Size (bits) | Required | Notes |
---|---|---|---|
VERSION |
1 |
Yes |
Shall be 0 |
VID_PID_PRESENT |
1 |
Yes |
0: no Vendor ID and Product ID present in Manual Pairing Code |
DISCRIMINATOR |
4 |
Yes |
4 Most-significant bits of the 12-bits Discriminator described above |
PASSCODE |
27 |
Yes |
Same as 27-bit Passcode described above |
VENDOR_ID |
16 |
No |
Needed only to support devices that need a user-intent or vendor specific flow before commissioning (i.e. a non-zero Custom Flow value). |
PRODUCT_ID |
16 |
No* |
* This element SHALL be included if and only if the VENDOR_ID element is present. |
The Vendor ID and Product ID elements are optional. Including these may provide additional information for the setup flow at the expense of a substantially longer Manual Pairing Code.
Custom Flow for Manual Pairing Code
The encoding for Manual Pairing Code does not have a dedicated field for Custom Flow, as exists in the Packed Binary Data Structure. Instead, this information is encoded in the following way:
-
For Standard commissioning flow, the variant of Manual Pairing Code without Vendor ID and Product ID SHALL be used. A commissioner encountering such Manual Pairing Code SHALL assume it is a "standard flow" device.
-
For User-intent commissioning flow and Custom Commissioning flow, the variant of Manual Pairing Code with Vendor ID and Product ID SHALL be used. For this case, a commissioner SHOULD use Vendor ID and Product ID to lookup the CommissioningCustomFlow field in the Distributed Compliance Ledger to determine which of these values applies for this Vendor ID and Product ID combination.
Encoding
The required and optional elements, along with a check digit, are encoded into either an 11-digit or 21-digit decimal numeric string, depending on whether the optional Vendor and Product ID information is included.
Method
Each group of digits in the Pairing Code SHALL be encoded as described in the table below. The left-most digit of the entire string SHALL be represented by DIGIT[1]. Groups of multiple digits SHALL be encoded such that the most-significant digit appears first (left-most).
Digit | Contents | Encoding | Notes |
---|---|---|---|
1 |
- Version 0 |
DIGIT[1] := |
Allows first digit typed/spoken to determine version and VID/PID present. |
2..6 |
- 3rd and 4th ms-bits of Discriminator |
DIGIT[2..6] := |
Yields a 5-digit decimal number from 00000 to 65535 (0xFFFF/16 bits) |
7..10 |
- 13 ms-bits of PASSCODE |
DIGIT[7..10] := |
Yields a 4-digit decimal number from 0000 to 8191 (0x1FFF/13 bits) |
11 |
- Check Digit |
DIGIT[11] := |
See Check Digit section for encoding |
Digit | Contents | Encoding | Notes |
---|---|---|---|
1 |
- Version 0 |
DIGIT[1] := |
Allows first digit typed/spoken to determine version and VID/PID present. |
2..6 |
- 3rd and 4th ms-bits of Discriminator |
DIGIT[2..6] := |
Yields a 5-digit decimal number from 00000 to 65535 (0xFFFF/16 bits) |
7..10 |
- 13 ms-bits of PASSCODE |
DIGIT[7..10] := |
Yields a 4-digit decimal number from 0000 to 8191 (0x1FFF/13 bits) |
11..15 |
- Vendor ID |
DIGIT[11..15] := |
Yields a 5-digit decimal number from 00000 to 65535 (0xFFFF/16 bits) |
16..20 |
- Product ID |
DIGIT[16..20] := |
Yields a 5-digit decimal number from 00000 to 65535 (0xFFFF/16 bits) |
21 |
- Check Digit |
DIGIT[21] := |
See Check Digit section for encoding |
Check Digit
The CHECK_DIGIT element is a single decimal digit computed across all of the preceding digits of the Pairing Code using the Verhoeff algorithm.
5.1.4.2. Copying between applications
When the Manual Pairing Code is presented in an application within a multi-function device, such as an application on a smartphone, it SHOULD provide a mechanism such as a copy button to allow easy conveyance of the information to other commissioners on the same device. When a Commissioner is implemented as an application within a multi-function device, such as an application on a smartphone, it SHOULD provide a mechanism such as a paste button to allow easy conveyance of the information from an administrator on the same device.
5.1.5. TLV Content
A variable-length TLV Data section MAY be encoded into the Packed Binary Data Structure. The TLV section MAY consist of manufacturer-specific information elements and/or elements common to Matter, encoded using TLV. All elements SHALL be housed within an anonymous top-level structure container.
5.1.5.1. Manufacturer-specific Elements
Manufacturer-specific elements SHALL be tagged with context-specific tags that have semantics which are defined by the vendor for use in the products using their Vendor ID, and SHALL use tag numbers 0x80 to 0xFF.
Tag numbers 0x00 to 0x7F are reserved to indicate Matter-common elements.
Manufacturer-specific elements inherit the context of the Vendor ID and Product ID provided in the Packed Binary Data Structure described above. All elements SHALL follow the constraints outlined in Appendix A, Tag-length-value (TLV) Encoding Format.
5.1.5.2. Matter-common Elements
All elements common to Matter SHALL use tag numbers in the range 0x00 to 0x7F, as defined in the following section.
Vendors are encouraged to use Matter-common elements where applicable.
Tag | Value | Description | Type(s) |
---|---|---|---|
kTag_SerialNumber |
0x00 |
Device Serial # |
UTF-8 String (length = 1..32 bytes) |
Unsigned Integer, up to 8-byte value (has room to represent a 19-digit decimal number) |
|||
PBKDFIterations * |
0x01 |
Unsigned Integer (range = CRYPTO_PBKDF_ITERATIONS_MIN.. CRYPTO_PBKDF_ITERATIONS_MAX) |
|
PBKDFSalt * |
0x02 |
Octet String (length = 16..32 bytes) |
|
kTag_NumberOfDevices |
0x03 |
Number of devices that are expected to be onboarded using this payload when using the Enhanced Commissioning Method |
Unsigned Integer, range 1 to 255 |
kTag_CommissioningTimeout |
0x04 |
Time, in seconds, during which the device(s) are expected to be commissionable using the Enhanced Commissioning Method |
Unsigned Integer, see Announcement Duration |
reserved |
0x05..0x7F |
reserved for future use |
* If the PBKDF parameters are to be included in the TLV section, both the PBKDFSalt
and PBKDFIterations
SHALL be encoded.
5.1.5.3. TLV Examples
Manufacturer-specific and Matter-common elements
{ vendorTag01 (0x81) = "Vendor", kTag_SerialNumber(0) = "1234567890" }
The above notation encodes to the following bytes:
0x15 0x2C 0x81 0x06 0x56 0x65 0x6E 0x64 0x6F 0x72 0x2C 0x00 0x0A 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x18 Data Comments =========== =================================================== 0x15 Control Byte for outermost container (structure) - Tag control 000xxxxxb: Anonymous tag - Elem type xxx10101b: Structure 0x2C Control Byte for next TLV - Tag control 001xxxxxb: Context-specific tag - Elem type xxx01100b: UTF-8 String, 1-byte length 0x81 Context-specific vendor tag - Matter-common versus vendor tag 1xxxxxxxb: Vendor tag - Tag number x0000001b: Vendor tag #1 --------- 10000001b = 0x81 0x06 Length of vendor string (e.g. 6 bytes) 0x56 0x65 0x6E 0x64 0x6F 0x72 UTF-8 encoded vendor string "Vendor" 0x2C Control byte for next TLV - Tag control 001xxxxxb: Context-specific tag - Elem type xxx01100b: UTF-8 String, 1-byte length --------- 00101100b = 0x2C 0x00 Context-specific Matter-common Serial Number tag - Matter-common versus vendor tag 0xxxxxxxb: Matter-common tag - Tag number x0000000b: kTag_SerialNumber --------- 00000000b = 0x00 0x0A Length of Serial Number string (10 bytes) 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 UTF-8 encoded Serial Number string "1234567890" 0x18 End of container
Matter-common elements only
{ kTag_SerialNumber (0) = "1234567890" }
The above notation encodes to the following bytes:
0x15 0x2C 0x00 0x0A 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 0x18 Data Comments =========== =================================================== 0x15 Control Byte for outermost container (structure) - Tag control 000xxxxxb: Anonymous tag - Elem type xxx10101b: Structure 0x2C Control Byte for next TLV - Tag control 001xxxxxb: Context-specific tag - Elem type xxx01100b: UTF-8 String, 1-byte length --------- 00101100b = 0x2C 0x00 Context-specific Matter-common Serial Number tag - Matter-common versus vendor tag 0xxxxxxxb: Matter-common tag - Tag number x0000000b: kTag_SerialNumber --------- 00000000b = 0x00 0x0A Length of Serial Number string (10 bytes) 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x30 UTF-8 encoded Serial Number string "1234567890" 0x18 End of container
5.1.6. Concatenation
The Onboarding Payload MAY be concatenated with additional Onboarding Payloads to be placed in a single QR Code:
QR code string := MT:<onboarding-base-38-content>*<onboarding-base-38-content2>
Where *
is used as the delimiter.
Concatenation of multiple Matter Onboarding Payloads allows a single QR code to provide the onboarding payload for a number of devices. Example use case for this concatenation:
-
Easy onboarding for multi-device packaging, e.g. for a package of light bulbs containing four separate bulbs. Each bulb will have its own Onboarding Payload code(s) printed on the bulb itself. The Manufacturer MAY include a leaflet in the box with a larger QR code containing the concatenation of the four individual Onboarding Payloads. The user can then scan this combined QR code (one step for the user) which would give the Commissioner the Onboarding Payload for all four bulbs in one operation, and it can proceed to commission the four bulbs.
All Commissioners SHALL recognize the *
separator from the QR code as indication concatenation is used.
A Commissioner which does not support such concatenated Matter Onboarding Payloads SHOULD indicate to the user the need to commission devices one by one by scanning their individual QR codes.
The Commissioner SHOULD commission the devices in the order as they are provided in the concatenated code. (This ordering is particularly relevant in case of combi-packs where one of the devices needs to be commissioned first, e.g. a Thread Router first, then one or more Thread-connected bulbs).
Example of concatenated Onboarding Payloads:
MT:<onboarding-base-38-content_bulb1>*<onboarding-base-38-content_bulb2>*<onboarding-base-38-content_bulb3>*<onboarding-base-38-content_bulb4>
5.1.7. Generation of the Passcode
A device can support either dynamic or static passcodes for purposes of establishing the shared secret for the initial secure channel over which further onboarding steps take place.
All devices SHALL conform to the following rules for passcodes:
-
Passcodes SHALL NOT be derived from public information, such as a serial number, manufacturer date, MAC address, region of origin, etc.
-
The Passcode generation process SHALL use a cryptographically secure random number generator.
If a device generates a dynamic Passcode, then it SHALL conform to the following additional rule:
-
Passcodes SHALL be accessible to commissioner only during the commissioning process.
If a device cannot generate a dynamic Passcode, then the static Passcode SHALL conform to the following additional rules:
-
A random passcode SHALL be generated and used for each individual device.
-
The device SHALL be supplied with the PAKE verifier in its internal storage.
-
If the static passcode is also supplied to the device, the static passcode SHALL NOT be accessible during operational mode using any data model attributes or commands.
-
If the static passcode is supplied to the device, its storage location SHALL be physically isolated from the location where the PAKE verifier is stored and SHALL only be accessible through local interfaces and SHALL NOT be accessible to the executing unit handling the PAKE verifier. For example, a device equipped with a NFC connected tag may contain the QR code containing the static passcode in the NFC connected tag private memory and the NDEF record containing the NFC tag onboarding payload is only presented to the commissioner during the commissioning window through the NFC interface.
5.1.7.1. Invalid Passcodes
The following Passcodes SHALL NOT be used for the PASE protocol due to their trivial, insecure nature:
-
00000000
-
11111111
-
22222222
-
33333333
-
44444444
-
55555555
-
66666666
-
77777777
-
88888888
-
99999999
-
12345678
-
87654321
5.1.8. NFC Tag
A Commissioner MAY use, in addition to the QR Code Format and Manual Pairing Code as described above, an NFC tag associated with a Commissionee to retrieve the Onboarding Payload. When an NFC tag is used the following requirements are applicable.
-
The data contained in the NFC tag SHALL be the same as specified in QR Code Format.
-
The NFC tag SHALL be one of the types as defined by NFC Forum.
-
The NFC tag SHALL use the NFC Data Exchange Format (NDEF) as defined by NFC NDEF 1.0.
-
The NFC tag SHALL use NDEF messages as defined by NFC RTD 1.0.
-
The Onboarding Payload for the NFC tag SHALL use NDEF URI Record Type Definition as defined by NFC RTD URI 1.0 and as specified in the following table.
Offset | Content | Description |
---|---|---|
0 |
0xD1 |
TNF=0x01, SR=1, MB=1, ME=1 |
1 |
0x01 |
Length of Record Type |
2 |
URI payload size in bytes |
Length of payload |
3 |
0x55 |
Record Name ("U") |
4 |
0x00 |
URI Identifier Code: No URI abbreviation |
5 |
URI data |
MT:<base-38-content> |
5.2. Initiating Commissioning
5.2.1. Purpose and Scope
The process of Matter commissioning can be initiated by the User in a number of ways. This section describes different user journeys supported by Matter. For each, a rationale is provided along with a high-level flow description, up until the point where a commissioning secure session is established. References to sections describing dependent functionality in more detail are provided.
The purpose of this section is to connect features provided in other sections to the user journeys for which they are designed.
Warning
|
The list of user journeys provided here is not meant to be exhaustive; there may be other journeys not listed here which can be realized using Matter. |
This section provides rationales for Matter functionality and does NOT contain normative requirements for Matter.
The following User Journeys are described in this section:
-
Section 5.2.2.1, “Commissioner Setup Code Entry, Not Yet Commissioned Device”. "Launch Commissioner, Enter Code"
-
Section 5.2.2.2, “User-Initiated Beacon Detection, Not Yet Commissioned Device”. "Launch Commissioner, Discover New Devices"
-
Section 5.2.2.3, “User-Initiated Beacon Detection, Already Commissioned Device”. "Launch Commissioner, Discover My devices"
-
Section 5.2.2.4, “Commissioner Discovery, from an On-Network Device”. "Launch Device User Interface, Discover Commissioners"
5.2.2. User Journey Details
5.2.2.1. Commissioner Setup Code Entry, Not Yet Commissioned Device
"Launch Commissioner, Enter Code"
In the Setup Code Entry for a Not Yet Commissioned Device use case, the User first initiates an interaction with a Commissioner, and then provides the necessary setup code from the Commissionee, by scanning an Onboarding Payload (e.g. QR Code) or otherwise inputting the manual setup code through an input method supported by the commissioner.
5.2.2.1.1. Rationale
In this use case, the user will often have the device in-hand, have immediate access to the onboarding payload, and have immediate access to the desired Commissioner.
5.2.2.1.2. High Level Flow
-
User initiates an interaction with a Commissioner.
-
User inputs the onboarding payload from the Commissionee.
-
Commissioner determines which technologies to use for Device Discovery. When attempting to locate the device on IP-bearing networks, the Commissionable Node Discovery method is used and typically the DNS-SD service subtypes for long or short discriminator, and commissioning mode (see Commissioning Subtypes) are specified to filter the results to Commissionees that match the discriminator in the onboarding payload and that are in Commissioning Mode. When attempting to locate the device via BLE or Soft-AP advertisements, the discriminator will typically be used to filter the results.
-
Commissioner begins the Commissioning process (see Section 5.5, “Commissioning Flows”). If more than one Commissionee is discovered, the Commissioner may further refine the results using any additional information such as a Vendor ID or Product ID that may be available in the onboarding payload. If there is still more than one discovered Commissionee, the Commissioner will typically attempt to establish a PASE secure commissioning session with each.
5.2.2.1.3. Misuse Considerations
When a device has a static onboarding payload, and the value is physically affixed to the product, it is possible for an attacker with one-time physical access to the device to obtain the onboarding payload and use it to compromise the security of the device in the future. For example, if the device is commissioned again using the same onboarding payload (for example, after a reset), then the attacker may be able to perform a person-in-the-middle attack which could result in a compromise of sensitive user data such as network credentials if passed to the device.
When a device includes device-specific information such as Vendor ID and Product ID in advertisements, then a malicious actor within advertisement range can detect this information and potentially associate it with the location of the device (and potentially, additional information about the location, such as its residents) in ways that the user did not intend.
5.2.2.2. User-Initiated Beacon Detection, Not Yet Commissioned Device
"Launch Commissioner, Discover New Devices"
In the User-Initiated Beacon Detection for a Not Yet Commissioned Device use case, the User first initiates an interaction with a Commissioner, and then indicates an intention to commission devices without providing additional information about them (no onboarding payload, etc).
5.2.2.2.1. Rationale
In this use case, the user has immediate access to a Commissioner. However, the user may not know how to locate the onboarding payload (it may be hidden behind a panel, pin-protected in a settings menu, or inaccessible on a device already physically installed).
Example User interactions with the Commissioner include pushing a "Discover New Devices" button, or speaking to a voice agent "Agent, discover new devices".
5.2.2.2.2. High Level Flow
-
User initiates an interaction with a Commissioner.
-
User indicates an intention to commission devices without providing additional information about them.
-
Commissioner determines which technologies to use for Device Discovery. When attempting to locate the device on IP-bearing networks, the Commissionable Node Discovery method is used and typically the subtype for commissioning mode (see Commissioning Subtypes) is specified with value 1 in order to filter the results to Commissionees that are in Commissioning Mode.
-
Commissioner constructs a list of Commissionees discovered, using as much information as possible from the Commissionee advertisement. When a Vendor ID and Product ID is provided in the advertisement, the Commissioner may obtain human readable descriptions of the Vendor and Product in order to assist the user with selection by using fields such as
ProductName
andProductLabel
from the Distributed Compliance Ledger or any other data set available to it. The ledger entry may also include additional URLs which the Commissioner can offer to the user to help in locating the Setup Code or otherwise assist in setting up the device such as theUserManualUrl
,SupportUrl
, andProductUrl
. The Commissioner may have additional data sets available for assisting the user. -
User selects Commissionee from list.
-
Commissioner instructs the user to locate and input the onboarding payload.
-
Commissioner begins the Commissioning process (see Section 5.5, “Commissioning Flows”).
5.2.2.2.3. Variation - Filter by Device Type
The user may indicate the type of device to the Commissioner when initiating this flow. For example, the user might speak the following to a voice agent: "Agent, Discover TVs".
When discovering TVs or any other specific device type on the IP network, this flow will be the same except that a subtype which specifies the device type identifier (see Descriptor Cluster on root node endpoint) is passed to the Commissionable Node Discovery method (see Commissioning Subtypes).
5.2.2.2.4. Misuse Considerations
In addition to the Misuse Considerations for the Section 5.2.2.2, “User-Initiated Beacon Detection, Not Yet Commissioned Device”, a Commissioner which performs Device Discovery without knowledge of the Onboarding Payload may discover advertisements from devices that the user did not intend to onboard with the given Commissioner. This additional information collected by the Commissioner can be associated with the user in ways that the user did not intend.
5.2.2.3. User-Initiated Beacon Detection, Already Commissioned Device
"Launch Commissioner, Discover My Devices"
In the User-Initiated Beacon Detection for an Already Commissioned Device use case, the User first initiates an interaction with a Commissioner, and then indicates an intention to commission devices already on the IP network without providing additional information about them.
5.2.2.3.1. Rationale
A Device may choose to be discoverable by entities on the local IP network, even when not in Commissioning Mode, in order to satisfy specific user journeys. For example, a TV or Bridge device may choose to be discoverable in order to facilitate connectivity with other Smart Home systems.
Example User interactions with the Commissioner include pushing a "Discover My Devices" button, or speaking to a voice agent "Agent, discover my devices".
5.2.2.3.2. High Level Flow
-
User initiates an interaction with a Commissioner.
-
User indicates an intention to commission existing devices on the IP network without providing additional information about them.
-
Commissioner sends the Commissionable Node Discovery broadcast message.
-
Commissioner constructs a list of Commissionees discovered, using as much information as possible from the Commissionee advertisement. When a Vendor ID and Product ID is provided (see Commissioning VID/PID), the Commissioner may obtain human readable descriptions of the Vendor and Product in order to assist the user with selection by using fields such as
ProductName
andProductLabel
from the Distributed Compliance Ledger or any other data set available to it. The ledger entry may also include additional URLs which the Commissioner can offer to the user to help in locating the Setup Code or otherwise assist in setting up the device such as theUserManualUrl
,SupportUrl
, andProductUrl
. The Commissioner may have additional data sets available for assisting the user. When the Device Type (see Commissioning Device Type) and/or the Device Name (see Commissioning Device Name) values are provided, then the Commissioner may provide this information to the user in order to assist with Commissionee selection. -
User selects Commissionee from list.
-
The Commissionable Node Discovery DNS-SD TXT record for the selected Commissionee includes key/value pairs that can help the Commissioner to guide the user through the next steps of the commissioning process. If the Commissioning Mode value (see Commissioning Commissioning Mode) is set to 0, then the Commissionee is not yet in Commissioning Mode and the Commissioner can guide the user through the steps needed to put the Commissionee into Commissioning Mode. The Pairing Hint (see: Commissioning Pairing Hint) and the Pairing Instruction (see: Commissioning Pairing Instruction) fields would then indicate the steps that can be followed by the user to put the device into Commissioning Mode.
-
If not already in Commissioning Mode, Commissioner instructs the user to put the Commissionee into Commissioning Mode, and verifies the new state using Commissionable Node Discovery.
-
Commissioner instructs the user to locate and input the onboarding payload. When a Vendor ID and Product ID is available to the Commissioner, the Distributed Compliance Ledger may also provide a URL for the Device User Guide which can contain additional information to help in locating the onboarding payload. The Commissioner may have additional data sets available for assisting the user.
-
Commissioner begins the Commissioning process (see Section 5.5, “Commissioning Flows”).
5.2.2.3.3. Variation - Filter by Device Type
The user may indicate the type of device to the Commissioner when initiating this flow. For example, the user might speak the following to a voice agent: "Agent, Discover TVs".
When discovering TVs or any other specific device type on the IP network, this flow will be the same except that a subtype which specifies the device type identifier is passed to the Commissionable Node Discovery method (see Commissioning Subtypes).
5.2.2.3.4. Misuse Considerations
When a Device implements Commissionable Node Discovery while not in Commissioning Mode, the time period during which it may unintentionally provide information to a malicious actor on the network is longer than it otherwise would be. This additional information could potentially be associated with the user in ways that the user did not intend. See Commissionable Node Discovery Privacy Considerations for device requirements relating to this risk.
When a device includes device-specific information such as Vendor ID, Product ID and Device Type, or user-generated data such as Device Name, in the DNS-SD TXT record, then a malicious actor on the network can detect this information and potentially associate it with the user in ways that the user did not intend.
A Commissioner which performs Device Discovery without knowledge of the Onboarding Payload may discover devices on the network that the user did not intend to onboard with the given Commissioner. This additional information collected by the Commissioner can be associated with the user in ways that the user did not intend.
5.2.2.4. Commissioner Discovery, from an On-Network Device
"Launch Device User Interface, Discover Commissioners"
In the Commissioner Discovery use case for a Device already on the IP network, the User first initiates an interaction with the Device via a display or other user interface, and indicates the intention to have this device commissioned by a Commissioner on the network. The Device might already have been commissioned into one or many Fabrics or it might not yet have been commissioned. Upon this user interaction, the Device discovers candidate Commissioners and allows the user to select one. The Device then requests from that Commissioner to be commissioned.
5.2.2.4.1. Rationale
In this use case, a Device (Commissionee) with a user interface, such as a TV or Thermostat, initiates the commissioning process. For example, this might be done from within a settings menu for Smart Home control. The Device discovers Commissioners on the IP-bearing network, presents the resulting list to the User for selection. Once selected, the Device indicates to the selected Commissioner that it has been selected by the User, the Device enters Commissioning Mode and provides the onboarding payload to the User.
Another example for this use case is a Device or Node (Commissionee) with a user interface, such as a Content Provider Device or Application, that initiates the commissioning process. This might be done from a program guide or while watching a video when the user indicates a desire to play the selected content on a nearby device. The Device discovers Commissioners on the IP-bearing network, presents the resulting list to the User for selection. Once selected, the Commissionee indicates to the selected Commissioner that it has been selected by the User (see User Directed Commissioning), the Commissionee enters Commissioning Mode and provides the onboarding payload to the User.
5.2.2.4.2. High Level Flow
-
User initiates an interaction with the Device.
-
User indicates a desire to connect this Device with a Commissioner on the network.
-
Device uses Commissioner Discovery over DNS-SD on the IP bearing network.
-
Device collects candidates from DNS-SD service records found.
-
Device displays list of Commissioners discovered, including as much information as possible from the DNS-SD TXT record. When a Vendor ID and Product ID is provided (see Commissioning VID/PID), the Device may obtain human readable descriptions of the Vendor and Product in order to assist the user with selection by using fields such as
ProductName
andProductLabel
from the Distributed Compliance Ledger or any other data set available to it. The Device may have additional data sets available for assisting the user. When the Device Type (see Commissioning Device Type) and/or the Device Name (see Commissioning Device Name) values are provided in the DNS-SD TXT record, then the Device may provide this information to the user in order to assist with Commissioner selection. -
User selects an entry from the list.
-
Device enters Commissioning Mode.
-
Device displays onboarding payload to the user.
-
Device initiates a User Directed Commissioning session with the selected Commissioner, which includes in the DNS-SD service name of the Device.
-
Commissioner prompts user to confirm intention to commission this device and asks for onboarding payload.
-
User enters onboarding payload into Commissioner UX.
-
Commissioner begins the commissioning process (see Section 5.5, “Commissioning Flows”).
5.2.2.4.3. Misuse Considerations
In addition to the Misuse Considerations for the Section 5.2.2.3, “User-Initiated Beacon Detection, Already Commissioned Device”, a Commissionee which performs Commissioner Discovery may discover Commissioners on the network that the user did not intend to be discovered by the given Commissionee. This additional information collected by the Commissionee can be associated with the user in ways that the user did not intend. See Commissioner Discovery Privacy Considerations for Commissioner requirements relating to this risk.
Since there are no trust mechanisms employed for Commissioners advertising themselves, Commissionees may provide Commissioner selection choices to the User that are from malicious entities masquerading as commissioners.
When a Commissioner includes device-specific information such as Vendor ID, Product ID and Device Type, or user-generated data such as Device Name, in the DNS-SD TXT record, then a malicious actor on the network can detect this information and potentially associate it with the user in ways that the user did not intend.
5.3. User Directed Commissioning
5.3.1. Overview
In User Directed Commissioning (UDC), the Commissionee sends a message to the Commissioner in order to initiate the commissioning process (see Section 5.5, “Commissioning Flows”).
The availability of the UDC protocol is advertised through Commissioner Discovery
service records of DNS-SD service type _matterd._udp
(see Section 4.3.3, “Commissioner Discovery”).
Overall, the UDC protocol is a lightweight "door bell" message sent by a Commissionee,
and consists of an Identification Declaration
which provides the Commissionee’s
_matterc._udp
DNS‑SD service instance name.
Upon receiving this message,
the Commissioner MAY query the DNS-SD service instance indicated in the
Identification Declaration
, including TXT records,
in order to obtain additional information about the Commissionee,
MAY obtain the corresponding Onboarding Payload from the user for this Commissionee,
and MAY initiate the commissioning process with it.
One possible user journey for this feature is described in Commissioner Discovery from an Existing Device.
The Commissionee is the Initiator and the Commissioner is the Recipient.
It is assumed that the user has directed the Initiator to send this message to the Recipient. Upon receipt and before starting a PASE session with the Initiator, it is assumed that the Recipient will query the DNS-SD records for the Initiator, including all TXT records, and then prompt the user for approval and to enter its Onboarding Payload.
5.3.2. UDC Protocol Messages
Protocol Opcode | Protocol Command Name | Description |
---|---|---|
0x00 |
IdentificationDeclaration |
The Identification Declaration message provides the DNS-SD Instance Name of the commissionee requesting commissioning to the commissioner selected by the user. |
The following defines the Matter User Directed Commissioning TLV protocol:
namespace matter.protocols { user-directed-commissioning => PROTOCOL [ Matter:PROTOCOL_ID_USER_DIRECTED_COMMISSIONING ] { IdentificationDeclaration => IdentificationDeclaration-struct } }
5.3.3. Message format
All UDC messages SHALL be structured as specified in Section 4.4, “Message Frame Format”.
All UDC messages are unsecured at the message layer:
-
The Session ID field SHALL be set to
0
. -
The Session Type bits of the Security Flags SHALL be set to
0
. -
The S Flag and DSIZ fields of the Message Flags SHALL be set to
0
.
The R Flag of the Exchange Flags for the UDC messages SHALL be set to 0
.
For each UDC message, the application payload is the TLV encoding of the message structure as defined below:
Message Name | Payload TLV Encoding |
---|---|
IdentificationDeclaration |
The other fields of the Message format are not specific to the UDC messages.
5.3.4. Message Exchanges
The flags of the Exchange Flags of the Protocol Header are defined as follows per UDC message:
Message | I Flag |
---|---|
IdentificationDeclaration |
1 |
All UDC messages SHALL be sent unreliably, to an IP address found in a
AAAA record associated with the Commissioner Discovery (_matterd._udp
) service,
using UDP with a destination port as found in the _matterd._udp
SRV record.
The Initiator MAY send up to 4 retries.
Each retransmission SHALL be delayed by at least 100ms from the previous
transmission.
The other fields of the Protocol Header are not specific to the UDC messages.
5.3.5. IdentificationDeclaration Message
This message serves to identify the commissionee. It is sent by the commissionee to the commissioner. The commissionee SHALL:
-
Construct the
instanceName
based upon the DNS-SD instance name defined in Commissionable Node Discovery. -
Construct and send
IdentificationDeclaration
.
IdentificationDeclaration-struct => STRUCTURE [ tag-order ] { instanceName [1] : OCTET STRING [ length 8 ] }
5.4. Device Discovery
5.4.1. Purpose and Scope
The purpose of this section is to describe the process by which a device is discovered in order to commission it onto an operational Fabric.
Depending on the networking technologies supported by a device, discovery and commissioning are possible using Bluetooth Low Energy (BLE), Wi-Fi (IEEE 802.11-2020) technologies, or over IP if a device is already on an IP network.
Devices that utilize Thread (IEEE 802.15.4) networking technology must also support BLE for the purpose of discovery and commissioning. Directly utilizing Thread-based commissioning for device discovery and commissioning is neither specified nor supported.
BLE commissioning utilizes the Generic Access Profile (GAP) for discovery and for connection establishment, and the Generic Attribute Profile (GATT) for credential conveyance.
Wi-Fi commissioning utilizes Soft-AP functionality where the device acts as an Access Point (AP) that doesn’t provide Internet connectivity. Standard Wi-Fi AP advertisement and connection protocols are employed for device discovery and credential conveyance, respectively.
If a device already has network connectivity (over Wi-Fi, Ethernet, or otherwise) a Commissioner may discover such a device using DNS-based Service Discovery (DNS-SD), conveying credentials to the device over IP.
5.4.2. Announcement by Device
This section describes how devices announce their commissionable status to allow a Commissioner to discover the device to be commissioned.
5.4.2.1. Technology Priority
A device SHALL announce in any order of priority on all of the networking technologies it supports as indicated in the Discovery Capability Bitmask (see Table 36, “Discovery Capabilities Bitmask”). A Commissioner that is aware of the device’s Discovery Capability Bitmask SHALL initiate Device Discovery in any order of priority on all of the networking technologies that are supported by both the Commissioner and the device. A Commissioner that is unaware of the device’s Discovery Capability Bitmask SHALL initiate Device Discovery in any order on all of the networking technologies it supports out of Wi-Fi Soft-AP, BLE, and on IP network discovery.
Commissioners SHALL always support discovering a device using DNS-based Service Discovery (DNS-SD) for commissioning, irrespective of the Discovery Capabilities Bitmask specified in the Section 5.1.1, “Onboarding Payload Contents”.
5.4.2.2. Announcement Commencement
A device which is not yet commissioned into a Matter fabric SHALL commence announcing its ability to be commissioned depending on its primary device function and manufacturer-chosen Device Commissioning Flow, per the following table. Nodes already commissioned into one or more Matter fabrics and wishing to announce SHALL ONLY do so using DNS-SD over their operational network (see Section 4.3, “Discovery”). In the interest of privacy, an already-commissioned Node SHALL NOT commence announcement using Bluetooth LE or Wi-Fi Soft-AP technologies.
Primary Device Function | Announcement |
---|---|
Most control originates from a Fabric (excluding Locks and Barrier Access Devices) |
SHALL start announcing automatically upon application of power when using Standard commissioning flow. When using User-intent commissioning flow or Custom Commissioning flow, it SHALL NOT start announcing automatically upon application of power. |
Most control does not originate from a Fabric (e.g., dishwasher, coffee maker, refrigerator) |
SHALL NOT start announcing automatically upon application of power. User-intent commissioning flow or Custom Commissioning flow is required. |
Locks and Barrier Access Devices |
SHALL NOT start announcing automatically upon application of power. User-intent commissioning flow or Custom Commissioning flow is required. |
Note that the above guidelines are in place to avoid unnecessary pollution of the 2.4 GHz spectrum and as a mitigation of the privacy threat created due to unnecessary transmissions by a commissionable device.
If announcement has ceased (see Section 5.4.2.3, “Announcement Duration”), it may be re-initiated via a device-specific user interaction such as a button press or other action defined by the manufacturer and indicated by the methods specified in Section 5.7, “Device Commissioning Flows”.
5.4.2.3. Announcement Duration
In order to minimize unnecessary pollution of the crowded 2.4 GHz wireless spectrum, a commissionable device SHALL NOT announce for a duration longer than 15 minutes after announcement commences. This should provide ample time for a user to commission a range of devices, including time to download, install and launch applications, transit rooms within a home, etc.
Note that devices MAY choose to announce for less time in order to conserve battery life or for other device-specific reasons. Note that an announcement duration that is too short may result in a poor setup experience for users. Shorter announcement intervals SHOULD only be employed to meet otherwise unattainable device functionality/requirements. To help strike a balance between a good setup experience and conserving battery life, a device SHALL NOT announce for a duration of less than 3 minutes after announcement commences.
A failed attempt to commission does not restart or delay the timeout. Moreover, this timeout applies only to cessation of announcements and not to abortion of connections, i.e., a connection SHOULD NOT abort prematurely upon expiration of the announcement duration.
5.4.2.4. Discovery Information
This section details the information advertised by a commissionable Node.
Field |
Length |
Is Required? |
Discriminator |
12-bit |
Yes |
Vendor ID |
16-bit |
No |
Product ID |
16-bit |
No |
Extended Data |
Variable |
No |
5.4.2.4.2. Vendor ID
A 16-bit value identifying the device manufacturer (see Section 2.5.2, “Vendor Identifier (Vendor ID, VID)”).
5.4.2.4.3. Product ID
A 16-bit value identifying the product (see Product ID).
5.4.2.4.4. Extended Data
Extended Data MAY be made available by commissionable Nodes. This data SHALL be encoded using a standard TLV encoding defined in this section. The location of this data varies based on the Node’s commissioning networking technology.
This extended data SHALL be encoded as a TLV structure tagged with an anonymous tag.
The members of this structure SHALL use context-specific tags with the values and meanings shown in the table below.
Tag | Value | Member type | Member Description |
---|---|---|---|
RotatingIdTag |
0x00 |
octet string |
5.4.2.4.5. Rotating Device Identifier
Some device makers need a way to uniquely identify a device before it has been commissioned for vendor-specific customer support purposes. For example, the device maker may need this to identify factory software version and related features, manufacturing date, or to assist in recovery when a setup code has been lost or damaged. In order to avoid privacy issues associated with a fixed unique identifier, devices MAY utilize a Rotating Device Identifier for identification purposes. A Rotating Device Identifier is similar to a serial number but rotates at pre-defined moments.
The Rotating Device Identifier provides a non-trackable identifier which is unique per-device and that can be used in one or more of the following ways:
-
Provided to the vendor’s customer support for help in pairing or establishing Node provenance;
-
Used programmatically to obtain a Node’s Passcode or other information in order to provide a simplified setup flow. Note that the mechanism(s) by which the Passcode may be obtained is outside of this specification. If the Rotating Device Identifier is to be used for this purpose, the system implementing this feature SHALL require proof of possession by the user at least once before providing the Passcode. The mechanism for this proof of possession, and validation of it, is outside of this specification.
The Rotating Device Identifier is an optional feature for a Node to implement and an optional feature for a Commissioner to utilize. The algorithm used for generating a Rotating Device Identifier SHALL meet the following security and privacy requirements:
-
It SHALL be irreversible in such a way that:
-
It SHALL prevent recovery of a unique identifier for the device by entities that do not already have access to the set of possible unique identifiers.
-
Leaking of a common key or equivalent could not be used to recover a unique identifier for all devices sharing the common key.
-
-
It SHALL protect against long-term tracking by rotating upon each commencement of advertising.
-
It SHALL have a total of at least 64 bits of entropy and SHOULD preferably have more, up to 256 bits.
-
It SHALL NOT contain a fixed identifier such as a serial number.
The Rotating Device Identifier Algorithm below meets these requirements. A Node that implements the Rotating Device Identifier SHALL use either the Rotating Device Identifier Algorithm or a different algorithm which has been approved and verified by the Connectivity Standards Alliance for this purpose and which meets the same set of security and privacy requirements listed above.
The Rotating Device Identifier Algorithm employs a key derivation algorithm that combines a monotonically increasing lifetime counter with a unique per-device identifier.
The unique identifier SHALL consist of a randomly-generated 128-bit or longer octet string which SHALL be programmed during factory provisioning or delivered to the device by the vendor using secure means after a software update.
The unique identifier SHALL be protected against reading or writing over the air after initial introduction into the device, and stay fixed during the lifetime of the device.
The lifetime counter SHALL be an integer at least 16 bits in size, incremented upon each commencement of advertising, and wrapping when the maximum value is reached.
The Rotating Device Identifier Algorithm is defined as follows:
Rotating Device ID = Rotation Counter || Crypto_KDF( inputKey := Unique ID, salt:= Rotation Counter, info := "RotatingDeviceID", len := 128)
(where || is the concatenation operation)
The rotation counter is encoded as 2 bytes using little-endian encoding in the above algorithm, everywhere it appears.
The Rotating Device ID is the concatenation of the current rotation counter and the 16 bytes of the Crypto_KDF result.
5.4.2.4.6. TLV Example
Extended data containing just a Rotating Device Identifier would be encoded as the following bytes:
Offset |
Data |
Comments |
0x00 |
0x15 |
Control byte for structure with anonymous tag |
0x01 |
0x30 |
Control byte for octet string with 1-byte length and a context-specific tag |
0x02 |
0x00 |
Context-specific tag for Rotating Device Identifier |
0x03 |
0x12 |
Length of Rotating Device Identifier (e.g. 18 bytes) |
0x04 |
0xXX..0xXX |
Rotating Device Identifier |
0x16 |
0x18 |
End of container |
5.4.2.5. Using BLE
This section provides details of how a device announces its commissionable status using BLE technology. Nodes currently commissioned into one or more fabrics SHALL NOT employ this method.
Note
|
Need to add link(s) to BLE specification. |
5.4.2.5.1. Device Role
Commissionable devices SHALL implement the role of a Generic Access Profile (GAP) Peripheral.
5.4.2.5.2. Channels
There are three advertising channels used by BLE. All three channels SHOULD be used by commissionable devices for BLE advertising.
5.4.2.5.3. Interval
Commissionable devices SHOULD use an Advertising Interval between 20 ms and 60 ms for the first 30 seconds and a value between 150 ms to 1200 ms for the rest of the Announcement duration. Shorter intervals typically result in shorter discovery times.
5.4.2.5.4. Advertising Mode
Commissionable devices SHALL use the GAP General Discoverable mode, sending connectable undirected advertising events.
5.4.2.5.5. Advertising Address
To ensure privacy, commissionable devices SHALL use LE Random Device Address (see Bluetooth® Core Specification 4.2 Vol 6, Part B, Section 1.3.2.1 "Static device address") for BLE Advertising and SHALL change it at least on every boot.
5.4.2.5.6. Advertising Data
In order to reduce 2.4 GHz spectrum congestion due to active BLE scanning, and to extend battery life in battery-powered devices, all critical data used for device discovery is contained in the Advertising Data rather than the Scan Response Data. This allows a BLE Commissioner to passively scan (i.e., not issue Scan Requests upon receiving scannable advertisements) and still be able to receive all information needed to commission a device.
Note that if additional vendor-specific information is to be conveyed and does not fit within the Advertising Data, it may be included in the Scan Response Data. See Section 5.4.2.8, “Manufacturer-specific data” for details on including vendor-specific information.
The following table details the contents of the Advertising PDU payload:
Byte | Value | Description |
---|---|---|
0 |
0x02 |
AD[0] Length == 2 bytes |
1 |
0x01 |
AD[0] Type == 1 (Flags) |
2 |
0x06 |
Bit 0 (LE Limited Discoverable Mode) SHOULD be set to 0 |
3 |
0x0B |
AD[1] Length == 11 bytes |
4 |
0x16 |
AD[1] Type == 0x16 (Service Data - 16-bit UUID) |
5-6 |
0xFFF6 |
16-bit Matter UUID assigned by Bluetooth SIG |
7 |
0x00 |
Matter BLE OpCode == 0x00 (Commissionable) |
8-9 |
Variable |
Bits[15:12] == 0x0 (Advertisement version) |
10-11 |
Variable |
16-bit Vendor ID (see Section 5.4.2.4.2, “Vendor ID”) |
12-13 |
Variable |
16-bit Product ID (see Section 5.4.2.4.3, “Product ID”) |
14 |
Fixed |
Bit[0] == Additional Data Flag (see Section 5.4.2.5.7, “GATT-based Additional Data”) |
Devices MAY choose not to advertise either the VID and PID, or only the PID due to privacy or other considerations. When choosing not to advertise both VID and PID, the device SHALL set both VID and PID fields to 0. When choosing not to advertise only the PID, the device SHALL set the PID field to 0. A device SHALL NOT set the VID to 0 when providing a non-zero PID.
5.4.2.5.7. GATT-based Additional Data
When the Additional Data Flag is set in the Matter Service Data in the BLE Advertisement, the commissioner MAY access additional commissioning-related data via an unencrypted read-only GATT characteristic C3 (see Table 31, “BTP GATT service”).
The value of the C3 characteristic SHALL be set to the Extended Data payload of the Discovery Information (see Section 5.4.2.4.4, “Extended Data”).
5.4.2.6. Using Wi-Fi Temporary Access Points (Soft-AP)
This section details how a device advertises its commissionable state using Wi-Fi Soft-AP functionality, wherein the device acts as a Wi-Fi Access Point (AP) that doesn’t provide Internet access and a Commissioner acts as a Wi-Fi station client and associates with the device’s AP in order to commission it over IPv6. Nodes currently commissioned into one or more fabrics SHALL NOT employ this method.
5.4.2.6.1. Device Role
The device operates as an Access Point, transmitting Beacons and responding to Probe Requests by sending Probe Responses per the rules specified in IEEE 802.11-2020.
The Commissioner associates with the Device’s temporary Wi‑Fi access point. Once Commissioner and Device have established link-layer connectivity at the Wi‑Fi layer, both Commissioner and Device configure themselves unique IPv6 link-local addresses, and then Device Discovery proceeds as for the cases using existing IP-bearing network.
5.4.2.6.2. AP Operating Parameters
The following table specifies the AP operational parameters:
Parameter | Value | ||
---|---|---|---|
SSID |
Note that all above elements are present in the QR code for commissioners that require an exact SSID for scanning/connection.
|
||
Hidden SSID |
SSID SHALL NOT be hidden as the device may need to be chosen using a mobile OS "network picker" on older mobile OS versions. |
||
BSSID |
SHALL be randomly generated on each boot for privacy/tracking reasons. Broadcast bit SHALL be clear, Locally-administered bit SHALL BE set. |
||
Channel |
SHALL be chosen from any valid 2.4 GHz ISM channel based on regulatory domain at boot. SHOULD choose randomly from 1, 6, or 11. Vendors may need to choose a specific channel for device-specific reasons. |
||
Security |
None |
||
Beacon Interval |
100 TUs |
||
DTIM Interval |
Not specified (Commissioner power management not expected) |
5.4.2.6.3. Matter Vendor-specific IE
This section defines the Information Element (IE) and attributes for Matter devices that support Wi-Fi Soft-AP for commissioning. The Matter IE SHALL be carried in the Wi-Fi Soft-AP Beacon and Probe Response frames.
A Vendor Specific IE format as defined in IEEE 802.11-2020 SHALL be used to define the Matter IE in this specification. The format for the Matter IE is shown in Table 45, “Matter Information Element format”. Little-endian encoding is used for all fields and subfields in the Matter IE format.
Field | Size (Octets) | Value (Hex) | Description |
---|---|---|---|
Element ID |
1 |
0xDD |
IEEE 802.11-2020 vendor specific information element |
Length |
1 |
Variable |
Length of the following fields in the IE in octets. The Length field is variable and set to 4 plus the total length of the Matter Attributes |
OUI |
3 |
4A:19:1B |
Connectivity Standards Alliance OUI |
OUI Type |
1 |
0x00 |
Identifying the type and version of the Matter IE |
Matter attributes |
Variable |
Variable |
One or more Matter attributes |
The Matter attributes are defined to have a common general format consisting of a one octet Matter attribute identifier field, a one octet Length field, and a variable-length attribute-specific information field, as shown in Table 46, “Matter Attribute format”.
Field | Size (Octets) | Value (Hex) | Description |
---|---|---|---|
Attribute ID |
1 |
Variable |
identifies the type of Matter attribute. |
Length |
1 |
Variable |
Length of the following fields in the attribute |
Attribute Body |
Variable |
Variable |
Matter attribute specific information fields |
The Table 47, “Matter Attribute list” defines the Matter attributes that SHALL be included in the Wi-Fi Soft-AP Matter IE.
Attribute ID (Hex) | Description |
---|---|
0x00 |
Reserved |
0x01 |
Device OpCode |
0x02 |
Device Information |
0x03 |
Rotating Device Id |
0x04 - 0xFF |
Reserved |
The format of Device OpCode (Operational Code) Matter attribute is shown in Table 48, “Device State Matter Attribute format”.
Field | Size (Octets) | Value (Hex) | Description |
---|---|---|---|
Attribute ID |
1 |
0x01 |
Device OpCode attribute |
Length |
1 |
0x01 |
Length of the following fields in the attribute |
Attribute Body |
1 |
Variable |
0x00 : Commissionable |
The format of Device Information Matter attribute is shown in Table 49, “Device Information Matter Attribute format”.
Field | Size (Octets) | Value (Hex) | Description |
---|---|---|---|
Attribute ID |
1 |
0x02 |
Vendor ID attribute |
Length |
1 |
0x06 |
Length of the following fields in the attribute |
Device Discriminator |
2 |
Variable |
b0 - b11 : 12-bit discriminator (see Section 5.4.2.4.1, “Discriminator”) |
VID |
2 |
Variable |
16-bit Vendor ID (see Section 5.4.2.4.2, “Vendor ID”) |
PID |
2 |
Variable |
16-bit Product ID (see Section 5.4.2.4.3, “Product ID”) |
Devices MAY choose not to advertise either the VID and PID, or only the PID due to privacy or other considerations. When choosing not to advertise both VID and PID, the device SHALL set both VID and PID fields to 0. When choosing not to advertise only the PID, the device SHALL set the PID field to 0. A device SHALL NOT set the VID to 0 when providing a non-zero PID.
The format of Rotating Device Id is shown in Table 50, “Rotating Device Id Attribute format”.
Field | Size (Octets) | Value (Hex) | Description |
---|---|---|---|
Attribute ID |
1 |
0x03 |
Rotating Device Id attribute |
Length |
1 |
Variable |
Length of the following fields in the attribute |
RDI |
Variable |
Variable |
Rotating Device Identifier, encoded as a variable length upper-case hexadecimal string, including any leading zeroes. |
5.4.2.6.4. Additional Data
Additional data, using the encoding defined above (see Section 5.4.2.4, “Discovery Information”), MAY be included in the Matter IE as an additional attribute, for more information about IE attribute (see Matter Information Element)
5.4.2.6.5. DHCP
A DHCP Server SHALL be implemented on the device if Soft-AP commissioning is used. Though Soft-AP commissioning relies on link-local IPv6 communication, some mobile OSes generate lack-of-connectivity warnings to the user if an IPv4 address is not obtained via a DHCP server. The following table specifies the DHCP server operational parameters:
Parameter | Value |
---|---|
Prefix |
192.168.226/24 (avoid 192.168.1/24, 192.168.0/24, etc.) |
Server IPv4 Address |
192.168.226.1 |
Range |
192.168.226.2 to 192.168.226.254. |
Lease time |
15 minutes (same as discovery timeout) |
5.4.2.7. Using Existing IP-bearing Network
This section details how a device that is already connected to an IP-bearing network advertises its commissionable state. The discovery protocols leverage IETF Standard DNS-based Service Discovery [RFC 6763]. A device SHALL use multicast DNS [RFC 6762] on Wi-Fi and Ethernet networks to make itself discoverable. On Thread networks, a device SHALL use the Service Registration Protocol [SRP] and an Advertising Proxy [AdProx] running on a Thread Border Router to make itself discoverable. Additional details on application of the above protocols in Matter is found in Section 4.3, “Discovery”. The encoding of the information required for discovery during the commissioning process is covered in Section 4.3.1, “Commissionable Node Discovery”.
5.4.2.8. Manufacturer-specific data
If needed, manufacturer-specific data MAY be advertised by a commissionable device using one of the following mechanisms, based on the supported commissioning technology. Commissioners receiving this data SHOULD treat it as opaque unless they have the need to and possess the ability to correctly interpret the information conveyed.
5.4.2.8.1. Using BLE
Any manufacturer-specific data may be included as a Manufacturer Specific Data AD type in the Advertising Data or in the Scan Response data.
Note that to receive Scan Response data information the Commissioner has to perform BLE active scanning that, in addition to creating additional traffic in the shared 2.4 GHz unlicensed band, can delay device discovery and connection, increasing the overall time required to commission a device.
5.4.2.8.2. Using Wi-Fi
Any manufacturer-specific data SHOULD be conveyed using the Vendor-specific Information Element (IE) mechanism per IEEE 802.11-2020. Non-Matter-specific information SHALL NOT be included in the Matter-specified Vendor-specific IE (see Section 5.4.2.6.3, “Matter Vendor-specific IE”).
5.4.3. Discovery by Commissioner
How a Commissioner discovers a commissionable device depends on the networking technologies that device and the Commissioner supports (see Section 5.4.2.1, “Technology Priority”). Though not all networking technologies must be supported by every device (see Table 36, “Discovery Capabilities Bitmask”), a Commissioner SHALL support Commissioning (see Section 5.5, “Commissioning Flows”) using existing IP network and over BLE (if having such interface) and SHOULD support commissioning over Wi-Fi Soft-AP.
The following sections detail Commissioner behavior for each of these networking technologies. Though a QR or Manual Pairing code may be scanned or entered prior to discovery, it is not required to do so. However, after scan/entry of the code, the Discriminator, VID and PID elements are available to ensure that the intended device is discovered before proceeding to the connection phase of commissioning.
5.4.3.1. Using BLE
Commissioners SHALL implement the role of a GAP Central. To discover a commissionable device advertising over BLE, a Commissioner SHALL perform a BLE scan across all three advertising channels with a sufficient dwell time, interval, and overall duration of scan. In order to promote quick discovery it is recommended that a Commissioner scan as aggressively as possible within the Commissioner device functionality/UX constraints. In addition, if manufacturer-specific data is not needed, a passive scan (i.e., one that only listens for Advertisement PDUs and does not issue Scan Request PDUs).
If discovery procedure is user initiated the scan interval SHOULD be set between 30 ms and 60 ms, and the scan window SHOULD be set to 30 ms. If discovery procedure is not user initiated (i.e., the Commissioner is scanning in the background), the device may use more relaxed scan, for example, the scan interval set to 1.28 seconds and scan window set to 11.25 ms.
Note: Recommended values are defined in Appendix A: Timers and Constants of Bluetooth® Core Specification 4.2, Vol 3, Part C.
5.4.3.2. Using Wi-Fi
To discover a commissionable device acting as a Soft-AP and advertising its commissionable status, a Commissioner SHALL perform a scan of all 2.4 GHz Wi-Fi channels allowed per its operational regulatory domain. Given that channels 1, 6, and 11 are preferred (see Section 5.4.2.6.2, “AP Operating Parameters”), scanning of those channels SHOULD be prioritized to minimize discovery time. Where practical and allowed by regulations, active scanning using Probe Requests SHOULD be also be used to help minimize discovery time. However, Commissioners that are always scanning as a background activity SHOULD do so passively (i.e., SHOULD NOT send Probe Requests) in order to reduce unnecessary transmissions in the shared 2.4 GHz spectrum.
5.4.3.3. Using Existing IP-bearing Network
To discover a commissionable device over an existing IP-bearing network connection, the Commissioner shall perform service discovery using DNS-SD as detailed in Section 4.3, “Discovery”, and more specifically in Section 4.3.1, “Commissionable Node Discovery”.
5.5. Commissioning Flows
There are two commissioning flows depending upon the networking capability of the Commissioner and Commissionee, namely concurrent connection commissioning flow and non-concurrent connection commissioning flow.
A Commissioner and Commissionee with concurrent connection have the ability to maintain two network connections simultaneously. One connection is between the Commissioner (or Commissionee) and the operational network (e.g., home Wi-Fi network or Thread network) that the Commissionee is being programmed to join. The second connection is between the Commissioner and Commissionee for commissioning as is referred to as commissioning channel. A Commissioner and Commissionee with non-concurrent connection capability cannot be simultaneously connected to both the operational network that the Commissionee is being configured to join, and the commissioning channel.
The two connections MAY either be on the same or on different networking interfaces. For example, a Commissioner uses its Wi-Fi interface to connect to the operational network, but use its Bluetooth Low Energy interface for commissioning.
To determine whether a Commissionee has concurrent or non-concurrent connection capability, the Commissioner can use the SupportsConcurrentConnection attribute of the General Commissioning Cluster.
Commissioning SHALL be a time-bound process that completes before expiration of a fail-safe timer. The fail-safe timer SHALL be set at the beginning of commissioning. If the fail-safe timer expires prior to commissioning completion, the Commissioner and Commissionee SHALL terminate commissioning. Successful completion of commissioning SHALL disarm the fail-safe timer.
A Commissionee that is ready to be commissioned SHALL accept the request to establish a PASE session with the first Commissioner that initiates the request. When a Commissioner is either in the process of establishing a PASE session with the Commissionee or has successfully established a session, the Commissionee SHALL NOT accept any more requests for new PASE sessions until session establishment fails or the successfully established PASE session is terminated on the commissioning channel (see CloseSession in Secure Channel Status Report Messages). In the event a CloseSession status message is sent or received:
-
If the fail-safe timer is armed, the fail-safe timer SHALL be considered expired and the cleanup steps detailed in Section 11.9.7.2, “ArmFailSafe Command” SHALL be executed.
-
If the commissioning window is still open, the Commissionee SHALL continue listening for commissioning requests.
In order to avoid locking out the Commissionee from accepting new PASE session requests indefinitely, a Commissionee SHALL expect a PASE session to be established within 60 seconds of receiving the initial request. This means the Commissionee SHALL expect to receive the PAKE3 message within 60 seconds after sending a PBKDFParamResponse in response to a PBKDFParamRequest message from the Commissioner to establish a PASE session. If the PASE session is not established within the expected time window the Commissionee SHALL terminate the current session establishment using the INVALID_PARAMETER
status code as described in Section 4.10.1.3, “Secure Channel Status Report Messages”.
The commissioning commands and attributes are defined in Clusters (see Section 11.8, “Network Commissioning Cluster”, Section 11.9, “General Commissioning Cluster”, Section 11.13, “Thread Network Diagnostics Cluster”, and Section 11.14, “Wi-Fi Network Diagnostics Cluster”) and are sent, written, or read using the Interaction Model (see Interaction Model).
Figure 30, “Concurrent connection commissioning flow” and Figure 31, “Non-concurrent connection commissioning flow” depict the commissioning flow between the Commissioner and Commissionee with concurrent connection ability and non-concurrent connection ability, respectively. The specific steps are described below. Unless indicated otherwise, a commissioner SHALL complete a step, including waiting for any responses to commands it sends in that step, before moving on to the next step.
-
The Commissioner initiating the commissioning SHALL have regulatory and fabric information available, and SHOULD have accurate date, time and timezone.
-
Commissioner and Commissionee SHALL find each other over networking interfaces such as Bluetooth, Wi-Fi, or Ethernet using the process of discovery and establish a commissioning channel between each other (see Section 5.4, “Device Discovery”).
-
Commissioner and Commissionee SHALL establish encryption keys with PASE (see Section 4.13.1, “Passcode-Authenticated Session Establishment (PASE)”) on the commissioning channel. All subsequent messages on the commissioning channel are encrypted using PASE-derived encryption keys. Upon completion of PASE session establishment, the Commissionee SHALL autonomously arm the Fail-safe timer for a timeout of 60 seconds. This is to guard against the Commissioner aborting the Commissioning process without arming the fail-safe, which may leave the device unable to accept additional connections.
-
Commissioner SHALL re-arm the Fail-safe timer on the Commissionee to the desired commissioning timeout within 60 seconds of the completion of PASE session establishment, using the ArmFailSafe command (see Section 11.9.7.2, “ArmFailSafe Command”). A Commissioner MAY obtain device information including guidance on the fail-safe value from the Commissionee by reading BasicCommissioningInfo attribute (see Section 11.9.6.2, “BasicCommissioningInfo Attribute”) prior to invoking the ArmFailSafe command.
-
Commissioner SHALL configure regulatory information in the Commissionee if it has at least one instance of Network Commissioning cluster on any endpoint with either the
WI
(i.e. Wi-Fi) orTH
(i.e. Thread) feature flags set in its FeatureMap. Commissioner SHOULD configure UTC time, timezone, and DST offset, if the Commissionee supports the time cluster. The order of configuration of this information is not critical. The UTC time is configured using SetUtcTime command (see Section 11.16.7.1, “SetUtcTime Command”) while timezone and DST offset are set through TimeZone (see Section 11.16.6.6, “TimeZone Attribute”) and DstOffset attribute (see Section 11.16.6.7, “DstOffset Attribute”), respectively. The regulatory information is configured using SetRegulatoryConfig (see Section 11.9.7.4, “SetRegulatoryConfig Command”). -
Commissioner SHALL establish the authenticity of the Commissionee as a certified Matter device (see Section 6.2.3, “Device Attestation Procedure”).
-
If the Commissionee fails the Device Attestation Procedure, for any reason, the Commissioner MAY choose to either continue to the Commissioning, or terminate it, depending on implementation-dependent policies.
-
Upon failure of the procedure, the Commissioner SHOULD warn the user that the Commissionee is not a fully trusted device, and MAY give the user the choice to authorize or deny the commissioning. Such a warning enables user choice in Commissionee trust on their Fabric, for development workflows, as well as homebrew device development. Such a warning SHOULD contain as much information as the commissioner can provide about the Commissionee, and SHOULD be adapted to the reason of the failure, for example by being different between the case of an expired certificate and the case of a failed signature verification.
-
Reasons for failing the Device Attestation procedure MAY include, but are not limited to, the following:
-
The Commissionee being of a device type currently in development or not yet certified (see certification_type in the Certification Declaration).
-
The Commissionee’s PAA not being in the Commissioner’s trusted set.
-
The Commissioner having obtained knowledge that a PAA or PAI certificate presented has been revoked, or that the particular Device Attestation Certificate has been revoked.
-
The Commissionee failing to prove possession of the Device Attestation private key, either by programming error, malicious intent or other reasons.
-
One of the elements of the Commissionee’s Device Attestation Certificate chain not meeting the policy validation steps of the Device Attestation Procedure, including errors on validity period.
-
-
If a Commissioner denies commissioning for any reason, it SHOULD notify the user of the reason with sufficient details for the user to understand the reason, so that they could determine if it would be possible to commission the device using a different Commissioner.
-
-
Following the Device Attestation Procedure yielding a decision to proceed with commissioning, the Commissioner SHALL request operational CSR from Commissionee using the CSRRequest command (see Section 11.17.7.5, “CSRRequest Command”). The CSRRequest command will cause the generation of a new operational key pair at the Commissionee.
-
Commissioner SHALL generate or otherwise obtain an Operational Certificate containing Operational ID after receiving the CSRResponse command from the Commissionee (see Section 11.17.7.5, “CSRRequest Command”), using implementation-specific means.
-
Commissioner SHALL install operational credentials (see Figure 38, “Node Operational Credentials flow”) on the Commissionee using the AddTrustedRootCertificate and AddNOC commands.
-
Commissioner MAY configure the Access Control List (see Access Control Cluster) on the Commissionee in any way it sees fit, if the singular entry added by the
AddNOC
command in the previous step granting Administer privilege over CASE authentication type for the Node ID provided with the command is not sufficient to express its desired access control policies. -
If the Commissionee both supports it and requires it, the Commissioner SHALL configure the operational network at the Commissionee using commands such as AddOrUpdateWiFiNetwork (see Section 11.8.8.4, “AddOrUpdateWiFiNetwork Command”) and AddOrUpdateThreadNetwork (see Section 11.8.8.5, “AddOrUpdateThreadNetwork Command”). A Commissionee requires network commissioning if it is not already on the desired operational network. A Commissionee supports network commissioning if it has any NetworkCommissioning cluster instances. A Commissioner MAY learn about the networks visible to the Commissionee using ScanNetworks command (see Section 11.8.8.2, “ScanNetworks Command”).
-
The Commissioner SHALL trigger the Commissionee to connect to the operational network using ConnectNetwork command (see Section 11.8.8.10, “ConnectNetwork Command”) unless the Commissionee is already on the desired operational network.
-
Finalization of the Commissioning process begins. An Administrator configured in the ACL of the Commissionee by the Commissioner SHALL use Operational Discovery to discover the Commissionee. This Administrator MAY be the Commissioner itself, or another Node to which the Commissioner has delegated the task.
-
The Administrator SHALL open a CASE (see Section 4.13.2, “Certificate Authenticated Session Establishment (CASE)”) session with the Commissionee over the operational network.
-
The Administrator having established a CASE session with the Commissionee over the operational network in the previous steps SHALL invoke the CommissioningComplete command (see Section 11.9.7.6, “CommissioningComplete Command”). A success response after invocation of the CommissioningComplete command ends the commissioning process.
While the Administrator of steps 13-15 will, in many situations, be the Commissioner Node itself, it MAY be a different Node that was configured by the Commissioner to have Administer privilege against the Commissionee’s General Commissioning Cluster. This is to support flexibility in finalizing the Commissioning. From a Commissionee’s perspective, all Nodes with Administer privilege in the Commissionee’s ACL are equivalent once the Node has a Node Operational Certificate and associated Node Operational Identifier on the Fabric into which it was just commissioned.
A Commissioner MAY configure UTC time, Operational ID, and Operational certificates, etc., information over an arbitrary number of interactions at the Commissionee, over the operational network after the commissioning is complete, or over the commissioning channel after PASE-derived encryption keys are established during commissioning.
In concurrent connection commissioning flow the commissioning channel SHALL terminate after successful step 15 (CommissioningComplete command invocation). In non-concurrent connection commissioning flow the commissioning channel SHALL terminate after successful step 12 (trigger joining of operational network at Commissionee). The PASE-derived encryption keys SHALL be deleted when commissioning channel terminates. The PASE session SHALL be terminated by both Commissioner and Commissionee once the CommissioningComplete command is received by the Commissionee.
In both concurrent connection commissioning flow and non-concurrent connection commissioning flow, the Commissioner MAY choose to continue commissioning and override the failure in step 6 (Commissionee attestation).
5.5.1. Commissioning Flows Error Handling
Overall, all Commissioning operations employ actions using cluster attributes and commands that are also, in certain cases, available during normal steady-state operation once commissioned.
Whenever the Fail-Safe timer is armed, Commissioners and Administrators SHALL NOT consider any cluster operation to have timed-out before waiting at least 30 seconds for a valid response from the cluster server. Some commands and attributes with complex side-effects MAY require longer and have specific timing requirements stated in their respective cluster specification.
Some request commands used for Commissioning and administration have a 'Breadcrumb' argument. When set, this argument SHALL be used to update the value of the Breadcrumb Attribute as a side-effect of successful execution of those commands. On command failures, the Breadcrumb Attribute SHALL remain unchanged.
In concurrent connection commissioning flow, the failure of any of the steps 2 through 10 SHALL result in the Commissioner and Commissionee returning to step 2 (device discovery and commissioning channel establishment) and repeating each step. The failure of any of the steps 11 through 15 in concurrent connection commissioning flow SHALL result in the Commissioner and Commissionee returning to step 11 (configuration of operational network information). In the case of failure of any of the steps 11 through 15 in concurrent connection commissioning flow, the Commissioner and Commissionee SHALL reuse the existing PASE-derived encryption keys over the commissioning channel and all steps up to and including step 10 are considered to have been successfully completed.
In non-concurrent connection commissioning flow, the failure of any of the steps 2 through 15 SHALL result in the Commissioner and Commissionee returning to step 2 (device discovery and commissioning channel establishment) and repeating each step.
Commissioners that need to restart from step 2 MAY immediately expire the fail-safe by invoking the ArmFailSafe command with an ExpiryLengthSeconds
field set to 0. Otherwise, Commissioners will need to wait until the current fail-safe timer has expired for the Commissionee to begin accepting PASE again.
In both concurrent connection commissioning flow and non-concurrent connection commissioning flow, the Commissionee SHALL exit Commissioning Mode after 20 failed attempts.
Once a Commissionee has been successfully commissioned by a Commissioner into its fabric, the commissioned Node SHALL NOT accept any more PASE requests until any one of the following conditions is met:
-
Device is factory-reset.
-
Device enters commissioning mode.
Ongoing administration of Nodes by Administrators employs many of the same clusters and constraints related to Fail-Safe timer and cluster operation time-outs used for initial or subsequent Commissioning into new Fabrics. The respective cluster specifications for the Node Operational Credentials Cluster and the Network Commissioning Cluster reflect the necessary usage of the ArmFailSafe
and CommissioningComplete
commands of the General Commissioning Cluster to achieve consistent state during administrative operations.
5.6. Administrator Assisted Commissioning Flows
5.6.1. Introduction
In this method, a current Administrator of a Node first sends the Open Commissioning Window command to the Node over a CASE session. The new Administrator MUST already have network connectivity and complete commissioning based on the two flows described below.
The commands for these flows are defined in Section 11.18, “Administrator Commissioning Cluster”.
5.6.2. Basic Commissioning Method (BCM)
This method is OPTIONAL for Nodes and Administrators/Commissioners to implement. In this method, the current Administrator MUST send the Open Basic Commissioning Window command to the Node over a CASE session. The Node SHALL advertise its presence over DNS-SD (see Section 5.4.2.7, “Using Existing IP-bearing Network” and Commissionable Node Discovery) after receiving the Open Basic Commissioning Window command.
The new Administrator’s Commissioner then completes commissioning with the Node using similar Commissioning flow as it would do for a factory-new device (although note that IP channel is used for discovery). It can either scan the QR code format or use the Manual Pairing Code format of the Section 5.1, “Onboarding Payload” of the Node.
The following steps describe a possible sequence of events for BCM commissioning:
-
Current Administrator puts the Node in Open Basic Commissioning Window for a specified time window, and receives success response from the Node on the Open Basic Commissioning Window command.
-
When the targeted Node is a SED, the current Administrator can guide the user to perform some action to 'wake' the device from its sleep cycle.
-
-
New Administrator completes commissioning within the prescribed window using steps outlined in Figure 30, “Concurrent connection commissioning flow”.
5.6.3. Enhanced Commissioning Method (ECM)
This method is MANDATORY for Nodes and Commissioners/Administrators to implement.
When using ECM, the Node’s current Administrator instructs the Node over a CASE session, to go into Open Commissioning Window.
It SHALL choose a new RANDOM
passcode and SHALL compute and send the corresponding PAKE passcode verifier to the Node. Actual value of the passcode SHALL NOT be sent to the Node.
The current Administrator then presents the new passcode and discriminator as described below. The Node SHALL advertise its presence over DNS-SD (see Section 5.4.2.7, “Using Existing IP-bearing Network” and Commissionable Node Discovery) after receiving the Open Commissioning Window command.
Sleepy Nodes SHOULD include the optional SII
key in their TXT advertisement.
5.6.3.1. Presentation of Onboarding Payload for ECM
Presentation of the passcode and other relevant information SHALL be done at least with one or more of the methods below, depending on the capabilities of the first Administrator opening the OCW:
-
If a user interface display is supported, the temporary Onboarding Payload SHALL be displayed using a textual representation of the Manual Pairing Code, using the 11-digit variant: it SHALL NOT contain the
VENDOR_ID
orPRODUCT_ID
as the onboarding of the node(s) using the ECM cannot be subject to User-Intent or Custom Flows. -
If a user interface display is supported, the temporary Onboarding Payload SHOULD also be displayed using the definitions included in Section 5.1.3, “QR Code” subject to the following constraints:
-
If only a single Node is being subjected to the ECM, the Vendor ID and Product ID in the onboarding payload SHALL be the same as those of that Node.
-
If multiple Nodes are being subjected to the ECM using the same onboarding payload, the Vendor ID SHALL be set to
0x0000
(Matter Standard) and the Product ID SHALL be set to0x0000
(consistent with the value used for not advertising a Product ID in Device Announcement) . -
The
Custom Flow
element SHALL be set to0
to indicate standard flow. -
The
Discovery Capabilities Mask
SHALL have ONLY bit 2 set to indicate the Node is only discoverable on the IP network. -
The
Passcode
element SHALL be set by the existing Administrator to the same value as the passcode chosen for this ECM operation. -
The
Discriminator
element SHALL be set by the existing Administrator to the same value as theDiscriminator
parameter in Section 11.18.8.1, “OpenCommissioningWindow (OCW) Command”. -
If multiple Nodes are subjected to ECM, the Section 5.1.5, “TLV Content” SHALL contain an entry with
kTag_NumberofDevices
containing the number of devices that are expected to participate in the onboarding with this ECM operation. -
When the Commissioning Timeout parameter of the OCW command is set to less than the allowed maximum (15 minutes), the Section 5.1.5, “TLV Content” SHALL contain an entry with
kTag_CommissioningTimeout
containing the value of the Commissioning Timeout parameter used for this ECM operation.
-
-
If only audio output is supported, the temporary Onboarding Payload SHALL be delivered using a voice prompt of the Manual Pairing Code format. A method SHOULD be available for the user to have the pairing code repeated.
Remote UIs, both visual and audio — such as a manufacturer-specific mobile app or a web UI — are expressly permitted in the set of acceptable mechanisms for conveyance of the onboarding information.
This method allows a current Administrator to set multiple Nodes for commissioning with a new administrator with an appropriate Commissioning Window
, by turning on Open Commissioning Window and sending the PAKE passcode verifier to a series of Nodes. The new Administrator uses the information in Manual Pairing Code to discover the Nodes that are in Commissioning mode and commission them using the new passcode.
The following steps describe a possible sequence of events for ECM commissioning:
-
Current Administrator puts the Node(s) in commissioning mode for a specified time window with a new setup passcode, and receives success responses from the involved Node(s) on the Open Commissioning Window command.
-
When one or more SED are among the targeted Nodes, the current Administrator can guide the user to perform some action to 'wake' these devices from their sleep cycle.
-
-
Current Administrator presents Onboarding Payload as described above.
-
New Administrator completes commissioning within the prescribed window using steps outlined in Figure 30, “Concurrent connection commissioning flow”.
5.6.4. Open Commissioning Window
The following sequence diagram shows steps current Administrator takes to enable Open Commissioning Window.
5.7. Device Commissioning Flows
This section describes the three different flows for out-of-box commissioning that a Matter device manufacturer may select for a given product. For each flow, a description is provided which includes actions required to place the device into commissioning mode, fields in the Onboarding Payload which identify the flow selected by the device manufacturer, fields in the Distributed Compliance Ledger that provide information used for commissioning and help the Commissioner provide the user with appropriate instructions, and requirements for device packaging relating to the Onboarding Payload. The three flows are the following:
-
Standard Commissioning Flow
-
User-Intent Commissioning Flow
-
Custom Commissioning Flow
Matter device manufacturers SHALL use the Distributed Compliance Ledger to provide commissioners with information and instructions for both initial and secondary commissioning, and SHOULD use this Ledger to provide links to the user guide, a link to a manufacturer app, and other pre-setup information, to enable an optimal commissioning flow without requiring bilateral arrangements between each commissioner manufacturer and each device manufacturer.
Some fields in the Ledger SHALL or SHOULD be populated, depending on the type of commissioning flow, as detailed in the text below and in the Distributed Compliance Ledger section.
5.7.1. Standard Commissioning Flow
-
A Standard Commissioning Flow device SHALL be available for initial commissioning by any Matter commissioner.
-
A Standard Commissioning Flow device, when in factory-new state, SHALL start advertising automatically upon power on (see Commencement).
-
A Standard Commissioning Flow device SHALL set Custom Flow bits in the Onboarding Payload to indicate '0 - Standard Flow'.
-
A Standard Commissioning Flow device SHALL follow the rules for Manual Pairing Code and QR Code Inclusion.
-
For the case where the device has stopped advertising (e.g. user has powered on the device longer ago than the advertisement period), the manufacturer SHOULD provide guidance about how to bring the device back into advertising mode using the CommissioningModeInitialStepsHint field from the Distributed Compliance Ledger. Commissioners SHOULD use this information to guide the user for this case.
-
When commissioning fails, the commissioner MAY also reference Distributed Compliance Ledger fields such as UserManualUrl, SupportUrl and ProductUrl to assist the user in further steps to resolve the issue(s).
-
The Distributed Compliance Ledger entries for Standard Commissioning Flow devices SHALL include the CommissioningCustomFlow field set to '0 - Standard' and the CommissioningModeInitialStepsHint field set to a non-zero integer value, with bit 0 (Power Cycle) being set to 1. The CommissioningModeInitialStepsInstruction field SHALL be set when CommissioningModeInitialStepsHint has a Pairing Instruction dependency.
Field Name | Value(s) |
---|---|
CommissioningCustomFlow |
0 - Standard (Mandatory) |
CommissioningModeInitialStepsHint |
This field SHALL be set to a non-zero integer value. See Pairing Hint Table for a complete list of pairing instructions. Example value: 33 - The following bits are set: 0 (Power Cycle - Mandatory), 5 (Device Manual - Optional). Bit 1 (Device Manufacturer URL) MAY be set. |
CommissioningModeInitialStepsInstruction |
The field SHALL be set when CommissioningModeInitialStepsHint has a Pairing Instruction dependency. See PI Dependency column of Pairing Hint Table to determine which pairing hints have Pairing Instruction dependency and therefore require this field to be populated. |
5.7.2. User-Intent Commissioning Flow
-
A User-Intent Commissioning Flow device SHALL be available for initial commissioning by any Matter commissioner.
-
A User-Intent Commissioning Flow device, when in factory-new state, SHALL NOT start advertising automatically upon application of power (see Commencement).
-
To place a User-Intent Commissioning Flow device into advertising mode, some form of user interaction with the device beyond application of power is required (see Pairing Hint Table). If a Device Manufacturer setup artifact is required for this, beyond documentation, then the device is a Custom Commissioning Flow device and not a User-Intent Commissioning Flow device. The documentation MAY be printed or in the form of online documentation (e.g. Section 11.22.5.8, “UserManualUrl”).
-
A User-Intent Commissioning Flow device SHALL follow the rules for Manual Pairing Code and QR Code Inclusion.
-
The Distributed Compliance Ledger entries for User-Intent Commissioning Flow devices SHALL include the CommissioningCustomFlow field set to '1 - User Intent' and the CommissioningModeInitialStepsHint field set to a non-zero integer value. Bit 0 (Power Cycle) in the CommissioningModeInitialStepsHint field SHALL be set to 0. The CommissioningModeInitialStepsInstruction field SHALL be set when CommissioningModeInitialStepsHint has a Pairing Instruction dependency.
-
A User-Intent Commissioning Flow device SHALL set Custom Flow bits in the Onboarding Payload to indicate '1 - User Intent'.
-
The commissioner SHOULD reference Distributed Compliance Ledger fields such as CommissioningModeInitialStepsHint, CommissioningModeInitialStepsInstruction, UserManualUrl, and SupportUrl to assist the user during commissioning, e.g. to explain how to bring the device into commissioning mode.
Field Name | Value(s) |
---|---|
CommissioningCustomFlow |
1 - User Intent (Mandatory) |
CommissioningModeInitialStepsHint |
This field SHALL be set to a non-zero integer value. See Pairing Hint Table for a complete list of pairing instructions. Example value: 96 - The following bits are set: 6 (Press Reset Button - Optional), 5 (Device Manual - Optional). Bit 1 (Device Manufacturer URL) MAY be set. |
CommissioningModeInitialStepsInstruction |
The field SHALL be set when CommissioningModeInitialStepsHint has a Pairing Instruction dependency. See PI Dependency column of Pairing Hint Table to determine which pairing hints have Pairing Instruction dependency and therefore require this field to be populated. |
5.7.3. Custom Commissioning Flow
-
A Custom Commissioning Flow device SHALL require interaction with custom steps, guided by a service provided by the manufacturer for initial device setup, before it can be commissioned by any Matter commissioner.
-
A Custom Commissioning Flow device MAY include the Onboarding Payload on-device or in packaging. If it is not included on the device or in packaging, then it SHALL be provided to the user through other means provided by the manufacturer.
-
A Custom Commissioning Flow device SHALL set Custom Flow bits in the Onboarding Payload to indicate '2 - Custom'.
-
The Distributed Compliance Ledger entries for Custom Commissioning Flow devices SHALL include:
-
the CommissioningCustomFlow field set to '2 - Custom'
-
the CommissioningModeInitialStepsHint with bit 0 (Power Cycle) set to 0 and bit 1 (Device Manufacturer URL) set to 1
-
the CommissioningCustomFlowUrl field populated in order to indicate to commissioners that initial commissioning can only be completed by the user visiting the URL contained therein.
This URL will typically lead to a web page with relevant instructions and/or to a server which (e.g. by looking at the User-Agent) redirects the user to allow viewing, downloading, installing or using a manufacturer-provided means for guiding the user through the process and bring the device into a state that it is available for commissioning by any commissioner.
Since the URL is retrieved from a DCL entry corresponding to a specific VID and PID combination, the device manufacturer MAY choose to use any constructed URL valid in a HTTP GET request (i.e. dedicated for the product the user wants to commission) such as, for example,https://www.example.com/download-install-app?vid=FFF1&pid=1234
. All HTTP based URLs SHALL use thehttps
scheme.
-
-
When a Commissioner encounters a device with Custom Flow field (in Onboarding Payload) or its CommissioningCustomFlow field (in Distributed Compliance Ledger) set to '2 - Custom', it SHOULD use the CommissioningCustomFlowUrl to guide the user on how to proceed, unless it has alternative means to guide the user to successful commissioning.
-
If a Commissioner follows or launches the CommissioningCustomFlowUrl after a User request, it SHALL expand it as described in Section 5.7.3.1, “CommissioningCustomFlowUrl format”.
-
-
A manufacturer contemplating using this flow should realize that
-
This flow typically requires internet access to access the URL, so initial commissioning of the device may fail if there is no internet connection at that time/location.
-
If the flow requires an app, it needs to be made available for popular platforms amongst the user population; some of their platforms running a commissioner (e.g. a smart speaker not running a popular mobile OS) may thus not be able to be used for the initial commissioning of such devices.
-
Field Name | Value(s) |
---|---|
CommissioningCustomFlow |
2 - Custom (Mandatory) |
CommissioningCustomFlowUrl |
'URL' - Device Manufacturer URL (Mandatory) |
CommissioningModeInitialStepsHint |
This field SHALL be set to a non-zero integer value with at least bit 1 set (Device Manufacturer URL). See Pairing Hint Table for a complete list of pairing instructions. Example value: 2 - The following bits are set: 1 (Device Manufacturer URL) (Mandatory). |
CommissioningModeInitialStepsInstruction |
The field SHALL be set when CommissioningModeInitialStepsHint has a Pairing Instruction dependency. See PI Dependency column of Pairing Hint Table to determine which pairing hints have Pairing Instruction dependency and therefore require this field to be populated. |
5.7.3.1. CommissioningCustomFlowUrl format
The CommissioningCustomFlowUrl
MAY contain a query component (see RFC 3986 section 3.4).
If a query is present, it SHALL be composed of one or more key-value pairs:
-
The query SHALL use the
&
delimiter between key/value pairs. -
The key-value pairs shall in the format
name=<value>
wherename
is the key name, and<value>
is the contents of the value encoded with proper URL-encoded escaping. -
If key
MTcu
is present, it SHALL have a value of "_" (i.e.MTcu=_
). This is the "callback URL (CallbackUrl
) placeholder". -
If key
MTop
is present, it SHALL have a value of "_" (i.e.MTop=_
). This is the "onboarding payload placeholder". -
Any key whose name begins with
MT
not mentioned in the previous bullets SHALL be reserved for future use by this specification. Manufacturers SHALL NOT include query keys starting withMT
in either theCommissioningCustomFlowUrl
orCallbackUrl
unless they are referenced by a version of this specification.
When the CommissioningCustomFlowUrl
for a Custom Commissioning Flow device includes the MTop
key, the Passcode
embedded in any Onboarding Payload placed on-device or in packaging SHALL NOT be one that can be used for secure channel establishment with the device. This requirement is intended to ensure a shared secret used for proof of possession will not be transferred to a server without user consent. A Custom Commissioning Flow device MAY utilize Onboarding Payload fields such as the Serial Number (see kTag_SerialNumber
) to pass device identification to the server specified in CommissioningCustomFlowUrl
, as these fields by themselves could not be used to gain access to the device on their own like the Passcode could.
When the CommissioningCustomFlowUrl
for a Custom Commissioning Flow device includes the MTop
key, the Passcode
embedded in any Onboarding Payload placed on-device or in packaging MAY be set to 0 in order to provide a hint to the Commissioner that it is not one that can be used for secure channel establishment with the device. This would allow the Commissioner to avoid attempting to commission the device if an advertisement from it is detected.
Any other element in the CommissioningCustomFlowUrl
query field not covered by the above rules, as well as the fragment field (if present), SHALL remain as obtained from the Distributed Compliance Ledger's CommissioningCustomFlowUrl
field, including the order of query key/value pairs present.
5.7.3.1.1. Expansion of CommissioningCustomFlowUrl by Commissioner
Once the URL is obtained, it SHALL be expanded to form a final URL (ExpandedCommissioningCustomFlowUrl
) by proceeding with the following substitution algorithm on the original CommissioningCustomFlowUrl
:
-
If key
MTcu
is present, compute theCallbackUrl
desired (see Section 5.7.3.2, “CallbackUrl format for Custom Commissioning Flow response”), and substitute the placeholder value "_" (i.e. inMTcu=_
) in theCommissioningCustomFlowUrl
with the desired contents, encoded with proper URL-encoded escaping (see RFC 3986 section 2). -
If key
MTop
is present, substitute the the placeholder value "_" (i.e. inMTop=_
) in theCommissioningCustomFlowUrl
with either numeric manual code, or QR code body including theMT:
prefix and TLV data (if present), encoded with proper URL-encoded escaping (see RFC 3986 section 2). Note that both methods SHOULD be supported by the Manufacturer’s custom flow.
A Commissioner SHALL NOT append the MTop=
query key/value pair unless the key/value pair was already present as MTop=_
in the CommissioningCustomFlowUrl
previously obtained.
This constraint enables the determination of which products make use of the payload in their Custom Commissioning Flow infrastructure by inspection of the Distributed Compliance Ledger records.
The final URL after expansion (ExpandedCommissioningCustomFlowUrl
) SHALL be the one to follow per Section 5.7.3, “Custom Commissioning Flow”, rather than the original value obtained from the Distributed Compliance Ledger.
5.7.3.2. CallbackUrl format for Custom Commissioning Flow response
If a CallbackUrl
field (i.e. MTcu=
) query field placeholder is present in the CommissioningCustomFlowUrl
,
the Commissioner MAY replace the placeholder value "_" in the ExpandedCommissioningCustomFlowUrl
with a URL that the manufacturer custom flow can use to make a smooth return to the Commissioner when the device is in a state that it can be commissioned.
This URL field MAY contain a query component (see RFC 3986 section 3.4).
If a query is present, it SHALL be composed of one or more key-value pairs:
-
The query SHALL use the
&
delimiter between key/value pairs. -
The key-value pairs SHALL follow the format
name=<value>
wherename
is the key name, and<value>
is the contents of the value encoded with proper URL-encoded escaping. -
If key
MTrop
is present, it SHALL have a value of "_" (i.e.MTrop=_
). This is the placeholder for a "returned onboarding payload" provided by the manufacturer flow to the Commissioner. -
Any key whose name begins with
MT
not mentioned in the previous bullets SHALL be reserved for future use by this specification.
Any other element in the CallbackUrl
query field not covered by the above rules, as well as the fragment field (if present), SHALL remain as provided by the Commissioner through embedding within the ExpandedCommissioningCustomFlowUrl
, including the order of query key/value pairs present.
5.7.3.2.1. Expansion of CallbackUrl by the manufacturer custom flow
Once the CallbackUrl
is obtained by the manufacturer flow, it MAY be expanded to form a final ExpandedCallbackUrl
URL to be used by proceeding with the following substitution algorithm on the provided CallbackUrl
:
-
If key
MTrop
is present, the manufacturer custom flow having received the initial query containing theCallbackUrl
MAY compute an Onboarding Payload in QR code format includingMT:
prefix, and substitute the placeholder value "_" (i.e. inMTrop=_
) in theCallbackUrl
with the desired contents, encoded with proper URL-encoded escaping (see RFC 3986 section 2).-
The contents of the
MTrop=_
key/value pair in theExpandedCallbackUrl
SHALL only be expanded if the manufacturer custom flow, having received the initial query containing theCallbackUrl
, supports opening a commissioning window on the target device and supports conveying the corresponding onboarding payload to the Commissioner. -
The return onboarding payload, if provided, SHALL contain an ephemeral
Passcode
and not a permanent code that can be used in a subsequent commissioning window. If the manufacturer wants thePasscode
embedded in the Onboarding Payload placed on-device or in packaging to be the one used for session establishment with the Commissioner, then the manufacturer SHALL NOT include theMTop
key in itsCommissioningCustomFlowUrl
and SHALL NOT populate theMTrop
value in theCallbackUrl
expansion. -
The contents of the return onboarding payload, if provided, SHALL be constructed to match the state of the device at the moment the
ExpandedCallbackUrl
is opened. At least one ingredient which needs to be adapted relative to the received Onboarding Payload is theCustom Flow
field which needs to be0
for the return onboarding payload. -
The presence of this field is to assist automatically resuming commissioning without additional data entry (QR code or numeric manual code) by the user at the Commissioner that initially triggered the custom flow. The manufacturer custom flow SHOULD provide an alternate means of conveying the onboarding payload, such as a manual pairing code.
-
Note that if the information in the initial onboarding payload that caused triggering of a Custom Commissioning Flow was directly usable, it may be used by the Commissioner, either upon being triggered through the
ExpandedCallbackUrl
having been opened, or autonomously as a fallback. -
Commissioners providing a
CallbackUrl
to the manufacturer custom flow through theExpandedCommissioningCustomFlowUrl
SHOULD support using theExpandedCallbackUrl
to trigger resumption of Commissioning flow if theExpandedCallbackUrl
is followed, otherwise the Commissioner SHOULD NOT substitute theMTcu
query field when expanding theCommissioningCustomFlowUrl
into theExpandedCommissioningCustomFlowUrl
. -
If the manufacturer custom flow failed to make the device commissionable, it SHALL NOT replace the placeholder value "_" of an included
MTrop=_
key/value pair, to avoid a Commissioner attempting to discover or commission a device not made ready by the custom flow.
-
A manufacturer custom flow having received an ExpandedCommissioningCustomFlowUrl
SHOULD attempt to open the ExpandedCallbackUrl
, on completion of the steps, if an ExpandedCallbackUrl
was computed from the CallbackUrl
and opening such a URL is supported.
5.7.3.3. Examples of CommissioningCustomFlow URLs
Below are some examples of valid ExpandedCommissioningCustomFlowUrl
for several valid values of CommissioningCustomFlowUrl
, as well as some examples of invalid values of CommissioningCustomFlowUrl
:
-
Valid URL with no query string:
-
Before expansion: https://company.example.com/matter/custom/flows/vFFF1p1234
-
After expansion: https://company.example.com/matter/custom/flows/vFFF1p1234 (no change)
-
-
Invalid URL with no query string:
http
scheme is not allowed: -
Valid URL with basic manufacturer-specific scheme for query:
-
Before expansion: https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234
-
After expansion: https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234 (no change)
-
-
Valid URL with
MTop=_
placeholder using QR format onboarding payload embedding:-
Before expansion: https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234&MTop=_
-
After expansion: https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234&MTop=MT%3A-MOA57ZU02IT2L2BJ00
-
Onboarding payload QR content
MT:-MOA57ZU02IT2L2BJ00
was embedded withinMTop
key
-
-
-
Valid URL with
MTop=_
placeholder using numeric manual code onboarding payload embedding:-
Before expansion: https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234&MTop=_
-
After expansion: https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234&MTop=610403146665521046600
-
Onboarding numeric manual code
610403146665521046600
was embedded withinMTop
key
-
-
-
Valid URL with
MTop=_
placeholder using numeric manual code onboarding payload embedding, using a different order of keys/value pairs than the previous example:-
Before expansion: https://company.example.com/matter/custom/flows?pid=1234&MTop=_&vid=FFF1
-
After expansion: https://company.example.com/matter/custom/flows?pid=1234&MTop=610403146665521046600&vid=FFF1
-
Onboarding numeric manual code
610403146665521046600
was embedded withinMTop
key
-
-
-
Valid URL with onboarding payload elided (because commissioner could not provide it):
-
Before expansion: https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234&MTop=_
-
After expansion: https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234&MTop=_ (no change)
-
-
Valid URL, return onboarding payload and
CallbackUrl
requested:-
Before expansion:
https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234&MTop=_&MTcu=_
-
After expansion:
https://company.example.com/matter/custom/flows?vid=FFF1&pid=1234&MTop=MT%3A-MOA57ZU02IT2L2BJ00&MTcu=https%3A%2F%2Fcommissioner.example.com%2Fcb%3Ftoken%3DmAsJ6_vqbr-vjDiG_w%253D%253D%26MTrop%3D_
-
The
ExpandedCommissioningCustomFlow
URL contains:-
An embedded onboarding payload QR content value of
MT:-MOA57ZU02IT2L2BJ00
-
A
CallbackUrl
with a Commissioner-provided arbitrarytoken=
key/value pair and theMTrop=
key/value pair place-holder to indicate support for a return onboarding payload: https://commissioner.example.com/cb?token=mAsJ6_vqbr-vjDiG_w%3D%3D&MTrop=_ -
After expansion of the
CallbackUrl
(MTcu
key) into anExpandedCallbackUrl
, with an example return onboarding payload ofMT:-MOA5.GB00V68T62O10
, theExpandedCallbackUrl
would be:https://commissioner.example.com/cb?token=mAsJ6_vqbr-vjDiG_w%3D%3D&MTrop=MT%3A-MOA5.GB00V68T62O10
Note that the
MTcu
key/value pair was initially provided URL-encoded within theExpandedCommissioningCustomFlow
URL and theMTrop=_
key/value pair placeholder now contains a substituted returned onboarding payload.
-
-
-
Invalid URL, due to
MTza=79
key/value pair in reservedMT
-prefixed keys reserved for future use:
5.7.3.4. Example Custom Commissioning Flow
An example of this flow is illustrated below. The "DCL info" concept denotes that the Commissioner SHALL collect the information from the DCL via some mechanism, such as a network resource accessible to the Commissioner containing a replicated set of the DCL’s content.
In the flow above:
-
In the final steps, the User has to perform the trigger to the first Commissioner, so that it can start or continue the commissioning process.
-
If possible, a Commissioner MAY continue to scan for announcements from the device in the background while any manufacturer-specific app is configuring the device to be available for commissioning. The Commissioner may need a new OnboardingPayload provided to the User by the Manufacturer Website or App.
-
In order to simplify the flow, the Commissioner MAY:
-
Include the onboarding payload obtained from the user (see
MTop
key in Section 5.7.3.1, “CommissioningCustomFlowUrl format”) within theCommissioningCustomFlowUrl
. -
Include a callback URL (see
MTcu
key in Section 5.7.3.1, “CommissioningCustomFlowUrl format”) within theExpandedCommissioningCustomFlowUrl
.
-
-
The Manufacturer Website or App MAY utilize the
CallbackUrl
field, if provided in the query string, in order to simplify the process for signaling the completion of the manufacturer-specific part of the flow back to the Commissioner. When doing so, the Manufacturer Website or App SHOULD put the device into Commissioning mode and SHOULD provide the corresponding onboarding payload to the Commissioner using theMTrop
key/value pair within the ExpandedCallbackUrl.
5.7.4. Manual Pairing Code and QR Code Inclusion
Manual Pairing Code and QR setup codes enable secure commissioning and provide a consistent experience that many users are familiar with. However, because they contain a symmetric security code it is not appropriate in all circumstances to have them be in a readily accessible location on the device, such as printed on the back.
The following are the requirements and recommendations regarding the QR Code and Manual Pairing code for Standard and User Intent Commissioning Flow Devices. Custom Commissioning Flow Device rules are described in the Custom Commissioning Flow.
The term 'on-device' allows for a physical label affixed to the device or printed directly on the device, as well as one that can be displayed on demand through some physical interface properties of the device (e.g. visual or audio).
-
Devices SHALL include the Manual Pairing code on-device or in packaging.
-
Devices SHALL NOT have the QR nor the manual pairing code in an unprotected format on the outer packaging.
-
Devices SHOULD include the QR Code, and SHOULD include it alongside the Manual Pairing Code on-device or in packaging.
-
Manual Pairing Code and QR Code on-device MAY be removable or obscured to allow the owner to prevent commissioning without their consent.
-
Devices MAY include the QR Code and Manual Pairing Code in multiple forms (see below).
Presentation of the QR Code and Manual Pairing code on-device can occur in many forms to allow for adherence to device security requirements and manufacturing considerations. For example security devices could limit the access to the QR code or Manual Pairing Code to avoid an unauthorized user obtaining the information by simple inspection, or make the QR code and/or Manual Pairing Code removable.
The following is a list of possible ways that are acceptable to satisfy the requirements of inclusion of the QR code and Manual Pairing Code. An entry in the list should not be interpreted as being mutually exclusive with another entry. A device SHOULD include as many of these ways as possible.
-
QR and Manual Pairing Code shown via an on-device display (when available)
-
QR and Manual Pairing Code printed on-device, with removal/obscuring considerations noted above.
-
Manual Pairing Code presented on-device via audio output (when available)
-
QR and Manual Pairing Code printed on in-packaging materials.
The following are examples of QR code and Manual Pairing Code inclusion.
-
QR Code and Manual Pairing Code printed on a Matter wireless shade inside the battery compartment cover, and provided in the packaging.
-
QR Code and Manual Pairing code on a Matter Smart Thermostat that can be activated via an on-device User Interface and displayed only on screen.
-
QR Code and Manual Pairing code for a security sensor that is provided in the packaging, and on-device hidden behind a tamper-monitored cover.
-
QR code provided on an E12 light bulb, with manual pairing code on a removable label (the area of QR code likely fits better on small form factor bulb than the area for a 13 character string).
-
A wearable device with only a Manual Pairing Code printed on the fabric. No QR code is present because of the difficulty in scanning a QR code on an irregular surface.
-
A Smart speaker, without printed QR or manual pairing code on the device (but possibly in-packaging), that can be triggered to read out a Manual Pairing Code.
5.8. In-field Upgrade to Matter
This (informative) section discusses the case of a pre-Matter device currently in the user’s home which gets software updated to support Matter, and which steps (either Matter-specified or manufacturer specific) would typically be applied to accomplish this goal.
-
The initial s