mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
Minor fixes
This commit is contained in:
@@ -118,7 +118,7 @@ def add_appointment(args):
|
||||
logger.error("The response does not contain the signature of the appointment.")
|
||||
else:
|
||||
# verify that the returned signature is valid
|
||||
if is_appointment_signature_valid(appointment, response_json['signature']) == False:
|
||||
if not is_appointment_signature_valid(appointment, response_json['signature']):
|
||||
logger.error("The returned appointment's signature is invalid.")
|
||||
else:
|
||||
if 'error' not in response_json:
|
||||
|
||||
@@ -38,7 +38,6 @@ def add_appointment():
|
||||
if type(appointment) == Appointment:
|
||||
appointment_added, signature = watcher.add_appointment(appointment)
|
||||
|
||||
# ToDo: #13-create-server-side-signature-receipt
|
||||
if appointment_added:
|
||||
rcode = HTTP_OK
|
||||
response = {
|
||||
|
||||
@@ -31,8 +31,8 @@ class Watcher:
|
||||
raise ValueError("No signing key provided. Please fix your pisa.conf")
|
||||
else:
|
||||
with open(PISA_SECRET_KEY, "r") as key_file:
|
||||
privkey_pem = key_file.read().encode("utf-8")
|
||||
self.signing_key = load_pem_private_key(privkey_pem, password=None, backend=default_backend())
|
||||
secret_key_pem = key_file.read().encode("utf-8")
|
||||
self.signing_key = load_pem_private_key(secret_key_pem, password=None, backend=default_backend())
|
||||
|
||||
def add_appointment(self, appointment):
|
||||
# Rationale:
|
||||
@@ -73,7 +73,6 @@ class Watcher:
|
||||
|
||||
logger.info("New appointment accepted.", locator=appointment.locator)
|
||||
|
||||
print(appointment.to_json().encode("utf-8"))
|
||||
signature = self.signing_key.sign(
|
||||
appointment.to_json().encode("utf-8"),
|
||||
ec.ECDSA(hashes.SHA256())
|
||||
|
||||
Reference in New Issue
Block a user