Topic 2 · Data transmission

Symmetric and asymmetric encryption

Video lesson: Symmetric and asymmetric encryption▶ Watch the video lessonShort, exam-focused explanation of this topic on the CS with Aamir YouTube channel.

When data is sent over a network it can be intercepted. Encryption does not stop data being intercepted, but it makes the data meaningless to anyone who does not have the key to decrypt it.

Key words

Simple example (Caesar cipher): with a key of "shift each letter 3 places", the plaintext HELLO becomes the ciphertext KHOOR. Only someone who knows the key can shift the letters back. Real encryption algorithms are far more complex, but the idea is the same.

Symmetric encryption

Symmetric encryption uses the same key to encrypt and decrypt the data.

  1. The sender encrypts the plaintext using the key.
  2. The ciphertext is sent to the receiver.
  3. The receiver decrypts it using the same key.

The problem is that the key itself has to be sent to the receiver. If the key is intercepted, anyone can decrypt the data. This is called the key distribution problem.

Asymmetric encryption

Asymmetric encryption uses two different keys that are mathematically linked: a public key and a private key.

  1. The receiver makes their public key available to anyone who wants to send them data.
  2. The sender encrypts the plaintext using the receiver's public key.
  3. The ciphertext is sent to the receiver.
  4. Only the receiver's private key can decrypt it. The private key is never shared.

Because the private key never has to be sent, asymmetric encryption solves the key distribution problem. Even if someone intercepts the data and the public key, they cannot decrypt the data.

Symmetric or asymmetric? A comparison

SymmetricAsymmetric
Number of keysOne shared keyPublic key and private key
Key used to decryptThe same key used to encryptThe receiver's private key
Main weaknessThe key must be shared and could be interceptedSlower, as it needs more processing

Where is encryption used?

Exam tips

Want the full topic notes, slides and worksheets? See Notes & Slides, practise with the free CS with Aamir Quiz App, or order the O Level Computer Science Study Guide.