Issue
I'm trying to encrypt a 16KiB block with AES.
I tried to do it with openssl, but the size grew from 16384 to 16416. Looks like openssl put a 32B header.
Is there any way to "remove" the 32B header? If it matters, my environment is Redhat 5.11.
Edit: I tried only the command line tools of openssl: Encryption:
openssl aes-256-cbc -in text.txt -out encrypted.txt
Decryption:
openssl aes-256-cbc -d -in encrypted.txt -out decrypted.txt
Also - I need a tool that I can use with C++.
Solution
No, it did not put a header. It did padding.
The AES
is a block cipher with 128 bit block size that requires the length of data being enciphered to be even to the cipher block size. This padding is also used to recover the original data stream length after deciphering.
Edit:
According to @jww the openssl lib also prepends the stream with 16byte header containing a magic 8-byte string "Salted__" and and an IV, derived from the password
Answered By - Serge Answer Checked By - Dawn Plyler (WPSolving Volunteer)