
API frames
BLE Unlock API - 0x2C
Digi XBee® 3 Cellular LTE-M/NB-IoT Global Smart Modem User Guide
270
Phase 4 (Server presents M2)
Frame data field
Offset in frame
Length
M2
5
Hash algorithm digest length
(32 bytes for SHA256)
TX nonce
37
12-byte (96-bit) random nonce,
used as the constant prefix of
the counter block for
encryption/decryption of data
transmitted to the API service
by the client
RX nonce
49
12-byte (96-bit) random nonce,
used as the constant prefix of
the counter block for
encryption/decryption of data
received by the client from the
API service
Upon completion of
M2
verification, the session key has been determined to be correct and the API
service is unlocked and will allow additional API frames to be used. Content from this point will be
encrypted using AES-256-CTR with the following parameters:
n
Key
: The entire 32-byte session key.
n
Counter
: 128 bits total, prefixed with the appropriate nonce shared during authentication.
Initial remaining counter value is 1.
The counter for data sent into the XBee API Service is prefixed with the
TX nonce
value (see the
Phase 4
table, above), and the counter for data sent by the XBee to the client is prefixed with
the
RX nonce
value.
Example sequence to perform AT Command XBee API frames over
BLE
1. Discover the XBee 3 device through scanning for advertisements.
2. Create a connection to the GATT Server.
3. Optional, but recommended, request a larger MTU for the GATT connection.
4. Turn on indications for the API Response characteristic.
5. Perform unlock procedure using unlock frames. See
.
6. Once unlocked, AT Command (0x8) frames may be sent and AT Command Response frames
received.
a. For each frame to send, form the API Frame, and encrypt through the stream cipher as
described in the unlock procedure. See
.
b. Write the frame using one or more Write operations.
c. When successful, the response arrives in one or more indications. If your stack does not do
it for you, remember to acknowledge each indication as it is received. Note that you are