C utility to encrypt a file using AES-256
This program is designed to work with the cross-platform IDE Code::Blocks. For Windows platforms, be sure to download and install Code::Blocks with MinGW included.
Before compiling, download and install the GNU Realine Library:
- Debian Linux: sudo apt-get install libreadline6 libreadline6-dev
- Fedora Linux: sudo yum install libreadline6 libreadline6-dev
- Windows: Download Readline for Windows.
- Copy the contents of the "include" folder into <CodeBlocks>\MinGW\include
- Copy the contents of the "lib" folder into <CodeBlocks>\MinGW\lib
- Copy the runtime binaries (history5.dll and readline5.dll) into the same folder as the target application (found in AesFileEncryption\bin\Debug or AesFileEncryption\bin\Release)
When compiling on Windows, you might need to define the constant _WIN32. In the Code::Blocks toolbar, go to Settings -> Compiler Settings -> Global Compiler Settings. Under the tab #defines, add the line _Win32.
Open AesFileEncryption.cbp in Code::Blocks to edit the project and compile the code.
afe (-e | -d | -v) [-r] <in-file> [out-file]
- -e = Encrypt file
- -d = Decrypt file
- -v = Verify encryption of <in-file> to confirm that password is correct
- -r = Remove the backup file (only if [out-file] isn't specified)
If [out-file] isn't specified, then encryption or decryption overwrites <in-file>. However, a backup is created named <in-file>.bak.
- AES implementation is from the repository tiny-AES-c by kokke.
- SHA-256 is from the repository crypto-algorithms by Brad Conte (B-Con).