Skip to main content

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.

Python 3.8+ License: MIT

โœจ 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:
    1. Actions โ†’ Build and Release โ†’ select the run โ†’ Artifacts (per-OS zips), or
    2. Releases โ†’ select the tag you pushed โ†’ Assets (per-OS binaries).

Manually run the workflow (no tag):

  1. Push your latest changes to GitHub.
  2. Go to the Actions tab โ†’ Build and Release โ†’ Run workflow.
  3. 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 embeds gui/icon.ico if present.
  • Optional: add code signing and a release checklist for production builds.

Windows-specific notes:

  • The Windows build will produce an AES-Tool-GUI.exe in the dist folder 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 run AES-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 included run_gui.spec collects GUI package data and will bundle assets automatically when you run pyinstaller run_gui.spec.
  • If you need custom packaging behavior, modify run_gui.spec and commit it; the workflow will prefer it automatically.

๐Ÿ“š Documentation

๐Ÿ“ฆ 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:

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 secrets module 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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Add tests for new functionality
  4. Commit your changes (git commit -m 'Add some AmazingFeature')
  5. Push to the branch (git push origin feature/AmazingFeature)
  6. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ‘ค Author

Kushagra Bhardwaj

๐Ÿ™ 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: write in 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fence_file_encryption_engine-0.1.7.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fence_file_encryption_engine-0.1.7-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file fence_file_encryption_engine-0.1.7.tar.gz.

File metadata

File hashes

Hashes for fence_file_encryption_engine-0.1.7.tar.gz
Algorithm Hash digest
SHA256 51cac64e669c6e265f1b018ac2a210cefe11f4cbc9ffe776decb368f5bca1e2b
MD5 506032e4c59227a8654d521102d42fe5
BLAKE2b-256 a9db4b98448d34c812c7bf8aac1a13142473cbbda55a6f1239d87c01efea8b21

See more details on using hashes here.

File details

Details for the file fence_file_encryption_engine-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for fence_file_encryption_engine-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ac1ad6abc4673c6961a85aa219985057d5987a55152d6b0e4e96bafabdcb2a2a
MD5 51e0977ca094345e5b4d802595ea9efb
BLAKE2b-256 45282ab1aaa155f140a8cae5c6172e4b264b87d9703990a0c46b943ebd9a47c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page