in cvm-attestation/tpm_wrapper.py [0:0]
def read_public(self, index):
tpm = Tpm()
tpm.connect()
self.cleanSlots(tpm, TPM_HT.TRANSIENT)
self.cleanSlots(tpm, TPM_HT.LOADED_SESSION)
handle = TPM_HANDLE(index)
outPub = tpm.allowErrors().ReadPublic(handle)
h = outPub
if (tpm.lastResponseCode == TPM_RC.SUCCESS):
self.log.info("Persistent key 0x" + hex(handle.handle) + " already exists")
else:
self.log.info("Failed to read Public Area")
tpm.close()
return outPub.toBytes()