mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-17 09:28:05 +00:00
Fix initialization with so-pin.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
f4a537f156
commit
3d7f714936
1 changed files with 10 additions and 4 deletions
|
|
@ -39,7 +39,7 @@ except ModuleNotFoundError:
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from picohsm import PicoHSM, PinType, DOPrefixes, KeyType, EncryptionMode, utils
|
from picohsm import PicoHSM, PinType, DOPrefixes, KeyType, EncryptionMode, utils, APDUResponse, SWCodes
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
print('ERROR: picohsm module not found! Install picohsm package.\nTry with `pip install pypicohsm`')
|
print('ERROR: picohsm module not found! Install picohsm package.\nTry with `pip install pypicohsm`')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
@ -188,13 +188,19 @@ def initialize(picohsm, args):
|
||||||
_ = input('[Press enter to confirm]')
|
_ = input('[Press enter to confirm]')
|
||||||
|
|
||||||
if (args.pin):
|
if (args.pin):
|
||||||
picohsm.login(args.pin)
|
try:
|
||||||
pin = args
|
picohsm.login(args.pin)
|
||||||
|
except APDUResponse:
|
||||||
|
pass
|
||||||
|
pin = args.pin
|
||||||
else:
|
else:
|
||||||
pin = '648219'
|
pin = '648219'
|
||||||
|
|
||||||
if (args.so_pin):
|
if (args.so_pin):
|
||||||
picohsm.login(args.pin, who=PinType.SO_PIN)
|
try:
|
||||||
|
picohsm.login(args.so_pin, who=PinType.SO_PIN)
|
||||||
|
except APDUResponse:
|
||||||
|
pass
|
||||||
so_pin = args.so_pin
|
so_pin = args.so_pin
|
||||||
else:
|
else:
|
||||||
so_pin = '57621880'
|
so_pin = '57621880'
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue