I'm developing a device where I need to store a symmetric key that the customer uploads to the device. The device is offline at all times, so centralized storage in HSM is not an option. The device does not have a key-pad. The key is used for data encryption/decryption when the device is active. The key cannot be stored in clear text in flash.

I'm just learning about cryptography, so bare with me :) My thinking is that I need to key-wrap the symmetric key to securely store it in flash and unwrap to RAM when in use. To have a secure key to key-wrap with, my thinking is to use a TPM 2.0 chip, like this one, on the device.

My questions are:

  • What would a common approach to this issue be?
  • If my approach is feasible, how secure is it exactly? What would prevent an attacker from soldering of the TPM chip and use it to unwrap the symmetric key?
  • 1
    $\begingroup$ Can the device be physically accessed by threat actors? $\endgroup$
    – A. Hersean
    Sep 26, 2022 at 12:33
  • $\begingroup$ Yes, it is a handheld device that may be stolen or otherwise obtained by threat actors. $\endgroup$
    – BenjaminK
    Sep 26, 2022 at 16:12

2 Answers 2


Your approach is a good one. However, you must ensure that the TPM is not on a separate chip on the device, because communications on the bus between the TPM and the CPU happen in clear text.

Another similar solution is to use a TEE which is like a secured mini-CPU inside the main CPU. ARM calls their TEE "TrustZone", it's available on most Cortex CPUs and licensed by AMD for their Ryzen and EPYC CPUs.

When used to store encryption keys, TPMs and TEEs can use the keys to perform the encryption and decryption operation in the secured subsystem, preventing leaks of the key in the RAM.

Some operating systems, like Android, provide APIs to use the TEE to securely store encryption key and perform cryptographic operations.

However, keep in mind that this will not prevent threat actors with access to very expensive equipment and expert engineers to fetch a key directly in the silicon. That would be a destructive operation to the product.


You could possibly use a device with an "embedded HSM" - there are many such devices nowadays in the automotive realm.

Examples: ST Micro Infineon Renesas

These devices provide a separate microcontroller which has an AES accelerator (amongst other features). This microcontroller also has seperate flash and RAM from the main host micro.

You can look at the Evita project for some of the (quite ancient :) history.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.