Fix signature verificatio in pisa-cli

This commit is contained in:
Salvatore Ingala
2019-10-18 15:40:57 +08:00
parent ca64b59277
commit a73b14bf13
2 changed files with 3 additions and 3 deletions

View File

@@ -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."

View File

@@ -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"