CivicTechTO / tRacket-sensor

Design files and source code for the tRacket noise sensor
https://tracket.info
7 stars 0 forks source link

Encryption for stored information #6

Closed tcsullivan closed 7 months ago

tcsullivan commented 9 months ago

The device stores the user's WiFi SSID, passkey, and device ID. The API token is in firmware too. Some or all of these should be encrypted for the sake of security.

The encryption branch has a simple implementation of AES encryption for the WiFi passkey. It uses the device's ID as an encryption key.

tcsullivan commented 8 months ago

Let's just encrypt the WiFi credentials and the API token (as that will eventually be device-specific). I'm hoping we can find a hardware encryption feature that will make it difficult to extract these from a device.

tcsullivan commented 8 months ago

Merged main into encryption to bring it up to date, and encrypted the SSID.

I don't know if there's anything we can do to make the encryption key truly "secret". The best solution I have is physical: If the reset button is not held down at startup, then immediately disconnect the serial/USB pins by setting pins 18 through 21 to OUTPUT. This way, we could limit a hacker's ability to dump the microcontroller's memory to decrypt our secrets.

tcsullivan commented 7 months ago

I've discovered that we can use the HMAC with eFuse memory to do this encryption without exposing the key. Working on this now. Might also need to consider secure boot to fully ensure that a user can't extract the key or decrypted data.