← IGCSE Computer Science Paper 1

Public key

The half of a key pair that the owner shares openly. Anyone can use it to encrypt data sent to the owner, but it cannot decrypt that data. Only the matching private key can.

Understanding Public key in IGCSE Computer Science Paper 1

What it does: Sharing the public key is safe because it can only encrypt. The private key stays secret, so the data stays protected. The public key can travel over an insecure network. Even if an interceptor copies it, they cannot decrypt messages with it. A public key can encrypt but not decrypt. This is what makes asymmetric encryption work. The public key is shared openly. The private key is the one the owner never shares.

Common mistakes: The sender must use Bob's public key, which he shares openly. A private key is never shared. It should be getPublicKey("Bob"). The message was encrypted with Amy's public key, but this line sends the plaintext, so an interceptor could read it. It should send the ciphertext: send(cipher, "Amy").

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 189–203) and word search (Modules 189–217).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Who is allowed to have a copy of your public key?
Anyone, because it is shared openlyOnly you, because it must be kept secret
Matches
decrypt(ciphertext, publicKey)
↓
A public key cannot decrypt data. Decryption needs the matching private key.
Applying
Meanings
Term
public key
Meaning
The half of a key pair that the owner shares openly. Anyone can use it to encrypt data sent to the owner, but it cannot decrypt that data. Only the matching private key can.
Practice
publicKey ← GetPublicKey("Priya")
Testing
Gaps
ciphertext ← ENCRYPT(message, )
Check Answer
Spots
1msg ← "Meet at 5"
2pub ← getPrivateKey("Bob")

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Horned Lizard' badge — Bug Squasher, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Who is allowed to have a copy of your public key?
A. Only you, because it must be kept secret
B. Anyone, because it is shared openly ✓
The public key is meant to be shared openly. It is the private key that must be kept secret.
2. What is a public key used for?
A. Encrypting data sent to its owner ✓
B. Decrypting data sent to its owner
Anyone can use the owner's public key to encrypt data for them. Decryption needs the matching private key.
3. Can a public key decrypt data that it encrypted?
A. No, only the matching private key can decrypt it ✓
B. Yes, the same public key can decrypt it
A public key can encrypt but not decrypt. This is what makes asymmetric encryption work.
4. Which is a safe way to share a public key?
A. Publish it on a website ✓
B. Keep it hidden in a locked file
A public key is not secret, so it can be published on a website or sent over the network. Hiding it would defeat its purpose.
5. An interceptor copies your public key as it is sent over the network. What is the result?
A. Big problem, they can now read your messages
B. No problem, it cannot decrypt messages sent to you ✓
The public key can only encrypt. Reading messages needs your private key, which is never sent.

Match the Pairs

public key → The half of a key pair that the owner shares openly so anyone can use it to encrypt data sent to them
encrypt(message, publicKey) → Locks a message using the recipient's shared key so that only the recipient's private key can unlock it
A public key can be published openly, for example on a website, because it cannot decrypt data → publish(publicKey, website)
A public key can be sent over the network to anyone who wants to send the owner a secure message → send(publicKey, network)
decrypt(ciphertext, publicKey) → A public key cannot decrypt data. Decryption needs the matching private key.
keep(publicKey, secret) → A public key is meant to be shared openly. Only the private key must be kept secret.

Key Term

public key
The half of a key pair that the owner shares openly. Anyone can use it to encrypt data sent to the owner, but it cannot decrypt that data. Only the matching private key can.

Fill in the Blanks

1. ciphertext ← ENCRYPT(message, publicKey)
Hint: Type the variable holding the key that anyone may use to encrypt data for the owner.
2. PUBLISH(publicKey, website)
Hint: Type the command that makes the key openly available on a website.
3. message ← DECRYPT(ciphertext, privateKey)
Hint: Type the variable holding the only key that can decrypt this data.
4. publicKey ← keyPair.public
Hint: Type the name of the half of the key pair that is shared openly.
5. IF key = publicKey THEN canDecrypt ← FALSE ENDIF
Hint: Type the Boolean value showing that a public key cannot decrypt data.

Spot the Error

Question 1
A msg ← "Meet at 5"
B pub ← getPrivateKey("Bob")
C cipher ← encrypt(msg, pub)
D send(cipher, "Bob")
Line B — The sender must use Bob's public key, which he shares openly. A private key is never shared. It should be getPublicKey("Bob").
Question 2
A pub ← getPublicKey("Amy")
B msg ← "Hello Amy"
C cipher ← encrypt(msg, pub)
D send(msg, "Amy")
Line D — The message was encrypted with Amy's public key, but this line sends the plaintext, so an interceptor could read it. It should send the ciphertext: send(cipher, "Amy").
Question 3
A keys ← makeKeyPair()
B publish(keys.private, website)
C keep(keys.private)
Line B — Only the public key is published on a website. Publishing the private key would let anyone decrypt the owner's messages. It should be publish(keys.public, website).
Question 4
A cipher ← encrypt(msg, pub)
B send(cipher, "Sam")
C plain ← decrypt(cipher, pub)
D output plain
Line C — A public key can encrypt but cannot decrypt. Sam must use his matching private key. It should be decrypt(cipher, priv).
Question 5
A IF key = "private" THEN
B share(key)
C ELSE
D keepSecret(key)
E ENDIF
Line A — The key that is shared openly is the public key, not the private key. The condition should be IF key = "public" THEN.

Student with a class code? Join your class →