INNER CODE UNIT · Python
attestate
polhenarejos/pico-hsm · tools/pico-hsm-tool.py:220
def attestate(picohsm, args):
kid = int(args.key)
termca = picohsm.get_termca()
devcert = termca['cv']['data']
cert = picohsm.get_contents(0xCE, kid)
print(hexlify(bytearray(cert)))
print(f'Details of key {kid}:\n')
print(f' CAR: {(CVC().decode(cert).car()).decode()}')
print(' Public Key:')
puboid = CVC().decode(cert).pubkey().oid()
print(f' Scheme: {oid2scheme(puboid)}')
chr = CVC().decode(cert).chr()
car = CVC().decode(cert).car()
if (scheme_rsa(puboid)):
print(f' Modulus: {hexlify(CVC().decode(cert).pubkey().find(0x81).data()).decode()}')
print(f' Exponent: {hexlify(CVC().decode(cert).pubkey().find(0x82).data()).decode()}')
else: