Lockbox 🔐
A secure file encryption CLI tool built in Rust. Lockbox uses industry-standard cryptographic primitives to protect your files with a password.
Installation
From crates.io (recommended)
From Source
Quick Start
# Encrypt a file (password prompt will appear)
# Creates: secret.lb
# Decrypt a file
# Restores: secret.txt
Usage
Encrypt Files
# Encrypt a single file
# Encrypt multiple files
# Force overwrite of existing .lb files
# Securely delete originals after encryption (3-pass random overwrite)
# Combine flags
You'll be prompted to enter and confirm your password (hidden input):
🔐 Lockbox Encryption
Enter password:
Confirm password:
Encrypting secret.txt ... ✓ → secret.lb
Note: The original file extension is encrypted inside the
.lbfile and will be restored on decryption. This hides the file type from observers.
Decrypt Files
# Decrypt a single file
# Decrypt to a specific directory
# Decrypt multiple files
# Force overwrite of existing files
Directory Encryption
Lockbox can recursively encrypt or decrypt entire directories, preserving the directory structure:
# Encrypt all files in a directory
# Decrypt all .lb files in a directory to an output location
# Encrypt a directory and securely delete the originals
Piping (Stdin/Stdout)
Lockbox supports reading from stdin and writing to stdout for composability with other tools. When no files are provided and stdin is piped, Lockbox operates in streaming mode:
# Encrypt from stdin to a file
|
# Decrypt from stdin to a file
|
# Chain with other tools
|
| |
Password prompts are written to stderr, so they won't interfere with piped data.
Command Aliases
For convenience, shorthand aliases are available:
| Command | Aliases |
|---|---|
encrypt |
enc, e |
decrypt |
dec, d |
Flags Reference
Encrypt
| Flag | Short | Description |
|---|---|---|
--force |
-f |
Overwrite existing .lb files without prompting |
--shred |
-s |
Securely delete originals after encryption (also --delete) |
--progress |
-p |
Show a progress bar when processing multiple files |
Decrypt
| Flag | Short | Description |
|---|---|---|
--force |
-f |
Overwrite existing output files without prompting |
--output <DIR> |
-o |
Output directory for decrypted files |
--progress |
-p |
Show a progress bar when processing multiple files |
Security
Lockbox uses the following cryptographic primitives:
- Argon2id for password-based key derivation (64 MiB memory, 3 iterations, 4 parallelism)
- ChaCha20-Poly1305 for authenticated encryption (256-bit keys, 96-bit nonces)
- Authenticated header — the file header (magic bytes, version, KDF params, filename, salt, nonce) is passed as AEAD associated data, preventing undetected tampering
- Secure memory handling via
zeroize(key material zeroed on drop) andmlock(prevents swap to disk on Unix) - Secure deletion via
--shredoverwrites files with cryptographically random data (3 passes) before unlinking
KDF parameters are stored in the encrypted file header, allowing future upgrades without breaking existing files.
Note: Lockbox currently loads entire files into memory. A warning is displayed for files over 1 GiB. For very large files, consider available RAM or use stdin piping.
Development
# Run tests
# Run lints
# Format code
# Build release
Uninstalling
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Changelog
See CHANGELOG.md for release history.
License
MIT License - see LICENSE for details.