# Encryption using the TPM echo "secret" | tpm2_rsaencrypt --object-context=0x81000001 --output=msg.enc # Encryption using the public key echo "secret" | openssl pkeyutl -encrypt -pubin -inkey key.pem -out msg2.enc # Decryption using the TPM tpm2_rsadecrypt --object-context=0x81000001 msg.enc tpm2_rsadecrypt --object-context=0x81000001 msg2.enc