From e4e83167b71e54510aac53663f4e40646e6e972b Mon Sep 17 00:00:00 2001 From: Salvatore Ingala <6681844+bigspider@users.noreply.github.com> Date: Thu, 10 Oct 2019 16:48:58 +0700 Subject: [PATCH] Made signing key optional (will only sign if given) --- pisa/sample_conf.py | 1 + pisa/watcher.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pisa/sample_conf.py b/pisa/sample_conf.py index 7d00df5..7f0dc9f 100644 --- a/pisa/sample_conf.py +++ b/pisa/sample_conf.py @@ -17,6 +17,7 @@ EXPIRY_DELTA = 6 MIN_DISPUTE_DELTA = 20 SERVER_LOG_FILE = 'pisa.log' DB_PATH = 'appointments/' +SIGNING_KEY_DER = None # PISA-CLI CLIENT_LOG_FILE = 'pisa.log' diff --git a/pisa/watcher.py b/pisa/watcher.py index e189c9c..e3aa405 100644 --- a/pisa/watcher.py +++ b/pisa/watcher.py @@ -22,7 +22,7 @@ class Watcher: self.max_appointments = max_appointments self.zmq_subscriber = None self.responder = Responder() - self.sk = ecdsa.SigningKey.from_der(SIGNING_KEY_DER) + self.signing_key = ecdsa.SigningKey.from_der(SIGNING_KEY_DER) if SIGNING_KEY_DER is not None else None def add_appointment(self, appointment): # Rationale: @@ -63,7 +63,8 @@ class Watcher: logger.info("New appointment accepted.", locator=appointment.locator) - signature = self.sk.sign(appointment.serialize().encode('utf8')) + if (self.signing_key is not None): + signature = self.signing_key.sign(appointment.serialize().encode('utf8')) else: appointment_added = False