user296589 user296589 - 4 months ago 13
C++ Question

Encrypt with AES without header

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.

I tried only the command line tools of openssl:

openssl aes-256-cbc -in text.txt -out encrypted.txt


openssl aes-256-cbc -d -in encrypted.txt -out decrypted.txt

Also - I need a tool that I can use with C++.


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.


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