fernetrest 🔐
fernetrest is a Python package and CLI utility designed to provide secure, authenticated symmetric file encryption for Data at Rest using Fernet (AES-128-CBC + HMAC-SHA256) and key derivation via PBKDF2-HMAC-SHA256.
🛡️ Security Architecture
- Key Derivation (PBKDF2-HMAC-SHA256):
- Passwords are never used directly as cipher keys.
- A unique 16-byte cryptographically random salt (
os.urandom(16)) is generated per encryption to defeat rainbow table attacks. - 600,000 iterations of PBKDF2 stretch the password, mitigating brute-force and GPU dictionary attacks.
- Authenticated Symmetric Encryption (Fernet):
- Confidentiality: AES-128 in CBC mode with PKCS7 padding.
- Integrity & Authenticity: HMAC-SHA256 signatures guarantee that files cannot be modified or tampered with without immediate detection upon decryption.
- Format:
- Output files (
.enc) prepend the 16-byte salt directly to the Fernet ciphertext:┌──────────────────────┬──────────────────────────────────────────┐ │ Salt (First 16 Bytes)│ Ciphertext / Encrypted Content (Fernet) │ └──────────────────────┴──────────────────────────────────────────┘
- Output files (
🚀 Installation
pip install fernetrest
💻 CLI Usage
Once installed, you can use fernetrest directly from your command line!
1. Interactive Menu
Simply run:
fernetrest
2. Command Line Arguments
# Encrypt a file (prompts securely for password without echoing)
fernetrest encrypt secret_doc.pdf
# Specify custom output destination
fernetrest encrypt secret_doc.pdf -o /path/to/backup.enc
# Decrypt a file
fernetrest decrypt secret_doc.pdf.enc
# Specify custom decrypted output
fernetrest decrypt secret_doc.pdf.enc -o restored_doc.pdf
🐍 Python Library Usage
You can also use fernetrest inside your own Python projects:
from fernetrest import encrypt_file, decrypt_file
# Encrypt a document or media file
encrypted_path = encrypt_file("confidential.txt", password="MySecretPassword123")
print(f"Encrypted file saved to: {encrypted_path}")
# Decrypt the file
original_path = decrypt_file("confidential.txt.enc", password="MySecretPassword123")
print(f"Decrypted file restored to: {original_path}")
📄 License
This project is licensed under the MIT License.
Metadata
Release files for fernetrest 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fernetrest-0.1.0.tar.gz | 5.6 kB | Without provenance | Details for fernetrest-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fernetrest-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for fernetrest-0.1.0-py3-none-any.whl |
Total release size: 11.7 kB
Release files / fernetrest-0.1.0.tar.gz
| Download URL | fernetrest-0.1.0.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9d22896fabaa29a61ae109ca031fc157e0a81ddf1a21636117cf63b9639ba4cf
|
|
BLAKE2b-256 checksum How to use checksums |
d0925cb54730364388516d1c7b3541c890784b612f8bb1f4e79a1b496ab1ad1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / fernetrest-0.1.0-py3-none-any.whl
| Download URL | fernetrest-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
64fbb832cc4f3477cf7e0a195edecb3bc61f04016f243df9d66725386387a168
|
|
BLAKE2b-256 checksum How to use checksums |
a56573c7b54323cdabb51ed5ddf1202e54aa5f0681aa8e167bbbb66da429babd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Security for fernetrest 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.