I'm developing a product with simple Cortex-M MCU (with no OS on board, firmware on bare metal) and internet connectivity via external module.
How do I make it secure? More specifically, how do I protect the data that is sent to and from the remote server?
My thoughts are:
- I can't assume that firmware can be protected; since all users will have physical access to it - they eventually will find a way to dump it. Flash-read protection won't work, encrypting the flash won't prevent dumping it from RAM or something else.
- Using external encrypted flash/eeprom won't work for the same reasons.
- Relying on HTTPS on the external chip won't be enough because external module is connected to the MCU via UART and can easily be sniffed or tampered.
I have very basic understanding of cryptography but I know that I shouldn't invent my own, so I presume I'll have to encrypt all the data that is sent to the server by some well-known public key crypto. Probably using session keys. But that still requires using one master secret key on the device and I don't know how to store it securely due to 1).
Any ideas? Is there a well-known bulletproof solution?
Or I should just generate random keys for every device (not derived from device ID or anything like that)? So if one device is compromised it won't affect the whole network - and that's about it?
UPD: Clarification - I don't want to allow device owner to impersonate other devices and upload false data (about other devices) to the database.