INNER CODE UNIT · Python
opts
polhenarejos/pico-hsm · tools/pico-hsm-tool.py:272
def opts(picohsm, args):
opt = 0x0
if (args.opt == 'button'):
opt = 0x1
elif (args.opt == 'counter'):
opt = 0x2
current = picohsm.send(cla=0x80, command=0x64, p1=0x6)[0]
if (args.subcommand == 'set'):
if (args.onoff == 'on'):
newopt = current | opt
else:
newopt = current & ~opt
picohsm.send(cla=0x80, command=0x64, p1=0x6, data=[newopt])
elif (args.subcommand == 'get'):
print(f'Option {args.opt.upper()} is {"ON" if current & opt else "OFF"}')
class SecureLock:
def __init__(self, picohsm):