We're contemplating to use the following design to securely identify IoT devices from the cloud, and we would like to know if anybody would see major flaws in it.
The design is based on the use of a 4096 bits RSA key.
The public key would be included in the IoT device firmware.
At startup, the device will generate a random 256 bits ID (using a specific chip with true random capabilities or entropy from the user pushing buttons on the device). This ID will not change until the device is reset, and will be kept in RAM.
At first connection, the device will register in a cloud infrastructure sending an encrypted message containing the ID.
Then the device will send encrypted messages containing the ID and the payload. Cloud infrastructure will decrypt the message and will be ensured that it comes from the same device that had registered with the given ID in the first time.
JTAG capabilities are supposed to be disabled on the device. Potting can be considered.
Firmware is supposed to be genuine (user has the ability to flash his device before using it).
In those conditions, do you think there is a way for an attacker with access to the device to steal the ID?
Also another question is which pseudorandom generator could we use (library?) for the RSA encryption?
Thank you very much!