TU BSc CSIT 5th Semester Cryptography (CSC316): Complete Notes, Syllabus, Important Questions, Solved Numerical & Exam Guide

TU BSc CSIT 5th Semester Cryptography (CSC316): Complete Notes, Syllabus, Important Questions, Solved Numerical & Exam Guide



Introduction

Every time you log into a website, send a message, or make an online payment, cryptography is running silently in the background. The padlock icon in your browser's address bar? That's TLS — a cryptographic protocol. The "HTTPS" before a URL? That means your data is encrypted in transit. The fact that your bank can verify it's actually you, not someone pretending to be you? That's digital signatures and authentication protocols. Cryptography is the mathematical infrastructure that makes the modern digital world trustworthy.

CSC316 is where BSc CSIT students at Tribhuvan University encounter cryptography properly for the first time. It's a 5th-semester course that moves from classical hand-cipher techniques invented centuries ago to the algorithms securing real internet traffic today. Students who have studied mathematics seriously (number theory, modular arithmetic) will find parts of it elegant; students who find the mathematical sections intimidating should know that the exam rewards understanding and application over pure mathematical derivation — RSA encryption and decryption, for instance, becomes completely manageable once you've worked through the algorithm four or five times.

Why does cryptography matter specifically for a CS student, beyond passing this exam? Because you will almost certainly implement or configure cryptographic systems in your career. Choosing between SHA-256 and MD5, understanding why AES replaced DES, knowing when to use asymmetric vs symmetric encryption, configuring TLS correctly — these are real engineering decisions that real software engineers make. Developers who treat these as black boxes make security mistakes; developers who understand them make better systems.

This guide is structured so that each unit is actually explained before the exam questions for that unit are listed. The solved numerical examples (RSA, Caesar cipher, Hill cipher, Diffie-Hellman) are worked completely so you can follow each step. The exam weightage table, past paper analysis, and study plans tell you where to invest your preparation time most efficiently.

One correction from versions of this guide that circulated previously: this course is in the 5th semester, not the 6th.

Official Course Information

Particular Details
Course Title Cryptography
Course Code CSC316
Semester Fifth Semester
Nature of Course Theory + Lab
Full Marks 60 + 20 + 20
Pass Marks 24 + 8 + 8
Credit Hours 3

Text Book: W. Stallings, Cryptography and Network Security, Pearson Education Reference Books: Stallings – Network Security Principles and Practice; Matt Bishop – Computer Security: Art and Science; Bruce Schneier – Applied Cryptography; B.A. Forouzan – Cryptography and Network Security

Official Unit-Wise Syllabus Overview

Unit Title Hours
1 Introduction and Classical Ciphers 7
2 Symmetric Ciphers 10
3 Asymmetric Ciphers 8
4 Cryptographic Hash Functions and Digital Signatures 8
5 Authentication 3
6 Network Security and PKI 6
7 Malicious Logic 3

Units 2, 3, and 4 carry the most teaching hours and are the most heavily tested. Unit 2 (Symmetric Ciphers) and Unit 3 (Asymmetric Ciphers) together account for 18 of the 45 teaching hours.

Exam Weightage at a Glance

Topic Importance Appears As
RSA Algorithm + Numerical ★★★★★ Long question (10 marks)
AES Architecture ★★★★★ Long question
DES + Feistel Structure ★★★★☆ Long question / diagram
Diffie-Hellman Key Exchange + Numerical ★★★★★ Long question + numerical
Hash Functions (SHA, MD5) ★★★★★ Long question
Digital Signatures ★★★★★ Long or short question
Block Cipher Modes ★★★★★ Long question + diagram
Hill Cipher + Numerical ★★★★☆ Numerical question
Caesar Cipher + Frequency Analysis ★★★★☆ Short / numerical
SSL/TLS Handshake ★★★★★ Long question + diagram
Firewall Types ★★★★☆ Short / long question
PKI and Digital Certificates ★★★★☆ Long or short question
Symmetric vs Asymmetric Comparison ★★★★★ Short or comparative question
CIA Triad ★★★★☆ Short question
Malicious Logic (Virus, Worm, Trojan) ★★★☆☆ Short notes

Unit 1: Introduction and Classical Ciphers (7 Hrs)

Security Foundations

Before encryption algorithms, you need the vocabulary. The CIA Triad is the foundation of information security:

  • Confidentiality: Only authorized parties can read the information. Achieved through encryption.
  • Integrity: Information hasn't been altered without authorization. Achieved through hash functions and MACs.
  • Availability: Systems and data are accessible to authorized users when needed. Achieved through redundancy, backups, and anti-DoS measures.

