A Walkthrough on AES Image Encryption

Jaken Herman
4 min readMar 7, 2018

Today I’m going teach you how to encrypt a simple picture that you can download here:

http://postimg.org/image/630q43ax1/

Now, I will be using Linux Ubuntu 12.04 throughout this post, so if you’re running a different OS and something goes buggy, I’m sorry. We should have no problems, however — as most of our process will be through the use of openSSL.

We’ll be using Advanced Encryption Standard, which many of you may know, is a type of block cipher. Block ciphers are brilliant, and thanks to a post on reddit, I found a beautiful representation of how the AES block cipher works.

Last thing you should know, is that ECB is in no way a good operation to use when encrypting pictures. I’m simply using it to show how different operations work, and ECB is parallelizable in both encryption and decryption. It’s got support for error propagation, and we just don’t want that. CBC or any other operation is really the way you’ll want to go. You can find a list of operations, and how they work here.

CBC is better for encrypting pictures because of the use of the Initialization Vector or the IV. You’ll see what I mean later. Now, the IV can be public, as well as the operation, as long as the key is safe with you. That should be common sense to those who subscribe to Kerckhoffs’s Principle.

So, let’s get on with it, shall we?

First thing you’ll want to do is install openSSL to your machine. Open up your…

--

--