Cryptographic specification · revision 1.1 · 1 November 2026

The Encrypted Link of UP↑SCALE

On PRO and ENTERPRISE scales every Bluetooth payload between the app and the scale is encrypted with AES-128-GCM. For each connection the scale makes a one-time P-256 key, signs it with its own identity key, and agrees the session keys with the app by ECDH and HKDF-SHA256. This page describes the design with the exact parameters from the firmware and app source. It is a technical description, not a certification.

AES-128-GCMpayload, 128-bit tag
ECDH P-256one-time keys on both sides
HKDF-SHA256RFC 5869 key derivation
ECDSA P-256signed scale key, optional app keys
1 · Purpose and scope

What this specification covers

It covers the Encrypted Link between the UP↑SCALE app (a browser app using Web Bluetooth) and the scale firmware (ESP32-S3 / ESP32-C3), the optional registered-apps mode, the password envelope and the scale identity key they build on. It is written for IT-security, QA and validation reviewers. It does not cover the website, the licence server, or how a customer stores exported files.

UP↑SCALE has not had the implementation evaluated by a third party (for example FIPS 140-3 or Common Criteria). The algorithms are standard; the way they are combined is our own protocol. Section 8 lists its known limits.

2 · Architecture

Encryption runs end to end in the app and the firmware

Encryption is done at the application layer by the two endpoints. The Bluetooth LE link itself stays unpaired, so BLE link-layer security is not relied on. A hook on each side wraps the three UP↑SCALE GATT characteristics; the rest of the code sees plain 42-byte packets.

UP↑SCALE app (browser) Web Crypto API ECDH + ECDSA P-256 AES-128-GCM, HKDF-SHA256 browser CSPRNG Keys in the app scale key: certificate or pinned session keys (memory only) app key (IndexedDB, optional) Scale (ESP32-S3 / C3) mbedTLS ECDH + ECDSA P-256 AES-128-GCM, HKDF-SHA256 hardware RNG Keys on the scale identity key sk (NVS flash) registered app keys (NVS) session keys (RAM only) 63-byte AES-128-GCM packets Ku: app → scale (per handshake) Kd: scale → app (per connection) plain: GO-LC, [227], [232] 13 public keys, signature, wrapped key Not covered: advertising, Decent Scale service, USB serial, ESP-NOW
The handshake goes plain but carries only public keys, a signature and a wrapped key. Everything else on the three characteristics is encrypted.
3 · Cryptographic primitives

Standard algorithms only, from mbedTLS and Web Crypto

The firmware uses mbedTLS from the ESP-IDF / Arduino-ESP32 core. The app uses the browser's Web Crypto API. Neither side contains its own cipher code.

FunctionAlgorithmParametersStandard
Scale identity key (sk / pk)ECDSA key pairsecp256r1 (P-256), made once on the scaleFIPS 186-5
Key agreementECDH, ephemeral–ephemeralP-256; a new key pair on both sides for every handshake; shared secret = x-coordinate (32 bytes)SP 800-56A
Scale authenticationECDSA signaturewith sk over SHA-256("UPSCALE-LINK2-S" ‖ A ‖ B)FIPS 186-5
Public-key checkpoint validationscale: mbedtls_ecp_check_pubkey; app: Web Crypto importKeySP 800-56A 5.6.2.3
Key derivationHKDF-SHA256salt = A ‖ B, info = "UPSCALE-LINK2", 52 bytes outRFC 5869, SP 800-56C
Payload encryptionAES-GCM128-bit key, 96-bit IV, 128-bit tag, 6-byte AADFIPS 197, SP 800-38D
Downlink key transportAES-GCM key wrapkey Kw and IV from HKDF, 128-bit tagSP 800-38D
App authentication (optional)ECDSA signatureapp key P-256 over SHA-256("UPSCALE-LINK2-A" ‖ A ‖ B)FIPS 186-5
Password envelopeECDH + AES-GCMP-256 with sk, key = SHA-256(Z ‖ nonce ‖ "UPSCALE-PW1")[0..16], 128-bit tag; travels inside the Encrypted Link on PRO / ENTERPRISESP 800-56A, SP 800-38D
Stored user passwordsPBKDF2-HMAC-SHA25616-byte random saltSP 800-132, RFC 8018
Seals and certificatesECDSAP-256 over SHA-256, raw r ‖ sFIPS 186-5
Random numbersscale: hardware RNG (esp_fill_random, radio on); app: browser CSPRNG—Espressif TRM, W3C Web Crypto
4 · Session establishment

