O Level Computer Science 2210 · Area 1 · Computer systems

Encryption and why transmitted data is encoded

Data in transit passes through equipment that neither the sender nor the receiver controls, so it can be read or altered on the way. Encryption makes it meaningless to anyone without the key. This page explains the purpose and then the two key arrangements: one shared key, or a public and a private pair.

Not started

Syllabus coverage

  • Understand the need for encryption when transmitting data
  • Understand the purpose of encryption, which is to keep the contents of transmitted data confidential
  • Understand how data is encrypted and decrypted using symmetric encryption, where the same key is used at both ends
  • Understand how data is encrypted and decrypted using asymmetric encryption, including the use of a public key and a private key

Part of the O Level Computer Science syllabus 2210.

Encryption: keeping data unreadable in transitEncryption does not stop interception; it makes what is intercepted useless without the key.Symmetric uses one shared key; asymmetric uses a public key to encrypt and a private key to decrypt.plaintextwhat is writtenkeyencryptionciphertextwhat is sentkeydecryptionplaintextSymmetric: the same key encrypts and decrypts, so the key must reach both ends without being seen.Asymmetric: a public key encrypts and only the matching private key decrypts, so the key can be published.
Plaintext entering a key-operated lock to become ciphertext, the ciphertext travelling along a transmission channel where an interceptor can see only unreadable characters, and the same key at the far end unlocking it back into plaintext, with a second panel showing one shared key for symmetric encryption and a public and private key pair for asymmetric encryption.

Why transmitted data needs protecting

Data that stays on one machine is protected by that machine's own security. Data that is transmitted is different: it leaves the device, travels through cables, routers, switches, wireless access points and servers, and arrives somewhere else. Most of that path belongs to nobody in the conversation. A message between two people may pass through a dozen pieces of equipment owned by several different organisations.

At any point on that path the data can be intercepted. On a wireless network an attacker within range can capture the radio signals without touching any cable. On a wired network, traffic can be copied at a router or a shared connection. Once captured, data sent as plain readable text can simply be read, and it may also be altered before being passed on.

The information at risk is often the most sensitive there is: passwords, card numbers, medical records, personal messages and business documents. If a password crosses a network in plain text, anyone who captures it can use it. This is why the need for encryption is not about hiding the fact that a message was sent; it is about making sure that only the intended recipient can understand what it says.

The purpose of encryption in one sentence: it keeps the contents of transmitted data confidential, so that intercepted data is meaningless to anyone who does not have the key.

Plaintext, ciphertext and the key

Encryption is the process of converting readable data into a form that cannot be understood without the key. The readable original is called plaintext. The scrambled result is called ciphertext. Decryption is the reverse process, turning ciphertext back into plaintext.

The transformation is controlled by a key, which is a value used by the encryption algorithm. The algorithm itself is usually public and well known; the secrecy lies in the key. Anyone with the ciphertext and the correct key can recover the plaintext, and anyone without the key should not be able to do so in any practical time.

A useful way to picture it is a locked box. The plaintext goes in, the key locks it, and the locked box travels along the channel. An interceptor can see the box and can even copy it, but cannot open it. At the other end the matching key opens the box and the plaintext comes out. This is why encryption is described as protecting data in transit, and why it is used for web logins, banking, messaging and any transfer of personal details.

Two further points matter for exams. Encryption does not stop interception; it removes the value of what is intercepted. And encryption does not protect data at rest on a disk unless the disk itself is encrypted; the syllabus is concerned with data being transmitted.

Symmetric encryption: one shared key

Symmetric encryption uses the same key to encrypt and to decrypt. The sender and the receiver must both have that key before any data is exchanged. The sender encrypts the plaintext with the key, the ciphertext travels along the channel, and the receiver applies the same key to recover the plaintext.

Its great advantage is speed. Symmetric algorithms do relatively little computation per block of data, so they can encrypt large volumes, such as a video stream or a file download, without slowing the connection noticeably. The key is also short, and the same algorithm can be implemented cheaply on small devices.

