Encryption 101 : Introducing the idea of Symmetric Encryption
Published: 2017-04-16 22:25:36

---
title: "Encryption 101 : Introducing the idea of Symmetric Encryption"
cover_image: https://thepracticaldev.s3.amazonaws.com/i/wih4l3bxxarj2fcm7c0v.jpg
published: true
description: Basics on symmetric encryption
tags: #encryption #symmetricencryption #security #cryptanalysis #cryptology
---


We know encryption is a tool that allows the safe communication between two different parties: for example 2 different users. Is it completely safe? Of course not, encryption just makes the task of an eavesdropper to possibly find out the information behind the encrypted data difficult and with this, if the decryption process becomes out of hand, computationally speaking, then we can say we found a way of communicating in a safe way.

Throughout this schema, many different types of encryption have emerged. I will point out the basics of how symmetric encryption works.

First things first, we can define some concepts in the world of encryption:

1. Plaintext: The text or data as is. Data that can be an e-mail message, a shopping card detail information, etc.

2. Cipher: The algorithm used explicitly for encrypting plaintext. It is a group of steps performed on the data in order to obtain an encrypted version of the plaintext.

3. Ciphertext: The data that has been already been processed by means of a cipher. This is the data that could be obtained for example by an eavesdropper, the goal of the system security is to be able to ensure the security at a point in which the eavesdropper cannot obtain the plaintext even though he/she finds out the ciphertext.

4. Encryption: The way of obtaining a ciphertext.

5. Decryption: The opposite from encryption = obtaning a plaintext from the ciphertext and potentially also some other extra information.

With these concepts in mind (and if I don't forget some of them.. if I do I will just point them as I go for the easy understanding) we can follow the idea of how symmetric encryption works.

Why is it called Symmetric first of all?

Let's say we have a channel of communication between two different parties: Alice and Bob. Alice sends a message (plaintext) to Bob by means of a specific cipher and Bob obtains the ciphertext which can be then decrypted by him and read = That is the goal, if there is nobody actually listen to this channel of communication. But what if there was somebody in there? We could think of this schema also in this funny way:

Imagine I need to tell you a secret so I write it down on a piece of paper and put it into a safe and lock it with a lock I own. Then what I do is send it to you and of course you would need to have the same key I had to open the lock and obtain the message. 

That is exactly what happens with symmetric encryption: it is called symmetric since both parties are using the same key to open the safe. It actually works both the same way in terms of digital information. If there was another person let's say an eavesdropper trying to access this channel of communication between me and you, and he somehow manages to obtain the safe, he would not only need the algorithm to open it but he would also need the key. If he does not have it, the decryption would not be possible at all.

Oops, I know, I said that the eavesdropper has to know the algorithm, but is that necessary?

And the answer is yes it is. It is necessary that we have public known algorithms because having a secret algorithm is a bad practice. And it is a bad practice because it compromises the system totally: Imagine a system in which I use propietary algorithm to cipher my data, and by any mean any device with this algorithm is filtered, this could be exploited and reverse engineered by an eavesdropper and obtain additional information that I could be compromising into the code.

Actually what I have just said in the last paragraph is one of the most important principles into security = The Kerchoff's principle. So we can now say okay, my algorithm is public but... doesn't that mean that the eavesdropper can get the message easily? Not exactly. By means of this definition I don't say everything needs to be of public knowledge (there would not be security at all) So what I try to say is that only the algorithm should remain public, and the key is the one that should be very difficult to find in order to achieve the goal of security.

By know we can have a very nice basic idea of how symmetric encryption works, next time I will post some more things about encryption because is one of my favorite topics. See you next time and hope you found this information useful.