From: Michael Rasmussen Date: Sat, 11 Aug 2018 23:26:26 +0000 (+0200) Subject: Make backwards compatible with nacl 1.0.x X-Git-Url: http://git.datanom.net/securemail.git/commitdiff_plain/3e18b00b2002d8269bc09c33e510bb4c89311cb4 Make backwards compatible with nacl 1.0.x --- diff --git a/cryptonize.py b/cryptonize.py index d24a72b..9c1b02f 100644 --- a/cryptonize.py +++ b/cryptonize.py @@ -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