Its weakness is the key distribution problem. Because one key does both jobs, it must be shared between the two parties, and it must be shared securely. If the key is sent across the same channel as the data, an interceptor who captures the key can decrypt everything, both the message in hand and every later message encrypted with that key. In a large network every pair of users would need its own shared key, and the number of keys grows very quickly, which makes management difficult.

Symmetric encryption is therefore strong and fast but depends on a safe way of getting the key to the other person. In practice the key is often delivered using asymmetric encryption, which is the subject of the next block.

StageWhat happens
1Sender and receiver agree on one shared key, and the receiver obtains it securely
2The sender encrypts the plaintext using the shared key, producing ciphertext
3The ciphertext is transmitted; an interceptor without the key cannot read it
4The receiver decrypts the ciphertext using the same shared key, recovering the plaintext
Symmetric means one key for both jobs. If you write 'the sender uses the public key and the receiver uses the private key', you have described asymmetric encryption, not symmetric.

Asymmetric encryption: a public and a private key

Asymmetric encryption uses a pair of keys that are mathematically related but not derivable from one another in practice. One is the public key, which is published openly and can be given to anyone. The other is the private key, which is kept secret by its owner and never sent anywhere.

The pair works in a way that seems backwards at first. Data encrypted with a person's public key can only be decrypted with that person's private key. So if you want to send a confidential message to someone, you obtain their public key, encrypt the message with it, and send the ciphertext. Anyone can see the ciphertext and anyone can have the public key, but only the holder of the matching private key can turn it back into plaintext.

The private key is never shared, so there is no key to intercept. This is what solves the distribution problem of symmetric encryption. A person can publish a public key on a website or in a directory and receive confidential messages from strangers without ever having met them or agreed a secret in advance.

Asymmetric encryption is computationally expensive. The mathematics involves very large numbers, so it is far slower than symmetric encryption and is not used to encrypt a whole video or file. The usual arrangement is a hybrid: asymmetric encryption is used briefly to deliver a symmetric session key safely, and the bulk data is then encrypted with that symmetric key, which gives the security of asymmetric key exchange with the speed of symmetric encryption.

Symmetric encryptionAsymmetric encryption
Keys usedOne key, used to encrypt and to decryptA pair: a public key and a private key
Who holds the keyBoth sender and receiver must have the same keyThe public key is available to anyone; the private key is held only by its owner
How the key is sharedThe key itself must be delivered securely to the other partyThe public key can be published openly; the private key is never shared
SpeedFast, suitable for large amounts of dataSlow, because of the complex mathematics
Main weaknessAnyone who obtains the shared key can read the trafficSlower and more processing-intensive, so used for small amounts of data such as keys
The one line to remember: the public key encrypts, the private key decrypts, and the private key never leaves its owner.

The two keys in use

A short sequence shows how asymmetric encryption is used for a real exchange. The receiver generates a key pair and publishes the public key. The sender obtains that public key, encrypts the message with it, and transmits the ciphertext. The receiver applies the private key and reads the message. An interceptor who captured both the ciphertext and the public key still cannot decrypt, because the public key does not reverse its own encryption.

The pair can also be used the other way round, to show where data came from. If the sender encrypts with their own private key, anyone with the matching public key can decrypt it, which proves that the holder of that private key produced it. This is the basis of a digital signature, and it provides authenticity rather than confidentiality, because everyone can read the message.

That gives the two properties that matter in the syllabus. Using the recipient's public key gives confidentiality: only the recipient can read the data. Using the sender's private key gives authenticity: the recipient can tell who sent it. In practice a system may use both, and combine them with a symmetric key for the bulk of the data.

Choosing between them

The choice follows from what each method is good at. Symmetric encryption is chosen when speed matters and the two parties can share a key safely, for example within one organisation where keys can be distributed by an administrator, or for encrypting a large file before storage or transfer.

