From d1a3a2452764a8b0778025ce81c5650293f0fe6a Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Thu, 3 Nov 2022 16:09:42 +0100 Subject: [PATCH] Import secure_key only when needed. Now, it does not block anymore the entire execution of pico tool. Signed-off-by: Pol Henarejos --- tools/pico-hsm-tool.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/pico-hsm-tool.py b/tools/pico-hsm-tool.py index 00b399c..b50cde4 100644 --- a/tools/pico-hsm-tool.py +++ b/tools/pico-hsm-tool.py @@ -59,15 +59,6 @@ import platform from datetime import datetime 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): def __init__(self, sw1, sw2): @@ -336,6 +327,15 @@ class SecureLock: send_apdu(self.card, [0x80, 0x64], 0x3A, 0x03, list(ct)) 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() def get_skey(self):