INNER CODE UNIT · Python

keygen

polhenarejos/pico-hsm · tools/pico-hsm-tool.py:437

def keygen(picohsm, args):
    if (args.subcommand == 'aes'):
        ret = picohsm.key_generation(KeyType.AES, param=args.size)
    elif (args.subcommand in ['x25519', 'x448', 'ed25519', 'ed448']):
        curve = args.subcommand
        if (args.subcommand in ['x25519', 'x448']):
            curve = 'curve' + args.subcommand[1:]
        ret = picohsm.key_generation(KeyType.ECC, curve)
    print('Key generated successfully.')
    print(f'Key ID: {ret}')

def phy(picohsm, args):
    val = args.value if 'value' in args else None
    if (val):
        if (args.subcommand == 'vidpid'):
            sp = val.split(':')
            if (len(sp) != 2):
                print('ERROR: VID/PID have wrong format. Use VID:PID format (e.g. 1234:5678)')

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…