Asymmetric encryption is chosen when the two parties have no secure channel in advance, or when they have never met. Publishing a public key needs no secrecy, so a website can offer confidential communication to any visitor without prior arrangement. It is also chosen when proof of origin is needed.

Because asymmetric encryption is too slow for bulk data, the common solution combines them: asymmetric encryption carries a freshly generated symmetric key, and symmetric encryption carries the actual data. The slow mathematics is used once for a small key, and the fast algorithm handles everything else.

What encryption does and does not do

Encryption provides confidentiality: the contents cannot be read without the key. It does not prevent the data being intercepted, copied, delayed or destroyed, and it does not by itself stop an attacker from knowing that a message was sent, or to whom, or how large it was.

Encryption does not replace the other protections. A weak password can still be guessed, a compromised device can still be read before anything is encrypted, and a stolen private key defeats the whole scheme. Encryption also does not detect errors caused by interference; that is the job of parity, checksums and ARQ. Encryption and error detection solve different problems and are used together.

Nor does encryption prove that the public key belongs to the person it claims to. If an attacker can substitute their own public key, the sender will encrypt to the wrong party. Certificates and trusted authorities exist to solve that problem, but they go beyond what this syllabus requires; what matters here is knowing what the key pair does and what it does not.

  • Provides confidentiality of the contents in transit.
  • Does not stop interception, only makes the intercepted data useless.
  • Does not detect transmission errors; parity, checksums and ARQ do that.
  • Depends on the key staying secret, and on the public key genuinely belonging to its owner.

Key terms you must be able to define

Encryption
The process of converting readable data into an unreadable form, called ciphertext, so that it cannot be understood by anyone who does not have the key needed to decrypt it.
Decryption
The reverse of encryption: converting ciphertext back into readable plaintext using the correct key.
Plaintext
The original readable form of the data before it is encrypted.
Ciphertext
The scrambled output of encryption, which cannot be understood without the key.
Key
The value used by the encryption algorithm to convert plaintext into ciphertext and back again. Its secrecy is what protects the data.
Symmetric encryption
Encryption that uses the same key to encrypt and decrypt. It is fast, but the key must be delivered securely to both parties.
Asymmetric encryption
Encryption that uses a pair of linked keys: a public key, which anyone may have and which is used to encrypt, and a private key, which is kept secret and is the only key that can decrypt.
Public key
The key of an asymmetric pair that is published openly. Data encrypted with it can only be decrypted with the matching private key.
Private key
The key of an asymmetric pair that is kept secret by its owner and is never transmitted. It decrypts data that was encrypted with the matching public key.
Interception
Capturing data while it is being transmitted, for example by listening to a wireless signal or copying traffic at a router.

In context

2210 sets its questions inside systems a student already uses - a school network, a phone, a supermarket till, a vending machine, a website. These show how the theory is applied to a context you have not seen before, then you answer for the system you are given.

In a web login

When you type a password into a shopping site, the connection uses HTTPS, so the form data is encrypted before it leaves the browser. The site's public key is in its certificate, so the browser can encrypt data that only the site's private key can open. Anyone capturing the wireless traffic sees ciphertext, not the password.

In a messaging app

A messaging app sets up a session by agreeing a symmetric key with each contact, delivered using asymmetric encryption so that the key is never sent in the clear. The messages themselves are encrypted with that symmetric key, because it is fast enough for photos and video. The two methods are used together, each for the job it does best.

On a public wireless network

A cafe's wireless network is open, so anyone within range can capture the radio traffic. Unencrypted requests are readable in full. Encrypted requests still reveal which server is being contacted, but the contents, including any password or card number, are useless to the person capturing them without the key.

In a bank's internal network

Traffic between two systems inside a bank may use symmetric encryption alone, because the key can be installed on both machines by an administrator over a controlled link rather than sent across the network. The gain is speed on large transfers; the risk being managed is a stolen key rather than an intercepted one.

Flashcards

Click a card to flip it. Mark honestly — the tracker uses this.

