I was going through the ESAPI APIs , I have hosted the TPM simulator on my Ubuntu 22.04 desktop and trying to generate the symmetric private key from one C program and another C program using the same key for encryption and decryption simple plain text.
So far I went through this example <https://github.com/tpm2-software/tpm2-tss/blob/master/test/integration/esys-rsa-encrypt-decrypt.int.c>
And I did small compilation using -ltss2-esys the Development environment looks fine.
The generated private key where it will be stored?
/* Alternative for simulator */
// char *name = "mssim:host=127.0.0.1,port=2321";
where I can view the key I have simulator , no Hardware TPM usage as if now.
Open for any FAPI suggestions also, yet I am in Learning phase.
small console output
amp@amp-virtual-machine:~$ openssl rand -engine tpm2tss -hex 10
engine "tpm2tss" set.
8d76bc5c449c894a019b
amp@amp-virtual-machine:~$ sudo -u tss G_MESSAGES_DEBUG=all tpm2-abrmd
[sudo] password for amp:
** INFO: 06:35:41.119: tabrmd startup
** (process:6838): WARNING **: 06:35:41.121: tcti_conf before: "device:/dev/tpm0"
** INFO: 06:35:41.121: logging to stdout
** (tpm2-abrmd:6838): WARNING **: 06:35:41.121: tcti_conf after: "device:/dev/tpm0"
** INFO: 06:35:41.122: entering g_main_loop
** INFO: 06:35:41.124: init_thread_func start
** (tpm2-abrmd:6838): DEBUG: 06:35:41.127: random_class_init
** (tpm2-abrmd:6838): DEBUG: 06:35:41.127: opening entropy source: /dev/urandom
** (tpm2-abrmd:6838): DEBUG: 06:35:41.127: reading from entropy source: /dev/urandom
** (tpm2-abrmd:6838): DEBUG: 06:35:41.129: connection_manager_set_property
** (tpm2-abrmd:6838): DEBUG: 06:35:41.129: max_connections: 27
** (tpm2-abrmd:6838): DEBUG: 06:35:41.131: IpcFrontendDbus set bus_name: com.intel.tss2.Tabrmd
** (tpm2-abrmd:6838): DEBUG: 06:35:41.132: ipc_frontend_connect
ERROR:tcti:src/tss2-tcti/tcti-device.c:451:Tss2_Tcti_Device_Init() Failed to open specified TCTI device file /dev/tpm0: No such file or directory
ERROR:tcti:src/tss2-tcti/tctildr-dl.c:169:tcti_from_file() Could not initialize TCTI file: device
ERROR:tcti:src/tss2-tcti/tctildr.c:430:Tss2_TctiLdr_Initialize_Ex() Failed to instantiate TCTI
** (tpm2-abrmd:6838): CRITICAL **: 06:35:41.182: init_thread_func: failed to create TCTI with conf "device:/dev/tpm0", got RC: 0xa000a
** (tpm2-abrmd:6838): DEBUG: 06:35:41.182: init_thread_func: calling gmain_data_cleanup
** (tpm2-abrmd:6838): DEBUG: 06:35:41.186: gmain_data_cleanup
** (tpm2-abrmd:6838): DEBUG: 06:35:41.187: ipc_frontend_disconnect
(tpm2-abrmd:6838): GLib-GIO-CRITICAL **: 06:35:41.188: g_bus_unown_name: assertion 'owner_id > 0' failed
** (tpm2-abrmd:6838): DEBUG: 06:35:41.207: random_finalize
** INFO: 06:35:41.208: main_loop_quit
** INFO: 06:35:41.219: g_main_loop_run done, cleaning up
** (tpm2-abrmd:6838): DEBUG: 06:35:41.221: gmain_data_cleanup
** INFO: 06:35:41.222: main_loop_quit
amp@amp-virtual-machine:~$ tpm2_startup -c
amp@amp-virtual-machine:~$ file /dev/urandom
/dev/urandom: character special (1/9)