return plain
def asymmetric_encrypt(self, privkey, pubkey, plain):
+ if not isinstance(plain, bytes):
+ plain = plain.encode('utf-8')
box = Box(privkey, pubkey)
if NACL_VERSION < "1.1.0":
nonce = random(Box.NONCE_SIZE)
return cipher
def asymmetric_decrypt(self, privkey, pubkey, cipher):
+ if not isinstance(cipher, bytes):
+ cipher = cipher.encode('utf-8')
box = Box(privkey, pubkey)
plain = box.decrypt(cipher)
box = None