Lesson 2: The Secret of Symmetry

Explore symmetric key cryptography and its everyday applications.

Welcome to Lesson 2 of Cybersecure It and Safety Net’s Cryptography Course. In this lesson, we will dive into the world of symmetric key cryptography. When sending a message and you don't want anyone else to read it you can turn your message into a secret code. Symmetric key cryptography is like having a special key that you and the receiver both use to lock and unlock this secret code.

You start off by putting your message, the plaintext, and a secret key through a magical process called encryption. This process jumbles up your message in a specific way so that it looks like nonsense to anyone who sees it. Only someone with the same secret key can un-jumble it.

After encryption, your message is now called ciphertext. It's a scrambled version of your original message, and it's safe to send over the internet or any other channel. Even if someone intercepts the ciphertext, they can't understand it without the secret key.

When the other person receives the ciphertext, they can use the same secret key to perform decryption. This process reverses the encryption and turns the ciphertext back into the original message (plaintext) that you sent.

The important thing here is that you and the receiver must both know and keep the secret key safe. It's like having a special password that only the two of you share. If anyone else gets hold of this key, they can read your secret messages.

Symmetric key cryptography is super fast and efficient, making it great for things like encrypting files, securing online communications, and protecting data on your devices. But there's a challenge: how do you share this secret key with the receiver in the first place without anyone else knowing? If someone intercepts the key, they can read all your messages. This is where secure key exchange methods come into play.

An example of an exchange method is the Diffie-Hellman Key Exchange. Follow the steps below for a secret and secure key exchange.

  1. You both publicly agree on a large prime number and a base.

  2. Each of you secretly chooses a random number.

  3. You perform some mathematical operations involving the prime number, base, and your chosen number to get a result.

  4. You send the result to your friend.

  5. Your friend does similar calculations using their random number.

  6. Both of you end up with the same secret value, which you can then use as your shared key.

Let’s look at an example! In this scenario, Anna and Elsa want to establish a shared secret key over an insecure communication channel.

Anna and Elsa publicly agree on a large prime number 23 and a base 5. Then Anna secretly chooses her private key (a=6) and Elsa secretly chooses her private key (e=15). Anna calculates: A=5⁶ mod  23=8 while Elsa calculates E=5¹⁵ mod  23=19.

After Anna and Elsa exchange their calculated values A and E over the public channel, Anna takes Elsa's value and raises it to her private key a: Eᵃ mod  23=19⁶ mod  23=2. Elsa takes Anna's value and raises it to her private key e: Aᵉ mod  23=8¹⁵ mod  23=2.

Both Anna and Elsa now have the same shared secret key, which is 2. This key can be used for further symmetric encryption and decryption. Even though the values of A and E were exchanged publicly, an eavesdropper cannot easily deduce the secret key without knowing either Anna's or Elsa's private key, which are kept secret. 

This example demonstrates the fundamental concept of the Diffie-Hellman key exchange: by exchanging certain values publicly and performing mathematical operations, two parties can arrive at the same shared secret key without directly transmitting the key itself. This shared secret key can then be used for secure communication using symmetric cryptography.

Remember, symmetric key cryptography is like having a shared lock and key that only you and your friend can use. It's a powerful tool for keeping your secrets safe in the digital world.

Previous
Previous

Lesson 1: Cryptography Unveiled

Next
Next

Lesson 3: Unraveling Asymmetry