Saturday, June 13, 2026

Unit 3 — Public Key Cryptography and RSA

 

From MCA553 (Principles of Cryptography and Cyber Security). 


This is one of the most important units for exams.



---


Introduction to Cryptography


Cryptography is the science of protecting information by converting it into a secret form.


Goals of Cryptography


1. Confidentiality



2. Integrity



3. Authentication



4. Non-Repudiation





---


Plaintext and Ciphertext


Plaintext


Original readable message.


Example:


HELLO


Ciphertext


Encrypted unreadable message.


Example:


XKJ92A


Encryption


Converts plaintext into ciphertext.


Decryption


Converts ciphertext back into plaintext.



---


Symmetric Key Cryptography


Uses the same key for encryption and decryption.


Plain Text

    ↓

Encryption Key

    ↓

Cipher Text

    ↓

Decryption Key (Same Key)

    ↓

Plain Text


Advantages


Fast


Efficient


Suitable for large data



Disadvantages


Key distribution problem


Less secure for communication over open networks



Examples


DES


AES


Triple DES




---


Asymmetric Key Cryptography


Uses two different keys:


1. Public Key



2. Private Key




Public Key → Encrypt

Private Key → Decrypt


Advantages


Better security


Solves key distribution problem



Disadvantages


Slower than symmetric encryption



Examples


RSA


Diffie-Hellman


ECC




---


Difference Between Symmetric and Asymmetric Cryptography


Symmetric Asymmetric


One key Two keys

Faster Slower

Less secure key sharing More secure

DES, AES RSA, ECC




---


Message Authentication


Ensures that the message is genuine and has not been modified.


Methods:


Hash Functions


Digital Signatures


MAC (Message Authentication Code)




---


Public Key Cryptosystem Principles


Requirements:


1. Easy to generate key pair



2. Easy to encrypt



3. Easy to decrypt



4. Difficult to derive private key from public key



5. Difficult to recover plaintext without key





---


Diffie-Hellman Key Exchange


Used for securely sharing a secret key over an insecure network.


Steps


Suppose:


Prime number P = 23


Generator G = 5



Alice chooses:


a = 6


Bob chooses:


b = 15


Alice computes:


A = G^a mod P


Bob computes:


B = G^b mod P


They exchange A and B publicly.


Both calculate:


Secret Key = B^a mod P


and


Secret Key = A^b mod P


Result: Same secret key generated on both sides.



---


RSA Algorithm


Most important topic for exams.


RSA is based on:


> Difficulty of factoring large prime numbers.





---


RSA Key Generation


Step 1


Choose two prime numbers.


p = 3

q = 11


Step 2


Calculate:


n = p × q


n = 33



---


Step 3


Calculate:


φ(n) = (p−1)(q−1)


\phi(n)=(p-1)(q-1)


For this example:


φ(n) = 20



---


Step 4


Choose e such that:


1 < e < φ(n)


Choose:


e = 3



---


Step 5


Find d:


d × e ≡ 1 mod φ(n)


Result:


d = 7



---


Public Key


(e,n)

=

(3,33)


Private Key


(d,n)

=

(7,33)



---


Key Management


Process of:


Creating keys


Distributing keys


Storing keys


Revoking keys



Poor key management can break even strong encryption.



---


Symmetric Cipher Modes


Used to encrypt large amounts of data.


ECB


Electronic Code Book


Simple


Less secure



CBC


Cipher Block Chaining


More secure


Most commonly used



CFB


Cipher Feedback


OFB


Output Feedback



---


Substitution Technique


Replace characters with other characters.


Example:


A → D

B → E

C → F


Used in Caesar Cipher.



---


Transposition Technique


Characters remain the same but positions change.


Example:


HELLO

LHEOL



---


Block Cipher


Encrypts data block by block.


Example:


64-bit block

128-bit block


Popular Algorithms:


DES


AES




---


Data Encryption Standard (DES)


Developed by IBM.


Characteristics:


Symmetric algorithm


64-bit block size


56-bit key



Advantages


Fast



Disadvantages


Small key size


Vulnerable to brute force attack




---


Strength of DES


Originally strong.


Today:


Not secure enough


Can be cracked using modern computers




---


Differential Cryptanalysis


Studies differences in ciphertext to discover keys.


Purpose:


Break encryption algorithms




---


Linear Cryptanalysis


Uses linear relationships between plaintext and ciphertext.


Another method used to attack DES.



---


Block Cipher Design Principles


Good block cipher should have:


1. Confusion



2. Diffusion



3. Strong key management



4. Resistance to attacks





---


Important Exam Questions


Short Questions


1. Define Cryptography.



2. Difference between Symmetric and Asymmetric Encryption.



3. What is RSA?



4. What is Diffie-Hellman?



5. Define DES.



6. What is Ciphertext?



7. What is Key Management?



8. What is a Block Cipher?





---


Long Questions


1. Explain RSA algorithm with example.



2. Explain Diffie-Hellman key exchange.



3. Compare Symmetric and Asymmetric Cryptography.



4. Explain DES and its strengths.



5. Explain Differential and Linear Cryptanalysis.



6. Discuss block cipher design principles.





---


Quick Revision


Cryptography = Protecting information.


Symmetric = One key.


Asymmetric = Public + Private key.


RSA = Public key cryptography.


Diffie-Hellman = Secure key exchange.


DES = Symmetric block cipher.


Ciphertext = Encrypted message.


Key Management = Handling cryptographic keys.



Next Unit 4 covers AES, Triple DES, RC4, Hash Functions, MAC, and Message Authentication, which is also very important for university exams.

No comments:

Post a Comment