When using blowfish algorithm from openssl library, one can encrypt and decrypt any data.
Furthermore any data can be encrypted (decrypted) with any key\iv. There is no way in openssl to tell whether decryption was successful or not. It’s just some mathematical transformation.
So, what should I do to be sure that encryption was successful: that some data was decrypted with same key/iv which it was encrypted?
Should I add some MAGIC bytes in front of data that should be checked after decryption?
You can add a checksum (for instance, MD5 of the original content) at the end of the file. After you decrypt it, the last 16 bytes must again be equal to md5(content-16 bytes)