Device Certificates
Besides a registered key (see Device Provisioning), a device can sign in with an X.509 client certificate over mutual TLS. The device proves it holds its private key during the TLS handshake itself, so there is no token to steal or replay. Certificates also fit naturally if your devices already get certificates from your own certificate authority on the production line.
A device can use either method, or both while you migrate.
Two ways to get certificates
Section titled “Two ways to get certificates”- Issued by Espoirnet: you send a certificate signing request (CSR) from the device’s page and download the certificate. Good for a handful of devices, or when you don’t run your own CA.
- From your own certificate authority: you register your CA once, and every certificate it issues to your devices is accepted. Good for fleets whose certificates are made in the factory.
Issue a certificate from the console
Section titled “Issue a certificate from the console”-
On the device, or wherever its key is created, generate a key and a CSR:
Terminal window openssl ecparam -name prime256v1 -param_enc named_curve -genkey -noout -out device.keyopenssl req -new -key device.key -sha256 -subj "/CN=device" -out device.csrThe key must be EC P-256. Keep
device.keyon the device; only the CSR is sent to Espoirnet. On a microcontroller, the Embedded C SDK creates the key and the CSR on the device for you. -
On the device’s page, under Certificates, choose Issue Certificate and paste in
device.csr. -
Download the certificate and the CA chain, and install both on the device next to
device.key.
Certificates are valid for one year. Issue a new one before then; the device’s page shows when each certificate expires. Espoirnet sets the certificate’s identity itself, so whatever names you put in the CSR are ignored.
Connect with a certificate
Section titled “Connect with a certificate”| Broker | mqtts://rayon.espoirnet.io:8883 (TLS is required for certificates) |
| MQTT client ID | /{accountId}/{projectId}/{deviceId}, same as with a key |
| MQTT password | none; the certificate replaces it |
The device presents its certificate during the TLS handshake. If the certificate comes from your own CA through an intermediate, send the intermediate certificate(s) along with the device certificate.
With the Node.js SDK:
const device = new EspoirnetDevice({ accountId, projectId, deviceId, brokerUrl: 'mqtts://rayon.espoirnet.io:8883', certificate: { certPath: './device.crt', keyPath: './device.key' },})await device.connect()The Embedded C SDK supports certificate login too.
Sessions last at most a day. A certificate-authenticated connection is closed after 24 hours at the latest, and the device simply reconnects; the certificate is checked again each time. The SDK reconnects on its own schedule shortly before that, so the device stays online without interruption.
Use your own certificate authority
Section titled “Use your own certificate authority”Owners and admins can register a CA under Settings → Certificate Authorities. Only the CA’s certificate is stored; its private key never leaves your systems.
-
Choose Add CA, then Get Verification Code. The code is valid for one hour and works once.
-
Prove you control the CA by signing a short-lived verification certificate whose common name is the code:
Terminal window openssl ecparam -name prime256v1 -param_enc named_curve -genkey -noout -out verify.keyopenssl req -new -key verify.key -sha256 -subj "/CN=<verification code>" -out verify.csropenssl x509 -req -in verify.csr -CA your-ca.crt -CAkey your-ca.key -CAcreateserial -days 1 -sha256 -out verify.crt -
Paste the CA certificate (
your-ca.crt) andverify.crt, give the CA a name, and choose whether it’s trusted for the whole account or one project.
The CA certificate must be a CA (with certificate-signing usage) and currently valid, with an EC P-256, EC P-384 or RSA (2048-bit or larger) key. Signatures must use SHA-256 or stronger. The same CA can only be registered once.
Requirements for device certificates from your CA
Section titled “Requirements for device certificates from your CA”- Identity. Each certificate must carry the URI subject alternative name
rayon://{accountId}/{projectId}/{deviceId}, and it must match the client ID the device connects with. This stops one device’s certificate from being used to sign in as another device. - The device must already exist in the console before it can connect.
- Client authentication. If the certificate lists extended key usages, they must include client authentication.
- Signed with SHA-256 or stronger. Certificates signed with SHA-1 are refused.
An example for a factory script, signing a device CSR with your CA:
cat > device.ext <<'EOF'subjectAltName = URI:rayon://<accountId>/<projectId>/<deviceId>basicConstraints = CA:FALSEkeyUsage = digitalSignatureextendedKeyUsage = clientAuthEOF
openssl x509 -req -in device.csr -CA your-ca.crt -CAkey your-ca.key -CAcreateserial \ -days 365 -sha256 -extfile device.ext -out device.crtRevoking certificates
Section titled “Revoking certificates”- One device: on the device’s page, Certificates → Revoke. Within a minute every certificate issued to that device so far stops working, whether Espoirnet issued it or your own CA did, and the device is disconnected. Certificates issued afterwards work as normal.
- A whole CA: remove it under Settings → Certificate Authorities. Within a minute, devices using certificates from that CA can no longer connect, and connected ones are disconnected.
- Deleting a device revokes all of its certificates and keys as well.
Next steps
Section titled “Next steps”- Device Provisioning covers devices, sensors and key-based authentication.
- Telemetry covers publishing readings once connected.

