Skip to content

muskiteer/Encryptor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” File Encryptor

A secure, cross-platform file and folder encryption tool built with C++ that uses military-grade AES-256-CBC encryption with PBKDF2 key derivation.

✨ Features

  • πŸ›‘οΈ Military-Grade Security: AES-256-CBC encryption with PBKDF2 key derivation (100,000 iterations)
  • πŸ“ File & Folder Support: Encrypt single files or entire directory structures
  • πŸ–₯️ Interactive CLI: User-friendly interface with tab autocompletion for file paths
  • 🏠 Home Directory Support: Works with ~ paths and automatic expansion
  • πŸ”’ Secure Password Input: Hidden password entry with confirmation for encryption
  • πŸ“¦ Smart Compression: Automatic ZIP compression before encryption
  • πŸ”„ Directory Preservation: Maintains folder structure during decryption
  • ⚑ Fast Performance: Optimized for large files and directories
  • 🐧 Linux Native: Built specifically for Linux with bash-style tab completion

πŸš€ Quick Start

Prerequisites

# Ubuntu/Debian
sudo apt update
sudo apt install build-essential cmake libssl-dev libzip-dev pkg-config

# CentOS/RHEL/Fedora
sudo dnf install gcc-c++ cmake openssl-devel libzip-devel pkgconfig

# Arch Linux
sudo pacman -S base-devel cmake openssl libzip

Build & Install

git clone https://github.com/muskiteer/Encyptor
cd encryptor
mkdir build && cd build
cmake ..
make -j$(nproc)

Usage

Interactive Mode (Recommended)

./build/bin/encryptor
  • Follow the guided prompts
  • Use Tab for path autocompletion
  • Supports ~/ home directory paths

Command Line Mode

# Encrypt a file
./build/bin/encryptor -i document.txt -o ~/encrypted_output -p your_password -e

# Encrypt a folder
./build/bin/encryptor -i ~/my_folder -o ~/encrypted_output -p your_password -e

# Decrypt
./build/bin/encryptor -i file.txt.enc -o ~/decrypted_output -p your_password -d

# Show help
./build/bin/encryptor -h

πŸ“– How It Works

Encryption Process

  1. Input Processing: Files/folders are compressed into ZIP format
  2. Key Derivation: Password β†’ PBKDF2 (100,000 iterations) β†’ 256-bit key
  3. Random Generation: Cryptographically secure salt and IV generation
  4. Encryption: AES-256-CBC encryption with integrity delimiter
  5. Output: Single .enc file containing: [salt][IV][encrypted_data]

Decryption Process

  1. File Reading: Extract salt, IV, and encrypted data
  2. Key Derivation: Recreate encryption key using password and salt
  3. Decryption: AES-256-CBC decryption with integrity verification
  4. Extraction: Decompress ZIP and restore original structure

πŸ”§ Technical Specifications

Component Technology
Encryption AES-256-CBC
Key Derivation PBKDF2-HMAC-SHA256
Iterations 100,000 (configurable)
Salt/IV Size 128-bit (16 bytes)
Compression ZIP with directory preservation
Libraries OpenSSL, libzip
Language C++17

πŸ“ Project Structure

encryptor/
β”œβ”€β”€ CMakeLists.txt          # Build configuration
β”œβ”€β”€ main.cpp                # Main application entry
β”œβ”€β”€ cmd/
β”‚   └── cli.h              # Interactive CLI with tab completion
β”œβ”€β”€ internal/
β”‚   β”œβ”€β”€ directory.h        # Directory structure cleanup utilities
β”‚   β”œβ”€β”€ encryption.h       # AES encryption/decryption functions
β”‚   └── zip.h              # ZIP compression utilities
β”œβ”€β”€ test/                   # Test files and examples
β”‚   β”œβ”€β”€ testing.txt        # Sample test file
β”‚   └── *.enc              # Generated encrypted files
β”œβ”€β”€ build/                  # Build output (gitignored)
β”‚   └── bin/
β”‚       └── encryptor      # Compiled binary
└── README.md              # This file

πŸ›‘οΈ Security Features

  • Strong Key Derivation: 100,000 PBKDF2 iterations (configurable up to 600,000)
  • Cryptographically Secure Random: Uses OpenSSL's RAND_bytes()
  • Memory Security: Automatic password clearing after use
  • Path Validation: Protection against directory traversal attacks
  • Integrity Verification: Built-in tamper detection
  • No Key Storage: Keys are derived fresh each time

πŸ“‹ Command Reference

Interactive Mode

./build/bin/encryptor

