(filename, configuration, output_file=None, b64decode=False)
| 43 | |
| 44 | |
| 45 | def decrypt(filename, configuration, output_file=None, b64decode=False): |
| 46 | encryptor = get_encryptor(configuration['crypt_salt'], configuration['encryption_key']) |
| 47 | if not output_file: |
| 48 | output_file = filename + '_decrypted' |
| 49 | with open(output_file, 'wb') as f: |
| 50 | if b64decode: |
| 51 | f.write(base64.b64decode(read(filename, encryptor))) |
| 52 | else: |
| 53 | f.write(read(filename, encryptor)) |
| 54 | print(f'file decrypted and written to {output_file}') |
| 55 | |
| 56 | |
| 57 | if __name__ == '__main__': |