- if NACL_VERSION < "1.1.0":
- from nacl.utils import random
- from nacl.public import SecretBox
- nonce = random(SecretBox.NONCE_SIZE)
- cipher = crypto.symmetric_encrypt(key, pickle.dumps(self), nonce)
- else:
- cipher = crypto.symmetric_encrypt(key, pickle.dumps(self))