Features:

  • Tab completion for file paths
  • Home directory (~) support
  • Hidden password input
  • Password confirmation for encryption
  • Real-time path validation

Command Line Options

-i <path>    Input file or folder
-o <path>    Output directory
-p <pass>    Password for encryption/decryption
-e           Encrypt mode
-d           Decrypt mode
-h           Show help

🚨 Security Considerations

βœ… Strong Points

  • Industry-standard AES-256-CBC encryption
  • High iteration PBKDF2 (100,000+ iterations)
  • Cryptographically secure random generation
  • Memory clearing after password use
  • Path traversal protection

⚠️ Important Notes

  • Password Strength: Use strong, unique passwords
  • Backup: Keep secure backups of encrypted files
  • Updates: Regularly update OpenSSL and dependencies
  • Environment: Use on trusted systems only

πŸ”§ Build Options

Debug Build

cmake -DCMAKE_BUILD_TYPE=Debug ..
make

Release Build (Optimized)

cmake -DCMAKE_BUILD_TYPE=Release ..
make

Custom Iterations

Modify main.cpp line 8:

const int iterations = 600000;  // Increase for higher security

πŸ› Troubleshooting

Common Issues

"libssl not found"

sudo apt install libssl-dev  # Ubuntu/Debian
sudo dnf install openssl-devel  # CentOS/Fedora

"libzip not found"

sudo apt install libzip-dev  # Ubuntu/Debian
sudo dnf install libzip-devel  # CentOS/Fedora

"Permission denied"

chmod +x build/bin/encryptor

Tab completion not working

  • Ensure you're in interactive mode (build/bin/encryptor without arguments)
  • Check terminal supports ANSI escape sequences

πŸ“ˆ Performance

Benchmarks (approximate)

  • Small files (<1MB): Near-instantaneous
  • Medium files (1-100MB): 1-10 seconds
  • Large files (100MB-1GB): 10-60 seconds
  • Folders: Depends on total size and file count

Optimization Tips

  • Use Release build for production
  • SSD storage for better I/O performance
  • Adjust PBKDF2 iterations based on security vs speed needs

πŸ§ͺ Testing

The test directory contains sample files for testing:

# Test encryption
./build/bin/encryptor -i test/testing.txt -o /tmp/encrypted_test -p testpass123 -e

# Test decryption
./build/bin/encryptor -i /tmp/encrypted_test.txt.enc -o /tmp/decrypted_test -p testpass123 -d

πŸ” Example Usage

Encrypting a Single File

$ ./build/bin/encryptor
=== File Encryption Tool ===
Tab for autocompletion, Enter to confirm

Choose operation:
1. Encrypt (e)
2. Decrypt (d)
Enter choice (e/d): e
Input file/folder: ~/Documents/secret.txt
Output directory: ~/encrypted/
Enter password: ********
Confirm password: ********

Operation: Encrypt
Input: /home/user/Documents/secret.txt
Output: /home/user/encrypted/
Proceeding...

Encrypting...
File successfully zipped: /home/user/Documents/secret.txt.tmp.zip
Encryption completed successfully: /home/user/encrypted/secret.txt.enc

Decrypting a File

$ ./build/bin/encryptor -i ~/encrypted/secret.txt.enc -o ~/decrypted/ -p mypassword -d
Decrypting...
Extraction completed: /home/user/decrypted/
No unnecessary nesting detected.
Decryption completed successfully: /home/user/decrypted/

🀝 Contributing

  1. Fork the repository
  2. Create feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open Pull Request

Development Guidelines

  • Follow C++17 standards
  • Add security tests for new features
  • Update documentation for API changes
  • Ensure cross-platform compatibility

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • OpenSSL - Cryptographic library
  • libzip - ZIP compression library
  • CMake - Build system
  • Linux Community - Terminal handling inspiration

πŸ“ž Support

  • πŸ› Issues: Create a GitHub issue
  • πŸ’¬ Questions: Start a GitHub discussion

πŸ”„ Version History

v1.0.0

  • Initial release
  • AES-256-CBC encryption
  • Interactive CLI with tab completion
  • File and folder support
  • ZIP compression
  • Home directory support

⚠️ Disclaimer: This software is provided as-is. Always test thoroughly and maintain secure backups of important data.

πŸ” Security Note: This tool is designed for personal and educational use. For enterprise or high-security environments, consider additional security audits and compliance requirements.

About

A C++ library providing simple and secure encryption utilities for protecting sensitive data in applications. Built with modern C++ practices and the MIT license.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors