We are working on a sensor that is going to be collecting data, passing it to a smart phone which then stores the data in a database. I need to be able to verify that the hardware is legitimate, so that the data that gets stored in the database is legitimate too.

My current thought is to have a secret key stored on the hardware, which gets encrypted and sent when the hardware first connects. If authentication fails, the following data is rejected.

Is there a standard for authenticating hardware, to prevent malicious hardware impersonating a real device?

  • a phone implies a rather short range, won't you be able visually to tell if the hardware has been changed? – dandavis Jun 2 '17 at 3:50
  • The app will be publicly available, I'm thinking of this question in terms of someone with malicious intent impersonating legitimate hardware to hit the database. – Lukeyb Jun 2 '17 at 3:53

This sounds like a job for public key crypto. Sign messages from the devices worth an embedded private key. Then verify in the mobile app and on the server they report to.

I would propose:

  1. Embed a unique private key in each hardware sensor.
  2. Provide a certificate from a private certificate authority (that you create) with the device.
  3. Put the CA's public key in the phone app.
  4. Use the private key in the sensor to sign every data event, and include the identity of the sensor and the date/time, and a unique identifier in every event (to prevent replay attacks). Also include the certificate with the event.
  5. Using the signature and certificate, the phone app can verify the event comes from a legitimate sensor, without having any way to tamper with the event.
  6. The app passes the entire event+signature+certificate to your central server, which can use the unique ID, and date/time to verify that the event hasn't been duplicated.

You also need to consider your attacker: Are they only going to look at the phone app, or will they try to subvert your sensor. Can they alter the readings before they get signed (e.g. hair-dryer on a thermometer :-) )

| improve this answer | |
  • 4
    Yes, but do it right: Do not use the same key in every hardware device, rather use a signed individual key, that the phone can check against a trusted public CA key. Not like this: thehackernews.com/2015/11/iot-device-crypto-keys.html – Marcel Jun 2 '17 at 6:44
  • Ok, how does this sound: Each piece of hardware will contain a different embedded key and the smartphone will have access to a list of symmetrical keys for each piece of hardware. The hardware will identify itself to the phone, the phone will encrypt a random message and send it to the hardware, the hardware will decrypt it and respond with the decrypted message. The phone will check if the response matches. – Lukeyb Jun 2 '17 at 8:38
  • Use asymmetrical keys, not symmetric. – Joe Jun 2 '17 at 16:09
  • Right, that makes sense. – Lukeyb Jun 6 '17 at 2:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.