Computer ScienceFoundation18 min read

Encryption

Making intercepted data useless, and why the method being public does not matter

This topic appears in:

01

What encryption does and does not do

Data travelling across a network can be intercepted, and no realistic amount of care prevents that entirely. Encryption accepts the interception and makes it worthless: the data is scrambled so that anyone reading it sees nothing meaningful.

It is important to be precise about what this achieves. Encryption does not stop data being intercepted, stolen or deleted. It stops the interceptor understanding what they took. That distinction is examined directly and a great many answers lose the mark by claiming it prevents theft.

TermMeaning
Plaintextthe original readable data
Ciphertextthe scrambled result after encryption
Keythe secret value controlling the scrambling
Algorithmthe method — usually public knowledge
Encryptionplaintext → ciphertext
Decryptionciphertext → plaintext, using the key
02

A simple cipher, and why it is weak

The Caesar cipher shifts each letter a fixed number of places through the alphabet. A shift of 3 turns A into D and MEET into PHHW. The shift is the key, and reversing it recovers the message.

It illustrates the structure of every cipher — plaintext, key, ciphertext — and also why key length matters. There are only 25 useful shifts, so an attacker can simply try all of them in a few seconds. That is a brute force attack, and defending against it is entirely a matter of having too many possible keys to try.

Set the key to 0 and the ciphertext is the plaintext. Knowing the method is a shift cipher does not read the message — an attacker also needs the key. That principle holds for modern encryption too; only the key count changes.

Why the algorithm is published deliberately

Modern encryption algorithms are public, examined by anyone who wishes to, and used worldwide. Secrecy rests entirely on the key. This is deliberate: an algorithm kept secret has been checked by only a few people, and a weakness nobody noticed is far more dangerous than one found and fixed in public. Security through obscurity is not security.

03

Symmetric and asymmetric encryption

Symmetric encryption uses the same key to encrypt and to decrypt. It is fast and well suited to large amounts of data, but it has one serious problem: the key itself must reach the recipient somehow, and any channel safe enough to send the key on would have been safe enough to send the message on.

Asymmetric encryption solves that with a pair of keys. The public key is published freely and encrypts; the private key is never shared and decrypts. Anyone can send you a message nobody else can read, with no secret ever having been exchanged.

The cost is speed — asymmetric encryption is far slower. So real systems use both: asymmetric encryption to exchange a symmetric key safely, then symmetric encryption for the actual data.

symmetric:same key encrypts and decryptsfast, but the key must be sharedasymmetric: public key encrypts, private decryptsslow, but no secret is exchangedin practice: asymmetric to share a symmetric key, then symmetric for the datathis combination is what happens every time a browser opens an HTTPS connection

The public key cannot decrypt

It is tempting to assume that a key which locks can also unlock. In asymmetric encryption it cannot: the public key encrypts only, and even the person who encrypted the message cannot read it back. That one-way property is exactly what makes publishing the key safe.

04

Where encryption is used

The syllabus expects real applications rather than the theory alone.

HTTPS encrypts everything between a browser and a website, which is why payment pages must use it — and why browsers now mark plain HTTP as insecure regardless of what the page does. Disk encryption protects data at rest, so a stolen laptop yields nothing without the password. Messaging apps use end-to-end encryption, meaning even the company operating the service cannot read the messages. And wireless networks encrypt traffic so that anyone within range cannot simply read it out of the air.

Before you leave this chapter

  1. Encryption does not prevent interception — it makes the intercepted data meaningless.
  2. Plaintext + key + algorithm → ciphertext. The algorithm is public; only the key is secret.
  3. A short key is vulnerable to brute force — trying every possibility.
  4. Symmetric uses one shared key and is fast; asymmetric uses a public/private pair and needs no shared secret.
  5. Real systems use asymmetric encryption to exchange a symmetric key, then symmetric for the data.
05

What makes a key strong

Since the algorithm is public, the entire security of an encrypted message rests on the key being impractical to guess. Two things determine that.

The first is length. Each additional bit doubles the number of possible keys, so the search space grows exponentially: a 56-bit key has about 7 × 10¹⁶ possibilities and can now be exhausted, while a 256-bit key has more possibilities than there are atoms in the observable universe.

The second is unpredictability. A long key generated from a dictionary word or a birthday is not a random key, and an attacker will try likely values long before resorting to brute force. This is why password advice emphasises unpredictability as much as length.

