A production-grade, secure File Encryption and Decryption application built in Python. This tool uses cryptography.fernet (AES symmetric encryption) and supports both single-file processing and batch directory processing.
- Python 3.8+
- Dependencies listed in
requirements.txt
-
Navigate to the directory:
cd CLIFileEncryptor -
Install requirements:
pip install -r requirements.txt
-
Generate an Encryption Key: Before you can encrypt or decrypt files, you must generate a secure key. This will create a
secret.keyfile in the directory.python app.py generate-key
WARNING: DO NOT lose or share this
secret.keyfile. Anyone with this file can decrypt your data. If you lose it, you cannot recover your encrypted files. It is explicitly ignored in.gitignore.
You can view the help menu anytime by running:
python app.py --helpEncrypt a Single File:
python app.py encrypt --file "path/to/your/file.txt"This will create an encrypted copy named file.txt.enc.
Encrypt a Directory (Batch):
python app.py encrypt --dir "path/to/your/folder"This recursively processes all files. Files that are already encrypted (ending in .enc) and the secret.key itself will be safely skipped.
Decrypt a Single File:
python app.py decrypt --file "path/to/your/file.txt.enc"This will restore the original file by decrypting the content and removing the .enc extension.
Decrypt a Directory (Batch):
python app.py decrypt --dir "path/to/your/folder"This recursively decrypts all .enc files in the folder.