Key terminology:

  • Cryptography: The science of designing techniques for secure communication.
  • Cryptanalysis: The science of breaking cryptographic schemes without knowing the key.
  • Cryptology: The combined field covering both cryptography and cryptanalysis.
  • Plaintext: The original, readable message.
  • Ciphertext: The encrypted, unreadable output.
  • Key: The secret value controlling the encryption/decryption process.

Security Attacks:

  • Passive attacks: Intercept and read data without modifying it (eavesdropping, traffic analysis).
  • Active attacks: Modify, inject, or delete data (MITM, replay attack, DoS).

Kerckhoffs's Principle: A cryptosystem should be secure even if everything about the system — except the key — is public knowledge. This is why modern algorithms (AES, RSA) are published openly; their security rests entirely on the key being secret, not on the algorithm being hidden.

Shannon's Principles:

  • Confusion: Obscure the relationship between the plaintext and ciphertext (achieved by substitution).
  • Diffusion: Spread the influence of each plaintext bit across many ciphertext bits (achieved by transposition/permutation).

Classical Ciphers

Caesar Cipher: Each letter is shifted by a fixed number of positions in the alphabet.

Solved Example — Encrypt "HELLO" with shift 3:

Plaintext H E L L O
Position 7 4 11 11 14
+ Shift 3 10 7 14 14 17
Ciphertext K H O O R

"HELLO" encrypted = "KHOOR"

To decrypt: subtract the shift. K(10) - 3 = H(7), and so on.

Weakness: Only 25 possible keys. A brute-force attack tries all 25 shifts in seconds. Frequency analysis also breaks it by comparing letter frequencies in the ciphertext to known English language frequencies.

Playfair Cipher: Encrypts pairs of letters (digrams) using a 5×5 matrix built from a keyword. More complex than Caesar but still breakable through digram frequency analysis.

Vigenère Cipher: A polyalphabetic cipher using a repeating keyword where each letter of the key specifies a different Caesar shift. Harder to break than monoalphabetic ciphers but vulnerable to the Kasiski test if the key is short.

Hill Cipher: Uses matrix multiplication over modular arithmetic to encrypt blocks of letters.

Solved Example — Hill Cipher:

Key matrix K = [[3, 3], [2, 5]], Plaintext = "HI"

H = 7, I = 8 → Plaintext vector = [7, 8]ᵀ

Encryption: C = K × P (mod 26)

C₁ = (3×7 + 3×8) mod 26 = (21 + 24) mod 26 = 45 mod 26 = 19 = T C₂ = (2×7 + 5×8) mod 26 = (14 + 40) mod 26 = 54 mod 26 = 2 = C

"HI" encrypted = "TC"

Decryption requires the inverse of K modulo 26. For decryption, K⁻¹ must exist — the determinant of K must be coprime with 26 (i.e., gcd(det(K), 26) = 1).

Rail Fence Cipher: Transposition cipher — letters are written diagonally across multiple "rails" and then read row by row. "HELLO WORLD" on 2 rails:

  • Rail 1: H L O O L
  • Rail 2: E L W R D
  • Ciphertext: HLOOLEL WRD

Block vs Stream Ciphers: A block cipher encrypts fixed-size blocks of data (e.g., AES encrypts 128-bit blocks). A stream cipher encrypts data bit-by-bit or byte-by-byte continuously. Block ciphers are more common in modern applications.

Important Questions — Unit 1

  1. Define cryptography, cryptology, and cryptanalysis with examples.
  2. Explain the CIA Triad and its importance in information security.
  3. Explain Caesar cipher. Show how frequency analysis breaks it.
  4. Describe Playfair cipher. Build a 5×5 matrix from a keyword and encrypt a message.
  5. Explain Hill cipher with a complete numerical example.
  6. What is Kerckhoffs's Principle? Why is it fundamental to modern cryptography?
  7. Explain Shannon's principles of confusion and diffusion.
  8. Differentiate between symmetric and asymmetric key cryptography.
  9. Write short notes on: Rail Fence Cipher, Vigenère Cipher, Monoalphabetic Cipher.
  10. What are passive and active attacks? Give examples of each.

Unit 2: Symmetric Ciphers (10 Hrs)

Feistel Cipher Structure

The Feistel structure is a framework used in designing block ciphers. It's named after Horst Feistel (IBM) and is important because it allows the same structure to perform both encryption and decryption.

          Plaintext (64-bit)
               │
         Split into L₀, R₀
               │
    ┌──────────┴──────────┐
    │ L₁ = R₀             │
    │ R₁ = L₀ ⊕ F(R₀,K₁) │
    │          ...         │
    │ (repeat N rounds)    │
    └──────────┬──────────┘
               │
           Combine
               │
           Ciphertext

Key property: The function F need not be invertible because the structure is self-reversing. To decrypt, apply the same rounds with the subkeys in reverse order.

DES (Data Encryption Standard)

