Topic 2 · Data transmission
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
- Plaintext: the original data before it is encrypted.
- Ciphertext: the scrambled data after it has been encrypted.
- Encryption key: the value used by the encryption algorithm to scramble or unscramble the data.
- Encryption: changing plaintext into ciphertext. Decryption changes it back.
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.
- The sender encrypts the plaintext using the key.
- The ciphertext is sent to the receiver.
- 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.
- The receiver makes their public key available to anyone who wants to send them data.
- The sender encrypts the plaintext using the receiver's public key.
- The ciphertext is sent to the receiver.
- 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
| Symmetric | Asymmetric | |
|---|---|---|
| Number of keys | One shared key | Public key and private key |
| Key used to decrypt | The same key used to encrypt | The receiver's private key |
| Main weakness | The key must be shared and could be intercepted | Slower, as it needs more processing |
Where is encryption used?
- Secure websites using HTTPS, for example online banking and shopping. HTTPS actually uses both: asymmetric encryption to share a symmetric key safely, then faster symmetric encryption for the rest of the data.
- Messaging apps with end-to-end encryption, such as WhatsApp.
- Protecting files stored on laptops, USB drives or in the cloud, in case the device is lost or stolen.
Exam tips
- Say that encryption makes intercepted data meaningless – it does not stop the interception.
- In asymmetric encryption, data is encrypted with the receiver's public key and decrypted with the receiver's private key. Learn this order exactly.
- Use the words plaintext, ciphertext and key in your answers.
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.