From 6f572954d55cfc23a004c55aec5587059c4910dd Mon Sep 17 00:00:00 2001 From: Pol Henarejos Date: Tue, 12 Nov 2024 19:24:10 +0100 Subject: [PATCH] If the board is RP2350 or ESP32, the requested certificate must be for secp256k1 key. Signed-off-by: Pol Henarejos --- tools/pico-hsm-tool.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/pico-hsm-tool.py b/tools/pico-hsm-tool.py index be8b8c0..283da53 100644 --- a/tools/pico-hsm-tool.py +++ b/tools/pico-hsm-tool.py @@ -39,7 +39,7 @@ except ModuleNotFoundError: sys.exit(-1) try: - from picohsm import PicoHSM, PinType, DOPrefixes, KeyType, EncryptionMode, utils, APDUResponse, SWCodes, AES + from picohsm import PicoHSM, PinType, DOPrefixes, KeyType, EncryptionMode, utils, APDUResponse, SWCodes, AES, Platform except ModuleNotFoundError: print('ERROR: picohsm module not found! Install picohsm package.\nTry with `pip install pypicohsm`') sys.exit(-1) @@ -226,7 +226,10 @@ def initialize(picohsm, args): print(f'Public Point: {hexlify(Y).decode()}') pbk = base64.urlsafe_b64encode(Y) - data = urllib.parse.urlencode({'pubkey': pbk}).encode() + params = {'pubkey': pbk} + if (picohsm.platform in (Platform.RP2350, Platform.ESP32)): + params['curve'] = 'secp256k1' + data = urllib.parse.urlencode(params).encode() j = get_pki_data('cvc', data=data) print('Device name: '+j['devname']) dataef = base64.urlsafe_b64decode(