A file encryption program that uses the WinAPI library Cryptography API: Next Generation.
The compiled binary name is cngcrypt as this is easier to remember and write.
This program only works on Windows and can be compiled by using CMake.
cngcrypt [FLAGS] <SECRET> <INPUT> <OUTPUT>
FLAGSmust use specify at least one flagSECRETpassword used to derive the AES key fromINPUTinput fileOUTPUToutput file
-hprints help information and exits-eencrypt input file to output file-ddecrypt input file to output file-Sprint derived AES key and IV, optional
This program uses AES-128 to encrypt the files.
The AES key is derived by generating a SHA-256 hash of the password and
collapsing the hash into 128-bit using XOR (see data_half_collapse() in crypto.c).
The IV is generated randomly using BCryptGenRandom().
The encrypted file consists of three parts. The first 8 bytes are used to store the original file length. The next 16 bytes are used to store the IV. After that the actual encrypted contents start.