a °…bb ã@s¶UddlmZddlmZmZddlmZe ¡Z e e d<e  ¡Z e e d<e ¡Ze e d<e ¡Ze e d<e ¡Ze e d<e ¡Ze e d <eeeed œd d „Zeeeed œdd„ZdS)é)Ú exceptions)ÚffiÚlib)ÚensureÚcrypto_secretbox_KEYBYTESÚcrypto_secretbox_NONCEBYTESÚcrypto_secretbox_ZEROBYTESÚcrypto_secretbox_BOXZEROBYTESÚcrypto_secretbox_MACBYTESÚ!crypto_secretbox_MESSAGEBYTES_MAX)ÚmessageÚnonceÚkeyÚreturncCsŽt|ƒtkrt d¡‚t|ƒtkr,t d¡‚dt|}t dt|ƒ¡}t  ||t|ƒ||¡}t |dkdtj dt  |t|ƒ¡}|t d…S) zÆ Encrypts and returns the message ``message`` with the secret ``key`` and the nonce ``nonce``. :param message: bytes :param nonce: bytes :param key: bytes :rtype: bytes ú Invalid keyú Invalid nonceóúunsigned char[]rzEncryption failed©ZraisingN)ÚlenrÚexcÚ ValueErrorrrrÚnewrÚcrypto_secretboxrÚ CryptoErrorÚbufferr )r r rÚpaddedÚ ciphertextÚres©rúE/tmp/pip-target-98j97qn4/lib/python/nacl/bindings/crypto_secretbox.pyrs     r)rr rrcCsŽt|ƒtkrt d¡‚t|ƒtkr,t d¡‚dt|}t dt|ƒ¡}t  ||t|ƒ||¡}t |dkdtj dt  |t|ƒ¡}|t d…S) zÕ Decrypt and returns the encrypted message ``ciphertext`` with the secret ``key`` and the nonce ``nonce``. :param ciphertext: bytes :param nonce: bytes :param key: bytes :rtype: bytes rrrrrz1Decryption failed. Ciphertext failed verificationrN)rrrrrr rrrÚcrypto_secretbox_openrrrr)rr rrÚ plaintextrrrr r!9s     ýr!N)ZnaclrrZ nacl._sodiumrrZnacl.exceptionsrZcrypto_secretbox_keybytesrÚintÚ__annotations__Zcrypto_secretbox_noncebytesrZcrypto_secretbox_zerobytesrZcrypto_secretbox_boxzerobytesr Zcrypto_secretbox_macbytesr Z!crypto_secretbox_messagebytes_maxr Úbytesrr!rrrr Ús ÿ þ