DES uses the Feistel structure with 16 rounds, a 64-bit block size, and a 56-bit key. It was the dominant encryption standard from the 1970s to the late 1990s.

DES Structure:

  1. 64-bit plaintext enters
  2. Initial permutation (IP)
  3. 16 Feistel rounds, each using a 48-bit round key derived from the 56-bit master key
  4. Each round: expand R to 48 bits → XOR with round key → 8 S-boxes compress back to 32 bits → P-box permutation
  5. Final permutation (IP⁻¹)
  6. 64-bit ciphertext

Why DES is insecure today: The 56-bit key space (2⁵⁶ = ~72 quadrillion possibilities) can be brute-forced in hours with modern hardware. In 1999, a dedicated machine cracked DES in 22 hours.

Triple DES (3DES): Applies DES three times: Encrypt with K₁ → Decrypt with K₂ → Encrypt with K₃. Effective key length 112 or 168 bits. Much slower than AES; being phased out.

AES (Advanced Encryption Standard)

AES replaced DES after NIST's public competition. It's not a Feistel cipher — instead it uses a Substitution-Permutation Network (SPN).

Specifications: Block size: 128 bits. Key sizes: 128, 192, or 256 bits. Rounds: 10 (128-bit key), 12 (192-bit), 14 (256-bit).

Four operations per round:

  1. SubBytes: Each byte replaced using a fixed S-box (non-linear substitution for confusion).
  2. ShiftRows: Row 0 unchanged; Row 1 shifted left 1 byte; Row 2 shifted left 2; Row 3 shifted left 3 (diffusion).
  3. MixColumns: Each column multiplied by a fixed polynomial matrix in GF(2⁸) (diffusion).
  4. AddRoundKey: XOR the state with the round key derived from key schedule.

The final round omits MixColumns. AES is currently considered secure against all known attacks.

DES vs AES:

Aspect DES AES
Block Size 64 bits 128 bits
Key Size 56 bits 128/192/256 bits
Rounds 16 10/12/14
Structure Feistel Substitution-Permutation Network
Security Broken (brute force) Secure (no practical attacks)
Speed Slower in software Faster in software
Status Deprecated Current standard

Block Cipher Modes of Operation

A mode of operation defines how to apply a block cipher repeatedly to encrypt data longer than one block.

Mode Full Name IV Needed Parallelizable (Enc) Parallelizable (Dec) Key Feature
ECB Electronic Code Book No Yes Yes Same block → same ciphertext. Insecure.
CBC Cipher Block Chaining Yes No Yes Each block XORed with previous ciphertext.
CFB Cipher Feedback Yes No Yes Turns block cipher into stream cipher.
OFB Output Feedback Yes No No Keystream pre-generated; errors don't propagate.
CTR Counter Yes Yes Yes Counter encrypted to produce keystream.

ECB mode is the most commonly asked — and it's important to explain why it's insecure: identical plaintext blocks produce identical ciphertext blocks, revealing patterns in the data. The classic demonstration is encrypting a bitmap image in ECB mode, where the pattern of the original image is still visible in the ciphertext.

Important Questions — Unit 2

  1. Explain Feistel cipher structure with a neat diagram. How does it support both encryption and decryption?
  2. Describe DES algorithm: key generation, round function, S-boxes, P-boxes.
  3. Why is DES considered insecure? What attacks break it?
  4. Explain AES architecture — SubBytes, ShiftRows, MixColumns, AddRoundKey with diagrams.
  5. Compare DES and AES on architecture, key size, security, and real-world use.
  6. Explain all five block cipher modes (ECB, CBC, CFB, OFB, CTR) with diagrams.
  7. Why is ECB mode insecure for most applications?
  8. Describe S-boxes and P-boxes. How do they contribute to confusion and diffusion?

Unit 3: Asymmetric Ciphers (8 Hrs)

RSA Algorithm — Complete with Solved Numerical

RSA is the most important asymmetric encryption algorithm and appears in almost every TU Cryptography exam. Understanding it completely — key generation, encryption, decryption, and the mathematics behind it — is essential.

