From f2874ae3ef33aba01c54bae82a3a0c620086a748 Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Tue, 6 Dec 2022 20:00:19 +0100 Subject: [PATCH] Fix when ping is provided during the initialization. Signed-off-by: Pol Henarejos --- tools/pico-hsm-tool.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/pico-hsm-tool.py b/tools/pico-hsm-tool.py index bbad3b8..4ddbbe6 100644 --- a/tools/pico-hsm-tool.py +++ b/tools/pico-hsm-tool.py @@ -241,7 +241,13 @@ def initialize(card, args): _ = input('[Press enter to confirm]') send_apdu(card, 0xA4, 0x04, 0x00, [0xE8, 0x2B, 0x06, 0x01, 0x04, 0x01, 0x81, 0xC3, 0x1F, 0x02, 0x01]) - if (not args.pin): + if (args.pin): + pin = args.pin.encode() + try: + response = send_apdu(card, 0x20, 0x00, 0x81, list(pin)) + except APDUResponse: + pass + else: pin = b'648219' if (args.so_pin):