# Embedded devices Authentication, Integrity and Confidentiality

Embedded devices send messages to the server. The server occasionally sends messages to individual devices(Reboot, upgrade firmware etc)

After some research this is my ad-hoc solution:

1) Each devices gets a unique id(like MAC address) and a public/private key pair when first programmed at the factory. The server will have a copy of the unique id and the public key for each device.

2) The server has a public certificate.

3) When the device wants to send a message: If it wants confidentiality it can encrypt the message using symmetric encryption and the key,salt etc will be encrypted with the servers public key. Then it can use it's private key to digitally sign the message which gives the message Authentication and Integrity.

4) The same process could be reversed when the server wants to send a message to the client.

5) Timestamps will be part of the message to resist replay attacks. The time needs to be fairly synchronized (within a minute of each other) for data collection purposes.

Are there any flaws with doing it this way? The devices are fairly resource constrained so have to pick fast public key algorithms.

• Probably there is no flaw, but some questions remain. You claim that the server has a copy of each device info, does it mean that the number of device is fixed at the start up of the system and no device can be added or retired in the future? What happens if a particular device is compromised. The server has a public certificate ? Does the devices are also all be certified by the same autority? The management of Pub Keys in this case seems too restricted. – Robert NACIRI Dec 25 '14 at 22:39
• @RobertNACIRI: When the devices are programmed with public/private key pairs. The public keys are recorded and sent to the server by the admin. The devices are programmed in batches. The server certificate will be CA issued(for revocation and easy verification etc). The client key pair is generated at the factory. A bit like generating GPG key pairs. [Note: This was posted by the OP as a non-answer, because they've apparently lost access to their original account.] – Ilmari Karonen Dec 29 '14 at 1:37

I do not see an immediate flow, but the public-key cryptography seems to be an overkill in your system with a single server. As long as the server keeps some keys of each device $D$, it may as well keep a single symmetric key $K_D$, and use a single authenticated encryption scheme $\Pi$ with key $K_D$, for instance, AES-GCM. This would simplify your system significantly, and you would not need certificates. You would not even need random number generator, except for the key generation.
• the public-key cryptography seems to be an overkill in your system. With a single symmetric key (remember these are embedded devices), attacking a single device means you own the 1K/10K/100K/1M deployed devices, no? Plus, remember many of these embedded devices are small, resource-constrained, and often unattended (translation: easy targets). – Dan Dec 26 '14 at 4:23