Content-Type: multipart/mixed; boundary="===============7407193253532935093==" MIME-Version: 1.0 From: muthu.smk at gmail.com Subject: [tpm2] Usage of openssl command line API as library function along with tpm-tss engine Date: Tue, 28 Apr 2020 11:24:39 +0000 Message-ID: <20200428112439.2763.51972@ml01.vlan13.01.org> List-ID: To: tpm2@lists.01.org --===============7407193253532935093== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi , I would like to know how to use the below mentioned command line openssl AP= Is as library call inside a "c" program. I could see a "helper crypto functions as ESYS API . from this block diagra= m https://github.com/tpm2-software/tpm2-tss/blob/master/doc/TSS_block_diagr= am.png I dont want to use TPM ESYS/other TPM API to perform encryption/decryption = of keys generated by TPM . Instead need to use openssl s/w library with the= input of tpm generated key and generated a "encrypted file" and "decrypt" = it back. Ex: I would like encrypt the private key(priv_key) and random number (input= _random_key) as input to below openssl api and generate a encrypted output = file and vice versa for decryption. = Encryption: #openssl enc -aes-256-cbc -salt -in priv_key -out output_key -k input_rando= m_key "priv_key" is the output key that has been created using tpm2tss-rsa-genkey= () API - using TPM "input_random_key" is the output key generated using Esys_GetRandom() API -= using TPM "output_key" will be encryption file generated as output of this openssl co= mmand line API - using pure S/W openssl which understanding tpm generated k= eys and works via tpm2-tss/tpm2-tss-engine. = Vice versa of below decryption , need to use below command line API as libr= ary function and achieve the expectation. Decryption: #openssl enc -aes-256-cbc -d -in output_key -out decrypted_output_key -k in= put_random_rum = Now the output_key should have the content of "priv_key" which has been use= d as input to above openssl API during encryption. Thanks, --===============7407193253532935093==--