Understanding and setting up OpenVPN - secure in the network

Understanding Symmetric Encryption: Keys, Process, and Limitations

All videos of the tutorial Understanding and setting up OpenVPN - secure in the network
René Fürst
By René Fürst Last updated on

One lock, two identical keys: this is the most illustrative way to describe the basic principle of symmetric encryption. Anyone who sets up a VPN such as OpenVPN will sooner or later come into contact with this method. This guide shows you what the path from plaintext through ciphertext and back to plaintext looks like, what makes a key static, and why its distribution in particular is the Achilles' heel of this method. In the end, you will be able to judge where symmetric encryption works well and where it reaches its limits.

Understanding and setting up OpenVPN - secure in the network: 3.3 Symmetric encryption

The video is only loaded from YouTube when you play it – data (including your IP address) is then transmitted to YouTube/Google. More in the privacy policy

Key Takeaways

  • In symmetric encryption, the sender and recipient use the same key for encryption and decryption.
  • The key turns the plaintext into a ciphertext, which is converted back into plaintext with the same key.
  • A static key, also called a pre-shared key, can be generated yourself with OpenVPN.
  • The secure transmission of the key from one partner to the other is the biggest weakness.
  • If the key becomes known, all affected keys must be replaced.
  • The method is particularly well suited for local hard drives and data, because no key has to be passed on to other people.

Step 1: Understand the path from plaintext to ciphertext

Start with the basic idea. The plaintext is your readable message or your file. With the help of a key, this plaintext is converted into a ciphertext that makes no sense to outsiders without the key. The recipient then uses the same key to reverse the conversion. Only then is the original plaintext available again. Imagine the process as a cycle: plaintext, key, ciphertext, key, plaintext.

Understanding Symmetric Encryption: Keys, Process, and Limitations

Step 2: Recognize the hallmark of the shared key

The decisive feature of symmetric encryption is that both communication partners use the same key. The sender encrypts with it, the recipient decrypts with it. In practice, this shared key is often referred to as a static key or pre-shared key. When reading guides on OpenVPN, pay attention to exactly these terms, as they appear frequently.

Step 3: Generate a static key with OpenVPN

OpenVPN comes with the key generation function built in. On a Linux system, you call the command openvpn --genkey --secret schluessel.key in the terminal. The name of the file can be chosen freely; in the video, for example, a file named "secret" is created. The program then creates a text file containing the static key. This file is the only thing you need for the symmetric part.

Understanding Symmetric Encryption: Keys, Process, and Limitations

Step 4: Check the contents of the key file

Open the generated file with a text editor. At the beginning there is a label indicating an OpenVPN static key with 2048 bits. Below it follow many lines of numbers and letters that extend from the beginning to the end of the file. This very string of characters is the key with which messages are encrypted and decrypted again. Do not delete or change these characters, otherwise the key will no longer match on either side.

Step 5: Get the key safely to the partner

Now the real challenge begins. The key must reach the other party by a secure route. There are various options for this: a personal meeting with a USB stick, a printed sheet, or another trustworthy channel. Each of these variants brings its own problems. A USB stick can be lost, a printout can be copied. In addition, things quickly become unmanageable if a key is to be distributed to hundreds or thousands of people.

Step 6: Encrypt and transmit a message

The example with Anna and Peter shows the process in everyday use. Anna has a message that she encrypts with the shared key. The result is a ciphertext, which is shown in an orange color in the video. You can transmit this ciphertext over the internet or another secure route. Anyone who intercepts the message on the way can do little with the ciphertext without the key.

Understanding Symmetric Encryption: Keys, Process, and Limitations

Step 7: Decrypt the message at the recipient

Peter has the same key as Anna. With this key, he decrypts the ciphertext and reads the original message. Both sides therefore work with identical material, and this is precisely where the simplicity of the method lies. At the same time, however, this example also shows the problem: as soon as the key falls into the wrong hands, anyone who has it can read all messages.

Step 8: Assessing the Risk If the Key Is Lost

Now go through what happens if it is lost. If the key goes missing, anyone who finds it can use it and access all messages encrypted with it. Nothing can be done about that afterwards, at least not for data that has already been transmitted. This risk grows with every additional person who has the key.

Step 9: Responding to Compromised Key Material

Imagine you lose your apartment key, and the address is even written on it. Whoever finds the key can simply walk in. To prevent that, all the locks have to be changed and new keys then distributed to all family members, substitutes, and other authorized people. The same applies to a static key: If it has become publicly known, all affected keys must be replaced and redistributed.

Step 10: Choosing the Right Area of Use

Finally, the question arises of what the method is suited for. Symmetric encryption is relatively easy to use and works well for real data. It is particularly suitable for local hard drives and storage media. The reason is simple: You don't have to worry about how to hand the key over to another person, because the data is only meant to be read by you anyway. For exchanges with other people over insecure networks, however, the key exchange is the biggest hurdle. The video therefore points to asymmetric encryption, which approaches this problem in a different way.

Understanding Symmetric Encryption: Keys, Process, and Limitations

Summary – Understanding Symmetric Encryption: Keys, Process, and Limits

Symmetric encryption works with a single key that is used for both encrypting and decrypting. A static key can be easily generated with OpenVPN and saved as a text file. However, the weak point lies in the transmission: Anyone who gets the key to their partner securely can use the encryption reliably. If the key becomes known, all affected keys must be replaced. The method is therefore particularly well suited for local hard drives and data, but less so for exchanges over insecure channels.

FAQ

What distinguishes symmetric from asymmetric encryption?With symmetric encryption, both sides use the same key, while with asymmetric encryption there is a key pair consisting of a public and a private key. Asymmetric encryption is considered significantly more complex.

What is a static key?A static key is a shared key that is generated in advance and stored on both sides. It is also called a pre-shared key.

How do I generate a static key with OpenVPN?You use the command openvpn --genkey --secret, followed by the desired file name. The result is a text file containing the key.

What happens if the key falls into the wrong hands?Then anyone who has the key can read all messages encrypted with it. In this case, all affected keys must be replaced and redistributed.

Can I encrypt emails to many recipients with the same key?This is not advisable. The more people know the key, the greater the risk that it becomes known, and the more difficult it is to control access.

For which data is symmetric encryption particularly suitable?It is particularly well suited for local hard drives and data, since no key has to be handed over to other people.

René Fürst
Trainer About René Fürst Passionate IT consultant! I have been working in IT for over 16 years and have been confronted with a wide variety of tasks. All courses by René Fürst