Encrypt an image using openssl

I have a .bmp image. I wanted to encrypt the image file using openssl command. The following is the command I have used to encrypt the image.

openssl enc -aes-128-cbc -e -in pic_original.bmp -out aes128cbc.bmp -K 00112233445566778889aabbccddeeff -iv 0102030405060708

As per ECB mode is concerned I should be able to view partial image when I encrypt the file using ECB mode however I cannot see the image at all. The image viewing software says there is bogus header data

Is there any thing wrong in the command I used for encrypting the file. Can someone help me with this please

Thanks

Answers


That's because you encrypted everything, including header. You should extract bitmap data into a raw stream, encrypt that and attach header back to it.


Need Your Help

How to disable MySQL Query Caching

mysql caching

I am trying to do some benchmarking of different queries on different columns but MySQL just won't let me do it. After the first execution of a query, I can never get the same execution time for that

Replacing a pulled SQL ID value with its name from another table

php sql loops pdo foreign-keys

I have some code (see below) that populates a table with all the records. I however want to replace the ID that is presented for site_id with its actual name which is stored in another table. The s...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.