3 œäL]6ã@sbddlmZmZmZddlZddlmZddlmZddl m Z m Z m Z Gdd„dej e eƒZdS)é)Úabsolute_importÚdivisionÚprint_functionN)Úencoding)Ú exceptions)ÚEncryptedMessageÚ StringFixerÚrandomc@sfeZdZdZejjZejjZ ejj Z ejj Z ejfdd„Zdd„Zdejfdd„Zdejfd d „ZdS) Ú SecretBoxa5 The SecretBox class encrypts and decrypts messages using the given secret key. The ciphertexts generated by :class:`~nacl.secret.Secretbox` include a 16 byte authenticator which is checked as part of the decryption. An invalid authenticator will cause the decrypt function to raise an exception. The authenticator is not a signature. Once you've decrypted the message you've demonstrated the ability to create arbitrary valid message, so messages you send are repudiable. For non-repudiable messages, sign them after encryption. :param key: The secret key used to encrypt and decrypt messages :param encoder: The encoder class used to decode the given key :cvar KEY_SIZE: The size that the key is required to be. :cvar NONCE_SIZE: The size that the nonce is required to be. :cvar MACBYTES: The size of the authentication MAC tag in bytes. :cvar MESSAGEBYTES_MAX: The maximum size of a message which can be safely encrypted with a single key/nonce pair. cCsF|j|ƒ}t|tƒstjdƒ‚t|ƒ|jkrs