I am working in designing of a prepaid energy meter. One of the most things I should store are (private key, credit and cumulative energy).
The private key is stored only once. The credit and cumulative energy are stored every few hours or when the power goes off (it is normal in my situation).
I was using a flash memory in my previous design and I discovered its disadvantages in such application. I got some memory corruption and deletion when writing while the d.c supply is going down to 0.
If I stored the credit in the EEPROM, any one can access it. The microcontroller (dsPIC33CH128MP508) don't come with internal one.
I have only few seconds (~2s) to store these data before the power supply dies. My clock is 4MHz and the dsPIC is 16bit. Therefore, if I need to encrypt the data in EEPROM it should not cost more than 2 seconds.
My question is: How to overcome the security issue when storing in external EEPROM in such applications?