Every connection gets its own keys, signed by the scale

Each handshake yields an uplink key Ku for app → scale. Each Bluetooth connection gets a downlink key Kd for scale → app; two browser tabs that share one connection also share its Kd.

  1. State (plain). The app sends GO-LC 1; the scale answers [227] 1: setting, licence, active, key exists, boot id, registered-apps mode.
  2. Scale identity (plain). The app asks for the seal state (GO-EQ 26); [232] 13 carries pk and, on ENTERPRISE scales, the seal certificate.
  3. Trust. A valid UP↑SCALE seal certificate for this pk (and this Device ID) makes the key trusted at once. Without one, the first pk is pinned in the browser and a later change must be confirmed by the user.
  4. App one-time key. The app makes a P-256 key pair and sends its public key A in two parts (GO-LC 2).
  5. Scale one-time key. The scale validates A, makes its own one-time key pair b / B, computes Z = ECDH(b, A) and wipes b. It signs SHA-256("UPSCALE-LINK2-S" ‖ A ‖ B) with sk.
  6. Derivation. Both sides run HKDF-SHA256(salt = A ‖ B, ikm = Z, info = "UPSCALE-LINK2") → Ku (16) ‖ salt_u (8) ‖ Kw (16) ‖ IVw (12).
  7. Scale answer. [227] 3 = B ‖ signature (4 parts). [227] 4 = AES-GCMKw, IVw(Kd ‖ salt_d ‖ boot id), 28 + 16 bytes (2 parts). Kd and salt_d are random, made at the first handshake of the connection, RAM only.
  8. App check. The app verifies the signature with the trusted pk; a wrong signature ends the handshake. It then unwraps Kd and keeps Ku and Kd as non-extractable Web Crypto keys.

Re-keying. A reconnect always runs a new handshake with new one-time keys on both sides. A scale restart changes the boot id; apps notice and start again. Up to 4 handshakes and 4 connections are kept at once.

5 · Packet format

A 42-byte packet becomes 63 bytes on the air

BytesLengthContent
01marker 226
1–44counter, uint32 little-endian, strictly rising per sender and key
5–4642AES-128-GCM ciphertext
47–6216GCM tag (128 bits)

IV (96 bits) = salt (8) ‖ counter (4). AAD (6 bytes) = 226 ‖ direction ‖ counter, with direction 0 for Sending, 1 for Extra and 9 for app → scale. A packet cannot be moved to another characteristic or sent back the other way.

Replay and forgery. The scale takes an app packet only with a counter higher than the last one of that handshake. The app takes each counter once inside a 64-packet window. After 16 packets on one connection that fail the tag or the counter check, the scale drops the connection.

IV uniqueness. Each key has its own counter; every key is new per handshake or per connection, so an IV never repeats under one key.

DirectionPlain while the link is encryptedWhy
scale → app[227] state and handshake answersneeded before the keys exist; the key itself is wrapped, B is signed
scale → app[232] 13 seal statecarries the public identity key and certificate
app → scaleGO-LC 1, 2, 4, GO-EQ 26handshake and proof
bothadvertising, Decent Scale service, ESP-NOWoutside the Encrypted Link

Any other plain write is refused, and the scale answers with its state (at most once per second).

6 · Key lifecycle and storage

Only the identity key and the app list live in flash

