The private key associated with your Device CA Certificate is never shared with or seen by NervesHub. You register only the public CA certificate. NervesHub uses it to verify device certificates at connection time — your signing key stays entirely under your control.
How It Works
When a device connects, it presents its device certificate along with the CA certificate that signed it. NervesHub checks whether the CA certificate is registered to your organization, verifies the device certificate’s signature chain, and — on the device’s first-ever connection — automatically creates a device record in your product. Subsequent connections are verified against the registered CA without any manual intervention. This flow means you can pre-provision device certificates at manufacturing time and ship devices that self-register on first boot.Create a Device CA Certificate
Use thenh CLI to generate a new CA certificate and its associated private key:
Generate with OpenSSL (existing CA infrastructure)
Generate with OpenSSL (existing CA infrastructure)
If you already operate a PKI or want to integrate with an existing CA, you can generate a compatible CA certificate using OpenSSL:You can use this
ca_cert.pem with the nh ca upload command in the next step.Register Your CA Certificate with NervesHub
Upload your CA certificate so NervesHub can verify device certificates signed by it:Registering and removing certificate authorities requires the
admin role in the organization.Provision Device Certificates
Generate a certificate for a specific device using thenh CLI. The device identifier (e.g., a serial number) becomes part of the certificate’s common name:
Generate device certificates programmatically
Generate device certificates programmatically
For high-volume provisioning, generate certificates in Elixir using the
x509 library:Configure NervesHubLink
Pointnerves_hub_link at the certificate and key files on the device filesystem. These paths should live on a partition that persists across firmware updates (e.g., /data):
First Connection and Auto-Registration
On the device’s first connection to NervesHub, the following happens automatically:1
Device presents its certificate chain
nerves_hub_link sends the device certificate and the CA certificate during the TLS handshake.2
NervesHub verifies the CA
NervesHub checks whether the CA certificate is registered to your organization. If it is not recognized, the connection is rejected.
3
Device is auto-registered
If the CA is recognized and the device does not yet exist in your product, NervesHub creates a new device record using the certificate’s common name as the device identifier.
4
Subsequent connections are seamless
On all future connections, NervesHub verifies the certificate against the registered CA. No additional steps are required.
Revoking a Device
To prevent a specific device from connecting, navigate to the device in the NervesCloud UI and disable or delete it. Because each device has a unique certificate, revoking one device has no effect on the rest of your fleet.Next Steps
For the highest level of security — where the private key is physically protected and cannot be extracted even if a device is compromised — consider upgrading to hardware-backed key storage:NervesKey Hardware Security Module
Store device private keys in an ATECC508A/608A hardware security module. The key never leaves the chip, making it ideal for large production fleets.

