INNER CODE UNIT · Python
get_id_by_label
tpm2-software/tpm2-pkcs11 · tools/tpm2_pkcs11/commandlets_keys.py:384
def get_id_by_label(tobj, keylabel):
attrs = yaml.safe_load(io.StringIO(tobj['attrs']))
if CKA_LABEL in attrs:
x = attrs[CKA_LABEL]
x = binascii.unhexlify(x).decode()
if x == keylabel and attrs[CKA_CLASS] == CKO_PRIVATE_KEY:
return attrs[CKA_ID]
return None
@staticmethod
def get_label_by_id(tobj, keyid):
attrs = yaml.safe_load(io.StringIO(tobj['attrs']))
if CKA_ID in attrs: