Skip to content

docs: add BLE protocol specification#116

Draft
buckleypaul wants to merge 1 commit intoHubbleNetwork:mainfrom
buckleypaul:docs.add-spec
Draft

docs: add BLE protocol specification#116
buckleypaul wants to merge 1 commit intoHubbleNetwork:mainfrom
buckleypaul:docs.add-spec

Conversation

@buckleypaul
Copy link
Copy Markdown
Collaborator

Formal specification for Hubble BLE advertisement protocol covering packet structure, KBKDF key derivation, AES-CTR encryption, CMAC authentication, and test vectors for implementation validation.

Formal specification for Hubble BLE advertisement protocol covering
packet structure, KBKDF key derivation, AES-CTR encryption, CMAC
authentication, and test vectors for implementation validation.

Signed-off-by: Paul Buckley <paul@hubble.com>

Devices MUST be provisioned with UTC time before generating advertisements. The device MUST maintain time accuracy within ±1 hour to ensure gateway decryption succeeds.

Time synchronization methods:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are only a few methods to have it, the way it is state is that must be one of those. I would reword it to make it clear these are options.

The complete 10-bit sequence counter is reconstructed as:
```
seq_counter = ((prefix & 0x03) << 8) | seq_low
```
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block in this section is confusing because it covers bytes 2 and 3. seq_counter is two bytes long.

| Full advertisement (no payload) | 18 bytes |
| Full advertisement (max payload) | 31 bytes |

The 31-byte limit is the maximum for legacy BLE 4.x advertisements.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not an expert, but I think that is not a legacy limit, this is part of newer specifications as well. It happens is that newer Bluetooth versions have extended advertisement format.

### A.1 Complete KBKDF Algorithm

```
FUNCTION KBKDF_Counter(key, label, context, output_bits):
Copy link
Copy Markdown
Collaborator

@ceolin ceolin Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

output should be in bytes, it is byte aligned and we don't need number of bits.

```
DeviceKey = KBKDF(MasterKey, "DeviceKey", "20370", 256)
NonceKey = KBKDF(MasterKey, "NonceKey", "20370", 256)
EncryptionKey = KBKDF(MasterKey, "EncryptionKey", "20370", 256)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last parameter should by in bytes, see the comment in the implementation.

Copy link
Copy Markdown
Collaborator

@ceolin ceolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments. I liked it very much !

Copy link
Copy Markdown
Collaborator

@HongNguyen635 HongNguyen635 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree with @ceolin comments above ^
The rest looks good to me. Should we add @danielr-hubblenetwork as the reviewer as well since this relates to docs?

Copy link
Copy Markdown

@solidspark solidspark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a nit regarding the use of UTC Time vs Epoch Time.

|------|------------|
| Advertisement | A BLE broadcast packet containing Hubble service data |
| EID | Ephemeral ID, a time-based identifier that rotates daily |
| Time Counter | Integer derived from UTC time, increments daily |
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note we're using "Epoch Time", not UTC Time.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also note here that it "increments daily upon new advertisement retrieval"?

│ (Transmitter) │ ──────► │ (Receiver) │ ──────► │ Platform │
│ │ │ │ │ │
│ • Master Key │ │ • Decrypts adverts │ │ • Stores data │
│ • UTC time │ │ • Validates auth │ │ • Delivers to │
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment re: Epoch Time, throughout the document.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important: the receiver does not decrypt advertisement. This is on the backend. The gateway does not know device ID.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be "forwards to Hubble Cloud" in my view.
May need 4th column: between receiver and Cloud Platform, Hubble Backend?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And/or "Cloud Platform" should contain both decryption/storage as well as ability to retrieve packet data via API

@@ -0,0 +1,808 @@
# Hubble BLE Protocol Specification
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect to have a separate resource for SATELLITE?

If yes, can we adopt a naming convention like

  • Hubble Specification for Terrestrial Network
  • Hubble Specification for Satellite Network

Otherwise consider generic "Hubble Protocol Specification"?


### 1.1 Purpose

This document specifies the Hubble Network Bluetooth Low Energy (BLE) advertisement protocol. It provides the complete technical specification required for implementers to create interoperable transmitters that communicate with Hubble Network gateways.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SIG requires us to mark "Bluetooth®" on first use

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend that we name "Terrestrial" then use BLE going forward, e.g.
"This document specifies the Hubble Network Bluetooth Low Energy (BLE) advertisement protocol used to transmit on the Terrestrial Network."

This specification is limited to:

- Transmitter-side implementation
- UTC-based Ephemeral ID (EID) mode
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Epoch-time encryption (see Ryan's comments throughout)

| Advertisement | A BLE broadcast packet containing Hubble service data |
| EID | Ephemeral ID, a time-based identifier that rotates daily |
| Time Counter | Integer derived from UTC time, increments daily |
| Sequence Counter | Per-advertisement counter (0-1023) within a time period |
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might confuse readers because you can beacon the same advertisement multiple times. Can we be more clear e.g. "per unique advertisement counter"?


### 2.3 Time Synchronization Requirements

Devices MUST be provisioned with UTC time before generating advertisements. The device MUST maintain time accuracy within ±1 hour to ensure gateway decryption succeeds.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically our permissible range is +- 24 hours, do we want to conceal this?


#### 3.4.6 Encrypted Payload (Bytes 12-24)

AES-CTR encrypted user payload data. Maximum 13 bytes.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention customers can also use their own encryption on the custom payload?
https://docs.hubble.com/docs/security/network#1-optional-customer-managed-encryption-at-payload-creation

1. A provisioned master key (128 or 256 bits)
2. Current UTC time in milliseconds
3. A sequence counter value (0-1023)
4. Payload data (0-13 bytes)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional payload data

Copy link
Copy Markdown
Collaborator

@danielr-hubblenetwork danielr-hubblenetwork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a valuable addition. Good content. Especially the test vectors (net new content). Minor comments added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants