From 3e18b00b2002d8269bc09c33e510bb4c89311cb4 Mon Sep 17 00:00:00 2001 From: Michael Rasmussen Date: Sun, 12 Aug 2018 01:26:26 +0200 Subject: [PATCH] Make backwards compatible with nacl 1.0.x --- cryptonize.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.39.2