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:
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user