Introduction: Encrypting a Message, With OpenSSL!

Chances are you’ve heard of encryption at some point in your many dealings with computer technology, but what exactly is it? Encryption is when data, in this case a text file, is converted into cipher text. This ciphertext is an unrecognizable, random jumble of characters that can only be converted back into its original form by using a decryption key. The main benefit to this technology is that secure data can be sent back and forth between users; the only way to read the data contained in the file is by using the supplied password (encryption key). These files can be kept on your personal computer or sent to others. Follow these instructions to create your very own encrypted file!

Step 1: OpenSSL Download and Installation in Windows 10 or 7

In order to run OpenSSL we need to download and install it first. Based on your operating system you’ll need to download the installer specifically for your system. (Either 64 or 32 bit)

(If you don’t know what your operating system is running on. Right click on my computer and click properties. Look under system type and it should be there.)

  • Go to https://slproweb.com/products/Win32OpenSSL.html and
  • Download “Win64 OpenSSL v1.0.2f”or download the most current version that is up to date if available (Depending on your system download Win64 or Win32 version of OpenSSL)
  • Install OpenSSL without any changes in the setup (Just click next until you finish)
  • Uncheck the one-time donation box, unless you would like to donate, and finish!

Step 2: Create a Path for OpenSSL

In this step we will create a path that we will use later from our command prompt that will allow us to run OpenSSL.

  • Go to the start menu and right click “My Computer” or in windows 10 it will be called “This Pc” and click properties

Step 3: Go to Advance System Settings

  • Go to Advance system settings. On the left hand side

Step 4: Click on Environment Variables

  • Click on Environment Variables

Step 5: Look for the System Variables Box & Find Path

  • Go to the System Variables Box and scroll down until you see Path. Select Path and click on edit.

Step 6: Entering the Path for OpenSSL

  • Click on New and type in C:\OpenSSL-Win64\bin if you are running Windows 64 bit, type in C:\OpenSSL-Win32\bin if you are running Windows 32 bit. Select Ok.

Step 7: Pathing OpenSSL for Windows 7 "Optional"

This step is only required if you have Windows 7!

  • If you are running Windows 7 then editing the Path will look like this. Go to the end of Variable Value box and type in ;C:\OpenSSL-Win64\bin if you are running Windows 64 bit, type in ;C:\OpenSSL-Win32\bin if you are running Windows 32 bit. Select Ok.

Step 8: Running OpenSSL!

Now that we have the pathing done for OpenSSL we will need to bring it up through the command prompt.

  • To run OpenSSL you will need to open up the Command prompt. You can find it by clicking the Start menu and typing in cmd to bring up the application.
  • Once you are in the command prompt type in cd C:\OpenSSL-Win64 then type in cd bin. the result should be C:\OpenSSL-Win64\bin>
  • If you have Windows 32 bit, type in cd C:\OpenSSL-Win32 then cd bin instead. Result would look like this. C:\OpenSSL-Win32\bin>

Step 9: Let's Starting Encrypting!

Now that we have the OpenSSL running we can now go over how to encrypt. In the following steps we will show an example on how to do encrypt a file using one of the methods in OpenSSL.

  • Leave your Command Prompt open and go to your C: Drive.
  • Once there, open the OpenSSL folder then open the folder inside named “bin”

Step 10: Create a File You Would Like to Encrypt

  • Create a new text file within the bin folder. My text file will be named AAA as an example. Write whatever you’d like inside the text file and save it to the bin folder.

Step 11: Optional Commands in OpenSSL

  • Once that’s done go back to the command prompt. We have quite a few options on which encryption method we could use. By typing Openssl --help you can see all the cipher commands that you can use to encrypt your text file with.

Step 12: Encrypting a File Using a Cipher Command

  • To get you started on how to issue these commands I will be using the cipher command aes-128-cbc as an example
  • To issue the command to encrypt your text file, type in Openssl aes-128-cbc -in “YourTextFileNameHere.txt” -out “MakeUpAnOutputNameHere.txt” (omit the “ “). You don’t need to have created another text file for the output file. All you have to do is give it a name. I named mine AAOutput.txt.
  • Once you’ve done that it’ll ask you to enter a password. This password will be used to lock your files from being decrypted and can only be broken by using your password. It will ask you to enter your password twice. be aware: when typing your password it will not show that you are typing anything, and you are not able to delete any entered characters.

Step 13: Finding the Encryption Output

  • Let’s see our file now! Go back to the bin folder that’s in the OpenSSL folder and search for the output file you just created!

Step 14: Decrypting the File

Now that we have the encrypted file in our bin folder we need to be able to revert it back to the original message. In this step you will know how to do exactly just that. Most of the encryption methods can be decrypted in the exact same format that we will show you but you need to state which encryption method you used.

  • To decrypt the file back to the original text, we will need to go back to the command prompt. Type in openssl aes-128-cbc -d -in “OutputFileName.txt” -out “MakeUpANameHere.txt”. If you typed it correctly you will be asked for the password.
  • Enter the same password that you used to encrypt it.

Step 15: Decrypt Output!

  • Let check out the bin folder for the newly made text file!