A secure command-line file encryption tool built in Rust, implementing AES-256-GCM encryption with Argon2 key derivation for password-based file protection.
- AES-256-GCM Encryption - Industry-standard authenticated encryption
- Argon2 Key Derivation - Memory-hard password hashing resistant to brute-force attacks
- Password Confirmation - Prevents accidental encryption with mistyped passwords
- Memory Security - Automatic password zeroing after use
- Interactive CLI - Simple numbered menu system for file selection
- Organised Vault - Encrypted files stored in dedicated vault directory
- Authenticated Encryption - Detects tampering and wrong passwords automatically
- Cipher: AES-256-GCM (Galois/Counter Mode)
- Key Size: 256 bits
- Authentication: Built-in GCM authentication tag
- Algorithm: Argon2id (default configuration)
- Salt Size: 32 bytes (randomly generated per file)
- Purpose: Converts passwords into cryptographic keys whilst resisting GPU attacks
Encrypted files use the following structure:
[32 bytes: Salt] + [12 bytes: Nonce] + [Variable: Ciphertext + Auth Tag]
This allows secure decryption whilst maintaining cryptographic best practices.
- Rust 1.70 or higher (Install Rust)
Clone the repository:
git clone https://github.com/harrymoorheadtaylor/Rust-File-Vault.git
cd Rust-File-VaultBuild the project:
cargo build --releaseThe compiled binary will be located at:
target/release/file_vault(Linux/macOS)target\release\file_vault.exe(Windows)
cargo install --git https://github.com/harrymoorheadtaylor/Rust-File-Vault
Once installed run it anywhere using:
file_vault
Run the programme from the project directory:
cargo runOr use the compiled binary directly:
./target/release/file_vault # Linux/macOS
.\target\release\file_vault.exe # Windows- Encrypt a file - Select a file from the current directory to encrypt
- Decrypt a file - Select an encrypted file from the vault to decrypt
- List encrypted files - View all files currently in the vault
- Exit - Close the programme
Encrypting a file:
=== Encrypt File ===
Available files:
1. document.pdf
2. secret.txt
Enter file number: 1
Enter password:
Confirm password:
Passwords match
Encrypting...
Encryption complete!
Encrypted file saved: vault/document.pdf.vault
Original file deleted
Decrypting a file:
=== Decrypt File ===
Encrypted files in vault:
1. document.pdf.vault
Enter file number: 1
Enter password:
Decrypting...
Decryption complete!
Decrypted file saved: document.pdf
Encrypted file deleted from vault
Rust-File-Vault/
├── src/
│ └── main.rs # Main application code
├── vault/ # Directory for encrypted files (created automatically)
├── Cargo.toml # Project dependencies
├── Cargo.lock # Dependency lock file
├── .gitignore # Git ignore rules
└── README.md # This file
- aes-gcm (0.10) - AES-256-GCM encryption implementation
- argon2 (0.5) - Argon2 password hashing
- rand (0.8) - Cryptographically secure random number generation
- rpassword (7.3) - Secure password input without echo
- zeroize (1.7) - Secure memory zeroing for sensitive data
All cryptographic implementations are from the RustCrypto project.
- Strong Encryption: AES-256-GCM provides both confidentiality and authenticity
- Secure Key Derivation: Argon2 makes brute-force attacks computationally expensive
- Memory Safety: Rust's ownership system prevents memory-related vulnerabilities
- Password Zeroing: Sensitive data is explicitly cleared from memory after use
- No Password Storage: Passwords are never written to disk
- Hidden Input: Password entry doesn't display characters to prevent shoulder surfing
- Use strong, unique passwords - Weak passwords compromise encryption strength
- Keep passwords secure - Lost passwords mean permanently lost data
- Verify file integrity - GCM authentication will detect tampering but cannot recover corrupted files
- Memory safety without garbage collection overhead
- Zero-cost abstractions for cryptographic operations
- Strong type system prevents common security bugs
- Industry adoption for security-critical applications
AES-256-GCM:
- NIST-approved standard
- Hardware acceleration on modern CPUs
- Provides both encryption and authentication
- Resistant to known attacks
Argon2:
- Winner of the Password Hashing Competition (2015)
- Memory-hard algorithm resistant to GPU/ASIC attacks
- Configurable time/memory trade-offs
- Recommended by OWASP
- Files must be small enough to fit in memory (both plaintext and ciphertext)
- Encrypted filenames reveal original filename and extension
- No password recovery mechanism (by design)
- Terminal-only interface (no GUI)
Potential improvements for future versions:
- Streaming encryption for large files
- Optional filename encryption
- Multiple password attempts with lockout
- Vault password management
- Cross-platform file browser integration
MIT Licence - See LICENSE file for details
Harry Moorhead-Taylor - BSc Computer Science with Cyber Security, University of Liverpool
GitHub: @harrymoorheadtaylor
- RustCrypto for cryptographic implementations
- Rust community for excellent documentation and libraries