AES file/folder encryption tool with CLI and Tkinter GUI
Project description
FENCE (File ENCryption Engine)
A comprehensive Python-based file and folder encryption tool using AES (Advanced Encryption Standard). Supports AES-128 and AES-256 encryption with password-based or random key generation.
โจ Features
Complete Implementation โ
- ๐ Dual Encryption Modes: AES-128 (128-bit) and AES-256 (256-bit)
- ๐ File & Folder Support: Encrypt single files or entire directory trees
- ๐ Flexible Key Management: Password-based (PBKDF2) or random key generation
- ๐พ Secure Key Storage: Built-in keystore with optional encryption
- โ HMAC Authentication: Detect tampering with encrypted files (HMAC-SHA256)
- โก Batch Processing: Parallel encryption for improved performance
- ๐ฆ Compression Support: Optional ZIP compression before encryption
- ๐๏ธ Secure File Deletion: Multi-pass overwrite before deletion
- ๐ฅ๏ธ Comprehensive CLI: Feature-rich command-line interface
- ๐ผ๏ธ GUI Interface: User-friendly graphical interface with Tkinter
- ๐งช Complete Test Suite: 38 unit tests with 100% pass rate
- ๐ฆ Desktop App: Standalone executables with PyInstaller
๐ Quick Start
Install via PyPI (CLI/GUI)
Install and use the tool like this:
pip install fence-file-encryption-engine
# CLI
fence --help
# GUI (Tkinter)
fence-gui
TestPyPI (for verification before real PyPI):
python -m pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple fence-file-encryption-engine==0.1.6
Installation
# Clone the repository
git clone https://github.com/bhardwaj-kushagra/FENCE.git
cd FENCE
# Install dependencies
pip install -r requirements.txt
Basic Usage
GUI Mode (Recommended for beginners):
python run_gui.py
CLI - Encrypt a file:
python -m cli.aes_cli encrypt myfile.txt --password "YourSecurePassword" --output myfile.txt.enc
CLI - Decrypt a file:
python -m cli.aes_cli decrypt myfile.txt.enc --password "YourSecurePassword" --output myfile.txt
CLI - Encrypt a folder:
python -m cli.aes_cli encrypt-folder ./data --output ./encrypted --password "YourPassword"
๐ง Automated Desktop Builds (GitHub Actions)
This repository includes a GitHub Actions workflow that builds platform binaries using PyInstaller and attaches them to a GitHub Release. It triggers when you push a tag matching v*.*.* (for example v1.0.0) or when you run it manually from the Actions tab.
How to create a release (trigger build):
# create a tag locally
git tag v1.0.0
git push origin v1.0.0
Where is the .exe? Why don't I see it locally?
- GitHub Actions builds run on GitHub-hosted runners; binaries are not written into your local workspace.
- Download them from either:
- Actions โ Build and Release โ select the run โ Artifacts (per-OS zips), or
- Releases โ select the tag you pushed โ Assets (per-OS binaries).
Manually run the workflow (no tag):
- Push your latest changes to GitHub.
- Go to the Actions tab โ Build and Release โ Run workflow.
- Pick a branch and click Run.
Local one-off build (Windows):
pip install pyinstaller
pyinstaller --clean run_gui.spec
# Output: .\dist\AES-Tool-GUI.exe
Notes:
- The workflow currently builds on Windows runners only. Binaries are produced by PyInstaller.
- If you have non-Python assets (icons, data files), keep
run_gui.spec; it bundles GUI data and embedsgui/icon.icoif present. - Optional: add code signing and a release checklist for production builds.
Windows-specific notes:
- The Windows build will produce an
AES-Tool-GUI.exein thedistfolder on the runner. It will be available via the Release assets and/or workflow Artifacts. - The GUI artifact may be a zipped folder (one-dir) containing
AES-Tool-GUI.exe; download the.zip, extract, then runAES-Tool-GUI.exe. - To test a Windows build locally, run on a Windows machine; cross-building a Windows EXE on Linux is not officially supported by PyInstaller.
Adding icons or data files:
- Place GUI assets inside the
gui/directory (e.g.,gui/icon.ico). The includedrun_gui.speccollects GUI package data and will bundle assets automatically when you runpyinstaller run_gui.spec. - If you need custom packaging behavior, modify
run_gui.specand commit it; the workflow will prefer it automatically.
๐ Documentation
- DOCS/GUI_GUIDE.md - Comprehensive GUI user guide with screenshots and tutorials
- DOCS/DOCUMENTATION.md - Complete guide with cryptographic theory, architecture, detailed usage, and a Crypto Primer for newcomers
- DOCS/QUICK_REFERENCE.md - Quick command reference and cheat sheet
- CHANGES.md - Detailed changelog and implementation notes
๐ฆ Publish to (Test)PyPI via GitHub Actions
This repo includes a workflow at .github/workflows/publish-pypi.yml:
- TestPyPI: Actions โ "Publish to PyPI" โ Run workflow โ choose
testpypi - PyPI: push a version tag like
v0.1.6(publishes automatically)
Required GitHub repo secrets:
TEST_PYPI_API_TOKEN(token created on https://test.pypi.org/)PYPI_API_TOKEN(token created on https://pypi.org/)
Important: PyPI and TestPyPI tokens are different and not interchangeable.
๐๏ธ Project Structure
FENCE/
โโโ cli/
โ โโโ __init__.py
โ โโโ aes_cli.py # Command-line interface
โโโ core/
โ โโโ __init__.py
โ โโโ aes_crypto.py # Core encryption/decryption
โ โโโ key_store.py # Key management
โ โโโ batch_encrypt.py # Folder & batch operations
โโโ gui/
โ โโโ __init__.py
โ โโโ main_window.py # Main GUI window
โ โโโ file_tab.py # File encryption tab
โ โโโ folder_tab.py # Folder encryption tab
โ โโโ keys_tab.py # Key management tab
โ โโโ settings_dialog.py # Settings configuration
โโโ utils/
โ โโโ __init__.py
โ โโโ logger.py # Colored console output
โโโ tests/
โ โโโ __init__.py
โ โโโ test_aes_crypto.py
โ โโโ test_key_store.py
โ โโโ test_batch_encrypt.py
โ โโโ run_tests.py
โโโ DOCS/
โ โโโ DOCUMENTATION.md
โ โโโ QUICK_REFERENCE.md
โโโ CHANGES.md
โโโ requirements.txt
โโโ README.md
๐ Security Features
- AES-256-CBC: Industry-standard encryption algorithm
- PBKDF2: 100,000 iterations for password-based key derivation (OWASP recommendation)
- HMAC-SHA256: Authentication to detect tampering and corruption
- Secure Random: Uses
secretsmodule for cryptographically strong randomness - Padding Validation: Prevents padding oracle attacks
- Secure Delete: 3-pass overwrite for sensitive file deletion
๐งช Testing
Run the complete test suite:
python tests\run_tests.py
Run specific test modules:
python -m unittest tests.test_aes_crypto
python -m unittest tests.test_key_store
python -m unittest tests.test_batch_encrypt
๐ฆ Requirements
- Python 3.8 or higher
- pycryptodome >= 3.18.0
- rich >= 13.0.0
Install with:
pip install -r requirements.txt
๐ฏ Use Cases
- Personal Data Backup: Encrypt sensitive files before cloud storage
- Secure File Sharing: Encrypt files for secure transmission
- Compliance: Meet data encryption requirements
- Privacy: Protect confidential documents
- Development: Encrypt configuration files with secrets
๐ง Command Overview
| Command | Description |
|---|---|
encrypt |
Encrypt a single file |
decrypt |
Decrypt a single file |
encrypt-folder |
Encrypt all files in a folder |
decrypt-folder |
Decrypt all files in a folder |
keystore list |
List all stored keys |
keystore delete |
Delete a stored key |
Get help:
python -m cli.aes_cli --help
python -m cli.aes_cli encrypt --help
๐ Project Phases
| Phase | Status | Features |
|---|---|---|
| Phase 1 | โ Complete | Core AES encryption, CLI implementation |
| Phase 2 | โ Complete | Folder encryption, parallel processing, compression |
| Phase 3 | โ Complete | GUI development (Tkinter) |
| Phase 4 | โ Complete | Desktop app packaging (PyInstaller, Windows) |
๐ค Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Add tests for new functionality
- Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Author
Kushagra Bhardwaj
- GitHub: @bhardwaj-kushagra
- Repository: FENCE
๐ Acknowledgments
- PyCryptodome - Cryptographic library
- Rich - Terminal formatting
- NIST - AES standard specification
๐ ๏ธ Troubleshooting
- Buttons not visible: The Encrypt/Decrypt buttons are at the bottom of the File tab. Resize the window if theyโre not visible. The default size is now 950x800 (minimum 900x700).
- Release creation fails (403): GitHub Actions needs
permissions: contents: writein the workflow to publish releases. This repository includes that permission.
๐ฆ Publish to PyPI (recommended: TestPyPI first)
# Install packaging tools
python -m pip install --upgrade build twine
# Build wheel + sdist
python -m build
# Upload to TestPyPI
python -m twine upload --repository testpypi dist/*
# Verify install from TestPyPI
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple fence-file-encryption-engine
# Upload to PyPI
python -m twine upload dist/*
๐ Version
Current Version: 2.0
Last Updated: October 13, 2025
โญ Star this repository if you find it useful!
For detailed documentation, see DOCS/DOCUMENTATION.md
For quick reference, see DOCS/QUICK_REFERENCE.md
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fence_file_encryption_engine-0.1.7.tar.gz.
File metadata
- Download URL: fence_file_encryption_engine-0.1.7.tar.gz
- Upload date:
- Size: 34.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51cac64e669c6e265f1b018ac2a210cefe11f4cbc9ffe776decb368f5bca1e2b
|
|
| MD5 |
506032e4c59227a8654d521102d42fe5
|
|
| BLAKE2b-256 |
a9db4b98448d34c812c7bf8aac1a13142473cbbda55a6f1239d87c01efea8b21
|
File details
Details for the file fence_file_encryption_engine-0.1.7-py3-none-any.whl.
File metadata
- Download URL: fence_file_encryption_engine-0.1.7-py3-none-any.whl
- Upload date:
- Size: 33.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac1ad6abc4673c6961a85aa219985057d5987a55152d6b0e4e96bafabdcb2a2a
|
|
| MD5 |
51e0977ca094345e5b4d802595ea9efb
|
|
| BLAKE2b-256 |
45282ab1aaa155f140a8cae5c6172e4b264b87d9703990a0c46b943ebd9a47c7
|