A robust command-line file encryption and decryption tool written in modern C++. This tool implements industry-standard encryption algorithms and demonstrates advanced programming concepts including object-oriented design, secure file handling, and modern C++ features.
- Multiple encryption algorithms:
- AES-256 (Advanced Encryption Standard)
- XOR cipher (for educational purposes)
- File integrity verification using SHA-256
- Real-time progress tracking with progress bar
- Comprehensive error handling and input validation
- Binary file support
- Cross-platform compatibility
- Modern C++ implementation (C++17)
- Secure key derivation using OpenSSL
- Random IV generation for AES encryption
- File integrity verification using SHA-256 hashing
- Memory-safe operations
- Proper cleanup of sensitive data
FileEncryptionTool/
├── src/ # Source files
│ ├── main.cpp
│ ├── FileEncryptor.cpp
│ ├── EncryptionStrategies.cpp
│ ├── HashVerifier.cpp
│ └── ProgressBar.cpp
├── include/ # Header files
│ ├── FileEncryptor.hpp
│ ├── EncryptionStrategies.hpp
│ ├── HashVerifier.hpp
│ └── ProgressBar.hpp
├── tests/ # Test files
│ ├── test_encryption.cpp
│ └── test_hash.cpp
├── CMakeLists.txt # CMake configuration
└── README.md # Documentation
- C++17 compatible compiler (GCC 7+, Clang 5+, or MSVC 2017+)
- CMake 3.12 or higher
- OpenSSL development libraries
- Google Test (for running tests)
sudo apt-get update
sudo apt-get install build-essential cmake libssl-dev libgtest-dev
brew install cmake openssl
Install using vcpkg:
vcpkg install openssl:x64-windows gtest:x64-windows
- Clone the repository:
git clone https://github.com/maty7253/file-encryptor-tool.git
cd file-encryptor-tool
- Create and enter build directory:
mkdir build && cd build
- Configure and build:
cmake ..
cmake --build .
- (Optional) Run tests:
ctest --output-on-failure
The tool supports two operations (encryption and decryption) with multiple algorithms.
./FileEncryptionTool -e <algorithm> <input_file> <output_file> <key>
# Example using AES:
./FileEncryptionTool -e aes secret.txt secret.enc mypassword
# Example using XOR:
./FileEncryptionTool -e xor secret.txt secret.enc mypassword
./FileEncryptionTool -d <algorithm> <input_file> <output_file> <key>
# Example:
./FileEncryptionTool -d aes secret.enc decrypted.txt mypassword
- Strategy Pattern: For different encryption algorithms
- RAII: For resource management
- Factory Method: For creating encryption strategies
- Command Pattern: For encryption/decryption operations
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
The project includes comprehensive unit tests using Google Test framework. To run the tests:
cd build
ctest --output-on-failure
While this tool implements strong encryption algorithms, please note:
- Always use strong, random passwords
- Keep your encryption keys secure
- Update OpenSSL to the latest version
- For production use, consider additional security measures like key stretching
- The XOR cipher is included for educational purposes only and should not be used for sensitive data
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenSSL team for their cryptographic library
- Google Test team for the testing framework
- C++ community for modern C++ guidelines and best practices