]> git.datanom.net - securemail.git/blobdiff - cryptonize.py
Make backwards compatible with nacl 1.0.x
[securemail.git] / 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.029258 seconds and 5 git commands to generate.