4 Asymmetric Encryption

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.

Asymmetric Encryption: notes

Public key cryptography principles

In public key cryptography each user has two mathematically linked keys.

  • The public key can be given to anyone.
  • The private key is kept secret.

Data locked with one key can be unlocked only with the other.

Two uses:

  • Confidentiality: the sender encrypts with the receiver's public key. Only the receiver's private key can decrypt.
  • Authentication (signature): the sender encrypts a value with their own private key. Anyone can check it with the public key.

Safety rests on a one-way function with a trapdoor: easy to compute forward, very hard to reverse unless you know a secret. RSA uses the difficulty of factoring a large number. Diffie-Hellman uses the discrete logarithm problem.

PointSymmetricAsymmetric
KeysOne shared keyPublic and private pair
SpeedFastSlow
Key sharingHardEasy, public key can be open
Typical useBulk dataKey exchange, signatures

In practice the two are mixed: public key methods share a session key, and a symmetric cipher encrypts the data.

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 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

ParameterValue
$n$77
$\phi(n)$60
Public Key $(e, n)$(7, 77)
Private Key $(d, n)$(43, 77)
Plaintext $M$6
Ciphertext $C$41
Open this answer on its own page →

2080 · 5 marks

Write the algorithm for RSA key generation with encryption and decryption. [5]

Note: No specific reference notes were found for this topic. The following answer is based on standard RSA cryptography as taught in BSc CSIT curriculum. --- RSA (Rivest-Shamir-Adleman) is a public-key (asymmetric) cryptosystem based on the mathematical difficulty of factoring large integers. ---...

Open this answer on its own page →

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]

Parameter Value ------ Prime number $p$ 23 Primitive root $g$ 9 Alice's private key $a$ 5 Bob's private key $b$ 6 All required data is present. --- Aspect Threat Attack --------- Definition A potential danger that could exploit a vulnerability An actual, deliberate act to exploit a vulnerability ...

Open this answer on its own page →

2079 · 5 marks

Explain Diffie Hellman Key Exchange Protocol with suitable example. [5]

The question is descriptive. The only numeric inputs come from the standard example: - Prime $p = 23$ - Generator (primitive root) $g = 5$ - Alice's private key $a = 6$ - Bob's private key $b = 15$ --- The Diffie-Hellman (DH) Key Exchange, introduced by Whitfield Diffie and Martin Hellman (1976),...

Open this answer on its own page →

RSA encryption and decryption

0

RSA Encryption and Decryption

RSA is an asymmetric (public-key) cryptosystem. Encryption uses the receiver's public key and decryption uses the receiver's private key. Its security rests on the difficulty of factoring the product of two large primes. --- 1. Choose two large primes $p$ and $q$. 2. Compute the modulus

Open this answer on its own page →