From 6373f159f87601fb1d7d73b8dab2970381b46446 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Fri, 3 Sep 2021 14:42:59 +0200 Subject: [PATCH] Added link error handling. --- RNS/Link.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/RNS/Link.py b/RNS/Link.py index bca467e..7bb69cc 100644 --- a/RNS/Link.py +++ b/RNS/Link.py @@ -700,7 +700,11 @@ class Link: def encrypt(self, plaintext): try: if not self.fernet: - self.fernet = Fernet(base64.urlsafe_b64encode(self.derived_key)) + try: + self.fernet = Fernet(base64.urlsafe_b64encode(self.derived_key)) + except Exception as e: + RNS.log("Could not "+str(self)+" instantiate Fernet while performin encryption on link. The contained exception was: "+str(e), RNS.LOG_ERROR) + raise e # The fernet token VERSION field is stripped here and # reinserted on the receiving end, since it is always