]> git.datanom.net - securemail.git/commitdiff
Make backwards compatible with nacl 1.0.x
authorMichael Rasmussen <mir@datanom.net>
Sat, 11 Aug 2018 23:26:26 +0000 (01:26 +0200)
committerMichael Rasmussen <mir@datanom.net>
Sat, 11 Aug 2018 23:26:26 +0000 (01:26 +0200)
cryptonize.py

index d24a72ba20b3a2fa71a2ea8f333e297463e96403..9c1b02fdcfd17b8f179dc4228b98b0a421befe87 100644 (file)
@@ -51,7 +51,11 @@ class Cryptonize:
         
     def asymmetric_encrypt(self, privkey, pubkey, plain):
         box = Box(privkey, pubkey)
-        cipher = box.encrypt(plain)
+        if NACL_VERSION < "1.1.0":
+            nonce = random(Box.NONCE_SIZE)
+            cipher = box.encrypt(plain, nonce)
+        else:
+            cipher = box.encrypt(plain)
         box = None
         
         return cipher
This page took 0.087192 seconds and 5 git commands to generate.