A secure, production-quality CLI tool for encrypting and decrypting files using modern cryptography (AES-256-GCM / ChaCha20-Poly1305 and Argon2id).
Before installing, ensure you have the following tools installed on your Windows machine:
- Rust: Install Rust.
- C++ Build Tools: Required for compiling some dependencies.
- Download Visual Studio Build Tools.
- During installation, select "Desktop development with C++".
If you have the source code, you can run it directly via Cargo:
# Run CLI commands
cargo run --release -- encrypt input.txt output.enc
# Run TUI mode
cargo run --release -- uiTo use rust-file-encryptor from anywhere in your terminal:
-
Install via Cargo:
cargo install --path .This will compile and move the binary to your Cargo bin folder (usually
%USERPROFILE%\.cargo\bin), which should already be in your PATH. -
Manual Installation:
- Locate the built executable at:
target\release\rust-file-encryptor.exe - Copy it to a folder in your PATH (e.g.,
C:\Windows\System32or a custombinfolder).
- Locate the built executable at:
Launch the terminal user interface for a more visual experience.
rust-file-encryptor uiControls:
- Arrows / Tab: Navigate fields and tabs.
- Enter: Select files (in picker) or Submit forms.
- Esc: Go back or Cancel.
- Features: File picker, password masking, and easy switching between Encrypt/Decrypt modes.
Encrypts a file using a password. If the password is not provided via flag, you will be securely prompted.
rust-file-encryptor encrypt <INPUT_FILE> <OUTPUT_FILE> [FLAGS]Flags:
-p, --password <PASSWORD>: Provide password directly (less secure in history).-a, --algorithm <ALGO>: Choose encryption algorithm.aes256-gcm(Default) - Hardware accelerated, very fast.chacha20-poly1305- fast in software, safe against timing attacks.
--overwrite: Overwrite the output file if it exists.
Examples:
# Interactive password prompt (Recommended)
rust-file-encryptor encrypt secret.doc secret.enc
# Using ChaCha20-Poly1305
rust-file-encryptor encrypt image.png image.enc --algorithm chacha20-poly1305
# Force overwrite
rust-file-encryptor encrypt data.csv data.enc --overwriteDecrypts a file back to its original form.
rust-file-encryptor decrypt <INPUT_FILE> <OUTPUT_FILE> [FLAGS]Examples:
# Interactive password prompt
rust-file-encryptor decrypt secret.enc secret_restored.doc
# Provide password (useful for scripts)
rust-file-encryptor decrypt backup.enc backup.tar.gz --password "MySecretPass"- Encryption: Authenticated Encryption with Associated Data (AEAD).
- AES-256-GCM (96-bit nonce, 128-bit tag)
- ChaCha20-Poly1305 (96-bit nonce, 128-bit tag)
- Key Derivation: Argon2id
- Resists GPU/ASIC brute-force attacks.
- Uses a unique random 32-byte salt for every file.
- Randomness: Uses
OsRng(cryptographically secure system RNG) for salts and nonces. - Memory Safety: Passwords are zeroed out from memory after use.
This tool is provided as-is. While it uses standard, well-audited cryptographic primitives, always ensure you have backups of your important data.