I simply want to store one 32 bytes long symmetric key persistently in the NV storage of the TPM and after a power-cycle, use it (without getting it out of the TPM) to encrypt small-sized data.
I've tried to do that in two different ways:
1)
2)
I scanned TCG's Specs and I even read this free practical guide to TPM2.0 and haven't found any clues to my problems.
What am I missing?
TPM2_EncryptDecrypt
is meant to be used with symmetric keys. Pass the key handle you obtained with the TPM2_EvictControl
as the @keyHandle
parameter, and set the decrypt
parameter appropriately. Set mode
to TPM_ALG_NUL
so the default mode is used.
Keep in mind that it's not practical to use the TPM for encrypting large amounts of data (what symmetric keys are typically used for).