Super Secret Storage in a PICO
/I wanted to do some more work on code I wrote in Micro Python. But I couldn’t find it. Turns out that the latest version was in the PICO2 device inside the light I’d made. This can be a problem when writing code on a device. You end up with the source on the device and nowhere else. Of course you could have a rigorous code management regime that ensures that you extract and store all the code you’ve written at the end of a programming session. Yes, I guess you could do that….
Anyhoo, I managed to get my code back off the PICO2 even though I’d subsequently re-flashed the device with a C++ program. It seems that flashing a C++ program into a device doesn’t overwrite the part of the EEPROM where Micro Python stores files. And installing Micro Python doesn’t wipe the EEPROM at all. So, if you want to store super secret data you can do this:
Write a little Micro Python that takes your secret data, does a bit of encryption and drops it into a file on the device.
Then reflash the device with a C++ program that does something different and put it into something around the house, perhaps a light.
Now, if you want your super-secret data back you just have to load the Micro Python program that decrypts the data and run it.
Anyone who finds your device and takes a look at the EEPROM will just see random rubbish. They’d need to have your program (and maybe a key) to get it back. You could even use public/private key encryption so that you can send data to someone else inside a gadget you’ve made for them.
This technique is not restricted to PICO (although I’ve not tested it). It should work on ESP32 too. I’m sure that there are much better ways of hiding data than this, and I personally don’t have any top secret data to store (although this is of course what any superspy would say…)