# Symmetric & Asymmetric Encryption

- **Track:** Cambridge IGCSE™ Computer Science (0478 / 0984) (CAMBRIDGE IGCSE 0478)
- **Module:** Section 2: Data Transmission
- **Estimated Duration:** 15 minutes
- **Access:** Open Theory (All-Access for Interactive IDE &amp; Autotests)

---

## Theory & Conceptual Background

Encryption transforms readable plaintext into ciphertext using an algorithm and a key. Decryption recovers the plaintext using the appropriate key. Encryption protects confidentiality; it does not by itself prove a sender is honest or prevent deletion of data.

## Symmetric encryption

The sender and receiver use the same secret key to encrypt and decrypt. It is efficient for large amounts of data. The difficulty is securely sharing and protecting the secret key: anyone who obtains it can decrypt the messages.

## Asymmetric encryption

A related public/private key pair is used. For confidentiality, a sender encrypts with the recipient's public key; the recipient decrypts with their private key. The public key may be shared, while the private key must be kept secret. The sender must establish that the public key really belongs to the intended recipient, for example using a trusted certificate.

## Worked example

Mina wants to send confidential data to Leo. Leo shares his public key. Mina uses Leo's public key to encrypt the data and Leo uses his private key to decrypt it. Mina's public key would not solve this task. Asymmetric methods are generally more computationally expensive than symmetric encryption.

HTTPS uses authenticated key establishment followed by symmetric encryption of the connection. Details differ between protocol versions; do not memorise one historical handshake as universal. Digital signatures provide authentication/integrity through a different operation; they are not a way of keeping a message secret by encrypting it with a publicly known decryption key.

## Apply independently

A school must send a large confidential backup to a partner. Explain the key-sharing problem with symmetric encryption, the role of authenticated public keys, and why a shared symmetric key is suitable for the bulk data. Compare your answer with the distinctions above.

---

## Interactive Exercises & Autotest Specifications

### Exercise 1: Exam-Style Check: Symmetric vs Asymmetric Keys (Multiple choice, 25 XP)

**Instructions:**
In asymmetric cryptography, which key must the sender use to encrypt a confidential message meant only for recipient Alice?

**Options:**
- **A**: Alice&#39;s publicly available public key
- **B**: The sender&#39;s private key
- **C**: A single shared secret symmetric password
- **D**: Alice&#39;s secret private key


**Autotest Expectations:**
- **Correct option selected**: `selection_match` -> Expected: `b`

### Exercise 2: Exam-Style Question: Trace Public and Private Key Roles (Fill in blank, 35 XP)

**Instructions:**
Alice wants to send a confidential message to Bob using asymmetric encryption.

1. Alice encrypts the message using Bob's [blank_1] key.
2. Bob receives the ciphertext and decrypts it using his own [blank_2] key.
3. If Alice wants Bob to verify that the message genuinely came from her, she creates a digital signature using her own [blank_3] key.


**Starter Code:**
```text
{"prompt":"Fill in the blanks with \"public\" or \"private\":","template":"1. Encrypt message using Bob's [blank_1] key.\n2. Decrypt message using Bob's [blank_2] key.\n3. Digital signature created using Alice's [blank_3] key.","word_bank":["public","private","shared secret","symmetric"],"blanks":[{"id":"blank_1"},{"id":"blank_2"},{"id":"blank_3"}]}
```

**Autotest Expectations:**
- **Encrypt using Bob's public key**: `text_exact` -> Expected: `public`
- **Decrypt using Bob's private key**: `text_exact` -> Expected: `private`
- **Sign using Alice's private key**: `text_exact` -> Expected: `private`

### Exercise 3: Application: Check the reasoning (Fill in blank, 30 XP)

**Instructions:**
Work out each answer before submitting. Same shared secret for encryption/decryption: symmetric or asymmetric? For confidential sending to Ravi, use Ravi's public or private key to encrypt? Which key must Ravi keep secret?


**Starter Code:**
```text
{"prompt":"Application: Check the reasoning","template":"1. Same shared secret for encryption/decryption: symmetric or asymmetric? [blank_1]\n2. For confidential sending to Ravi, use Ravi's public or private key to encrypt? [blank_2]\n3. Which key must Ravi keep secret? [blank_3]","blanks":[{"id":"blank_1"},{"id":"blank_2"},{"id":"blank_3"}],"word_bank":["symmetric","public","private","asymmetric","shared key","plaintext"]}
```


