Encrypt and decrypt files and folders on Windows, macOS, and Linux using AES-256 encryption — with both a GUI and a CLI.
- AES-256-CBC encryption with PBKDF2-HMAC-SHA256 key derivation (600,000 iterations)
- HMAC-SHA256 integrity verification (detects tampering and wrong passwords)
- Encrypt individual files or entire folders
- Graphical UI (tkinter) — no command line needed
- CLI for scripting and terminal workflows
- Cross-platform — works on Windows, macOS, and Linux (Python 3.9+)
- Installable as a Python package or standalone executable
# From the project directory:
pip install .
# Launch the GUI:
passlock-gui # or: python -m passlock
# Use the CLI:
passlock lock secret.pdf
passlock unlock secret.pdf.lockedpip install -r requirements.txt
# GUI
python -m passlock
# CLI
python -m passlock lock /path/to/file
python -m passlock unlock /path/to/file.lockedSee Building Standalone Executables below.
Launch the graphical interface:
passlock-gui # if installed via pip
python -m passlock # without installing
passlock gui # CLI sub-commandThe GUI lets you:
- Browse for files or folders
- Enter your password in a dialog (with confirmation for locking)
- Toggle "keep original" option
- See a real-time log of operations
passlock lock /path/to/secret.pdfYou'll be prompted to enter and confirm a password. The original file is replaced with secret.pdf.locked.
passlock lock /path/to/my_folderThe folder is archived, encrypted, and saved as my_folder.locked. The original folder is removed.
passlock unlock /path/to/secret.pdf.locked
passlock unlock /path/to/my_folder.lockedUse --keep to retain the original file/folder after locking or the .locked file after unlocking:
passlock lock myfile.txt --keep
passlock unlock myfile.txt.locked --keepBuild a single-file executable for your OS using PyInstaller:
chmod +x build.sh
./build.shmacOS output: dist/PassLock.app (drag to Applications)
Linux output: dist/passlock (copy to /usr/local/bin/)
build.batOutput: dist\PassLock.exe
To create a proper Windows installer, compile installer_win.iss with Inno Setup.
| OS | Python | GUI | CLI | Standalone |
|---|---|---|---|---|
| Windows 10/11 | 3.9 – 3.13 | ✅ | ✅ | .exe (PyInstaller) |
| macOS 12+ | 3.9 – 3.13 | ✅ | ✅ | .app bundle (PyInstaller) |
| Ubuntu 20.04+ | 3.9 – 3.13 | ✅ | ✅ | binary (PyInstaller) |
| Debian / Fedora / Arch | 3.9+ | ✅ | ✅ | binary (PyInstaller) |
Note (Linux): tkinter may need to be installed separately:
sudo apt install python3-tk(Debian/Ubuntu) orsudo dnf install python3-tkinter(Fedora).
| Property | Value |
|---|---|
| Cipher | AES-256-CBC |
| Key derivation | PBKDF2-HMAC-SHA256, 600 000 iterations |
| Salt | 32 bytes, cryptographically random |
| IV | 16 bytes, cryptographically random |
| Integrity | HMAC-SHA256 (encrypt-then-MAC) |
| Padding | PKCS7 |
PLCK (4 B) | version (1 B) | salt (32 B) | IV (16 B) | ciphertext (var) | HMAC (32 B)
passlock/
├── __init__.py # package metadata & version
├── __main__.py # python -m passlock entry point
├── core.py # encryption engine
├── cli.py # command-line interface
└── gui.py # graphical interface (tkinter)
pyproject.toml # package config (pip install .)
passlock.spec # PyInstaller build spec
build.sh # macOS / Linux build script
build.bat # Windows build script
installer_win.iss # Inno Setup script (Windows installer)
requirements.txt # pip dependencies
- Python 3.9+
cryptographypackagetkinter(included with Python on Windows/macOS; install separately on some Linux distros)