Free tech learning for everyone, from basics to pro

IoT SecurityIoT SecurityAdvanced

Device identity: certificates, secure elements, TPMs and provisioning

In short: Every device needs its own identity that cannot easily be copied. The best practice is a unique key pair per device, created and kept inside a secure element or TPM, with a certificate signed by a trusted CA. Provisioning is the process of giving devices that identity safely, at the factory or on first connection.

Why identity matters

When a message arrives saying "temperature 4.2 degrees", the platform must know which fridge sent it and that it really came from that fridge. When the platform sends "unlock door", the lock must know the command came from the real platform. Weak identity leads to spoofed data, hijacked devices and the inability to cut off one compromised unit without affecting all the others.

Shared secret vs per-device certificateShared secretSame key in every unitOne leak exposes allHard to revoke one deviceEasy to copyPer-device certificateUnique key pair per unitLeak affects one deviceRevoke a single certKey kept in hardware
Figure 1. A unique, hardware-protected identity per device limits the damage when one unit is compromised.

Many early products used one API key or password baked into every unit. Extracting it from one device let an attacker impersonate the whole fleet. The modern approach is a unique asymmetric key pair per device with an X.509 certificate, used in mutual TLS (mTLS), where both client and server present certificates.

Protecting the private key in hardware

OptionWhat it isTypical use
Secure elementA small tamper-resistant chip that generates and stores keys and performs signing inside itself; the key cannot be read outMicrocontroller sensors, locks, payment devices
TPM 2.0 (Trusted Platform Module)A standardised security chip (or firmware function) from the Trusted Computing Group with key storage, measured boot and attestationGateways, industrial PCs, Linux and Windows devices
On-chip secure enclaveA protected area inside the main processor, such as Arm TrustZone, holding keys away from normal codeHigher-end microcontrollers and system-on-chip designs
PUF (physically unclonable function)Derives a key from tiny manufacturing differences in the silicon, so no key is stored at allLow-cost chips needing anti-cloning
Software key in flashKey stored as a file, ideally with flash encryptionPrototypes only; easy to extract

The standard IEEE 802.1AR describes a useful pattern: an IDevID (initial device identity) installed by the manufacturer for life, and an LDevID (locally significant identity) issued by the owner's own CA once the device is deployed. The factory identity proves what the device is; the local one proves it belongs to you.

Provisioning

Provisioning a device identityGenerate keyinside securechipCSRpublic keyonlySignmanufacturingCARegisterin IoTplatformConnectmutual TLS
Figure 2. During manufacturing the private key is created inside the device and never leaves it; only the public key is certified.

Provisioning is getting an identity onto the device and registering it with the platform. Common approaches:

  • Factory provisioning: keys and certificates are created on the production line. Ideally the key is generated inside the secure element, and only a CSR (certificate signing request) leaves the chip.
  • Pre-provisioned secure elements: chip vendors can ship parts that already contain a key and certificate, and give you the certificate list to upload to your cloud.
  • Just-in-time or fleet provisioning: devices connect with a limited "claim" credential, prove who they are, and receive their long-term certificate on first contact.

The commands below show the CSR step in software for a lab gateway. On a real product the key generation happens inside the secure hardware.

# lab only: create a device key and a CSR with the device ID as the common name
openssl ecparam -name prime256v1 -genkey -noout -out device-0042.key
openssl req -new -key device-0042.key -subj "/O=Example Ltd/CN=device-0042" -out device-0042.csr

# the CA signs it (on the CA machine)
openssl x509 -req -in device-0042.csr -CA ca.crt -CAkey ca.key -CAcreateserial -days 825 -sha256 -out device-0042.crt

Running identity across the lifecycle

  1. Keep an inventory linking each device ID, certificate serial number and owner.
  2. Plan certificate renewal well before expiry, because devices in the field cannot be visited easily.
  3. Revoke a device's certificate (or remove it from the platform's allow list) when it is stolen, faulty or retired.
  4. Protect the CA private key in an HSM and use a separate intermediate CA for manufacturing.
  5. Use attestation, where available, so the platform can check the device's boot state as well as its identity.

Tip: put a device identifier, not a person's name or a MAC address the user can see, in the certificate subject. It keeps logs useful without leaking personal data.

Practice

Why should the private key be generated inside the secure element?
So it never exists outside protected hardware; nobody on the production line or in the supply chain can copy it.
What is the difference between an IDevID and an LDevID?
The IDevID is installed by the manufacturer and proves the device type and origin; the LDevID is issued by the owner after deployment and proves membership of their network.
A single device in a fleet of 50,000 is stolen. With per-device certificates, what do you do?
Revoke or block that one certificate in the platform; every other device keeps working.

Key takeaways

  • Each device needs a unique identity that cannot easily be copied.
  • Per-device key pairs with X.509 certificates and mutual TLS are the norm.
  • Secure elements, TPMs and enclaves keep private keys out of reach.
  • Provisioning should create the key inside the device and certify only the public key.
  • Track, renew and revoke certificates across the device lifecycle.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.