[tpm2] Re: Ecrypting and decrypting a file using a TPM2

dawn.howe at alten.com Wed, 15 Jun 2022 19:29:28 +0000
Newsgroups dev.linux.lists.tpm2
Message-ID <[email protected]>
Petr:
Thanks so much for the suggestion.  I was able to encrypt and decrypt my files based on the pattern in https://github.com/tpm2-software/tpm2-openssl/blob/master/test/cipher_aes128_cbc.sh.  I think I can accomplish what I want with some system calls to openssl.

The code I'm writing is in C++. Is there a way to replace the system call to openssl with a c++ library call (perhaps that takes a provider parameter)?

i.e. Replace the following with a C++ library call 
openssl enc -provider tpm2 -aes128 -e -K $KEY -iv $IV -in testdata -out testdata.enc

I'd love to see a code sample if you have one.

thanks,
Dawn