Posts

Showing posts with the label crypto

ESP-IDF Tutorial: A proposal for verifying data from embedded devices

I'll soon return to the basic tutorials on the ESP-IDF. This tutorial is a one-off on a topic I find interesting. "How can I validate that data from an embedded device came from that device?" This sounds like a job for public key cryptography. I'm no crypto engineer by any means, but I can certainly use libraries. The ESP IDF ships with mbedtls , which is a surprisingly comprehensive suite of crypto. The library is owned by some people called ARM mbed, so I am guessing you can run it on any ARM. Here's the scheme: Create a public/private key pair (RSA in this example) on the embedded device and store it in memory. In our case in the SPIFFS file system. Send the public key to the server Hash and sign every data packet you will send the server with the private key. Embed the signature as a header in the HTTP request Validate the signature on the server when receiving data The remainder of this post will show you how to do those things. The code is kind of intense i...