---
title: "Short note: public key cryptography"
subject: "Operating System"
chapter: 8
key: "semester_6/operating_system:public-key-cryptography-note"
source: https://www.bctengineer.com/q/semester_6/operating_system/public-key-cryptography-note
site: BCT Engineering
---

# Short note: public key cryptography

Operating System · Chapter 8: Security

- Asked in: 2075 Baisakh, 3 marks; year not given
- Video: [Encryption and public keys | Internet 101 | Computer Science | Khan Academy](https://www.youtube.com/watch?v=6-JjHa-qLPk) — Khan Academy
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/operating_system/public-key-cryptography-note
- Whole chapter: https://www.bctengineer.com/md/semester_6/operating_system/chapter-8

## Question

Write a short note on public key cryptography.

## Short answer

Public-key cryptography uses a public key for encryption and a private key for decryption; only the private key can decrypt. RSA (n=pq, C=P^e mod n) enables secure key exchange and digital signatures without prior secret sharing. It is slower than symmetric ciphers, so often used to exchange session keys.

## Answer

**Public-key (asymmetric) cryptography** uses a pair of mathematically related keys: a **public key** E known to everyone, and a **private key** D kept secret by the owner. What one key encrypts, only the other can decrypt. It was proposed by Diffie and Hellman (1976); RSA (Rivest, Shamir, Adleman, 1978) is the best-known algorithm.

#### Requirements
1. D(E(P)) = P.
2. It is extremely hard to find D from E.
3. E cannot be broken by a chosen-plaintext attack.

#### Working (confidentiality)
```text
 Sender                          Receiver
 P --[encrypt with receiver's  --> C --[decrypt with
      PUBLIC key]                       own PRIVATE key]--> P
```

#### RSA outline
1. Choose two large primes p, q; n = p × q; z = (p−1)(q−1).
2. Choose e coprime with z; find d with e·d ≡ 1 (mod z).
3. Public key = (e, n); private key = (d, n).
4. Encrypt: C = Pᵉ mod n. Decrypt: P = Cᵈ mod n.

#### Uses and comparison
- Key exchange, digital signatures (sign with private key, verify with public key), secure web (SSL/TLS).
- Advantage: no secret key needs to be shared; disadvantage: much slower than symmetric ciphers, so it is used to exchange a session key for a symmetric cipher.

## Check yourself

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

1. In confidentiality, which keys are used?
   A. Encrypt with sender's private key; decrypt with public
   B. Both with the same secret key
   C. Encrypt with receiver's private; decrypt with sender's public
   D. Encrypt with receiver's public key; decrypt with receiver's private key
   Answer: D. Only the receiver holds the private key. (Key point: Keys)

2. How are RSA keys related?
   A. n = p*q, z = (p-1)(q-1), e*d = 1 mod z
   B. n = p+q, e*d = 1 mod p
   C. z = p*q, e = d
   D. n = p*q, e + d = z
   Answer: A. Public key (e,n), private key (d,n). (Key point: RSA)

3. Why exchange session key with public key and then use symmetric cipher?
   A. Public keys are less secure
   B. Public-key ciphers are much slower
   C. Symmetric needs no key
   D. Public keys cannot encrypt
   Answer: B. Symmetric is used for bulk data. (Key point: Why hybrid)

## Related in Operating System

- [Public key cryptography and digital signature](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Adigital-signature-public-key) — Operating System, chapter 8

## Related in other subjects

- [What is public key cryptography](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Apublic-key-cryptography) — Computer Networks and Security, chapter 8
- [Public speaking and key strategies](https://www.bctengineer.com/question.md?key=semester_5%2Fcommunication_english%3Apublic-speaking-strategies) — Communication English, chapter 4