Q1Why is encryption needed when data is transmitted?
Because transmitted data passes through cables, routers and wireless links that the sender does not control, so it can be intercepted. Encryption keeps the contents confidential so that intercepted data is meaningless without the key.
Q2What are plaintext and ciphertext?
Plaintext is the readable original data; ciphertext is the unreadable output produced by encrypting it.
Q3What is a key in encryption?
The value used by the encryption algorithm to turn plaintext into ciphertext and back again. Its secrecy is what protects the data.
Q4How does symmetric encryption work?
The same key is used to encrypt and to decrypt, so both the sender and the receiver must have that key.
Q5What is the main weakness of symmetric encryption?
The key has to be shared with the other party. If it is intercepted or stolen, all data encrypted with it can be read.
Q6What is the main advantage of symmetric encryption?
It is fast, so it is suitable for encrypting large amounts of data such as files and video.
Q7How does asymmetric encryption work?
Each user has a public key and a private key. Data encrypted with the public key can only be decrypted with the matching private key.
Q8Which key is used to send a confidential message, and which decrypts it?
The recipient's public key encrypts the message, and the recipient's private key decrypts it.
Q9Why is the private key never transmitted?
If it were intercepted, the security of every message sent to its owner would be lost. Keeping it local means there is no secret to intercept.
Q10Why is asymmetric encryption not used for large files?
It involves complex mathematics with large numbers, so it is much slower than symmetric encryption. It is used for small amounts of data such as a symmetric session key.
Q11How are symmetric and asymmetric encryption often used together?
Asymmetric encryption is used to deliver a symmetric key safely, and the symmetric key then encrypts the bulk of the data, giving security with speed.
Q12Does encryption prevent data from being intercepted?
No. It makes intercepted data unreadable without the key. It protects confidentiality, not the physical link.
0 of 12 marked as known

Exam-style questions

7 questions, 19 marks. Write your answer and press Mark my answer — it is marked against the scheme and tells you which points you made and what would gain the next mark. You can still reveal the scheme and mark it yourself instead.

StateAO11 mark
State the purpose of encrypting data before it is transmitted.

Mark scheme — tick each point you actually made

Examiner tip: One mark, one idea: confidentiality of the contents. Do not write 'to stop hacking' or 'to make it secure'; both are too vague to score.
DescribeAO12 marks
Describe how symmetric encryption is used to send data from one device to another.

Mark scheme — tick each point you actually made

Examiner tip: The word that must appear is 'same'. One key does both jobs, and both ends must hold it.
ExplainAO23 marks
A company wants to send confidential documents to a new supplier it has never worked with before. Explain why asymmetric encryption is more suitable than symmetric encryption for the first exchange.

Mark scheme — tick each point you actually made

Examiner tip: The scenario is the point: the two organisations have no secure channel yet. Answer with the key distribution problem and how the public key solves it.
CompareAO14 marks
Compare symmetric and asymmetric encryption, referring to the keys used, how the keys are shared and the speed of each method.

Mark scheme — tick each point you actually made

Examiner tip: Three points are named in the question, so structure the answer around them and add one consequence. A table with a row per point is the quickest full-mark answer.
ExplainAO24 marks
A user buys a book from an online shop using a public wireless network. Explain why the payment details are encrypted, and describe how a public key and a private key are used in the transaction.

Mark scheme — tick each point you actually made

Examiner tip: Two halves: why (interception on an open network, confidentiality) and how (public key encrypts, private key decrypts). Keep the direction of the keys correct.
GiveAO12 marks
Give two reasons why asymmetric encryption is not normally used to encrypt a large video file.

Mark scheme — tick each point you actually made

Examiner tip: Both marks come from the same underlying cause, so phrase them differently: one about speed of the method, one about the processing load or time taken for a large file.
ExplainAO23 marks
A messaging app uses asymmetric encryption to send a symmetric key, and then uses that symmetric key to encrypt the messages. Explain why the app uses both methods rather than only one.

Mark scheme — tick each point you actually made