KeyMade byStoredLifetimeWiped
Identity key sk (32 B)scale, once, after the first start (radio on)NVS EQUIP/sk, not encrypteduntil the flash is erasednever automatically
Seal certificate (144 B)UP↑SCALE licence toolNVS EQUIP/scertas skwhen sk changes
One-time keys a, bapp, scalememoryone handshakeb: right after ECDH; a: dropped
Z, HKDF output, Kwboth sidesmemoryone handshakembedtls_platform_zeroize / fill(0)
Ku, salt_uboth sides (HKDF)scale RAM slot; app non-extractable CryptoKeyone handshakeon disconnect
Kd, salt_dscale (RNG)scale RAM; app non-extractable CryptoKeyone connectionon disconnect
Registered app keys (8 × 64 B public)the appsNVS EQUIP/lappsuntil removedREMOVE ALL
App key (private)browser, onceIndexedDB, non-extractableuntil browser data is cleared—
Password envelope keyboth, from ECDH + nonceRAMone use, 30 safter use or timeout

The Encrypted Link is on by default and active when the setting is on, the licence is PRO or ENTERPRISE, and the identity key exists. Switching it on also switches off BLE FOR ALL, which puts the weight into the plain advertising; the user can switch that on again.

7 · Registered apps (ENTERPRISE, optional)

Only the devices you registered get the keys

Each browser keeps its own ECDSA P-256 key, created non-extractable in IndexedDB. The scale stores up to 8 public app keys. With registered apps only on, the scale withholds the wrapped Kd and refuses all app packets until the app signs SHA-256("UPSCALE-LINK2-A" ‖ A ‖ B) with a registered key.

  • Registering, switching on and removing go only over the encrypted link, need ENTERPRISE and pass the ADMIN settings gate when users are set up.
  • Only an app that has proven itself can switch the mode on, so the device that does it cannot lock itself out.
  • A new device is let in from a registered one for 2 minutes. Recovery when all devices are lost: the USB serial command LINKOPEN (physical access).
  • Every change is written to the activity log (settings 28 and 29).
8 · Threat model and known limits

What the Encrypted Link protects against

The Encrypted Link stops a passive sniffer and an active attacker on the radio from reading, changing, replaying or injecting payloads.

Protected againstNot protected against
Reading payloads over the air, also from recordings made earlier: one-time keys on both sides, so a later leak of the scale key does not open them—
A device posing as the scale: its one-time key must be signed with the trusted identity key; ENTERPRISE scales are checked against the UP↑SCALE seal certificateOn PRO scales (no certificate) the very first connection of a browser: the key is pinned then, later changes are asked
Changed, injected, replayed or redirected packets: 128-bit tags, counters, direction in the AAD; 16 failed packets drop the connectionTraffic analysis: that a connection exists, packet timing and rate (all packets are 63 bytes)
Unknown devices (ENTERPRISE, registered apps only): no keys without a signature of a registered app keyWith registered apps only off, or on PRO: any central can complete the handshake; users and passwords are then the access control
One app reading another app's traffic: a separate downlink key per Bluetooth connectionBrowser tabs that share one Bluetooth connection share its key
Recorded passwords: they never cross the link in plain text; stored as PBKDF2-HMAC-SHA256Weak passwords chosen by the users: the minimum is 8 characters - choose long ones
—BLE FOR ALL (off by default, if switched on), the Decent Scale service, USB serial and ESP-NOW: plain by design

Tests: the app side is tested against an emulation of the firmware protocol (handshake, signature check, wrong signature, replay, tampered tag, AAD direction, registration and proof, unregistered app refused, pinned key change). On a DIY scale (ESP32-C3) the full handshake takes about 1 second; registration, the registered-apps mode, refusal of an unregistered app and the USB recovery were tested there. The other scale variants follow.

10 · Implementation references

Where each part lives in the source

PartFirmwareApp
Handshake, wire format, replay, registered appsl16_seal_link.inolink_crypt.js
Identity key, signatures, envelopel16_seal.inoseal.js, pw_envelope.js
Licence and certificate checkl16_licence.inolicence.js
Password hashingl16_pwhash.ino, l16_register.ino—
Hooks into the BLE stacksend_queued_BLE_packets(), IncomingCallback::queue_it(), onDisconnectlinkcrypt_hook()
RevisionDateChange
1.12026-11-01link v2: signed one-time scale key, HKDF, 128-bit tags, key per connection, registered apps, PBKDF2 passwords, certificate check of the scale key
1.02026-11-01first issue