Hi, I am new to TPMs and wanted to try pytss to connect to a TPM simulator, e.g. ms-tpm which I got already set up. Unfortunately, I could not find any getting started guide or basic example of pytss, so I don't know how and where to start.
I only found this stackoverflow question which refers to some example in the documentation, but this site does not exist anymore.
I really would appreciate any help and explanation on how to start with pytss and connect to a TPM simulator to perform a basic operation like signing some bytes :)
Hi, I am facing an issue with tpm2_rsadecrypt after reboot
Following are the TPM commands sequence,
tpm2_changeauth -c o ownerauth -> Changing the authorization of storage hierarchy
tpm2_createprimary -P ownerauth -p primarykey -c prim.ctx -> Creating a primary key
tpm2_evictcontrol -C o -c prim.ctx 0x81000000 -P ownerauth -> Storing Primary key to TPM NVRAM persistent storage using reserved handle
tpm2_create -P primarykey -p childkey -C prim.ctx -u key.pub -r key.priv -> Creating a child key under primary key and storing to disk
tpm2_load -P primarykey -C prim.ctx -u key.pub -r key.priv -c key.ctx -> Loading child key under primary key in TPM
echo "my message" > msg.dat
tpm2_rsaencrypt -c key.ctx -o msg.enc msg.dat -> encrypt message using child key in TPM
tpm2_rsadecrypt -p childkey -c key.ctx -o msg.ptext msg.enc -> Decrypt message using child key in TPM
cat msg.ptext
tpm2_load -P primarykey -C 0x81000000 -u key.pub -r key.priv -c key.ctx -> Load primary key and child key in to TPM after reboot
tpm2_rsadecrypt -p childkey -c key.ctx -o msg.ptext msg.enc -> Decrypt operation failing after reboot
WARNING:esys:src/tss2-esys/api/Esys_RSA_Decrypt.c:305:Esys_RSA_Decrypt_Finish() Received TPM Error
ERROR:esys:src/tss2-esys/api/Esys_RSA_Decrypt.c:102:Esys_RSA_Decrypt() Esys Finish ErrorCode (0x00000084)
ERROR: Esys_RSA_Decrypt(0x84) - tpm:handle(unk):value is out of range or is not correct for the context
ERROR: Unable to run tpm2_rsadecrypt
Hey folks, anyone has any idea why I would get the errors below? This happens on initramfs, but when in the system I don't get this error and can access tpm
ERROR:tcti:src/tss2-tcti-device.c:440:Tss2_Tcti_Device_Init() Failed to open specified TCTI device file /dev/tpmrm0: No such file or directory
WARNING:tcti:src/tss2-tcti/tctildr.c:79:tcti_from_init() TCTI init for function 0x7f689fca8140 failed with a000a
WARNING:tcti:src/tss2-tcti/tctildr.c:109:tcti_from_info() Could not initialize TCTI named: tcti-device
ERROR:tcti:src/tss2-tcti/tctildr-dl.c:154:tcti_from_file() Could not initialize TCTI file: libtss2-tcti-device.so.0
ERROR:tcti:src/tss2-tcti-device.c:440:Tss2_Tcti_Device_Init() Failed to open specified TCTI device file /dev/tpm0: No such file or directory
WARNING:tcti:src/tss2-tcti/tctildr.c:79:tcti_from_init() TCTI init for function 0x7f689fca8140 failed with a000a
WARNING:tcti:src/tss2-tcti/tctildr.c:109:tcti_from_info() Could not initialize TCTI named: tcti-device
ERROR:tcti:src/tss2-tcti/tctildr-dl.c:154:tcti_from_file() Could not initialize TCTI file: libtss2-tcti-device.so.0
ERROR:tcti:src/tss2-tcti/tctildr-dl.c:254:tctildr_get_default() No standard TCTI could be loaded
ERROR:tcti:src/tss2-tcti/tctildr.c:416:Tss2_TctiLdr_Initialize_Ex() Failed to instantiate TCTI
ERROR:esys:src/tss2-esys/esys_contect.c:69:Esys_Initialize() Initialize default tcti. ErrorCode (0x000a000a)
ERROR in pcr_unseal (src/libtpm2-initramfs-tool.c:390): 0x000a000a