Added --silent flag to initialization to avoid prompt display.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos 2023-09-05 18:15:05 +02:00
parent 7506ccd263
commit f09654ccf4
No known key found for this signature in database
GPG key ID: C0095B7870A4CCD3

View file

@ -66,6 +66,7 @@ def parse_args():
parser_init = subparser.add_parser('initialize', help='Performs the first initialization of the Pico HSM.') parser_init = subparser.add_parser('initialize', help='Performs the first initialization of the Pico HSM.')
parser.add_argument('--pin', help='PIN number') parser.add_argument('--pin', help='PIN number')
parser_init.add_argument('--so-pin', help='SO-PIN number') parser_init.add_argument('--so-pin', help='SO-PIN number')
parser_init.add_argument('--silent', help='Confirms initialization silently.', action='store_true')
parser_attestate = subparser.add_parser('attestate', help='Generates an attestation report for a private key and verifies the private key was generated in the devices or outside.') parser_attestate = subparser.add_parser('attestate', help='Generates an attestation report for a private key and verifies the private key was generated in the devices or outside.')
parser_attestate.add_argument('-k', '--key', help='The private key index', metavar='KEY_ID') parser_attestate.add_argument('-k', '--key', help='The private key index', metavar='KEY_ID')
@ -176,14 +177,15 @@ def pki(_, args):
print('Error: no PKI is passed. Use --default to retrieve default PKI.') print('Error: no PKI is passed. Use --default to retrieve default PKI.')
def initialize(picohsm, args): def initialize(picohsm, args):
print('********************************') if (not args.silent):
print('* PLEASE READ IT CAREFULLY *') print('********************************')
print('********************************') print('* PLEASE READ IT CAREFULLY *')
print('') print('********************************')
print('This tool will erase and reset your device. It will delete all ' print('')
'private and secret keys.') print('This tool will erase and reset your device. It will delete all '
print('Are you sure?') 'private and secret keys.')
_ = input('[Press enter to confirm]') print('Are you sure?')
_ = input('[Press enter to confirm]')
if (args.pin): if (args.pin):
picohsm.login(args.pin) picohsm.login(args.pin)