mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 22:24:23 +01:00
Fix signature verificatio in pisa-cli
This commit is contained in:
@@ -95,8 +95,8 @@ def add_appointment(args):
|
||||
logger.error("The response does not contain the signature of the appointment.")
|
||||
else:
|
||||
# verify that the returned signature is valid
|
||||
signature = response_json['signature']
|
||||
pisa_public_key.verify(signature.encode("utf-8"), data, ec.ECDSA(hashes.SHA256()))
|
||||
sig_bytes = unhexlify(response_json['signature'].encode('utf-8'))
|
||||
pisa_public_key.verify(sig_bytes, appointment_data, ec.ECDSA(hashes.SHA256()))
|
||||
else:
|
||||
if 'error' not in response_json:
|
||||
logger.error("The server returned status code {}, but no error description."
|
||||
|
||||
@@ -106,7 +106,7 @@ def test_add_appointment(run_bitcoind, watcher):
|
||||
|
||||
# verify the signature
|
||||
try:
|
||||
data = appointment.to_json().encode("utf-8")
|
||||
data = appointment.to_json().encode('utf-8')
|
||||
public_key.verify(sig, data, ec.ECDSA(hashes.SHA256()))
|
||||
except InvalidSignature:
|
||||
assert False, "The appointment's signature is not correct"
|
||||
|
||||
Reference in New Issue
Block a user