0

I have a MCU-based design that essentially controls other hardware and this MCU is controlled through an app. I was hoping someone could help me figure out how to secure this communication between the app and MCU. I've tried something like SipHash which essentially appends a hash of the message with a plain text message and this is particularly useful against man-in-the-middle attacks. The other method I tried is encrypting the command packets between the two using AES. However both these methods require storing a secret key on the app and the device. Assuming this goes into production, there will be multiple devices and app downloads. It would be quite insecure to have the same key on all the MCU devices. Is there a way to get a random key on the device and then somehow have the app get this key?

  • What kind of "secure" do you want? Integrity and/or authenticity and/or confidentiality? How many app instances should communicate with a single MCU? Is it viable to assign a random key to each device during production and hand it to the customer in printed form to enter into the app? – JimmyB Jul 18 '16 at 7:50
  • @JimmyB: The main function is to prevent anybody using network scanners to read packets between the app and the device and then spoof as either one. Not sure what you mean by "number of app instances". The initial key exchange would happen once and then using the key multiple apps (on multiple phones) would be able to control a single MCU. Now that I think about it, I could create a QR code for the key that the app can scan and get the key. This would mean that there cannot be random keys across devices. – hpb Jul 18 '16 at 16:24
  • You need full-blown encryption in some form to do this right. Tacking on a hash alone is useless; if I was the MITM I'd just rewrite your message, re-hash it, tack my new hash on, and the MCU wouldn't know any difference. There must be a pre-shared key of some sort involved. AES with a pre-shared key is probably going to be your best bet. – Jody Lee Bruchon Jul 21 '16 at 11:00
-1

You can use diffie hellman algorithm (https://en.wikipedia.org/wiki/Diffie%E2%80%93Hellman_key_exchange) to share a secret over a public chanel. In your case I think you should also have a central server that keeps track of who owns which device. Each device should have a unique identifier and when a user purchases a device there should be a registration process that marks the device as owned by that user in the central database.

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.