Hi Dawn,
there are code samples in the OpenSSL documentation.
First, you need OSSL_PROVIDER_load as shown here
https://github.com/tpm2-software/tpm2-openssl/blob/master/test/selftest.c
Then, to load EVP_PKEY from the TPM you need the OSSL_STORE* functions and the shipplet from here
https://github.com/tpm2-software/tpm2-openssl/issues/26#issuecomment-1057929799
Finally, I believe the OpenSSL routines to use for file encrypting are EVP_Seal* and EVP_Open*
https://wiki.openssl.org/index.php/EVP_Asymmetric_Encryption_and_Decryption_of_an_Envelope
these work exactly like Steven suggested.
I you face any troubles, just let me know.
Petr
______________________________________________________________
> Od: dawn.howe@alten.com
> Komu: tpm2@lists.01.org
> Datum: 15.06.2022 21:29
> Předmět: [tpm2] Re: Ecrypting and decrypting a file using a TPM2
>