Information Security · Unit 4
Asymmetric Encryption
Exam-focused notes for Asymmetric Encryption (Information Security, BIT303): what the TU syllabus asks and how it has actually been tested, with 5 solved past questions from this unit.
Asymmetric Encryption in short
Asymmetric (public key) encryption uses a pair of keys, one public and one private. It solves the key sharing problem of symmetric systems. This chapter covers RSA, Diffie-Hellman and the ideas behind public key cryptography.
What this unit covers
- RSA algorithm and key generation
- RSA encryption and decryption
- RSA numerical examples
- Diffie-Hellman key exchange protocol
- Public key cryptography principles
RSA algorithm and key generation
2081 · 10 marks
RSA Cryptosystem with p=11 and q=7
Consider p=11 and q=7 in a RSA cryptosystem.
i. What is a public key pair (e, n)?
ii. What is a private key pair (d, n)?
iii. What is ciphertext for M=6? [10]
Show solved answerHide answer
RSA Cryptosystem: p = 11, q = 7
Given Data
- $p = 11$ (prime)
- $q = 7$ (prime)
- Message $M = 6$
Step A: Compute n and φ(n)
$$n = p \times q = 11 \times 7 = 77$$
$$\phi(n) = (p-1)(q-1) = 10 \times 6 = 60$$
Part (i): Public Key Pair (e, n)
Choose $e$ with $1 < e < \phi(n)$ and $\gcd(e, \phi(n)) = 1$.
Try $e = 7$: $$\gcd(7, 60) = 1 \quad \checkmark$$
$$\boxed{\text{Public Key} = (e, n) = (7, 77)}$$
Note: $e$ is not unique; other valid choices include 11, 13 and 17. We use $e = 7$ here.
Part (ii): Private Key Pair (d, n)
Find $d$ such that $d \times 7 \equiv 1 \pmod{60}$.
Extended Euclidean Algorithm:
$$60 = 8 \times 7 + 4$$ $$7 = 1 \times 4 + 3$$ $$4 = 1 \times 3 + 1$$ $$3 = 3 \times 1 + 0$$
Back substitution:
$$1 = 4 - 1 \times 3$$ $$1 = 4 - 1 \times (7 - 1 \times 4) = 2 \times 4 - 1 \times 7$$ $$1 = 2 \times (60 - 8 \times 7) - 1 \times 7 = 2 \times 60 - 17 \times 7$$
So $d = -17 \equiv 60 - 17 = 43 \pmod{60}$.
Verification: $43 \times 7 = 301 = 5 \times 60 + 1 \equiv 1 \pmod{60}$ ✓
$$\boxed{\text{Private Key} = (d, n) = (43, 77)}$$
Part (iii): Ciphertext for M = 6
$$C = M^e \bmod n = 6^7 \bmod 77$$
Using repeated squaring:
$$6^1 = 6$$ $$6^2 = 36$$ $$6^4 = 36^2 = 1296 = 16 \times 77 + 64 \equiv 64 \pmod{77}$$
$$6^7 = 6^4 \times 6^2 \times 6^1 = 64 \times 36 \times 6$$
$$64 \times 36 = 2304 = 29 \times 77 + 71 \equiv 71 \pmod{77}$$ $$71 \times 6 = 426 = 5 \times 77 + 41 \equiv 41 \pmod{77}$$
$$\boxed{C = 41}$$
Summary Table
| Parameter | Value |
|---|---|
| $n$ | 77 |
| $\phi(n)$ | 60 |
| Public Key $(e, n)$ | (7, 77) |
| Private Key $(d, n)$ | (43, 77) |
| Plaintext $M$ | 6 |
| Ciphertext $C$ | 41 |
2080 · 5 marks
Write the algorithm for RSA key generation with encryption and decryption. [5]
Diffie-Hellman key exchange protocol
2080 · 10 marks
Distinguish between threats and attack. Discuss some computer security strategy. Assume a prime number 23 and 9 as its primitive root. Alice select a private key 5 and Bob select the private key 6. Now find the secret key value that Alice and Bob shared using Diffie - Hellman protocol.[10]
2079 · 5 marks
Explain Diffie Hellman Key Exchange Protocol with suitable example. [5]
RSA encryption and decryption
Make Unit 4 stick
Practice BIT303 with flashcards & quizzes