mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-17 09:28:05 +00:00
If the board is RP2350 or ESP32, the requested certificate must be for secp256k1 key.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
99a9803328
commit
6f572954d5
1 changed files with 5 additions and 2 deletions
|
|
@ -39,7 +39,7 @@ except ModuleNotFoundError:
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
try:
|
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:
|
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)
|
||||||
|
|
@ -226,7 +226,10 @@ def initialize(picohsm, args):
|
||||||
print(f'Public Point: {hexlify(Y).decode()}')
|
print(f'Public Point: {hexlify(Y).decode()}')
|
||||||
|
|
||||||
pbk = base64.urlsafe_b64encode(Y)
|
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)
|
j = get_pki_data('cvc', data=data)
|
||||||
print('Device name: '+j['devname'])
|
print('Device name: '+j['devname'])
|
||||||
dataef = base64.urlsafe_b64decode(
|
dataef = base64.urlsafe_b64decode(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue