Import secure_key only when needed.
Now, it does not block anymore the entire execution of pico tool. Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -59,15 +59,6 @@ import platform
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from argparse import RawTextHelpFormatter
|
from argparse import RawTextHelpFormatter
|
||||||
|
|
||||||
if (platform.system() == 'Windows'):
|
|
||||||
from secure_key import windows as skey
|
|
||||||
elif (platform.system() == 'Linux'):
|
|
||||||
from secure_key import linux as skey
|
|
||||||
elif (platform.system() == 'Darwin'):
|
|
||||||
from secure_key import macos as skey
|
|
||||||
else:
|
|
||||||
print('ERROR: platform not supported')
|
|
||||||
sys.exit(-1)
|
|
||||||
|
|
||||||
class APDUResponse(Exception):
|
class APDUResponse(Exception):
|
||||||
def __init__(self, sw1, sw2):
|
def __init__(self, sw1, sw2):
|
||||||
@@ -336,6 +327,15 @@ class SecureLock:
|
|||||||
send_apdu(self.card, [0x80, 0x64], 0x3A, 0x03, list(ct))
|
send_apdu(self.card, [0x80, 0x64], 0x3A, 0x03, list(ct))
|
||||||
|
|
||||||
def _get_key_device(self):
|
def _get_key_device(self):
|
||||||
|
if (platform.system() == 'Windows'):
|
||||||
|
from secure_key import windows as skey
|
||||||
|
elif (platform.system() == 'Linux'):
|
||||||
|
from secure_key import linux as skey
|
||||||
|
elif (platform.system() == 'Darwin'):
|
||||||
|
from secure_key import macos as skey
|
||||||
|
else:
|
||||||
|
print('ERROR: platform not supported')
|
||||||
|
sys.exit(-1)
|
||||||
return skey.get_secure_key()
|
return skey.get_secure_key()
|
||||||
|
|
||||||
def get_skey(self):
|
def get_skey(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user