I’m exploring the possibility of using the RSA private key stored in my P1’s internal flash memory to do some custom encryption. Reading various forum posts about RSA it seems it should be possible although the heap constraints may be a challenge.
However an issue I’m running into here is that I’m not able to figure out a way to access the device’s private key from my user firmware. Is that possible?
I’ve found the API exposed to allow setting the private key, “System.set” - but there’s no corresponding “System.get”.
The memory map here makes it seem like I should be able to read it but I haven’t found any examples of people doing it: https://docs.particle.io/datasheets/p1-datasheet/#memory-map
I’m set up with the local build toolchain / Eclipse, so I was able to add the “fetch_device_private_key()” function from ota_flash_hal_stm32f2xx.h to my main.cpp file and get it to compile, but it won’t link since fetch_device_private_key is an undefined symbol in the user space firmware.
Same issue with trying to use the lower-level “dct_read_app_data()” function.
Is it possible to get either of those functions to compile with the local toolchain so they are available for the user space firmware? Or is there some kind of hack I can use that will just pull the data I’m looking for from flash?
Thanks in advance!