-
Notifications
You must be signed in to change notification settings - Fork 0
security (module)
The agutil.security module includes two methods at the module level for file encryption and decryption: encryptFile() and decryptFile(). Additionally, several exceptions are defined for use by the ciphers
-
encryptFile(input_filename, output_filename, key, nonce=
None, **kwargs):Opens input_filename and output_filename and passes their file handles, along with the other arguments, to
encryptFileObj(). For a description of that function, see below. -
encryptFileObj(reader, writer, key, nonce=
None, **kwargs):Encrypts the data read from reader using the cipher and writes it to writer. Initializes an
agutil.security.EncryptionCipherto handle the encryption. kwargs are passed to the constructor of theEncryptionCipherand may be any valid keyword argument toconfigure_cipher()(see ciphers). Padding is handled internally (chunks are padded to 16-byte intervals). -
decryptFile(input_filename, output_filename, key, nonce=
None, compatability=False):Opens input_filename and output_filename and passes their file handles, along with the other arguments, to
decryptFileObj(). For a description of that function, see below. -
decryptFileObj(reader, writer, key, nonce=
None, compatability=False):Decrypts the data read from reader using cipher and writes it to writer. Initializes an
agutil.security.DecryptionCipherto handle decryption. The cipher can handle data encrypted byagutilversions 1.2.0 and newer. compatability must beTrueto decrypt data from earlier versions. -
CipherError: (Exception)
ValueError->CipherErrorThis is the parent exception type for other cipher errors -
EncryptionError: (Exception)
ValueError->CipherError->EncryptionErrorRaised byagutil.security.EncryptionCipherif there is an error during encryption -
DecryptionError: (Exception)
ValueError->CipherError->DecryptionErrorRaised byagutil.security.DecryptionCipherif there is an error during decryption -
HeaderError: (Exception)
ValueError->CipherError->HeaderErrorRaised by ciphers if the header is in an invalid state -
HeaderLengthError: (Exception)
ValueError->CipherError->HeaderError->HeaderLengthErrorRaised byagutil.security.DecryptionCipherif there was not enough initial data to initialize the cipher -
InvalidHeaderError: (Exception)
ValueError->CipherError->HeaderError->InvalidHeaderErrorRaised by ciphers if the header is corrupt or does not specify a valid configuration