Key Generation Steps:

  1. Choose two distinct large prime numbers p and q
  2. Compute n = p × q (the modulus)
  3. Compute φ(n) = (p-1)(q-1) (Euler's totient)
  4. Choose e such that: 1 < e < φ(n) and gcd(e, φ(n)) = 1
  5. Compute d such that: d × e ≡ 1 (mod φ(n)) (modular inverse of e)
  6. Public key: (e, n) — shared openly
  7. Private key: (d, n) — kept secret

Encryption: C = Mᵉ mod n Decryption: M = Cᵈ mod n

Solved Example:

Let p = 11, q = 17

Step 1: n = 11 × 17 = 187

Step 2: φ(n) = (11-1)(17-1) = 10 × 16 = 160

Step 3: Choose e = 7 (check: gcd(7, 160) = 1 ✓, since 160 = 2⁵ × 5 and 7 is prime)

Step 4: Find d such that 7d ≡ 1 (mod 160) Using extended Euclidean algorithm: 7 × 23 = 161 = 160 + 1 → 7 × 23 ≡ 1 (mod 160) d = 23

Public key: (7, 187) | Private key: (23, 187)

Encrypt M = 88: C = 88⁷ mod 187

88² = 7744 → 7744 mod 187 = 7744 - 41×187 = 7744 - 7667 = 77 88⁴ = 77² = 5929 → 5929 mod 187 = 5929 - 31×187 = 5929 - 5797 = 132 88⁷ = 88⁴ × 88² × 88¹ = 132 × 77 × 88 (mod 187) 132 × 77 = 10164 → 10164 mod 187 = 10164 - 54×187 = 10164 - 10098 = 66 66 × 88 = 5808 → 5808 mod 187 = 5808 - 31×187 = 5808 - 5797 = 11

Ciphertext C = 11

Decrypt C = 11: M = 11²³ mod 187

(Using repeated squaring — follow same method) 11² = 121 11⁴ = 121² mod 187 = 14641 mod 187 = 14641 - 78×187 = 14641 - 14586 = 55 11⁸ = 55² mod 187 = 3025 mod 187 = 3025 - 16×187 = 3025 - 2992 = 33 11¹⁶ = 33² mod 187 = 1089 mod 187 = 1089 - 5×187 = 1089 - 935 = 154 11²³ = 11¹⁶ × 11⁴ × 11² × 11¹ = 154 × 55 × 121 × 11 (mod 187) 154 × 55 = 8470 mod 187 = 8470 - 45×187 = 8470 - 8415 = 55 55 × 121 = 6655 mod 187 = 6655 - 35×187 = 6655 - 6545 = 110 110 × 11 = 1210 mod 187 = 1210 - 6×187 = 1210 - 1122 = 88

Decrypted message = 88 ✓ (matches original M)

Diffie-Hellman Key Exchange

DH allows two parties to agree on a shared secret key over an insecure channel without ever transmitting the key itself.

Public parameters (shared openly): Prime p, primitive root g

Solved Example:

Let p = 23, g = 5

Alice chooses private key a = 6:

  • Alice computes: A = gᵃ mod p = 5⁶ mod 23 = 15625 mod 23 = 8
  • Alice sends 8 to Bob

Bob chooses private key b = 15:

  • Bob computes: B = gᵇ mod p = 5¹⁵ mod 23 = 19
  • Bob sends 19 to Alice

Shared secret computation:

  • Alice computes: s = Bᵃ mod p = 19⁶ mod 23 = 2
  • Bob computes: s = Aᵇ mod p = 8¹⁵ mod 23 = 2

Both arrive at shared secret = 2 — without ever transmitting it. An eavesdropper who saw p=23, g=5, A=8, B=19 cannot easily compute the shared secret without solving the discrete logarithm problem, which is computationally hard for large primes.

Man-in-the-Middle (MITM) Attack on DH: DH alone doesn't authenticate the parties. An attacker (Mallory) can intercept and pretend to be Bob to Alice and Alice to Bob, establishing separate shared secrets with each. This is why DH must be combined with authentication (certificates, digital signatures).

Elliptic Curve Cryptography (ECC)

ECC uses the mathematics of elliptic curves over finite fields instead of integer factorization (RSA) or discrete logarithms (DH). The key advantage: the same security level as RSA with much smaller key sizes.

Security Level RSA Key Size ECC Key Size
80-bit 1024 bits 160 bits
112-bit 2048 bits 224 bits
128-bit 3072 bits 256 bits

Smaller keys mean faster computation and lower power consumption — which is why ECC is preferred for mobile devices and IoT.

Important Questions — Unit 3

  1. Describe the complete RSA algorithm. Show key generation, encryption, and decryption with a full numerical example (p=11, q=17 or similar).
  2. Explain Diffie-Hellman key exchange. Show how two parties derive a shared secret with a numerical example.
  3. What are man-in-the-middle attacks in public-key systems? How does certificate-based authentication prevent them?
  4. Explain ECC. Compare its key sizes and advantages over RSA.
  5. Define Public Key Infrastructure (PKI). Explain Certificate Authority, digital certificates, and X.509.
  6. Compare symmetric and asymmetric cryptography on: key distribution, speed, key size, use case.

Unit 4: Cryptographic Hash Functions and Digital Signatures (8 Hrs)

Hash Functions

A cryptographic hash function takes an input of arbitrary length and produces a fixed-length output (the hash or digest). It must satisfy three key security properties:

  1. Pre-image resistance: Given hash h, it should be computationally infeasible to find any message M such that hash(M) = h. ("One-way" property)
  2. Second pre-image resistance: Given message M₁, it should be infeasible to find a different M₂ such that hash(M₁) = hash(M₂).
  3. Collision resistance: It should be infeasible to find any two different messages M₁ ≠ M₂ where hash(M₁) = hash(M₂).

Why hash functions matter: They're used everywhere — password storage, data integrity checking, digital signatures, file verification, blockchain.

Algorithm Output Size Status
MD5 128 bits Broken — collision attacks feasible
SHA-1 160 bits Deprecated — collisions demonstrated in 2017
SHA-256 256 bits Secure — current standard
SHA-512 512 bits Secure — higher security margin

MD5 was widely used for file integrity and password hashing but is now considered broken — practical collision attacks exist where two different inputs produce the same MD5 hash. Never use MD5 for security-critical purposes today.

SHA-256 (part of SHA-2 family) is the current recommended choice for most applications. It processes 512-bit message blocks in 64 rounds.

Password Hashing and Salting

Storing passwords as plain hashes is dangerous — an attacker who steals the hash database can use precomputed rainbow tables to recover common passwords instantly. Salting adds a random value (the salt) to each password before hashing: stored value = hash(salt + password). Since each password has a unique salt, rainbow tables become useless — the attacker must brute-force each password individually.

Modern password hashing functions (bcrypt, PBKDF2, Argon2) deliberately slow down computation by using thousands of iterations, making brute-force attacks much more expensive even without a rainbow table.

Message Authentication Codes (MACs)

A MAC provides both authentication and integrity. Unlike a hash (which anyone can compute), a MAC requires a shared secret key. HMAC (Hash-based MAC) is the most common construction: HMAC(key, message) = hash((key ⊕ opad) ∥ hash((key ⊕ ipad) ∥ message)).

Hash vs MAC vs Digital Signature:

Aspect Hash MAC Digital Signature
Key Required None Shared secret Public/private key pair
Authentication No Yes (shared key) Yes (verifiable by anyone with public key)
Non-repudiation No No Yes
Common Use Integrity checking, password storage Message authentication between known parties Document signing, software distribution

Digital Signatures

A digital signature scheme allows anyone to verify that a message was signed by a specific private key holder, without being able to forge that signature.

Signing: Compute hash of message → Encrypt hash with private key → Signature is the encrypted hash. Verification: Decrypt signature with public key → Compute hash of received message → Compare. If equal, signature is valid.

DSA (Digital Signature Algorithm): The US federal standard for digital signatures, specified in FIPS 186. Uses a different mathematical structure than RSA for signing.

RSA-based Signatures: Sign with private key, verify with public key — conceptually the reverse of RSA encryption.

Important Questions — Unit 4

  1. Define hash function. Explain pre-image resistance, second pre-image resistance, and collision resistance.
  2. Describe MD5. Why is it considered broken today?
  3. Explain SHA-1 and SHA-256. How does SHA-2 improve on SHA-1?
  4. What is HMAC? How does it provide message authentication?
  5. Explain digital signatures — signing and verification steps with diagram.
  6. Compare hash functions, MACs, and digital signatures.
  7. Explain password salting. Why does salting prevent rainbow table attacks?
  8. What is PBKDF2? How does key stretching increase password security?

Unit 5: Authentication (3 Hrs)

Authentication Systems

Authentication verifies that a principal (user, system) is who it claims to be. Three authentication factors:

  • Something you know: Password, PIN
  • Something you have: Smart card, hardware token, phone (OTP)
  • Something you are: Biometrics — fingerprint, retina, face

Password-Based Authentication: Simple but vulnerable to dictionary attacks (trying common words/phrases) and brute force. Defenses include account lockouts, CAPTCHAs, and mandatory complexity requirements.

Challenge-Response Authentication: The server sends a random challenge; the client proves knowledge of the shared secret by responding correctly (e.g., HMAC of the challenge with the shared key). The password is never transmitted directly.

Biometric Authentication: Measures and matches unique physical characteristics. Benefits: can't be forgotten or stolen. Drawbacks: if compromised, can't be changed; false accept/reject rates require tuning.

Kerberos Protocol

Kerberos is a network authentication protocol that uses tickets to prove identity without sending passwords over the network. It's widely used in enterprise environments (Active Directory uses Kerberos).

A simplified flow:

  1. Client authenticates to the Authentication Server (AS) and receives a Ticket-Granting Ticket (TGT).
  2. Client presents the TGT to the Ticket-Granting Server (TGS) to request a service ticket.
  3. Client presents the service ticket to the target service.
  4. The target service grants access.

The key benefit: passwords are never transmitted after the initial login; tickets have limited lifetimes.

Important Questions — Unit 5

  1. Explain the three authentication factors with examples.
  2. Describe password-based authentication. What is a dictionary attack and how is it mitigated?
  3. Explain the Kerberos authentication protocol and its ticket-based mechanism.
  4. What is challenge-response authentication? How does it improve on password-only schemes?
  5. Describe biometric authentication. What are false accept and false reject rates?

Unit 6: Network Security and Public Key Infrastructure (6 Hrs)

PKI and Digital Certificates

A Public Key Infrastructure (PKI) is the framework of hardware, software, policies, and procedures for creating, distributing, storing, and revoking digital certificates.

Digital Certificate: A signed document binding a public key to an identity. An X.509 certificate contains the subject's name, public key, certificate validity period, the Certificate Authority's (CA's) name, and the CA's digital signature over all of this.

Certificate Authority (CA): A trusted organization that issues and signs digital certificates. When your browser shows the padlock, it has verified that the website's certificate was signed by a CA your browser trusts.

Certificate Life Cycle: Issue → Distribute → Use → Renew or Revoke. Certificates can be revoked before expiry if the private key is compromised — revocation is published via Certificate Revocation Lists (CRLs) or OCSP.

SSL/TLS Handshake

TLS (Transport Layer Security) is the protocol providing encrypted, authenticated connections — the "S" in HTTPS. It replaced the older SSL.

TLS 1.3 Handshake (simplified):

Client                                    Server
  │                                          │
  │──── ClientHello (supported ciphers) ────►│
  │                                          │
  │◄─── ServerHello + Certificate ───────────│
  │     (server's public key in certificate) │
  │                                          │
  │──── Client verifies certificate ─────────│
  │──── Key Exchange (pre-master secret) ───►│
  │                                          │
  │  Both derive session keys from pre-master│
  │                                          │
  │◄═══════ Encrypted Application Data ══════│

The TLS handshake:

  1. Client sends supported cipher suites and TLS version.
  2. Server responds with chosen cipher suite and its certificate.
  3. Client verifies the certificate (checks CA signature, expiry, domain name).
  4. Key exchange establishes a shared session key (using DH or RSA).
  5. All further communication is encrypted with the symmetric session key.

IPSec

IPSec provides security at the IP layer — it can encrypt and authenticate IP packets, protecting all traffic between two endpoints without requiring individual applications to implement encryption.

  • AH (Authentication Header): Provides integrity and authentication but not confidentiality. Signs the packet headers.
  • ESP (Encapsulating Security Payload): Provides encryption, integrity, and authentication of the payload.

Two modes: Transport mode (encrypts payload only, IP header visible) and Tunnel mode (encrypts the entire original packet and wraps in a new IP header — used for VPNs).

Firewalls

A firewall monitors and controls network traffic based on predefined security rules.

Firewall Type Operating Level What It Inspects
Packet Filtering Network Layer Source/destination IP and port; no session state
Stateful Inspection Network + Transport Tracks connection state; more intelligent filtering
Application-layer (Proxy) Application Layer Inspects application-level data (HTTP, FTP content)
Next-Generation Firewall All Layers Deep packet inspection, IDS/IPS, application awareness

PGP (Pretty Good Privacy)

PGP provides end-to-end email encryption and authentication. It combines symmetric encryption (for the message itself, for efficiency) with asymmetric encryption (to encrypt the symmetric key for the recipient) and digital signatures (to authenticate the sender). PGP uses a "web of trust" model rather than hierarchical CAs.

Important Questions — Unit 6

  1. What is PKI? Explain Certificate Authority, digital certificates, and certificate life cycle.
  2. Explain the SSL/TLS handshake in detail with a diagram.
  3. Describe IPSec. Explain AH, ESP, and the difference between transport and tunnel mode.
  4. Explain types of firewalls: packet filtering, stateful inspection, and application-layer.
  5. How does PGP provide confidentiality and authentication for email?
  6. Differentiate between SSL and TLS. Which is preferred today and why?

Unit 7: Malicious Logic (3 Hrs)

Types of Malicious Software

Type Spread Mechanism Primary Impact
Virus Attaches to files; spreads when files are shared File corruption, system slowdown
Worm Self-replicating through networks, no host file needed Network congestion, bandwidth consumption
Trojan Horse Disguised as legitimate software Opens backdoors, data theft
Zombie/Bot Infected system controlled remotely DDoS attacks, spam sending
Ransomware Via email attachments or exploits Encrypts files, demands payment

Denial of Service (DoS): Overwhelms a service with requests until it can't respond to legitimate users. DDoS (Distributed DoS) uses thousands of compromised machines (botnet) simultaneously.

Intrusion Detection Systems (IDS)

An IDS monitors network traffic or system events for signs of malicious activity.

Detection Type Method Advantage Disadvantage
Signature-based Compares against known attack patterns Low false positives Can't detect new attacks
Anomaly-based Baseline normal behavior; flag deviations Can detect new attacks Higher false positive rate

IDS only detects and alerts. An IPS (Intrusion Prevention System) also actively blocks detected threats.

Important Questions — Unit 7

  1. Define malicious logic. Explain virus, worm, and Trojan horse with examples.
  2. Differentiate between DoS and DDoS attacks.
  3. Explain IDS. Compare signature-based and anomaly-based detection.
  4. What are zombies/bots? How do they contribute to DDoS attacks?

Past Paper Analysis (TU CSC316 Exam Patterns)

Appears almost every year:

  • RSA algorithm with numerical (complete key generation, encrypt, decrypt)
  • DES structure / Feistel structure with diagram
  • AES architecture (SubBytes, ShiftRows, MixColumns, AddRoundKey)
  • Block cipher modes with ECB and CBC diagrams
  • Diffie-Hellman key exchange with numerical
  • Digital signature — signing and verification
  • Hash function properties + SHA vs MD5
  • SSL/TLS handshake with diagram
  • Symmetric vs Asymmetric comparison table

Frequently appears:

  • Hill cipher numerical
  • Caesar cipher + frequency analysis
  • Firewall types (packet filtering, stateful, application-layer)
  • PKI and digital certificates
  • Password hashing and salting
  • MAC and HMAC
  • Kerberos protocol
  • IPSec (AH vs ESP)

Occasionally appears:

  • ECC and its advantages over RSA
  • PGP and S/MIME
  • Elgamal cryptosystem
  • Needham-Schroeder scheme
  • Shannon's principles (confusion and diffusion)

Rarely appears as a standalone question:

  • Modular arithmetic / Galois fields (GF details)
  • Miller-Rabin primality testing
  • IDEA algorithm

Common Mistakes Students Make

The most common mistake in RSA numericals is computing φ(n) incorrectly — many students write φ(n) = (p-1) × (q-1) correctly but then make arithmetic errors in the modular inverse calculation. Work every step explicitly.

Confusing hash functions with encryption: hash functions are one-way (you cannot decrypt a hash to get the original). Encryption is two-way (decrypt with the key). This distinction appears in both theory questions and short questions.

DES and AES get mixed up: remember DES uses 56-bit keys (broken) and a Feistel structure, while AES uses 128/192/256-bit keys (secure) and a Substitution-Permutation Network structure.

In block cipher modes, students draw the ECB diagram (each block independently encrypted) and CBC diagram (XOR with previous ciphertext) correctly but then get CFB and OFB confused. CFB feeds ciphertext output back as input; OFB feeds the keystream output back (not the ciphertext), meaning errors in one block don't propagate in OFB.

For TLS diagrams, the order matters: ClientHello → ServerHello + Certificate → Key Exchange → Encrypted data. Getting these steps out of order costs marks.


Study Plans

30-Day Plan

  • Days 1–5: Unit 1 — CIA triad, Caesar cipher (with numerical), Hill cipher (with numerical), classical cipher types
  • Days 6–12: Unit 2 — Feistel structure, DES, AES, all block cipher modes with diagrams
  • Days 13–18: Unit 3 — RSA (full numerical), Diffie-Hellman (full numerical), ECC overview, PKI basics
  • Days 19–23: Unit 4 — Hash properties, SHA vs MD5, HMAC, digital signatures, DSA
  • Days 24–25: Unit 5 — Authentication factors, Kerberos, challenge-response
  • Days 26–29: Unit 6 — TLS handshake diagram, IPSec, firewalls, PKI, PGP
  • Day 30: Unit 7 (malicious logic) + full past-question practice round

15-Day Plan

  • Days 1–2: Unit 1 (classical ciphers, CIA, worked examples)
  • Days 3–5: Unit 2 (Feistel, DES, AES, cipher modes)
  • Days 6–8: Unit 3 (RSA numerical — practice 3 times, DH numerical)
  • Days 9–11: Unit 4 (hash properties, SHA, HMAC, digital signatures)
  • Day 12: Unit 5 (authentication)
  • Days 13–14: Unit 6 (TLS, IPSec, firewalls, PKI)
  • Day 15: Unit 7 + past question review + exam weightage table revision

7-Day Plan

  • Day 1: Unit 1 (CIA, Caesar, Hill cipher — do numericals)
  • Day 2: Unit 2 (Feistel, DES vs AES comparison, cipher modes)
  • Day 3–4: Unit 3 (RSA numerical — don't rush this, do it twice. DH numerical)
  • Day 5: Unit 4 (hash properties, SHA, digital signatures)
  • Day 6: Units 5–6 (Kerberos, TLS handshake diagram, firewall types)
  • Day 7: Unit 7 + all comparison tables + past question checklist

Night Before Exam

  • Redo one RSA numerical (p=11, q=17 is a reliable practice pair) — this is almost certainly on the exam.
  • Sketch the TLS handshake diagram from memory — steps in correct order.
  • Review DES vs AES comparison table and block cipher modes table.
  • Recall the three hash properties (pre-image, second pre-image, collision resistance) — short question favorite.
  • Skim the firewall types comparison.
  • Don't attempt anything new tonight.

Frequently Asked Questions

Is Cryptography difficult for BSc CSIT students? The conceptual parts (CIA triad, protocol descriptions, cipher types) are manageable with reading and understanding. The mathematical sections (RSA modular arithmetic, Hill cipher matrix operations) require actual practice — they can't be understood by reading alone. Students who work through the numericals five to ten times typically find the exam manageable.

Is the RSA numerical compulsory in TU exams? RSA appears in almost every past paper — either as a full 10-mark question or as a numerical sub-question. Treating it as compulsory and practicing it repeatedly is the safest strategy.

Should I memorize every DES round operation in detail? You should understand the overall DES structure (16 rounds, Feistel structure, 56-bit key, S-boxes and P-boxes) and be able to draw the block diagram. Full mathematical detail of every DES sub-operation is rarely required at TU exam level.

Is AES asked every year? Yes — AES architecture (the four operations per round) appears very consistently. Draw the four operations and explain each one.

How many diagrams should I practice? Minimum: RSA key generation flow, DES/Feistel structure, AES round structure, ECB vs CBC mode diagrams, TLS handshake, digital signature workflow. Practice drawing all of these from memory.

Is the Diffie-Hellman numerical as important as RSA? Yes — both appear regularly. Practice DH numericals with small primes (p=23, g=5 is a standard example) until you can compute the shared secret quickly.

Is ECC tested deeply at TU? ECC typically appears as a shorter explanation question — what it is, why it needs smaller keys, comparison with RSA. Deep mathematical details of elliptic curve operations aren't usually tested at TU level.

What's the difference between hashing and encryption? Hashing is one-way — you cannot recover the original input from a hash. Encryption is two-way — you can decrypt with the key. Hashing is used for integrity and password storage; encryption is used for confidentiality.

Is MD5 still used? Can I mention it as a secure algorithm? MD5 is broken — practical collision attacks exist. You should always describe it as deprecated/insecure when discussing it. SHA-256 is the current recommended alternative for most purposes.

Is Unit 7 (Malicious Logic) worth studying seriously? Unit 7 has only 3 teaching hours and is typically represented by one short question. A clear understanding of virus vs worm vs Trojan, DoS vs DDoS, and IDS detection methods (signature vs anomaly) is usually sufficient. Don't sacrifice Unit 3 or 4 study time for deeper Unit 7 coverage.


Quick Resources — Pre-Exam Checklist

Before the exam, verify you can do each of these without notes:

  • [ ] State and explain the CIA Triad
  • [ ] Encrypt a message using Caesar cipher and show how frequency analysis breaks it
  • [ ] Perform a complete Hill cipher encryption (2×2 matrix)
  • [ ] Draw the Feistel cipher structure and explain both encryption and decryption directions
  • [ ] List four AES operations per round and explain each
  • [ ] Complete RSA key generation, encryption, and decryption with small primes
  • [ ] Compute the shared DH secret from given p, g, and both private keys
  • [ ] State the three hash function security properties
  • [ ] Explain the difference between hash, MAC, and digital signature
  • [ ] Draw and explain the TLS handshake sequence
  • [ ] List and compare three firewall types
  • [ ] Draw ECB and CBC mode diagrams and explain why ECB is insecure

Conclusion

Cryptography is one of the most practically relevant courses in the BSc CSIT curriculum — the algorithms and protocols studied here are the ones actually securing the internet right now. RSA, AES, SHA-256, and TLS aren't historical curiosities; they're running in production systems processing billions of transactions daily.

For exam success, the combination that works is: understand the concepts (so you can explain them), practice the numericals (RSA and DH especially) enough that the procedure is automatic, and learn to draw the key diagrams from memory. These three together — conceptual understanding, numerical fluency, and diagram practice — cover the vast majority of what TU exam questions actually test.

These notes have been prepared based on the official TU CSC316 syllabus and consistent analysis of past TU examination question patterns. The goal is to give you both the understanding and the exam strategy to approach the Cryptography paper confidently.

For related subjects, see: Introduction to Information Technology (CSC114) Complete Guide, Digital Logic (CSC116) Complete Guide, Computer Networks (CSC263) Complete Guide, C Programming (CSC115) Complete Guide, and Mathematics-I (MTH117) Complete Guide.

Post a Comment

0 Comments