How NervesHub decides
NervesHub keeps device certificates on file.- The certificate is on file. The device is allowed. NervesHub does not check the expiry of a certificate it has on file.
- The certificate is new, and a CA signed it. NervesHub looks up the signing CA among the registered certificate authorities and validates the certificate against it. The certificate’s common name must match the identifier of a device in the CA’s organization. NervesHub then records the certificate for that device. If no such device exists, the connection is refused unless the CA has a just-in-time provisioning profile.
- The certificate is new, and it is self-signed. The connection is refused. A self-signed certificate is only accepted when it is already on file for the device.
A deleted device is refused, whatever certificate it presents.
Requirements
- The device certificate’s common name is the device identifier.
- A CA-signed device certificate needs an Authority Key Identifier. NervesHub matches it against the Subject Key Identifier of the registered CA, so the CA certificate needs a Subject Key Identifier.
- Registering, editing and deleting certificate authorities need the Manage role or higher from NervesHub 2.5.3. Earlier versions need Admin in the web UI.
Register a certificate authority
You register the CA certificate only. NervesHub never sees the CA private key. To prove you hold the key, you sign a short-lived verification certificate with it.- CLI
- Web UI
Generate a CA on your machine and register it:The key is used locally to sign the verification certificate.
nh ca generate writes the key and certificate to <data-dir>/ca/<org>/, named by the generation time, for example 2026-06-11-16-41-10-cert.pem and 2026-06-11-16-41-10-key.pem. The data directory defaults to ~/.nh. The common name defaults to the organization name. Change it with --name, and the validity with --valid-for.To register a CA you already have, give its certificate and key:Check expiration
By default NervesHub does not check the CA certificate’s validity period when it registers a device certificate. Turn on Check expiration to stop an expired CA from registering new device certificates. You cannot turn it on while registering a CA that has already expired.Create device certificates
nh device certificates generate creates a private key (secp256r1) on your machine. What else it creates depends on the flags:
<data-dir>/certificates/<org>/, named <identifier>-<timestamp>-key.pem and <identifier>-<timestamp>-cert.pem. --valid-for sets the validity, for example 90d. The default is 31y.
--upload registers the certificate with the device, so the device must already exist. To upload a certificate from another source:
nh device import creates the devices and their certificates from the manifest. See Devices.
Configure NervesHubLink
Select theLocalCertKey configurator. It is never chosen automatically.
certorcertfilein thessloptionnerves_hub_certin the Nerves key-value store, as PEMcert.pemin thedata_pathdirectory, which defaults to/data/nerves-hub
keyorkeyfilein thessloptionnerves_hub_keyin the Nerves key-value store, as a PEM EC private keykey.pemin thedata_pathdirectory
/data/nerves-hub/cert.pem and /data/nerves-hub/key.pem.
Put the files on the device
NervesHub andnh do not copy the certificate and key to the device for you. /data is the device’s application data partition, so files there are not part of the firmware image and you write them once per device. Two ways that need no extra tooling:
-
A device on your bench. If the firmware includes an SSH server with SFTP, copy the two files over SFTP.
nerves_sshstarts an SFTP subsystem by default.Use the host name or address your device answers on in place ofnerves.local. -
A device that already connects to NervesHub. A device that connects another way, for example with a shared secret, can be given the files over the remote console. Its firmware needs
remote_iex: true. Rename your copies of the files tocert.pemandkey.pem, then drop each one on the device’s Console tab.nerves_hub_linksaves a dropped file under its own name in thedata_pathdirectory, which is whereLocalCertKeylooks. This needsnerves_hub_link2.1.0 or later. You can also write the files from the console prompt:Then send the device firmware that selectsLocalCertKey.
/data alone. Writing a complete image does not: on the official Nerves systems, such as nerves_system_rpi4, the complete task that mix burn runs invalidates the application data partition so that it is formatted on the next boot. After you burn an SD card again, copy the files again.
To use other paths:
Check that it works
Open the device’s Settings tab. The Certificates card lists the certificate with its serial, the CA that signed it, its validity and when it was last used. The CA’s page shows how many devices use a certificate it signed, by product. If the device does not connect, check:- The CA is registered in the same organization as the device.
- The certificate’s common name is exactly the device identifier.
- The device exists and is not deleted, or the CA has a just-in-time provisioning profile.
- A self-signed certificate has been uploaded to the device.
Limits
- One key per device. A device that has a certificate on file cannot register a certificate with a different public key by connecting with it. Upload the new certificate instead.
- Renewing a certificate with the same key is automatic. When a device presents a new certificate for a public key NervesHub already knows, NervesHub records it if the common name still matches the device and a CA registered in the device’s organization signed it.
- Deleting a certificate does not block a CA-signed device. When a device has no certificate on file and its CA is still registered, NervesHub records its certificate again the next time it connects. To keep a device out, delete the device. See Devices.
- Certificates stay with a device when it moves to another product or organization.

