No project description provided
Project description
FFenc - File Encryption Tool
A secure file encryption and decryption tool with password protection.
Features
- Secure Encryption: Uses Fernet (AES-128-CBC) for content encryption
- Password Protection: Encrypts the encryption key with PBKDF2 key derivation
- CLI Interface: Easy-to-use command-line interface
- Hidden Passwords: Secure password input that doesn't display on screen
- File and Text Support: Encrypt both files and text content
- Binary Safe: Handles both text and binary files
Installation
pip install -e .
Usage
Command Line Interface
The tool provides several commands for different use cases:
Encrypt a File
# Encrypt a file (password will be prompted)
ffenc encrypt-file input.txt output.enc
# Encrypt with password provided
ffenc encrypt-file input.txt output.enc --password "mysecret"
# Encrypt with password flag
ffenc encrypt-file input.txt output.enc -p "mysecret"
Decrypt a File
# Decrypt to a new file (password will be prompted)
ffenc decrypt-file output.enc decrypted.txt
# Decrypt to stdout
ffenc decrypt-file output.enc --stdout
# Decrypt with password provided
ffenc decrypt-file output.enc decrypted.txt -p "mysecret"
Encrypt Text Content
# Encrypt text from command line
ffenc encrypt-text "Hello, secret message!" output.enc
# Encrypt text from file
ffenc encrypt-text --file input.txt output.enc
# Encrypt text from stdin
echo "Secret message" | ffenc encrypt-text output.enc
Python API
You can also use the functions directly in Python:
from ffenc import encrypt, decrypt
# Encrypt content
encrypt("my_password", "Hello, secret message!", "output.enc")
# Decrypt content
decrypted = decrypt("my_password", "output.enc")
print(decrypted.decode('utf-8')) # Hello, secret message!
Security Features
- Key Generation: Each encryption generates a unique random key
- Key Derivation: Uses PBKDF2 with 100,000 iterations for password-based key derivation
- Salt: Each encryption uses a unique salt for additional security
- Secure Storage: The encryption key is encrypted with the password before storage
File Format
Encrypted files are stored in JSON format containing:
- Encrypted encryption key (encrypted with password)
- Salt used for key derivation
- Encrypted content (base64 encoded)
Examples
Encrypting a sensitive document
ffenc encrypt-file secret_document.txt secret_document.enc
# Enter password when prompted
Decrypting and viewing content
ffenc decrypt-file secret_document.enc --stdout
# Enter password when prompted
Encrypting a configuration file
ffenc encrypt-text --file config.json config.enc
# Enter password when prompted
Development
Running Tests
pytest tests/
Building
pip install build
python -m build
License
MIT License - see LICENSE.txt for details.
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
ffenc-0.0.1.tar.gz
(5.3 kB
view details)
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
ffenc-0.0.1-py3-none-any.whl
(6.2 kB
view details)
File details
Details for the file ffenc-0.0.1.tar.gz.
File metadata
- Download URL: ffenc-0.0.1.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1938a997131f93c6260002d8b87bb830252f65abde6fde98174b0530feadac02
|
|
| MD5 |
069742f4d1533b3cacef0473777b2ac5
|
|
| BLAKE2b-256 |
86e0d8e11e6908722815e5a979d510d3eb026e69d85e5ca87c3a127ed4cbd4e8
|
File details
Details for the file ffenc-0.0.1-py3-none-any.whl.
File metadata
- Download URL: ffenc-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e22bff0bdbd5ec3e7ebb0b6006e86e22c8ff9b8cfbce8c7bfad92bb0390bfe8
|
|
| MD5 |
1ad65cebd724b46fd803008200384280
|
|
| BLAKE2b-256 |
1a9bbfda730229f8621b5cff6514e94cfa6314ebefeb380529322094edf76797
|