---
title: "Short note: RSA"
subject: "Computer Networks and Security"
chapter: 8
key: "semester_7/computer_networks_and_security:rsa-note"
source: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/rsa-note
site: BCT Engineering
---

# Short note: RSA

Computer Networks and Security · Chapter 8: Network Security

- Asked in: 2070 Asar, 4 marks
- Video: [Lec-92: RSA Algorithm in Network Security with examples in Hindi rsa algorithm example in hindi](https://www.youtube.com/watch?v=VUxfDCmWM0U) — Gate Smashers
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/computer_networks_and_security/rsa-note
- Whole chapter: https://www.bctengineer.com/md/semester_7/computer_networks_and_security/chapter-8

## Question

Write a short note on RSA (printed as "RSK").

## Short answer

RSA is a public-key algorithm using a public key (e,n) for encryption and a private key (d,n) for decryption. Security relies on the difficulty of factoring large primes p and q where n=p×q. Key generation computes φ(n)=(p-1)(q-1), chooses e coprime to φ(n), and finds d as e's modular inverse. Used for key exchange, digital signatures, and encrypting small data like session keys; 2048-bit keys are recommended.

## Answer

**RSA** (Rivest, Shamir, Adleman, 1977) is the most widely used **public-key (asymmetric) algorithm**. It uses two different but related keys: the public key to encrypt (or verify) and the private key to decrypt (or sign). Its strength is the difficulty of factorising n = p × q when p and q are large primes.

#### Key generation
1. Choose primes p, q. 2. n = p × q. 3. φ(n) = (p − 1)(q − 1). 4. Choose e with gcd(e, φ(n)) = 1. 5. d = e⁻¹ mod φ(n).
Public key = (e, n); private key = (d, n).

#### Operation
- Encryption: C = Mᵉ mod n. Decryption: M = Cᵈ mod n.

#### Small example
p = 3, q = 11, n = 33, φ = 20, e = 3, d = 7 (3 × 7 = 21 ≡ 1 mod 20). Message M = 4:
C = 4³ mod 33 = 64 mod 33 = **31**; M = 31⁷ mod 33 = **4**.

#### Uses and features
- Key exchange, digital signatures, and encryption of small data such as session keys (SSL/TLS, PGP).
- Slower than symmetric ciphers (like AES), so it is used with them.
- Key sizes 2048 bits or more are recommended today.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. Which key encrypts and which decrypts?
   A. Both same
   B. Hash
   C. Public encrypts, private decrypts
   D. Private encrypts, public decrypts
   Answer: C. Public key (e,n) encrypts, private (d,n) decrypts. (Key point: Key use)

2. For p=3, q=11, e=3, M=4, the ciphertext is:
   A. 31
   B. 7
   C. 4
   D. 64
   Answer: A. 4^3 = 64 mod 33 = 31. (Key point: Example)