Examiner tip: Name the problem each method solves: key distribution for asymmetric, speed for symmetric. The mark is for combining the two reasons, not for describing either method alone.

Exam technique for this topic

  • Answer the purpose question before the mechanism question. 'Why encrypt?' is about confidentiality of data in transit; 'how?' is about keys and ciphertext.
  • Never write that encryption stops interception. It does not. It makes the intercepted data meaningless without the key, and that is the mark.
  • For symmetric, say one key, used by both ends, and name the weakness: the key has to be shared, so it can be intercepted or stolen.
  • For asymmetric, say which key does which job: the recipient's public key encrypts, their private key decrypts, and the private key is never transmitted. Getting the direction backwards loses the marks.
  • If a question asks you to compare, use the same three points for both: number of keys, how the key is shared, and speed. A table is quicker and clearer than prose.

Why students lose marks here

A student wroteA student wrote: 'Encryption prevents data from being intercepted while it is in transit.'
Why it loses marksEncryption does not prevent interception. It changes the data so that an interceptor cannot understand it. The distinction is the whole point of the mark: the threat is not removed, its value is.
The answer that scoresData in transit passes through cables and equipment that the sender does not control, so it can be intercepted. Encryption converts the plaintext into ciphertext using a key, so an interceptor who captures the data cannot read it without the key. The interception may still happen, but what is captured is meaningless, which keeps the contents confidential.
A student wroteA student wrote: 'In asymmetric encryption the sender encrypts with their private key and the receiver decrypts with the sender's public key, so the message stays secret.'
Why it loses marksThe keys have been swapped and the purpose confused. Encrypting with a private key produces something anyone with the corresponding public key can read, so it provides proof of origin, not confidentiality. For confidentiality the recipient's public key encrypts and the recipient's private key decrypts.
The answer that scoresIn asymmetric encryption each user has a public key that is published and a private key that is kept secret. To send a confidential message, the sender encrypts it with the recipient's public key; only the recipient's matching private key can decrypt it, and that private key is never transmitted. Encrypting with the sender's own private key is a different use of the pair: it allows anyone with the sender's public key to decrypt, which proves who sent the message but does not keep it secret.
A student wroteA student wrote: 'Symmetric encryption is more secure than asymmetric encryption because it uses a longer key.'
Why it loses marksThe statement confuses strength with the practical weakness of symmetric encryption. Its problem is not its cryptographic strength but key distribution: the single key must be delivered to both parties, and anyone who intercepts it can read all the traffic. Asymmetric encryption exists to solve that problem, not because symmetric encryption is weak.
The answer that scoresSymmetric encryption uses one key for both encryption and decryption. It is fast and strong, but the key must be shared with the other party, and if it is intercepted or stolen then all data encrypted with it can be read. Asymmetric encryption uses a public key, which can be published, and a private key, which is never shared, so no secret has to be transmitted. Asymmetric encryption is slower, which is why it is often used to deliver a symmetric key that then encrypts the bulk of the data.
A student wroteA student wrote: 'Encryption will also detect if the data was corrupted during transmission.'
Why it loses marksEncryption and error detection do different jobs. Decryption of corrupted ciphertext generally produces garbage or fails, but that is not a designed check and it cannot tell the receiver what went wrong. Error detection is done by parity, checksums, echo checks and ARQ.
The answer that scoresEncryption protects confidentiality: it makes the contents unreadable without the key. It is not an error detection method. Errors caused by interference during transmission are detected by a parity check, a checksum or an echo check, and automatic repeat query (ARQ) then arranges for the data to be re-transmitted. A secure system uses encryption for confidentiality and a separate error detection method for accuracy.

Where this fits in O Level Computer Science 2210

This page is one topic of Cambridge O Level Computer Science 2210. O Level Computer Science 2210 is the course home: every area and every topic in Cambridge's own order, the papers you sit and what each one tests, and the exam-practice tools. The full topic list, with each topic linked to its revision page, is on the O Level Computer Science 2210 syllabus page.