# CargoCrypt ๐
**Zero-config cryptographic operations for Rust projects**
[](https://crates.io/crates/cargocrypt)
[](LICENSE-MIT)
[](https://github.com/marcuspat/cargocrypt)
[](https://github.com/marcuspat/cargocrypt)
CargoCrypt brings zero-configuration cryptography to your Rust workflow: file encryption, git-integrated secret detection, and team key sharing.
## Demo

*Recorded from the actual binary with [asciinema](https://asciinema.org) + [agg](https://github.com/asciinema/agg).*
## Version 0.2.0
**135 of 135 unit tests passing as of 2026-08-11 (147/147 across the full suite: unit + integration + doctests). Previously known failure clusters have been fixed; see the Testing section below for details.**
### What's New in v0.2.0
โ
**Complete Feature Set:**
- **Full-featured TUI interface** with file browser and directory traversal
- **Secret detection** with entropy analysis and regex pattern matching
- **Comprehensive Git integration** (hooks, filters, attributes, team collaboration)
- **Real-time performance monitoring** with metrics dashboard and alerts
- **Circuit breaker resilience patterns** with automatic error recovery
- **Security hardening** with timing attack prevention and secure memory
- **Team collaboration features** with secure key distribution
## Quick Start
```bash
# Install from crates.io
cargo install cargocrypt
# Initialize in your project (zero config!)
cargocrypt init
# Initialize with git integration
cargocrypt init --git
# Encrypt sensitive files
cargocrypt encrypt src/secrets.rs
# Decrypt when needed
cargocrypt decrypt src/secrets.rs.enc
# Interactive TUI mode with full file browser
cargocrypt tui
# Real-time monitoring dashboard
cargocrypt monitor dashboard
```
## ๐ฅ Complete Feature Set
### Core Operations
- **File encryption/decryption** with ChaCha20-Poly1305 (1.0+ GB/s)
- **Password-based encryption** with Argon2id key derivation
- **Zero-configuration setup** - works immediately after install
- **Secure memory management** with automatic zeroization
- **Multiple security profiles** (Fast, Balanced, Secure, Paranoid)
### Advanced Features
- **Interactive TUI** with file browser and visual progress indicators
- **Git integration** with hooks, filters, and automatic secret detection
- **Team collaboration** with secure key sharing through git
- **Real-time monitoring** with metrics collection and alerting
- **Secret detection** for 50+ secret types via regex + entropy scoring (false-positive rate not independently benchmarked)
- **Performance optimization** with circuit breakers and retry logic
### Command Reference
```bash
# Project Management
cargocrypt init [--git] # Initialize project with optional git integration
cargocrypt config # Show current configuration
# File Operations
cargocrypt encrypt <file> # Encrypt individual files
cargocrypt decrypt <file> # Decrypt individual files
# Interactive Interfaces
cargocrypt tui # Launch full-featured TUI with file browser
cargocrypt monitor dashboard # Real-time monitoring dashboard
cargocrypt monitor metrics # Show current system metrics
cargocrypt monitor alerts # Show performance alerts
# Git Integration
cargocrypt git install-hooks # Install git hooks for automatic secret detection
cargocrypt git uninstall-hooks # Remove git hooks
cargocrypt git configure-attributes # Configure git attributes for encryption
cargocrypt git update-ignore # Update .gitignore with CargoCrypt patterns
# Advanced Features
cargocrypt monitor server # Start monitoring HTTP server
cargocrypt monitor export # Export metrics to JSON
cargocrypt monitor health # System health check
```
## ๐จ Interactive TUI
Launch the full-featured terminal interface:
```bash
cargocrypt tui
```
**TUI Features:**
- **File browser** with directory traversal and selection
- **Visual encryption/decryption** with progress indicators
- **Real-time configuration** viewer and editor
- **Performance monitoring** integrated displays
- **Team collaboration** status and key management
- **Security alerts** and recommendation system
- **Help system** with contextual guidance
## ๐ Performance Benchmarks
**Encryption/Decryption Performance:**
- **Throughput**: 1.0-1.2 GB/s (ChaCha20-Poly1305)
- **Key Derivation**: 110ms-6.8s (configurable security profiles)
- **Memory Usage**: 4MB-1GB (adaptive based on security level)
- **Setup Time**: <60 seconds (480x faster than server-based solutions)
**Security Profiles:**
| Profile | Memory | Time | Parallelism | Use Case |
|----------|--------|-------|-------------|----------|
| Fast | 4 MB | 1 iter| 8 threads | Development/Testing |
| Balanced | 64 MB | 3 iter| 4 threads | Production (Default) |
| Secure | 256 MB | 4 iter| 4 threads | Sensitive Data |
| Paranoid | 1 GB | 10 iter| 4 threads | Maximum Security |
## ๐ง Configuration
CargoCrypt works with zero configuration, but supports customization:
```toml
# .cargocrypt/config.toml (optional)
performance_profile = "Balanced" # Fast, Balanced, Secure, Paranoid
[key_params]
memory_cost = 65536 # Memory for key derivation (64MB default)
time_cost = 3 # Iteration count
parallelism = 4 # Thread count
output_length = 32 # Key length in bytes
[file_ops]
backup_originals = true # Create .backup files during encryption
[security]
timing_attack_protection = true # Constant-time operations
secure_memory = true # Automatic zeroization
[monitoring]
real_time_metrics = true # Enable performance monitoring
alert_thresholds = "balanced" # Alert sensitivity
[git_integration]
auto_detect_secrets = true # Regex + entropy-based secret detection
team_key_sharing = true # Secure collaborative key distribution
pre_commit_hooks = true # Automatic secret scanning
```
## ๐ Security
**Cryptographic Foundation:**
- **ChaCha20-Poly1305** - Fast, secure authenticated encryption
- **Argon2id** - Memory-hard key derivation function
- **Ring cryptography** - Battle-tested, audited implementations
- **Constant-time operations** - Protection against timing attacks
- **Secure memory** - Automatic zeroization of sensitive data
**Operational Security:**
- **Secret detection** - 50+ secret types via regex + entropy scoring
- **Git integration** - Prevent accidental secret commits
- **Team security** - Secure key distribution through git
- **Audit trails** - Comprehensive operation logging
- **Real-time alerts** - Security event monitoring
## ๐งช Testing & Quality
**Test status: 135/135 unit tests passing, 147/147 across the full suite (135 unit + 5 integration + 7 doctests), as of 2026-08-11.** All previously known failure clusters have been root-caused and fixed:
- Entropy-based secret detection (`detection::entropy`, `detection::scanner`, `detection::detector`) - the natural-language check now tokenizes text and matches whole words against a dictionary instead of doing raw substring search; false-positive/sequential-pattern heuristics no longer reject genuine secrets that happen to contain short digit runs (e.g. `sk_test_FAKE1234567890ABCDEF`); and confidence scoring is now gated by the same entropy/charset thresholds used for classification, so strings that don't clear those thresholds can no longer score as high-confidence secrets.
- Git-backed team storage (`git::storage`, `git::team`) - `EncryptedStorage::initialize` now creates the parent `.cargocrypt` directory before writing `storage.toml` (it did not exist yet on a fresh repo); team commits now stage the team directory with `index.add_all` (via a new `GitRepo::stage_all_under` helper) instead of passing a directory to `index.add_path`, which libgit2 rejects with "cannot create blob from '...': it is a directory".
- `crypto::security::tests::test_secure_buffer` - `SecureBuffer::zeroize` now zeroizes the buffer's contents in place instead of calling `Vec::zeroize()`, which also truncates the buffer to empty; the intended security property is "overwritten with zeros," not "deallocated."
- `git::hooks::tests::test_secret_pattern_matching` - the default secret-detection regexes now allow an optional leading quote before the character class, matching how the patterns are used against quoted config values.
- `validation::tests::test_path_validation` - a missing parent directory is now reported as a warning rather than a hard validation error, since it is a legitimate, common state (e.g. a path whose directory will be created later).
```bash
# Run full test suite
cargo test
# Run comprehensive functionality tests
./comprehensive_test.sh
# Performance benchmarks
cargo run --example performance_test --release
```
**Test Categories:**
- โ
Core encryption/decryption operations
- โ
Password security and edge cases
- โ
File operations with various types (binary, text, empty)
- โ
Concurrent operations and performance
- โ
Git integration and team features
- โ
TUI interface functionality
- โ
Monitoring and alerting systems
- โ
Error handling and resilience patterns
## ๐ ๏ธ Development
### Building from Source
```bash
git clone https://github.com/marcuspat/cargocrypt
cd cargocrypt/cargocrypt
cargo build --release
```
### Development Tools
```bash
# Watch for changes during development
cargo install cargo-watch
cargo watch -x test
# Fast testing
cargo install cargo-nextest
cargo nextest run
# Security audit
cargo audit
# Benchmark performance
cargo run --example performance_test --release
```
## ๐ค Contributing
We welcome contributions! See the Testing section above and [SECURITY_AUDIT_REPORT.md](SECURITY_AUDIT_REPORT.md) for current known issues before relying on this in production.
**Contribution Areas:**
- Additional secret detection patterns
- Performance optimizations
- Platform-specific enhancements
- Documentation improvements
- Integration with other tools
## ๐ License
Licensed under either of:
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE))
- MIT License ([LICENSE-MIT](LICENSE-MIT))
at your option.
## ๐ฃ๏ธ Roadmap
### v0.3.0 (Next Release)
- [ ] Hardware Security Module (HSM) integration
- [ ] Advanced team role management with fine-grained permissions
- [ ] Custom secret detection pattern training
- [ ] API integrations for external secret stores (HashiCorp Vault, AWS Secrets Manager)
### v1.0.0 (Stable Release)
- [ ] Complete security audit and certification
- [ ] Plugin ecosystem for extensibility
- [ ] Enterprise deployment and management tools
- [ ] Advanced analytics and compliance reporting
## ๐ Acknowledgments
- **Rust Cryptography Community** - Ring, ChaCha20-Poly1305, Argon2 teams
- **Ratatui Community** - Beautiful terminal user interfaces
- **Git Community** - Integration patterns and collaborative workflows
- **Claude AI** - Development acceleration and intelligent code generation
---
**๐ Zero-Config Security. ๐ฆ Pure Rust.**
**Under active development โ see Testing section for current status. Built for teams. Optimized for Rust.**