mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-17 01:18:06 +00:00
Key id not needed on keygen.
It also returns the fresh new generated key id. Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
74afa07512
commit
2086a68c53
1 changed files with 3 additions and 1 deletions
|
|
@ -117,7 +117,7 @@ def parse_args():
|
||||||
parser_cipher.add_argument('--file-out', help='File to write the result.')
|
parser_cipher.add_argument('--file-out', help='File to write the result.')
|
||||||
parser_cipher.add_argument('--aad', help='Specifies the authentication data (it can be a string or hex string. Combine with --hex if necesary).')
|
parser_cipher.add_argument('--aad', help='Specifies the authentication data (it can be a string or hex string. Combine with --hex if necesary).')
|
||||||
parser_cipher.add_argument('--hex', help='Parses the AAD parameter as a hex string (for binary data).', action='store_true')
|
parser_cipher.add_argument('--hex', help='Parses the AAD parameter as a hex string (for binary data).', action='store_true')
|
||||||
parser_cipher.add_argument('-k', '--key', help='The private key index', metavar='KEY_ID', required=True)
|
parser_cipher.add_argument('-k', '--key', help='The private key index', metavar='KEY_ID', required=all(['keygen' not in s for s in sys.argv]))
|
||||||
parser_cipher.add_argument('-s', '--key-size', default=32, help='Size of the key in bytes.')
|
parser_cipher.add_argument('-s', '--key-size', default=32, help='Size of the key in bytes.')
|
||||||
|
|
||||||
parser_x25519 = argparse.ArgumentParser(add_help=False)
|
parser_x25519 = argparse.ArgumentParser(add_help=False)
|
||||||
|
|
@ -363,6 +363,8 @@ def secure(picohsm, args):
|
||||||
def cipher(picohsm, args):
|
def cipher(picohsm, args):
|
||||||
if (args.subcommand == 'keygen'):
|
if (args.subcommand == 'keygen'):
|
||||||
ret = picohsm.key_generation(KeyType.AES, param=args.key_size * 8)
|
ret = picohsm.key_generation(KeyType.AES, param=args.key_size * 8)
|
||||||
|
print('Key generated successfully.')
|
||||||
|
print(f'Key ID: {ret}')
|
||||||
else:
|
else:
|
||||||
if (args.file_in):
|
if (args.file_in):
|
||||||
fin = open(args.file_in, 'rb')
|
fin = open(args.file_in, 'rb')
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue