FluxEncrypt
A high-performance, secure encryption SDK for Rust applications, providing both hybrid encryption capabilities and streaming data protection with enterprise-grade security features.
Authors
- Wyatt Roersma - Lead Developer
- Claude Code - AI Assistant Developer
- Codex - Architecture Consultant
Developed for the ThreatFlux Organization
Features
🔐 Core Encryption
- Hybrid Encryption: Combines RSA-OAEP and AES-GCM for optimal security and performance
- AES-256-GCM: Fast symmetric encryption with authenticated encryption
- RSA-OAEP: Secure asymmetric encryption with optimal padding (4096-bit keys by default)
- Key Derivation: PBKDF2 and Argon2 support for secure key generation
- Base64 Encoding: Default base64 output for easy handling in text environments
🚀 Performance
- Stream Processing: Handle large files and data streams efficiently
- Batch Operations: Process multiple files with parallel execution
- Memory Safety: Zero-copy operations where possible
- Hardware Acceleration: Leverages hardware crypto instructions
🔧 Developer Experience
- Simple API: Intuitive interface for common use cases
- Flexible Configuration: Customizable security parameters
- String Data Support: Direct encryption/decryption of string data via CLI
- Multiple Output Formats: Base64 (default) and raw binary output options
- Comprehensive Examples: Ready-to-use code samples
- Excellent Documentation: Detailed guides and API references
🛡️ Security
- Memory Protection: Automatic secret zeroization
- Constant-time Operations: Protection against timing attacks
- Secure Random Generation: Cryptographically secure randomness
- Environment Integration: Secure secret management from environment variables
📦 Async Support
- Tokio Integration: Full async/await support
- Streaming Operations: Process large datasets asynchronously
- Concurrent Processing: Handle multiple operations simultaneously
Quick Start
Installation
Add FluxEncrypt to your Cargo.toml:
[]
= "0.1.3"
# For async support
= "0.1.3"
# For CLI usage
= "0.1.3"
Basic Usage
use ;
use KeyPair;
// Generate a new key pair (default 4096-bit)
let keypair = generate?;
// Create cipher with default configuration
let cipher = new;
// Encrypt data
let plaintext = b"Hello, FluxEncrypt!";
let ciphertext = cipher.encrypt?;
// Decrypt data
let decrypted = cipher.decrypt?;
assert_eq!;
File Encryption
use FileStreamCipher;
use Path;
let cipher = new;
// Encrypt a file
cipher.encrypt_file?;
// Decrypt a file
cipher.decrypt_file?;
Async Operations
use ;
let cipher = new;
// Async encryption
let ciphertext = cipher.encrypt_async.await?;
// Async decryption
let plaintext = cipher.decrypt_async.await?;
Environment-based Key Management
use EnvSecretProvider;
// Load keys from environment variables
let provider = new;
let private_key = provider.get_private_key?;
let public_key = provider.get_public_key?;
Command Line Interface
FluxEncrypt includes a powerful CLI for file encryption operations:
# Install the CLI
# Generate a new key pair (4096-bit RSA by default)
# Generate keys in base64 format
# Encrypt a file
# Encrypt string data directly (outputs base64 by default)
# Encrypt with raw binary output
# Decrypt a file
# Decrypt base64 string data directly
# Decrypt raw binary input
# Batch encrypt multiple files
# Stream encrypt large files
Configuration
FluxEncrypt provides flexible configuration options:
use ;
let config = builder
.cipher_suite
.key_derivation
.compression
.memory_limit_mb
.build;
Performance Benchmarks
FluxEncrypt is designed for high performance:
- AES-256-GCM: 2.5+ GB/s throughput on modern hardware
- RSA-4096: 500+ operations/sec for key operations (enhanced security)
- Hybrid Mode: Optimal balance of security and speed
- Stream Processing: Constant memory usage regardless of file size
Run benchmarks:
&&
Security Considerations
Cryptographic Standards
- Uses only well-established, peer-reviewed algorithms
- Implements current NIST recommendations
- Regular security audits and updates
Memory Safety
- Automatic zeroization of sensitive data
- Protected memory allocation for keys
- Secure random number generation
Side-channel Resistance
- Constant-time implementations
- Protection against timing attacks
- Secure coding practices throughout
Project Structure
fluxencrypt/
├── fluxencrypt/ # Core library
├── fluxencrypt-cli/ # Command line interface
├── fluxencrypt-async/ # Async support
├── examples/ # Usage examples
├── benches/ # Performance benchmarks
├── tests/ # Integration tests
└── docs/ # Additional documentation
Examples
The fluxencrypt/examples/ directory contains comprehensive examples:
basic_encryption.rs- Simple encrypt/decrypt operations with 4096-bit keysfile_encryption.rs- File-based encryption with streamingkey_management.rs- Key generation, storage, and base64 handlingenvironment_config.rs- Environment-based configuration
Note: Examples use 2048-bit keys for demonstration purposes. Production use should prefer 4096-bit keys (CLI default).
Contributing
We welcome contributions! Please see our Contributing Guidelines for details.
Development Setup
# Clone the repository
# Install development dependencies
# Run tests
# Run security audit
# Check for license compliance
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
- Documentation: https://docs.rs/fluxencrypt
- Issues: https://github.com/ThreatFlux/fluxencrypt/issues
- Discussions: https://github.com/ThreatFlux/fluxencrypt/discussions
Changelog
See CHANGELOG.md for a detailed history of changes.
FluxEncrypt - Secure, Fast, Reliable Encryption for Rust Applications