https://github.com/markkreel/encryption-cli
A Python CLI tool that encrypts files with AES-256 and verifies integrity using SHA-256, offering a simple, secure way to protect sensitive data.
https://github.com/markkreel/encryption-cli
aes-256 cli cli-utility cybersecurity decryption encryption hash pbkdf2 pep8 portfolio pycryptodome python salt security-tools sha256 zlib
Last synced: 6 months ago
JSON representation
A Python CLI tool that encrypts files with AES-256 and verifies integrity using SHA-256, offering a simple, secure way to protect sensitive data.
- Host: GitHub
- URL: https://github.com/markkreel/encryption-cli
- Owner: Markkreel
- License: mit
- Created: 2025-02-24T16:17:49.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-03-31T14:38:29.000Z (6 months ago)
- Last Synced: 2025-03-31T16:02:28.454Z (6 months ago)
- Topics: aes-256, cli, cli-utility, cybersecurity, decryption, encryption, hash, pbkdf2, pep8, portfolio, pycryptodome, python, salt, security-tools, sha256, zlib
- Language: Python
- Homepage:
- Size: 117 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Encryption CLI
A Python utility for securely encrypting files with AES-256 encryption and zlib compression, with integrity verification and progress tracking.
## Features
- Complete CLI integration for encryption, decryption, and compression
- Configurable compression levels through CLI arguments
- Extensive logging and error handling
- Support for multiple file formats
- Progress tracking during operations## Specifications
- AES-256 CBC mode encryption
- Zlib compression with configurable levels (1-9)
- SHA-256 hash verification for tamper detection## Installation
```bash
# Requires Python 3.9+
pip install -r requirements.txt
```## Usage
### Secure a File (Encrypt + Compress)
```python
from src.main import secure_filesecure_file(
"sensitive.docx",
"your_strong_password",
compression_level=7 # Optimal balance of speed/size
)
# Creates: sensitive.docx.flc
```#### Encrypt Command
```bash
python src/cli.py encrypt file_path --password yourpassword --compression balanced
```Available compression levels: none, fast, balanced, max
### Restore a File (Decrypt + Decompress)
```python
from src.main import restore_filerestore_file(
"sensitive.docx.flc",
"your_strong_password"
)
# Restores: sensitive.docx
```#### Decrypt Command
```bash
python src/cli.py decrypt file_path --password mypassword
```Optional arguments:
- `--output`: Specify custom output path
For more example commands and usage scenarios, refer to the `CLI_EXAMPLES.md` document or the `sample.sh` script included in the repository. The script includes examples of:
- Direct file compression with different compression levels
- Progress tracking during compression/decompression
- Various compression configurations
- Basic and advanced usage patterns## Technical Details
### File Structure (.flc)
```bash
[1 byte: compression level] +
[32 bytes: SHA-256 hash] +
[zlib compressed data] +
[AES-256 encrypted payload]
```### Integrity Verification
1. Generates SHA-256 hash of original data
2. Stores hash in file header
3. Verifies hash during restoration## Testing
### Running Tests Locally
Run test suite:
```bash
pytest tests/ -v
```### Running Tests with Docker
You can also run tests using Docker:
```bash
# Build the Docker image
docker build -t filelock-tests .# Run tests in a Docker container
docker run --rm filelock-tests
```Or using Docker Compose:
```bash
docker-compose up
```## Contributing
1. Fork the repository
2. Create feature branch
3. Submit pull request## License
MIT License - See [LICENSE](LICENSE) for details
**Last Updated:** 28-03-2025 ⸺ **Last Reviewed:** 28-03-2025