Storing a secure key in an embedded device's memory I am working on an embedded device which send/receive data and stored them in ciphertext mode (encrypted mode ). Now what's best approach for storing Keys (I used ARM CORTEX M series MCU) ?


Storing keys in the SRAM memory,in each booting sequence ,inject keys to the embedded MCU and store them in the SRAM memory. It is best way I think,then when MCU sense penetration (with tamper sensor or ...) it can erased SRAM quickly and reset itself. Disadvantage: if attacker success to pass tampers and access to device,how safe is SRAM memory (against code mining). I can't find any security ability for this memory in MCUs.
Generate keys and stored them in the flash memory in programming MCU. MCU flash memory's support CRP (code read protection) which prevent from code mining and with assist of its internal AES engine and RNG (random number generation) engine we can make a random key and encrypt flash memory and stored that random key in the OTP (one time programmable memory -a 128 bit encrypted memory), then in code execution we decode flash memory with RNG key and access to initial key and codes. Disadvantage: Keys stored in a non volatile memory, tampers will be useless and attacker have a lot of time to mine keys.
Stored key in the EEPROM memory,combination of 2 above approach, key stored in the non volatile memory but when tampers sense penetration EEPROM is erasable.
I consider LPC18S57FBD208(cortex m3 with 1MB of flash memory, 180MHZ, 136KB SRAM, 16KB EEPROM and a TFT LCD controller which i need to drive a 7" TFT LCD and AES 128 bit crypto engine) for that is there any other better suggestion?


part 2:
I am using a PCD (proximity coupling device or the card reader) like CLRC663 for reading RFID tags too.
connection between PCD and MCU is based on SPI,Becouse of unsecure and un-encrypted connection between them ,each attacker can sniff the connection and achieve the keys used for reading and writing to the RFID tags.
 what is your suggestion for this?
An issue with storing a key in RAM is, there are attacks that involve erasing the flash to unlock the device and then using a debugger to copy the RAM contents. Problem with internal EEPROM is the same as RAM unless you can lock it. External EEPROM is worse, unless you encrypt that.

My druthers would be store the key in flash and then lock the lock the processor to disable debugging access. If possible use a separate key for each and every device. If you copy the key to ram, make sure it's gets over-written when done.