A simple yet secure File Encryption & Decryption Tool built in Python.
It uses AES-256-GCM for encryption and a password-protected master key for secure key management.
- AES-256-GCM file encryption & decryption
- Master key wrapped with password using scrypt (key derivation)
- Change password anytime without re-encrypting files
- Integrity and authenticity validation
- Interactive CLI password prompts
- Built-in unit tests (pytest)
- GitHub Actions CI for test automation
| Component | Technology |
|---|---|
| Language | Python 3.11+ |
| Library | cryptography |
| Testing | PyTest |
| Version Control | Git & GitHub |
| CI/CD | GitHub Actions |
git clone https://github.com/Lokeswar72/file-encryptor.git
cd file-encryptorpython -m venv .venv
# Activate (Windows PowerShell)
.venv\Scripts\Activate.ps1pip install -r requirements.txtpython encryptor.py generate-master-keyCreates a new AES master key and encrypts it with a password-derived key (scrypt).
Stores the wrapped key at keys/master_key.bin.enc.
python encryptor.py encrypt examples/secret.txtCreates an encrypted file: examples/secret.txt.enc.
python encryptor.py decrypt examples/secret.txt.encDecrypts the file back to examples/secret.txt.
python encryptor.py change-passwordUnwraps your master key using the old password and re-wraps it using a new one —
so you can rotate passwords without re-encrypting all files.
pytest -qIf everything is working, you’ll see:
.. [100%]
2 passed in 0.50s
This repository includes a workflow that automatically:
- Sets up Python 3.9, 3.10, and 3.11
- Installs all dependencies
- Runs your PyTest suite
You can see the latest build status at the top of this README.
(.venv) PS> python encryptor.py generate-master-key
Enter password to protect the master key:
Confirm password:
Generated and wrapped master key -> keys\master_key.bin.enc
file-encryptor/
│
├── encryptor.py # Main CLI program
├── tests/
│ └── test_encryptor.py # Unit tests
├── requirements.txt # Dependencies
├── .github/workflows/ # CI pipeline
│ └── python-tests.yml
├── keys/ # Encrypted master key (gitignored)
└── README.md # Project documentation
- Keep your
keys/master_key.bin.encbacked up safely. - Never commit or share your master key file or passwords.
- Use strong, unique passwords.
- Test decryption regularly to verify backups.
Lokeswar
GitHub: @Lokeswar72
This project is open source and available under the MIT License.