This Python script allows you to encrypt and decrypt files.
- Fernet: Symmetric encryption for secure file storage.
- AES: Advanced Encryption Standard, a widely-used symmetric encryption algorithm.
- Entropy Calculation: Determines if a file is likely encrypted based on its entropy value (Shannon entropy).
- Fernet Encryption: Encrypt files with Fernet symmetric encryption.
- AES Encryption: Encrypt files using AES with CBC mode (supporting key sizes of 16, 24, or 32 bytes).
- Encryption Key Management: Saves the generated encryption keys for later decryption.
- Decryption: Decrypt files using the saved keys (for both Fernet and AES encryption).
- Python 3.x
cryptographylibrary (for encryption)
- Clone or download the repository.
- Install the Python dependencie:
pip install cryptography- Run the script.
- Enter the full path of the file you want to encrypt.
- Choose whether to encrypt using Fernet or AES.
- If using AES, select the key size (16, 24, or 32 bytes).
The tool will create a new file prefixed with encrypted- and save the encryption key in a separate file with the prefix key-.
- Run the script.
- Enter the full path of the encrypted file.
- Choose whether to decrypt using Fernet or AES.
- Enter the encryption key when prompted.
The tool will create a new file with the .decrypted suffix.
Enter the full path of the file: /home/user/file.txt
This file is not encrypted.
Do you want to encrypt the file? (yes/no): yes
Choose encryption method (Fernet or AES): Fernet
File encrypted as encrypted-file.txt
Key saved as key-file.txt