Signed firmware, verified on the device
SimpleOTA's Arduino and ESP-IDF clients verify an Ed25519 signature on the ESP32 before marking the image bootable, so in signed mode a tampered build never runs.
Over-the-air updates are only as trustworthy as the weakest link between your build server and the device. Checking a signature when firmware is uploaded is a good start, but the guarantee that actually matters is on the device: before the new firmware is marked bootable, does it carry proof that you approved it?
To make an ESP32 reject a tampered or unsigned update, sign each build with your own Ed25519 private key, pin the matching public key in the firmware, and set cfg.security_mode = SIMPLEOTA_SECURITY_SIGNED. The first-party Arduino and ESP-IDF clients then perform that check on the ESP32 itself. They hash the image while writing it, and mark it bootable only after the SHA-256 matches the offer’s checksum and the signature verifies against a pinned key.
How it works end to end
- You register a project signing key (Ed25519). Generate the keypair in your browser on the signing keys page, or locally with openssl, and register the public half. A browser-generated private key is shown once on that page and never sent to SimpleOTA, which only ever keeps the public key.
- In CI you sign the raw firmware binary (the
.ino.binor equivalent app image) and include the signature plus key_id in the upload manifest. - SimpleOTA verifies the signature at upload time against your registered public key. Bad or missing signatures are rejected before a build number is allocated.
- When a device is eligible for a signed artifact, the OTA check response includes
security_mode: "signed",signing_key_id,signature_algorithm, and the base64signature. - The client downloads the binary over the pre-signed URL. It feeds every byte into both the existing SHA-256 hasher and an incremental Ed25519 verifier (using a vendored Monocypher 3.1.3). Only if both checks pass does it finish the OTA write and mark the partition bootable.
The verification runs before the point of no return. A failed signature never touches the bootable partition. The device reports a failed status event with reason signature_invalid, which shows up inline on the device row in the dashboard and in the deployment timeline.
Enforcing devices and anti-downgrade
A device becomes enforcing when it both advertises security_mode: "signed" and has at least one public key pinned in its firmware. In signed mode simpleota_init() fails with ESP_ERR_INVALID_ARG when no key is pinned, so every signed-mode device that starts is enforcing. For those devices:
- A signed offer with a bad or missing signature is rejected before the download even starts (or during, before commit).
- An offer that lacks the signature fields is also treated as a signature failure. A compromised server or MITM cannot silently downgrade an enforcing device.
A device with no key pinned falls back to checksum-only verification, with a warning in the client log when a signed artifact is offered. A device that pins a key verifies every signed offer, whatever mode it reports. This keeps migration safe.
Migrating an existing fleet
Keys are baked into the firmware at compile time. The server’s compatibility rule for security_mode (exact match or blank on either side) plus that fact gives us a clean migration path with no risk of bricking devices that cannot yet verify:
- Build one last artifact with
security_mode: "basic". Inside that firmware, pin the key incfg.signing_keysand setcfg.security_mode = SIMPLEOTA_SECURITY_SIGNED. - Roll it out. Devices running the new code now report signed mode and pin the key.
- From that point forward, publish only signed artifacts. A device reporting signed will never be offered a basic artifact, and vice versa.
A device that reports basic is never offered a signed build it cannot verify. A signed device is never offered an unsigned build. Devices that miss the migration step stay put and keep reporting their earlier mode, which each device’s page in the dashboard shows. The client default, SIMPLEOTA_SECURITY_NONE, sends no mode, and the server keeps the last mode a device reported. A device that has never reported a mode is offered signed and unsigned builds alike, and without a pinned key it installs them after the checksum check alone.
Rotation is supported the same way: pin both the old and new key in cfg.signing_keys (up to two), start signing with the new key in CI, then revoke the old key on the server once the fleet has moved.
Using it
In your sketch or ESP-IDF app, set these before simpleota_init():
static const char *PUBKEY_PEM =
"-----BEGIN PUBLIC KEY-----\n"
"MCowBQYDK2VwAyEA...paste the PEM from the dashboard...\n"
"-----END PUBLIC KEY-----\n";
static const simpleota_signing_key_t keys[] = {
{"prod-2026", PUBKEY_PEM},
};
simpleota_config_t cfg = {};
cfg.token = PROJECT_TOKEN;
cfg.security_mode = SIMPLEOTA_SECURITY_SIGNED;
cfg.signing_keys = keys;
cfg.num_signing_keys = 1;
For rotation windows, add the second key to keys and set cfg.num_signing_keys = 2.
Create keys on the Firmware signing keys card of the project page (Advanced mode) or via the developer API. The dashboard upload form includes a “Sign it for me in my browser” helper that computes the signature locally with WebCrypto so the private key never leaves your machine. For production CI, sign with openssl and include the fields in the manifest:
SIGNATURE=$(openssl pkeyutl -sign -inkey private.pem -rawin -in firmware.bin | base64 -A)
Then put security_mode: "signed" and the signing_metadata object in your manifest before the POST to /api/v1/projects/.../artifacts/.
The GitHub Actions and GitLab CI examples in the docs include the signing step.
Full walkthrough, manifest examples, threat model notes (this is not Secure Boot), and Secure Boot composition guidance live in the signed firmware guide.
Defense in depth, and the layer that counts
Server-side verification is defense in depth. Device-side verification is what actually stops a tampered binary from running, even if your account, a CI token, or the storage bucket is compromised. Both clients take that path for every device you put in signed mode.
If you verify signatures in your own code, the built-in path can replace it. The contract is the same: the signature covers the exact bytes delivered by the pre-signed URL.