Device authentication
A device connects to NervesHub over TLS and verifies the server’s certificate. The device then proves its own identity in one of two ways.Device certificates and signer certificates
Each device has two pieces of material:- A device certificate. Its common name is the device identifier.
- A private key. It stays on the device. It can live on the filesystem, in a NervesKey or in a TPM.
Certificates are pinned
NervesHub keeps each device’s certificates on file and looks up a connecting certificate by its fingerprint. The registered CA only matters the first time a certificate is seen.- If the certificate is on file, the device is allowed. Its expiry is not checked.
- If the certificate is new and self-signed, the device is refused. A self-signed certificate is only accepted when it was uploaded for the device.
- If the certificate is new but its public key belongs to a known device, the device has renewed its certificate. NervesHub checks that the common name matches the device, that a CA registered in the device’s organization signed it, and that the certificate validates. It then records the new certificate.
- If neither the certificate nor the key is known, NervesHub checks that the certificate has a common name, that a registered CA signed it, and that it validates. It then looks for a device with that identifier in the CA’s organization.
- If the device does not exist, the connection is refused, unless the CA has a just-in-time provisioning profile. In that case NervesHub creates the device.
- If the device already has a certificate on file with a different key, the connection is refused. A device is expected to use one public key.
- Otherwise NervesHub records the certificate and allows the device.
Shared secrets
With a shared secret the device sends its key and a signature over its identifier, made with the secret. The secret is not sent. NervesHub accepts a signature for 90 seconds, so the device clock matters. A product key is shared by every device in a product. A device holding one can connect as any identifier in that product, so one leaked device exposes the whole product. A device key authenticates one device only. See Shared secret.Firmware signatures
For fwup firmware, signing is built intofwup. Signing keys are Ed25519 key pairs, not certificates, and they are not part of the TLS chain. Other firmware formats use their own key types. See Firmware signing.
The signature is checked in two places:
- On upload. NervesHub checks the firmware against the signing keys registered with your organization, on its Signing keys page.
- On the device. Before applying an update, the device checks the signature against the public keys it holds.
Where the device gets its public keys
A device takes its public keys from one of two places:-
Firmware configuration. Keys listed in
fwup_public_keysare compiled into the firmware. -
NervesHub, when the device connects. A device with no
fwup_public_keys, or withrequest_fwup_public_keys: true, asks NervesHub for the organization’s keys on connect.
nerves_hub_link 2.14.0 or later, the device rejects firmware that your key did not sign, even if it came from NervesHub. With keys requested on connect, the device trusts whichever server it connected to.
From nerves_hub_link 2.13.0, a device refuses firmware and archives it cannot signature-check. A device with no keys configured that receives none from NervesHub stops taking updates until it has some. From 2.14.0, a device ignores keys NervesHub sends unless it asked for them. Earlier versions let keys sent by NervesHub replace the configured ones. The details are in Firmware signing.