number of possible keys = 2^(key length in bits)8 bits → 25616 bits → 65 53632 bits → about 4.3 × 10⁹64 bits → about 1.8 × 10¹⁹each extra bit doubles the work an exhaustive search must do

Why encryption still fails in practice

Modern encryption is essentially never broken by attacking the mathematics. It fails because a key was stored somewhere unprotected, a user was tricked into revealing a password, or data was read before it was encrypted or after it was decrypted. The strongest cipher in the world protects only the journey — which is why encryption always appears alongside the other security measures rather than instead of them.

Practice questions

6 questions · 20 marks · full working on every one

Try each one on paper first, then open the working. The marks are shown where they are actually awarded, because that is where they are actually lost.

Short questions

3 · 6 marks

Two marks each, in the style of the short-question section of the paper. Answer in two or three lines.

SQ1[2 marks]
Explain what encryption does to data being transmitted.
Model answer

It scrambles the data using a key so that it becomes meaningless to anyone who intercepts it. Only someone with the correct key can decrypt it back into readable form.

Examiner tip. Say "meaningless", not "safe". Encryption does not stop the data being taken — it stops it being understood.

SQ2[2 marks]
Does encryption prevent data being intercepted? Explain.
Model answer

No. The data can still be intercepted, copied or deleted exactly as before. What encryption prevents is the interceptor understanding what they have taken, because without the key the ciphertext is unreadable.

Examiner tip. This is a standard question and a standard trap. Answering "yes" loses both marks however good the rest of the explanation is.

SQ3[2 marks]
Why is a longer encryption key more secure?
Model answer

Each extra bit doubles the number of possible keys, so a brute force attack — trying every key in turn — takes far longer. A key short enough to be tried exhaustively offers no real protection.

Examiner tip. Naming brute force is the mark. The doubling per bit shows why length matters so disproportionately.

Solved numericals

2 · 8 marks

Full working, one step per line, with the marks shown where they are awarded.

N1[4 marks]
Compare symmetric and asymmetric encryption, giving one advantage of each.
Full working
  1. Symmetric uses the same key to encrypt and decrypt[1]
  2. Advantage: it is much faster, so it suits large volumes of data[1]
  3. Asymmetric uses a public key to encrypt and a matching private key to decrypt[1]
  4. Advantage: no secret key needs to be exchanged, which removes the problem of getting the key to the recipient safelythe key distribution problem is the point[1]

Symmetric: one key, fast. Asymmetric: a public/private pair, no shared secret needed.

Examiner tip. The key distribution problem is the reason asymmetric encryption exists. Stating it explicitly is what earns the fourth mark.

N2[4 marks]
Explain why encryption algorithms are made public rather than kept secret.
Full working
  1. A public algorithm can be examined by cryptographers worldwide[1]
  2. so weaknesses are found and corrected, rather than remaining hidden until an attacker discovers one[1]
  3. Security rests entirely on the key, which remains secret — knowing the method does not read the message[1]
  4. A secret algorithm has been checked by very few people, and once leaked offers no protection at all — "security through obscurity" is not security[1]

Public scrutiny finds weaknesses; secrecy rests on the key alone, not on the method.

Examiner tip. The phrase "security through obscurity" is worth knowing by name — it is the position being argued against.

Long questions

1 · 6 marks

Theory and numerical together, as they appear in the long-question section.

LQ1[6 marks]
A customer buys goods from an online shop and enters card details.
  1. Explain how HTTPS protects the card details in transit.
  2. Explain why the site uses both asymmetric and symmetric encryption.
  3. Explain one thing encryption does NOT protect against here.
Mark scheme
  1. The data is encrypted in the browser before it is sent, so anything intercepted on the way is ciphertext[1]
  2. Only the shop's server holds the key needed to decrypt it, so an interceptor sees nothing usable[1]
  3. Asymmetric encryption is used first, to exchange a symmetric key safely without any prior shared secret[1]
  4. Then symmetric encryption is used for the actual data, because it is far faster for the volume involvedthe combination is the mark[1]
  5. Encryption does not protect the data once it has been decrypted at the destination[1]
  6. If the shop's database is later breached, or if the customer was tricked into sending details to a fake site in the first place, encryption offers no protection — it secured the journey, not the endpointsaccept phishing as the example[1]

(a) encrypted before sending, decryptable only by the server (b) asymmetric to exchange the key, symmetric for speed (c) it protects the journey, not the endpoints — a breached database or a fake site defeats it

Examiner tip. Part (c) is the one that separates answers. HTTPS to a convincing fake site encrypts your details perfectly and delivers them straight to the attacker.