About this guide
Status: supplementary. This guide is staged material provided for study and practice.
Source of unit outline: The unit titles, topics, and teaching hours in this guide come from a third-party syllabus page (NEBians, https://nebians.consica.com.np/app/syllabus/bca-course/cryptography-network-security/), captured on 2026-11-20. This is a candidate table of contents only.
Not official: This candidate TOC is not the official Tribhuvan University micro-syllabus, and it is not verified against the official TU 2025 record. The official TU 2025 course record confirms the course identity (BCA353, Cryptography and Network Security, Semester 6, 3 credits) but states that the course has no verified numbered unit outline in the cited document. Do not cite this guide as official TU text.
Teaching material: All explanations, worked examples, diagrams, and practice questions below are original BCA Nepal study material written to ground the listed topics. Nothing here is copied from the third-party page except the unit titles, topic names, and hours used to build the table of contents.
Security use: Examples in the security units are defensive, legal, and intended for authorized lab or classroom use only. Do not run attacks against systems you do not own or have written permission to test.
Course code: BCA353
Semester: 6
Curriculum: 2025
Credits: 3
Workload: 3 hours lecture / week
Candidate outline source: Third-party syllabus page, captured 2026-11-20
Outline status: Unverified — not the official TU micro-syllabus
Course overview
Cryptography and Network Security introduces the principles and techniques used to protect data confidentiality, integrity, authenticity, and availability in digital communication. The candidate outline organizes the course into eight units: classical ciphers and security goals; the number theory that underpins modern ciphers; symmetric block ciphers (Feistel, DES, AES) and their modes of operation; public-key cryptography (RSA, Diffie-Hellman, elliptic curves); hash functions, message authentication codes, digital signatures, and PKI; authentication and secure network protocols (Kerberos, TLS, IPsec, PGP, SSH); network and system defences (firewalls, IDS/IPS, VPNs, wireless security); and malware, intruders, steganography, network management security, and cyber law.
The course builds from classical substitution and transposition ciphers to modern algorithm design, then to the protocols and defences that protect real networks. Because the official 2025 record publishes no unit-level outline, the sequence and hours below come from the third-party candidate outline and should be treated as provisional.
Learning outcomes
Derived from the third-party candidate unit outline (not verified against the official TU micro-syllabus):
- Explain the security goals (confidentiality, integrity, authentication, non-repudiation, availability) and common attack categories.
- Describe classical ciphers (Caesar, affine, Vigenère, Playfair, Hill, transposition, one-time pad) and how they are broken.
- Apply modular arithmetic, the Euclidean algorithm, Euler's totient, primality testing, and the discrete logarithm.
- Compare block and stream ciphers, confusion and diffusion, and trace the Feistel structure, DES, AES, and modes of operation.
- Explain public-key cryptography: RSA, Diffie-Hellman key exchange, and elliptic-curve cryptography, and compare key sizes and uses.
- Describe cryptographic hash functions, HMAC, digital signatures, certificates, PKI, and password hashing.
- Explain authentication mechanisms and secure network protocols: Kerberos, TLS/HTTPS, IPsec, PGP, S/MIME, and SSH.
- Describe firewalls, IDS/IPS, VPNs, wireless security, common attacks and defences, and key management.
- Describe malware, intruder and password attacks, steganography, SNMP security, SET dual signatures, and cybercrime law.
- Carry out only defensive, authorized lab exercises; never test systems without written permission.
Unit 1: Security Goals and Classical Ciphers (6 hours)
Key terms
- Plaintext: readable original message.
- Ciphertext: scrambled, unreadable output.
- Encryption: converting plaintext to ciphertext with a key and algorithm.
- Decryption: recovering plaintext from ciphertext.
- Key: secret value that controls encryption/decryption.
- Confidentiality: only authorized parties can read the data.
- Integrity: data are not altered undetected.
- Authentication: sender and data origin are genuine.
- Non-repudiation: sender cannot deny sending.
- Availability: the service works when needed.
- Passive attack: eavesdropping or traffic analysis without modifying data.
- Active attack: masquerade, replay, modification, denial of service.
- Cryptanalysis: breaking a cipher without knowing the key.
- Kerckhoffs's principle: a cryptosystem should be secure even if everything about it is public except the key.
1.1 Security goals and attacks
Definition and why it matters. Security goals describe what a protection mechanism is trying to achieve. Confidentiality keeps data secret; integrity keeps it unaltered; authentication confirms identity; non-repudiation prevents denial; availability keeps the service running. Without these goals stated precisely, a system cannot be checked against a standard.
Core theory. The ITU X.800 security services are confidentiality, integrity, authentication, non-repudiation, and access control. Passive attacks (eavesdropping, traffic analysis) do not change data, so they are hard to detect but preventable by encryption. Active attacks (masquerade, replay, modification, denial of service) change data or service state and are easier to detect but harder to prevent.
Worked example. A student sends an email. Confidentiality: encrypt so only the recipient reads it. Integrity: attach a hash so changes are detected. Authentication: the recipient verifies the sender's signature. Non-repudiation: the sender cannot later deny sending it. Availability: the mail server stays online.
Use case. A bank protects customer records with encryption (confidentiality), verifies transactions with digital signatures (integrity and non-repudiation), authenticates users with credentials, and keeps its website reachable (availability).
Comparison table.
| Goal | Protects against | Example control |
|---|---|---|
| Confidentiality | Eavesdropping | Encryption |
| Integrity | Unauthorized change | Hash / MAC |
| Authentication | Impersonation | Password / certificate |
| Non-repudiation | Denial of action | Digital signature |
| Availability | Denial of service | Redundancy / filtering |
Common mistakes. Confusing active and passive attacks; assuming encryption alone gives integrity (it does not); treating availability as outside security.
Exam points. List the five security goals; distinguish passive vs active attacks with examples; state Kerckhoffs's principle.
Self-check. Q: Is traffic analysis a passive or active attack? A: Passive — data are not modified. Q: Name one active attack. A: Replay or modification.
1.2 Caesar, affine and Vigenère ciphers
Definition and why it matters. These are classical substitution ciphers that replace each letter with another. They are easy to teach and break, and they introduce the vocabulary of keys, alphabets, and cryptanalysis.
Core theory. Caesar shifts every letter by a fixed amount (classically 3). Affine uses E(x) = (ax + b) mod 26, requiring gcd(a, 26) = 1. Vigenère uses a keyword repeated over the text, shifting each letter by the corresponding keyword letter, making it a polyalphabetic cipher.
Worked example (Caesar, shift 3). Plaintext HELLO: H(7)->K(10), E(4)->H(7), L(11)->O(14), L->O, O(14)->R(17). Ciphertext: KHOOR. Decrypt: K(10)->H(7) by shifting back 3.
Worked example (affine, a=5, b=8). Encrypt letter A (x=0): E(0) = (5×0 + 8) mod 26 = 8 -> I. Encrypt B (x=1): (5×1 + 8) mod 26 = 13 -> N. Decrypt requires a⁻¹ mod 26: 5⁻¹ mod 26 = 21 (since 5×21 = 105 = 1 mod 26). D(y) = 21(y − 8) mod 26. For ciphertext I (y=8): D(8) = 21×0 mod 26 = 0 -> A.
Use case. Classroom demonstrations of how a short repeating key leaks patterns; historical use of Caesar in military messages.
Comparison. Caesar is monoalphabetic (one fixed substitution); Vigenère is polyalphabetic (multiple substitutions), which hides letter frequency but is still breakable.
Common mistakes. Choosing an affine 'a' not coprime to 26 (then decryption is impossible); assuming Vigenère is unbreakable (Kasiski examination breaks it).
Exam points. Encrypt/decrypt with Caesar and affine by hand; state the condition gcd(a,26)=1; explain why Vigenère resists simple frequency analysis.
Self-check. Q: Encrypt "CAT" with Caesar shift 3. A: FDW. Q: Is a=2 valid for affine mod 26? A: No, gcd(2,26)=2≠1.
1.3 Playfair
Definition and why it matters. Playfair is a digraph substitution cipher that encrypts pairs of letters, hiding single-letter frequency better than monoalphabetic ciphers.
Core theory. Build a 5×5 key square from a keyword (I/J combined). Encrypt digraphs: same row -> shift right; same column -> shift down; otherwise rectangle -> swap columns. Repeated letters in a pair get an inserted filler (X); odd length gets a trailing filler.
Worked example. Keyword "CRYPTO". Square: C R Y P T O A B D E F G H I/J K L M N Q S U V W X Z Encrypt "HI": H is row 3 col 3; I/J is row 3 col 4 -> same row, shift right: H->I/J, I/J->K. Ciphertext: IK. Encrypt "BM": B row 2 col 3; M row 4 col 2 -> rectangle: B->D (row 2 col 4), M->N (row 4 col 3). Ciphertext: DN.
Use case. Historical diplomatic and military communications before modern ciphers.
Comparison. Playfair encrypts digraphs (pairs), so it hides single-letter frequencies but not digraph frequencies.
Common mistakes. Forgetting to combine I and J; forgetting the filler for repeated letters or odd-length plaintext.
Exam points. Build the 5×5 square; apply row/column/rectangle rules; state the filler rule.
Self-check. Q: In Playfair, what happens when both letters are in the same row? A: Each is replaced by the letter to its right (wrapping around).
1.4 The Hill cipher
Definition and why it matters. Hill is a polygraphic substitution cipher based on linear algebra (matrix multiplication modulo 26). It shows how ciphers can operate on blocks of letters at once.
Core theory. Plaintext is converted to numbers (A=0...Z=25), arranged into column vectors, and multiplied by an invertible key matrix K modulo 26: C = K·P mod 26. Decryption: P = K⁻¹·C mod 26. K must be invertible modulo 26, meaning gcd(det(K), 26) = 1.
Worked example. Key K = [[3, 3], [2, 5]]. det = 3×5 − 3×2 = 15 − 6 = 9. gcd(9,26)=1, so invertible. Encrypt "HI": H=7, I=8 -> P = [[7],[8]]. C = [[3·7+3·8],[2·7+5·8]] mod 26 = [[21+24],[14+40]] mod 26 = [[45],[54]] mod 26 = [[19],[2]] = "TC". Decrypt: K⁻¹ mod 26. det⁻¹: 9⁻¹ mod 26 = 3 (9×3=27=1 mod 26). adj(K) = [[5,-3],[-2,3]]. K⁻¹ = 3×[[5,-3],[-2,3]] mod 26 = [[15,-9],[-6,9]] mod 26 = [[15,17],[20,9]]. P = K⁻¹·C = [[15·19+17·2],[20·19+9·2]] mod 26 = [[285+34],[380+18]] mod 26 = [[319],[398]] mod 26 = [[7],[8]] = "HI".
Use case. Teaching linear algebra applications in cryptography; historical use limited because known-plaintext attacks break it.
Comparison. Hill encrypts blocks (e.g., digraphs as 2-vectors), unlike Caesar which encrypts single letters.
Common mistakes. Using a key matrix whose determinant is not coprime to 26 (not invertible, cannot decrypt); arithmetic errors in matrix inverse modulo 26.
Exam points. State the encryption formula C = KP mod 26; state invertibility condition gcd(det(K),26)=1; encrypt a small digraph by hand.
Self-check. Q: What condition must the Hill key matrix satisfy? A: Its determinant must be coprime to 26 so the inverse exists modulo 26.
1.5 The programs
Definition and why it matters. The candidate outline includes short programs that implement classical ciphers, letting students run encryption/decryption and compare outputs with known values.
Core theory. A cipher program maps each letter to a number, applies the transformation (shift, affine formula, digraph rule), and maps back. Correctness is checked against independently known textbook values and a second implementation.
Worked example. A tiny Python Caesar program:
def caesar(text, shift):
out = ""
for ch in text.upper():
if ch.isalpha():
out += chr((ord(ch) - 65 + shift) % 26 + 65)
else:
out += ch
return out
print(caesar("HELLO", 3)) # KHOOR
print(caesar("KHOOR", -3)) # HELLO
Line by line: iterate over uppercase letters; shift within A–Z using modulo 26; leave non-letters unchanged; negative shift decrypts.
Use case. Lab exercise: implement Caesar and Vigenère, verify "HELLO"->"KHOOR", compare two implementations.
Comparison. A program implements the algorithm deterministically; the mathematical description defines the rule.
Common mistakes. Failing to handle lowercase or non-letters; off-by-one in modulo; not normalizing to the same case before comparing outputs.
Exam points. Write or trace a Caesar/Vigenère function; explain why outputs must match an independent implementation.
Self-check. Q: What does ord(ch) - 65 do for uppercase letters? A: Converts 'A'..'Z' to 0..25.
1.6 Breaking classical ciphers
Definition and why it matters. Cryptanalysis shows why classical ciphers are insecure and teaches frequency analysis, Kasiski examination, and known-plaintext attacks.
Core theory. Monoalphabetic ciphers leak letter frequency (E is most common in English). The attacker matches frequent ciphertext letters to frequent plaintext letters. Polyalphabetic ciphers (Vigenère) are broken by finding the key length (Kasiski: repeated ciphertext sequences at multiples of key length) then attacking each monoalphabetic stream.
Worked example. Ciphertext has "E" most frequent -> guess E = plaintext E. For Vigenère, repeated ciphertext "ABC" appears 9 positions apart -> key length likely divides 9 (try 3). Then treat positions 1,4,7,... as one Caesar cipher and solve by frequency.
Use case. Breaking an intercepted historical message; lab exercise breaking a Vigenère ciphertext.
Comparison. Ciphertext-only attack (only ciphertext) vs known-plaintext attack (ciphertext + matching plaintext) vs chosen-plaintext (attacker chooses plaintext).
Common mistakes. Assuming frequency analysis works on short texts (needs enough characters); ignoring that Vigenère needs key-length detection first.
Exam points. Describe frequency analysis; describe Kasiski examination; list attack models.
Self-check. Q: Which attack needs both ciphertext and known plaintext? A: Known-plaintext attack.
1.7 The one-time pad
Definition and why it matters. The one-time pad (OTP) is the only cipher with proven perfect secrecy, but it requires a key as long as the message, used once, kept secret.
Core theory. C = P ⊕ K (bitwise XOR) or modular addition for letters. Decryption: P = C ⊕ K. Perfect secrecy: ciphertext reveals no information about plaintext without the key. Requirements: truly random key, at least as long as the message, never reused, secret.
Worked example. Plaintext bitstream 1011, key 1101. C = 1011 ⊕ 1101 = 0110. Decrypt: 0110 ⊕ 1101 = 1011. Recover plaintext.
Use case. High-security diplomatic links where key distribution can be managed physically.
Comparison. OTP gives perfect secrecy; AES is computationally secure (secure assuming bounded attacker) but not information-theoretically perfect.
Common mistakes. Reusing the OTP key (two-time pad): C1⊕C2 = P1⊕P2, revealing XOR of plaintexts and enabling recovery.
Exam points. State perfect secrecy and the three key requirements; show XOR encrypt/decrypt; explain why key reuse breaks security.
Self-check. Q: Decrypt ciphertext 0110 with key 1101. A: 1011.
1.8 Seeing the ciphers: machines, frequencies and keyspaces
Definition and why it matters. This topic connects classical ciphers to cipher machines (e.g., Enigma), frequency analysis, and keyspace size — how many possible keys an attacker must try.
Core theory. Keyspace size for Caesar is 26 (or 25 useful shifts); for substitution it is 26! (huge but breakable by frequency); for Vigenère it is 26^k where k is key length. Enigma used rotors, plugboard, and reflector to create a large, changing substitution.
Worked example. Caesar keyspace: 26 keys — trivially brute-forced. Monoalphabetic substitution: 26! ≈ 4×10²⁶ keys — too many to brute force, but frequency analysis breaks it. Vigenère with 6-letter key: 26⁶ ≈ 3×10⁸ keys — brute force possible with computers.
Use case. Estimating effort to break a cipher; understanding why key length matters.
Comparison. Brute force (try all keys) vs cryptanalysis (exploit structure).
Common mistakes. Equating large keyspace with security (substitution has huge keyspace but is weak); ignoring that frequency analysis works regardless of keyspace size.
Exam points. Compute keyspace size for a given cipher; distinguish brute force from frequency analysis.
Self-check. Q: Caesar keyspace size? A: 26 shifts (25 meaningful). Q: Is a big keyspace enough for security? A: No — structure matters too.
Unit summary — Unit 1
Unit 1 covers the security goals and attack classes, then classical ciphers: Caesar, affine, Vigenère, Playfair, Hill, programs implementing them, breaking methods, the one-time pad, and keyspace/frequency concepts. Students should be able to encrypt and decrypt by hand for each classical cipher, explain why each is breakable, and state Kerckhoffs's principle and perfect secrecy requirements.
Unit 2: Number Theory for Cryptography (7 hours)
Key terms
- Modular arithmetic: arithmetic where numbers wrap around a modulus n.
- Congruence: a ≡ b (mod n) means n divides (a − b).
- Modular inverse: a⁻¹ such that a·a⁻¹ ≡ 1 (mod n).
- Euler's totient φ(n): count of integers 1..n coprime to n.
- Primality testing: deciding whether a number is prime.
- Primitive root: a generator of the multiplicative group mod n.
- Discrete logarithm: given g, h mod p, find x with gˣ ≡ h (mod p).
2.1 Modular arithmetic
Definition and why it matters. Modular arithmetic is the foundation of RSA, Diffie-Hellman, and elliptic-curve cryptography. It lets us work with remainders instead of unbounded integers.
Core theory. a ≡ b (mod n) if n | (a − b). Operations: (a + b) mod n, (a − b) mod n, (a·b) mod n, exponentiation aᵇ mod n. Modular inverse exists iff gcd(a, n) = 1.
Worked example. 17 mod 5 = 2. (7 + 8) mod 5 = 15 mod 5 = 0. (3 × 4) mod 5 = 12 mod 5 = 2. 3⁻¹ mod 5 = 2 (3×2 = 6 ≡ 1 mod 5). Compute 2¹⁰ mod 7 by repeated squaring: 2²=4, 2⁴=16≡2, 2⁸≡4, 2¹⁰ = 2⁸·2² ≡ 4×4 = 16 ≡ 2 mod 7.
Use case. RSA encryption computes c = mᵉ mod n; all arithmetic is modular.
Comparison. Normal arithmetic vs modular (wraps at modulus).
Common mistakes. Forgetting to reduce intermediate results modulo n; assuming every number has a modular inverse (only when coprime).
Exam points. Compute (a+b) mod n, (a·b) mod n, aᵇ mod n via repeated squaring; state when inverse exists.
Self-check. Q: 7⁻¹ mod 5? A: 3 (7≡2, 2×3=6≡1). Q: Compute (4+6) mod 5. A: 0.
2.2 The Euclidean and extended Euclidean algorithms
Definition and why it matters. Euclid's algorithm finds the greatest common divisor (gcd); the extended version finds coefficients for the modular inverse used in RSA key generation.
Core theory. gcd(a, b): repeatedly replace (a, b) with (b, a mod b) until b = 0. Extended Euclid also finds x, y such that ax + by = gcd(a, b); if gcd = 1, then x is a⁻¹ mod b.
Worked example. gcd(48, 18): 48 mod 18 = 12; 18 mod 12 = 6; 12 mod 6 = 0; gcd = 6. Extended: find 3⁻¹ mod 7. 7 = 2·3 + 1 -> 1 = 7 − 2·3, so (−2)·3 ≡ 1 mod 7, and −2 ≡ 5 mod 7. So 3⁻¹ mod 7 = 5. Check: 3×5 = 15 ≡ 1 mod 7.
Use case. RSA computes d = e⁻¹ mod φ(n) using the extended Euclidean algorithm.
Comparison. Euclid gives gcd only; extended Euclid gives gcd plus Bézout coefficients.
Common mistakes. Stopping too early; sign errors when back-substituting to find the inverse.
Exam points. Trace Euclid's algorithm; use extended Euclid to find a modular inverse.
Self-check. Q: gcd(35, 15)? A: 5. Q: 5⁻¹ mod 12? A: 5 (5×5=25≡1 mod 12).
2.3 Euler's totient, Fermat and Euler
Definition and why it matters. Euler's totient and Fermat's/Euler's theorems justify why RSA decryption recovers the plaintext.
Core theory. φ(n) = count of integers in [1, n] coprime to n. For prime p: φ(p) = p − 1. For n = pq (distinct primes): φ(n) = (p−1)(q−1). Fermat's little theorem: aᵖ⁻¹ ≡ 1 (mod p) for prime p and a not divisible by p. Euler's theorem: a^φ(n) ≡ 1 (mod n) when gcd(a, n) = 1.
Worked example. φ(15) = φ(3×5) = (3−1)(5−1) = 2×4 = 8. Check Euler: 2⁸ mod 15 = 256 mod 15 = 1. ✓. Fermat: 3⁴ mod 5 = 81 mod 5 = 1. ✓
Use case. RSA key generation uses φ(n) = (p−1)(q−1) to choose e and compute d.
Comparison. Fermat applies to prime modulus; Euler applies to any modulus with gcd(a,n)=1.
Common mistakes. Using φ(n) = n−1 for composite n (wrong; only prime); forgetting the gcd condition for Euler's theorem.
Exam points. Compute φ(pq); state Fermat's little theorem and Euler's theorem; explain their role in RSA correctness.
Self-check. Q: φ(21) where 21=3×7? A: (3−1)(7−1) = 12.
2.4 Primality testing
Definition and why it matters. RSA needs large primes p and q. Primality testing decides whether a candidate is prime efficiently enough for cryptographic key sizes.
Core theory. Trial division (inefficient for large numbers). Fermat test: if a^(n−1) ≢ 1 (mod n) then n is composite; if ≡ 1, n is probably prime (Carmichael numbers fool it). Miller-Rabin is a stronger probabilistic test used in practice.
Worked example. Test n = 15 with base a = 2: 2^(15−1) = 2^14 mod 15. 2⁴ = 16 ≡ 1 mod 15, so 2^14 = 2^(12)·2² ≡ 1·4 = 4 ≢ 1 mod 15 -> 15 is composite. ✓
Use case. Generating RSA primes: pick random odd numbers, test with Miller-Rabin until probably prime.
Comparison. Deterministic (trial division, AKS) vs probabilistic (Fermat, Miller-Rabin) tests.
Common mistakes. Trusting a single Fermat test (Carmichael numbers); testing even numbers > 2.
Exam points. Describe Fermat primality test and its flaw; state why probabilistic tests are used for large primes.
Self-check. Q: Is 15 prime by Fermat base 2? A: No — 2^14 mod 15 = 4 ≠ 1.
2.5 Primitive roots and the discrete logarithm
Definition and why it matters. Primitive roots generate the multiplicative group mod p; the discrete logarithm problem underpins Diffie-Hellman security.
Core theory. A primitive root g mod p generates all nonzero residues: {g¹, g², ..., g^(p−1)} mod p = {1, ..., p−1}. Discrete logarithm: given g, h mod p, find x such that gˣ ≡ h (mod p). Easy to compute gˣ; hard to reverse (x) for large p.
Worked example. mod 7, g = 3: 3¹=3, 3²=2, 3³=6, 3⁴=4, 3⁵=5, 3⁶=1 -> generates all {1..6}, so 3 is a primitive root mod 7. Discrete log: 3ˣ ≡ 6 mod 7 -> x = 3.
Use case. Diffie-Hellman uses a primitive root g and large prime p; security rests on the hardness of the discrete log.
Comparison. Discrete log (mod p) vs elliptic-curve discrete log (harder for same key size).
Common mistakes. Confusing discrete log with ordinary logarithm; assuming every base is a primitive root.
Exam points. Define primitive root and discrete logarithm; state why computing gˣ is easy but finding x is hard.
Self-check. Q: Is 3 a primitive root mod 7? A: Yes — powers give all of {1..6}.
2.6 Why the arithmetic is feasible and the inverse is hard
Definition and why it matters. This topic explains the asymmetry that makes public-key cryptography possible: exponentiation mod n is easy, but reversing it (discrete log or RSA root extraction) is hard without a trapdoor.
Core theory. Computing aᵇ mod n via repeated squaring is fast (O(log b) multiplications). Given a, g, p, computing gˣ mod p is fast; given g, h, p finding x is the hard discrete-log problem. RSA: computing c = mᵉ mod n is easy; finding m from c without d is hard (RSA problem, related to factoring n).
Worked example. Compute 2²⁰ mod 11 by repeated squaring: 2¹=2, 2²=4, 2⁴=16≡5, 2⁸≡5²=25≡3, 2^16≡9, 2^20 = 2^16·2⁴ ≡ 9×5 = 45 ≡ 1 mod 11. Fast. Reverse: given 3ˣ ≡ 5 mod 7, find x — try powers: 3¹=3,3²=2,3³=6,3⁴=4,3⁵=5 -> x=5. Easy here, hard for 200-digit p.
Use case. Explaining why Diffie-Hellman and RSA are secure against eavesdroppers.
Comparison. Easy direction (exponentiate) vs hard direction (invert without trapdoor).
Common mistakes. Assuming modular exponentiation is slow (it is fast via repeated squaring); assuming the inverse is always easy.
Exam points. Explain feasible vs infeasible directions; give the repeated-squaring complexity.
Self-check. Q: Is computing gˣ mod p easy or hard? A: Easy (fast exponentiation).
2.7 Seeing the arithmetic: portraits, clocks, cycles and chains
Definition and why it matters. Visual and intuitive models (clock arithmetic, cycles) help students internalize modular arithmetic, groups, and why cycles matter in ciphers.
Core theory. Clock arithmetic: mod 12 wraps after 12. Modular multiplication forms cycles; a primitive root cycles through all nonzero residues. Chains of residues illustrate exponentiation and the discrete log.
Worked example. Mod 5 multiplication by 2: 1→2→4→3→1 (cycle of length 4); 2 is a primitive root mod 5 because it hits all nonzero residues.
Use case. Teaching modular groups and cyclic structure before RSA/Diffie-Hellman.
Comparison. Additive cycle (clock) vs multiplicative cycle (primitive root).
Common mistakes. Treating modular arithmetic like ordinary arithmetic (no wrap); missing that 0 has no multiplicative inverse.
Exam points. Draw a mod-n multiplication cycle; identify a primitive root by listing its powers.
Self-check. Q: In clock arithmetic mod 12, what is 9 + 7? A: 16 mod 12 = 4.
Unit 2 summary
Unit 2 presents the number theory behind public-key cryptography: modular arithmetic, Euclid and extended Euclid (gcd and modular inverse), Euler's totient with Fermat's and Euler's theorems, primality testing, primitive roots and the discrete logarithm, and the easy/hard asymmetry. Students should compute inverses, totients, and powers by hand, and explain why the hard direction is computationally infeasible.
Unit 3: Symmetric Ciphers - Feistel, DES, AES and Modes of Operation (9 hours)
Key terms
- Block cipher: encrypts fixed-size blocks.
- Stream cipher: encrypts bits/bytes one at a time.
- Confusion: hides relationship between key and ciphertext.
- Diffusion: spreads plaintext influence across ciphertext.
- Feistel structure: split, round function, swap; invertible regardless of round function.
- DES: Data Encryption Standard, 64-bit block, 56-bit key.
- AES: Advanced Encryption Standard, 128-bit block, 128/192/256-bit keys.
- Mode of operation: how a block cipher encrypts more than one block (ECB, CBC, CFB, OFB, CTR).
- IV: initialization vector, randomizes encryption start.
3.1 Block and stream ciphers, confusion and diffusion
Definition and why it matters. Block ciphers (AES, DES) process fixed blocks; stream ciphers produce a keystream XORed with plaintext. Confusion and diffusion (Shannon) are the two properties that make a cipher strong.
Core theory. Confusion: complex key-ciphertext relationship (substitution). Diffusion: a small plaintext change spreads widely (permutation/mixing). A good cipher needs both. Stream ciphers (RC4, ChaCha20) encrypt bit-by-bit; block ciphers encrypt in blocks via a mode.
Worked example. One-round confusion+diffusion: substitute each nibble (confusion), then swap nibble positions between halves (diffusion). One plaintext bit flip changes multiple ciphertext bits.
Use case. AES (block) for file/disk encryption; ChaCha20 (stream) for TLS on mobile.
Comparison. Block vs stream: block needs padding and a mode; stream needs a nonce/key pair never reused.
Common mistakes. Reusing a stream-cipher keystream with the same key; using ECB mode (reveals patterns).
Exam points. Define block and stream ciphers; explain confusion and diffusion with examples.
Self-check. Q: Does AES process bits or blocks? A: Fixed 128-bit blocks.
3.2 The Feistel structure
Definition and why it matters. The Feistel structure (DES) splits data into halves and applies a round function to one half, XORing into the other, then swaps. It is invertible even if the round function is not.
Core theory. Lᵢ = Rᵢ₋₁; Rᵢ = Lᵢ₋₁ ⊕ f(Rᵢ₋₁, Kᵢ). Decryption runs the same rounds with reversed subkeys. No requirement that f be invertible.
Worked example. 2-round Feistel on 8-bit block, split into 4-bit halves. L0=1011, R0=1100, f(R,K)=reverse bits. Round1: L1=1100, R1=1011⊕0011=1000. Round2: L2=1000, R2=1100⊕0001=1101. Decrypt with reversed keys recovers 1011|1100.
Use case. DES is a 16-round Feistel cipher.
Comparison. Feistel (invertible by structure) vs SP-network (AES, needs invertible components).
Common mistakes. Thinking the round function must be invertible (it does not).
Exam points. Write Feistel encryption/decryption equations; explain why decryption uses reversed subkeys.
Self-check. Q: Is the Feistel round function required to be invertible? A: No.
3.3 DES
Definition and why it matters. DES is the historical standard block cipher (64-bit block, 56-bit key, 16 Feistel rounds). Its short key led to its replacement by AES.
Core theory. Initial permutation, 16 rounds (expansion, key mixing via XOR, S-box substitution, P-box permutation), final permutation (inverse of initial). Key schedule produces 16 subkeys of 48 bits from the 56-bit key.
Worked example. Conceptual: 64-bit plaintext -> initial permutation -> 16 Feistel rounds with subkeys K1..K16 -> final permutation -> 64-bit ciphertext. One round: expand 32-bit R to 48 bits, XOR with subkey, pass through 8 S-boxes (6->4 bits each), permute 32 bits, XOR with L.
Use case. Legacy systems (3DES still in some banking); understanding Feistel design.
Comparison. DES (56-bit key, breakable by brute force today) vs 3DES (effectively 112-bit) vs AES (128+ bit).
Common mistakes. Saying DES key is 64 bits (8 bits are parity; effective 56); thinking DES is still secure for new systems.
Exam points. List DES parameters (block 64, key 56, rounds 16); describe one Feistel round; state why DES is obsolete.
Self-check. Q: Effective DES key size? A: 56 bits.
3.4 AES
Definition and why it matters. AES is the current symmetric standard (128-bit block, 128/192/256-bit keys, 10/12/14 rounds), a substitution-permutation network.
Core theory. State is a 4×4 byte matrix. Each round (except last): SubBytes (S-box substitution), ShiftRows (rotate rows), MixColumns (mix columns), AddRoundKey (XOR round key). Key schedule expands the cipher key into round keys. Last round omits MixColumns.
Worked example. AES-128: 10 rounds. Initial AddRoundKey with round key 0. Round 1: SubBytes (each byte via S-box), ShiftRows (row i shifted by i), MixColumns (matrix multiply in GF(2⁸)), AddRoundKey with round key 1. Repeat through round 9; round 10 omits MixColumns.
Use case. File encryption, disk encryption, TLS, Wi-Fi WPA2.
Comparison. AES-128 (10 rounds, fastest), AES-192 (12), AES-256 (14, strongest margin).
Common mistakes. Thinking AES key size equals block size (block is always 128 bits); omitting that MixColumns is skipped in the last round.
Exam points. Describe the four AES transformations; state rounds for each key size; trace one round conceptually.
Self-check. Q: AES block size? A: 128 bits. Q: Which step is skipped in the final round? A: MixColumns.
3.5 Modes of operation
Definition and why it matters. A block cipher encrypts one block; modes define how to encrypt multiple blocks and whether identical plaintext blocks produce identical ciphertext.
Core theory. ECB: each block encrypted independently (reveals patterns — insecure). CBC: each plaintext block XORed with previous ciphertext before encryption; needs IV; encryption sequential, decryption parallel. CFB/OFB: turn block cipher into stream cipher. CTR: encrypt a counter, XOR with plaintext; parallel, random access, needs unique nonce.
Worked example. CBC encrypt: Cᵢ = E(K, Pᵢ ⊕ Cᵢ₋₁), C₀ = IV. Decrypt: Pᵢ = D(K, Cᵢ) ⊕ Cᵢ₋₁. If P₁ = P₂, C₁ ≠ C₂ (because IV differs), so patterns are hidden.
Use case. CBC for TLS records (historical), CTR for disk/file encryption, GCM (CTR-based) for authenticated encryption.
Comparison. ECB (never use for real data) vs CBC (chained, IV) vs CTR (parallel, nonce).
Common mistakes. Using ECB for images (reveals structure); reusing IV/nonce with CTR (catastrophic).
Exam points. Describe ECB, CBC, CTR; state when IV/nonce must be unique; explain why ECB leaks patterns.
Self-check. Q: Which mode lets you encrypt blocks in parallel? A: CTR (and decryption in CBC).
3.6 Comparison
Definition and why it matters. Students must choose among ciphers and modes based on security, speed, and usage context.
Core theory. Compare DES vs AES (key size, rounds, security); ECB vs CBC vs CTR (pattern leakage, parallelism, IV needs); block vs stream (padding, nonce).
Worked example. A 1 MB image: ECB shows outlines of the original image; CBC/CTR appear as random noise.
Use case. Selecting AES-CTR for a file encrypter; rejecting ECB for any structured data.
Comparison table.
| Cipher/mode | Block size | Key sizes | Parallel? | IV/nonce? | Safe for real data? |
|---|---|---|---|---|---|
| DES | 64 | 56 | No | No | No (obsolete) |
| AES-ECB | 128 | 128/192/256 | Yes | No | No (leaks patterns) |
| AES-CBC | 128 | 128/192/256 | Encrypt no | Yes | Yes |
| AES-CTR | 128 | 128/192/256 | Yes | Yes (nonce) | Yes |
Swipe to see all columns
Common mistakes. Picking ECB because it is simplest; using DES for new systems.
Exam points. Compare DES and AES; compare ECB/CBC/CTR on safety and parallelism.
Self-check. Q: Is ECB safe for an image? A: No — it reveals patterns.
3.7 Seeing symmetric ciphers: hardware, rounds and chaining
Definition and why it matters. Visualizing hardware implementation, round structure, and chaining helps students see how diffusion builds across rounds and how modes chain blocks.
Core theory. Hardware: AES rounds implemented as pipelines; each round adds confusion+diffusion. Chaining (CBC) means block i depends on all previous blocks, so an early change propagates.
Worked example. In CBC, flipping one bit in P₁ changes C₁, which changes P₂'s input, so C₂ changes, and the error propagates through all subsequent blocks — but decryption of block i only needs Cᵢ and Cᵢ₋₁.
Use case. Understanding why a corrupted ciphertext block affects neighboring plaintext in CBC but only one block in CTR.
Comparison. Hardware rounds (fixed function) vs software (table lookups); CBC propagation vs CTR independence.
Common mistakes. Assuming all blocks in CBC depend on all previous plaintext blocks (only ciphertext chains).
Exam points. Describe error propagation in CBC vs CTR; sketch round structure.
Self-check. Q: In CBC, does a one-bit plaintext change affect later ciphertext blocks? A: Yes, through chaining.
Unit 3 summary
Unit 3 covers symmetric ciphers: block vs stream, confusion and diffusion, the Feistel structure, DES, AES (SubBytes, ShiftRows, MixColumns, AddRoundKey), modes of operation (ECB, CBC, CFB, OFB, CTR), and comparisons. Students should trace a Feistel round and one AES round, explain mode differences, and know why ECB is unsafe.
Unit 4: Public-Key Cryptography - RSA, Diffie-Hellman, ElGamal and ECC (8 hours)
Key terms
- Public-key cryptography: key pair (public, private); public encrypts/verifies, private decrypts/signs.
- Trapdoor function: easy one way, hard to reverse without secret.
- RSA: Rivest–Shamir–Adleman; based on integer factorization.
- Diffie-Hellman: key exchange based on discrete log.
- Elliptic-curve cryptography (ECC): public-key over elliptic curves.
- Digital signature: signs a hash; provides authentication, integrity, non-repudiation.
- PKI: public-key infrastructure (certificates, CAs).
4.1 The public-key idea
Definition and why it matters. Public-key cryptography uses two keys: a public key anyone may use, and a private key kept secret. It solves the key-distribution problem of symmetric cryptography.
Core theory. Anyone with the public key can encrypt or verify; only the private-key holder can decrypt or sign. The public key must be authentic (bind to identity) via certificates/PKI, otherwise man-in-the-middle attacks succeed.
Worked example. Alice wants to receive a secret. She publishes her public key. Bob encrypts with Alice's public key. Only Alice's private key decrypts. Alice does not need to send a secret key to Bob first.
Use case. Secure email (PGP), HTTPS/TLS key exchange, software signing.
Comparison. Symmetric (one shared key, fast, key-distribution problem) vs asymmetric (key pair, slower, solves distribution).
Common mistakes. Thinking the private key can be derived from the public key easily (it cannot, by design); sending the private key to "share" it.
Exam points. State public vs private key roles; explain the key-distribution problem solved by public-key crypto.
Self-check. Q: Which key is shared publicly? A: The public key.
4.2 RSA
Definition and why it matters. RSA is the most widely used public-key cryptosystem, based on the difficulty of factoring the product of two large primes.
Core theory. Key generation: choose primes p, q; n = p·q; φ(n) = (p−1)(q−1); choose e with 1 < e < φ(n) and gcd(e, φ(n)) = 1; compute d = e⁻¹ mod φ(n). Public key = (n, e); private key = (n, d). Encrypt: c = mᵉ mod n. Decrypt: m = cᵈ mod n. Works because m^(e·d) ≡ m (mod n) by Euler's theorem.
Worked example (tiny, illustrative only). p = 11, q = 13. n = 143. φ(n) = 10×12 = 120. Choose e = 7 (gcd(7,120)=1). d = 7⁻¹ mod 120: 7×103 = 721 = 6×120 + 1, so d = 103. Public key (143, 7), private (143, 103). Encrypt m = 9: c = 9⁷ mod 143. 9² = 81, 9⁴ = 81² = 6561 mod 143 = 6561 − 45×143 = 6561 − 6435 = 126. 9⁷ = 9⁴·9²·9 = 126×81×9 mod 143. 126×81 = 10206 mod 143 = 10206 − 71×143 = 10206 − 10153 = 53. 53×9 = 477 mod 143 = 477 − 3×143 = 477 − 429 = 48. c = 48. Decrypt: 48¹⁰³ mod 143 = 9 (verified by Euler).
Use case. TLS handshake key exchange, digital signatures, encrypting small data (session keys, not bulk data).
Comparison. RSA security rests on factoring n; ECC gives equivalent security with smaller keys.
Common mistakes. Encrypting large files directly with RSA (slow, size-limited; RSA encrypts a symmetric key instead); using small primes (easily factored); textbook RSA without padding (deterministic, insecure).
Exam points. Generate an RSA key pair by hand with small primes; encrypt/decrypt a small message; state why padding (OAEP/PKCS#1) is required.
Self-check. Q: RSA public key components? A: (n, e). Q: What is the hardness assumption? A: Factoring n (and the RSA problem).
4.3 Diffie–Hellman key exchange
Definition and why it matters. Diffie-Hellman lets two parties establish a shared secret over an insecure channel without having shared anything beforehand.
Core theory. Public parameters: prime p and primitive root g. Alice picks private a, sends A = gᵃ mod p. Bob picks private b, sends B = gᵇ mod p. Alice computes s = Bᵃ = g^(ab) mod p. Bob computes s = Aᵇ = g^(ab) mod p. Both share s; an eavesdropper seeing g, p, A, B cannot easily compute g^(ab) (discrete log problem).
Worked example. p = 23, g = 5. Alice a = 6: A = 5⁶ mod 23 = 15625 mod 23 = 8. Bob b = 15: B = 5¹⁵ mod 23. 5²=25≡2, 5⁴≡4, 5⁸≡16, 5¹⁵ = 5⁸·5⁴·5²·5 ≡ 16×4×2×5 = 640 mod 23 = 640 − 27×23 = 640 − 621 = 19. B = 19. Alice: s = 19⁶ mod 23 = 19²=361≡16, 19⁴≡256≡3, 19⁶=19⁴·19² ≡ 3×16 = 48 ≡ 2. Bob: s = 8¹⁵ mod 23 = 8²=64≡18, 8⁴≡18²=324≡2, 8⁸≡4, 8¹⁵ = 8⁸·8⁴·8²·8 ≡ 4×2×18×8 = 1152 mod 23 = 1152 − 50×23 = 1152 − 1150 = 2. Shared secret s = 2.
Use case. Establishing a session key in TLS; any two-party key agreement.
Comparison. DH provides forward secrecy when ephemeral keys are used (ECDHE in TLS); static RSA key transport does not.
Common mistakes. Using small p (easily broken); not authenticating the parties (vulnerable to man-in-the-middle).
Exam points. Trace DH with small numbers; state what an eavesdropper sees and cannot compute; explain forward secrecy with ephemeral DH.
Self-check. Q: What does an eavesdropper see in DH? A: p, g, A, B (but not a, b, or s).
4.4 Elliptic-curve cryptography
Definition and why it matters. ECC provides public-key cryptography using elliptic-curve groups, offering equivalent security to RSA with much smaller keys and faster operations.
Core theory. Points on a curve y² = x³ + ax + b over a finite field, with a point at infinity. Point addition and scalar multiplication (k·P) are the operations. Public key Q = d·G where d is private and G is a base point. Security rests on the elliptic-curve discrete logarithm problem (harder than classical discrete log for the same size).
Worked example. Conceptual: private key d = 7, base point G. Public key Q = 7·G = G+G+...+G (7 times) via point addition/doubling. To recover d from Q and G requires solving ECDLP — infeasible for standard curves (P-256, Curve25519).
Use case. TLS (ECDHE), Bitcoin/Ethereum wallets, mobile devices (small keys, low power).
Comparison. ECC-256 ≈ RSA-3072 in security; ECC is faster and uses less bandwidth/storage.
Common mistakes. Thinking ECC keys are the same size as RSA keys (they are much smaller); using non-standard or weak curves.
Exam points. Define ECC public key Q = d·G; state the hardness assumption (ECDLP); compare ECC key size to RSA for equivalent security.
Self-check. Q: Is a 256-bit ECC key stronger than a 256-bit RSA key? A: Yes — far stronger (256-bit ECC ≈ 3072-bit RSA).
4.5 Comparing key sizes and uses
Definition and why it matters. Equivalent security levels guide algorithm and key-size selection; public-key is slow, so it is used for small data (keys, signatures) while symmetric ciphers handle bulk data.
Core theory. Approximate equivalent security: RSA-1024 ≈ ECC-160; RSA-2048 ≈ ECC-224; RSA-3072 ≈ ECC-256; RSA-15360 ≈ ECC-512. Public-key ops are ~1000× slower than symmetric, so hybrid systems encrypt a session key with RSA/ECC and the data with AES.
Worked example. A TLS session: server sends an RSA/ECC certificate; client and server perform key exchange (RSA or ECDHE) to derive a session key; then AES-GCM encrypts the HTTP data.
Comparison table.
| Security level | RSA key | ECC key | Typical use |
|---|---|---|---|
| 80-bit | 1024 | 160–224 | Legacy (RSA-1024 weak now) |
| 112-bit | 2048 | 224–256 | General web (RSA-2048) |
| 128-bit | 3072 | 256 | Modern high security |
Swipe to see all columns
Common mistakes. Using RSA-1024 today (inadequate); encrypting bulk data with RSA directly.
Exam points. State equivalent key sizes; explain hybrid encryption (public-key for key, symmetric for data).
Self-check. Q: Why not encrypt a whole file with RSA? A: RSA is slow and limited in size; use hybrid encryption.
4.6 Seeing public-key cryptography: pioneers, keys and curves
Definition and why it matters. Historical and visual context (Diffie and Hellman's 1976 paper, Rivest-Shamir-Adleman, elliptic curves) grounds the mathematics in real inventions.
Core theory. Diffie-Hellman (1976) introduced public-key concepts and key exchange. RSA (1978) gave a practical encryption/signature scheme. ECC (Koblitz and Miller, mid-1980s) moved to curve-based groups. Visual: a public key is a point on a curve; private key is a scalar.
Use case. Understanding the evolution of public-key crypto and why ECC replaced RSA in many modern systems.
Comparison. RSA (integer factorization) vs DH (discrete log) vs ECC (elliptic-curve discrete log).
Common mistakes. Attributing RSA to Diffie-Hellman; confusing the discrete-log problem with factoring.
Exam points. Name the hard problem behind RSA, DH, and ECC; state the rough timeline of inventions.
Self-check. Q: Which problem does RSA rely on? A: Integer factorization.
Unit 4 summary
Unit 4 covers public-key cryptography: the public/private key idea, RSA (key generation, encryption, decryption, small example, factoring assumption), Diffie-Hellman key exchange (shared secret, discrete log), elliptic-curve cryptography (smaller keys, ECDLP), and key-size comparisons. Students should generate a small RSA key pair, trace Diffie-Hellman, and compare RSA and ECC key sizes.
Unit 5: Hash Functions, MACs, Digital Signatures and PKI (7 hours)
Key terms
- Cryptographic hash function: maps arbitrary input to fixed-size output; preimage, second-preimage, collision resistant.
- MD5 / SHA-1 / SHA-256: hash algorithms (MD5 and SHA-1 broken; SHA-256 recommended).
- MAC: message authentication code, keyed integrity/authentication.
- HMAC: hash-based MAC.
- Digital signature: signs a hash with a private key; verifiable with public key.
- Certificate: binds a public key to an identity, signed by a CA.
- PKI: public-key infrastructure (CA, registration, revocation).
- Password hashing: slow salted hash (bcrypt, scrypt, Argon2, PBKDF2).
5.1 Cryptographic hash functions
Definition and why it matters. A hash function takes arbitrary data and produces a fixed-size digest. It is used for integrity, fingerprinting, and signing. Cryptographic hashes must be one-way and collision-resistant.
Core theory. Properties: preimage resistance (given h, hard to find m with H(m) = h), second-preimage resistance (given m, hard to find m′ ≠ m with same hash), collision resistance (hard to find any m ≠ m′ with same hash). Output is fixed size (MD5: 128, SHA-1: 160, SHA-256: 256 bits). The birthday attack finds collisions in ~2^(n/2) work for n-bit hash.
Worked example. Conceptual: H("hello") = 2cf24dba... (SHA-256). Changing one letter ("h3llo") produces a completely different digest (avalanche effect). Finding two inputs with the same SHA-256 is infeasible (~2^128 work).
Use case. File integrity checks (download sites list SHA-256), digital signatures (sign the hash, not the whole document), blockchain.
Comparison. MD5 (broken, collisions easy), SHA-1 (broken for collisions), SHA-256 (secure, recommended).
Common mistakes. Using MD5/SHA-1 for security (collisions known); assuming a hash hides the input (it does not — hashes are not encryption).
Exam points. State the three resistance properties; give output sizes; explain the birthday bound; say why MD5/SHA-1 are deprecated.
Self-check. Q: Is a hash reversible? A: No — preimage resistance makes it one-way.
5.2 Message authentication codes and HMAC
Definition and why it matters. A MAC provides integrity and authenticity using a shared secret key; HMAC is a MAC built from a hash function.
Core theory. MAC: tag = MAC(K, m); receiver recomputes and compares. HMAC: HMAC(K, m) = H((K ⊕ opad) || H((K ⊕ ipad) || m)). It resists length-extension attacks that naive H(K||m) suffers.
Worked example. HMAC-SHA256 with key K and message m: compute inner = H((K⊕ipad)||m), then outer = H((K⊕opad)||inner). Sender and receiver (sharing K) produce the same tag; an attacker without K cannot forge it.
Use case. API request authentication, message integrity in protocols (TLS, IPsec).
Comparison. MAC (shared key, faster) vs digital signature (public key, non-repudiation, slower).
Common mistakes. Using a plain hash H(m) for integrity without a key (anyone can recompute); using H(K||m) (length-extension) instead of HMAC.
Exam points. Describe HMAC structure; contrast MAC vs digital signature; state why HMAC resists length-extension.
Self-check. Q: Does a MAC give non-repudiation? A: No — both parties share the key, so either could have produced the tag.
5.3 Digital signatures
Definition and why it matters. A digital signature authenticates the signer, ensures integrity, and provides non-repudiation using public-key cryptography.
Core theory. Sign: compute h = H(m), then signature = Sign(sk, h) (e.g., RSA sign = hᵈ mod n, or DSA/ECDSA). Verify: compute h = H(m), then Verify(pk, signature, h). Only the private-key holder can produce a valid signature; anyone with the public key can verify.
Worked example (RSA sign, tiny). Using the Unit 4 example keys: sk = (143, 103), pk = (143, 7). Message digest h = 9. Signature s = 9¹⁰³ mod 143. Verify: s⁷ mod 143 = 9 = h. ✓ (Real signatures use padding like PSS and sign a hash.)
Use case. Software updates (signed so users trust the source), legal documents, TLS certificates.
Comparison. Signature (public key, non-repudiation) vs MAC (shared key, no non-repudiation); RSA sign vs DSA/ECDSA.
Common mistakes. Signing the whole message instead of its hash (slow, size limits); using a signature for confidentiality (it does not hide content).
Exam points. Describe sign/verify flow; state what a signature provides (authentication, integrity, non-repudiation); explain why signing a hash is standard.
Self-check. Q: Can anyone with the public key forge a signature? A: No — only the private key can sign.
5.4 Certificates and PKI
Definition and why it matters. A public key is useful only if you know it belongs to the claimed owner. Certificates bind public keys to identities, and PKI is the system that issues and manages them.
Core theory. A certificate contains subject identity, subject public key, issuer (CA), validity dates, and the CA's signature. A CA signs certificates; clients trust root CAs. Chain: end-entity cert → intermediate CA → root CA. Revocation via CRL or OCSP.
Worked example. A website's TLS certificate: subject = example.com, public key = server's RSA key, issuer = Let's Encrypt, signed by Let's Encrypt. The browser verifies the signature using Let's Encrypt's root certificate already in its trust store.
Use case. HTTPS (website authentication), code signing, email encryption (S/MIME).
Comparison. Certificate (binds key to identity, CA-signed) vs public key alone (no identity binding — vulnerable to MITM).
Common mistakes. Trusting a self-signed certificate without verification; ignoring certificate warnings (enables MITM); expired certificates.
Exam points. Describe certificate contents; explain the certificate chain and trust anchor; state revocation methods (CRL, OCSP).
Self-check. Q: What binds a public key to an identity in a certificate? A: The CA's signature.
5.5 Password hashing
Definition and why it matters. Passwords must not be stored in plain text; they are hashed with a unique salt and a slow work factor so offline cracking is expensive.
Core theory. Store H(salt || password) with a slow KDF: PBKDF2 (≥600,000 iterations for HMAC-SHA256 per OWASP), bcrypt (cost 2ⁿ, 72-byte input limit), scrypt/Argon2 (memory-hard). A unique salt per user prevents rainbow tables and identical passwords from having identical hashes.
Worked example. User password "p@ssw0rd", random salt "a1b2". Store (salt, PBKDF2-HMAC-SHA256(password, salt, 600000)). To verify, recompute with the stored salt and compare. Two users with the same password have different salts and different stored hashes.
Use case. Website user databases, password managers.
Comparison. Fast hash (SHA-256, unsuitable for passwords — GPU cracking) vs slow salted KDF (Argon2/bcrypt, suitable).
Common mistakes. Storing plain passwords; using unsalted fast hashes (MD5/SHA-256); reusing the same salt for all users.
Exam points. State why salt must be unique per user; recommend a KDF (Argon2id, bcrypt, scrypt, PBKDF2); state OWASP PBKDF2 iteration guidance.
Self-check. Q: Why is a unique salt per user important? A: Prevents rainbow tables and identical-password identical-hash leaks.
5.6 Seeing hashes, signatures and certificates
Definition and why it matters. Visualizing hash avalanche, signature structure, and certificate chains clarifies how integrity and authentication are established end to end.
Core theory. Hash: small input change -> completely different digest. Signature: hash then sign; verify recomputes hash. Certificate chain: end entity -> intermediate -> root trust anchor.
Worked example. H("cat") vs H("cats") differ in nearly every bit. A certificate path: browser trusts root R; R signs intermediate I; I signs site cert S; browser verifies S with I, I with R, R is in the trust store.
Use case. Debugging TLS certificate errors; understanding signed software updates.
Comparison. Hash (unkeyed integrity fingerprint) vs MAC (keyed) vs signature (public key, non-repudiation).
Common mistakes. Confusing a hash with a MAC (no key); thinking a certificate encrypts data (it binds identity to a key).
Exam points. Sketch a certificate chain; show hash avalanche conceptually; list what a signature provides.
Self-check. Q: What is the trust anchor in PKI? A: A trusted root CA certificate.
Unit 5 summary
Unit 5 covers hash functions (properties, MD5/SHA-1/SHA-256, birthday bound), MACs and HMAC, digital signatures (sign/verify, non-repudiation), certificates and PKI (CA, chain, revocation), and password hashing (salt, slow KDFs). Students should contrast hash/MAC/signature and explain certificate validation.
Unit 6: Authentication and Secure Network Protocols (8 hours)
Key terms
- Authentication: verifying identity.
- Kerberos: ticket-based authentication using a trusted KDC.
- TLS/HTTPS: transport-layer security; handshake and record protocols.
- IPsec: network-layer security (AH, ESP, security associations).
- PGP / S/MIME: secure email.
- SSH: secure remote login and file transfer.
- Handshake: negotiation of cipher suite and keys.
- Man-in-the-middle (MITM): attacker relays and possibly alters messages.
6.1 Authentication and its attacks
Definition and why it matters. Authentication confirms who a user or system is. It is the gatekeeper for authorization; weak authentication undermines all other security.
Core theory. Authentication factors: something you know (password), have (token/phone), are (biometric). Multi-factor authentication (MFA) combines factors. Attacks: guessing, brute force, credential stuffing, phishing, replay, man-in-the-middle.
Worked example. A user logs in with password + TOTP code. Even if the password is stolen, the attacker lacks the time-based code from the user's phone.
Use case. Corporate VPN, banking, email accounts.
Comparison. Single-factor (password only) vs multi-factor (two or more factors).
Common mistakes. Relying on passwords alone; SMS codes vulnerable to SIM-swap (phishing-resistant keys better).
Exam points. List authentication factors; describe MFA benefit; name authentication attacks.
Self-check. Q: Which factor is "something you have"? A: A security key or phone.
6.2 Kerberos
Definition and why it matters. Kerberos is a ticket-based authentication system using a trusted Key Distribution Center (KDC), common in enterprise single sign-on.
Core theory. Components: client, server, KDC (Authentication Server AS + Ticket-Granting Server TGS). Flow: client asks AS for a TGT (ticket-granting ticket) encrypted with the client's password key; client presents TGT to TGS to get a service ticket; client presents service ticket to the server. Tickets are time-stamped to prevent replay.
Worked example. User logs in -> AS returns TGT (encrypted with user's key) + session key. User sends TGT + authenticator to TGS -> TGS returns service ticket for the file server. User sends service ticket + authenticator to file server -> access granted.
Use case. Windows Active Directory, enterprise single sign-on.
Comparison. Kerberos (symmetric-key tickets, trusted third party) vs public-key certificates.
Common mistakes. Thinking Kerberos encrypts data (it authenticates; confidentiality is separate); ignoring clock synchronization (tickets expire).
Exam points. Describe the AS/TGS/service-ticket flow; state the role of timestamps; name the KDC components.
Self-check. Q: What does the TGS issue? A: A service ticket for a specific server.
6.3 TLS and HTTPS
Definition and why it matters. TLS (and its predecessor SSL) secures transport-layer communications; HTTPS is HTTP over TLS. It provides encryption, server authentication, and integrity.
Core theory. TLS handshake: client hello (versions, cipher suites, random), server hello (cipher suite, certificate, random), key exchange (RSA or Diffie-Hellman), certificate verification, finished messages, then encrypted record protocol. The record protocol fragments, compresses (optional), MACs/encrypts, and sends data.
Worked example. Client and server agree on AES-GCM. During handshake they perform ECDHE to derive a shared secret, derive keys, and then all HTTP traffic is encrypted with AES-GCM using sequence numbers for integrity.
Use case. HTTPS websites, secure email submission, API traffic.
Comparison. TLS (transport layer, secures the connection) vs application-layer security (PGP/S/MIME for email content).
Common mistakes. Accepting invalid certificates (MITM); using TLS 1.0/1.1 (deprecated, weak ciphers).
Exam points. List TLS handshake steps; state what TLS provides; explain why certificate validation matters.
Self-check. Q: What does the server send in ServerHello? A: Chosen cipher suite, server certificate, server random.
6.4 IPsec
Definition and why it matters. IPsec secures IP packets at the network layer, used in VPNs and site-to-site encryption.
Core theory. Two protocols: Authentication Header (AH) provides integrity/authentication (no encryption); Encapsulating Security Payload (ESP) provides encryption (+ optional authentication). Two modes: transport (protects payload) and tunnel (encapsulates whole IP packet, used in VPNs). Security Association (SA) = simplex connection with keys and parameters; Security Policy Database (SPD) decides which traffic is protected.
Worked example. Tunnel mode: original packet (inside LAN) is encapsulated in a new IP packet encrypted between two gateways; the internet sees only gateway-to-gateway encrypted traffic.
Use case. Site-to-site VPN between branch offices; remote-access VPN.
Comparison. Transport mode (end-to-end between hosts) vs tunnel mode (gateway-to-gateway, hides original IPs); AH (integrity only) vs ESP (encryption).
Common mistakes. Thinking IPsec is only for VPNs (it can protect any IP traffic); confusing SA (one direction) with a bidirectional connection.
Exam points. Describe AH and ESP; contrast transport and tunnel mode; define Security Association.
Self-check. Q: Which IPsec mode hides the original IP addresses? A: Tunnel mode.
6.5 PGP, S/MIME and SSH
Definition and why it matters. PGP and S/MIME secure email (content encryption/signing); SSH secures remote login and file transfer.
Core theory. PGP: web of trust (users sign each other's keys), encrypts email with a session key (hybrid), signs messages. S/MIME: certificate-based (PKI), encrypts/signs email. SSH: client authenticates server via host key, user authenticates via password or public key, all traffic encrypted (TCP port 22). SSH provides remote shell, SCP/SFTP file transfer, port forwarding.
Worked example. SSH: client connects to server; server sends host key; client checks it against known_hosts; client authenticates with a public key; a secure shell session is established.
Use case. PGP for signing software releases; SSH for administering servers.
Comparison. PGP (web of trust) vs S/MIME (centralized PKI); SSH (interactive shell) vs TLS (web/connection security).
Common mistakes. Accepting an unknown SSH host key (MITM); using PGP without verifying the web-of-trust path.
Exam points. Contrast PGP and S/MIME; describe SSH authentication (host key + user key); list SSH uses.
Self-check. Q: What does SSH encrypt? A: The entire session (login, commands, file transfers).
6.6 Comparing the layers
Definition and why it matters. Security can be applied at different network layers, each protecting different things and suited to different uses.
Core theory. Link layer (Wi-Fi WPA2/WPA3), network layer (IPsec VPN), transport layer (TLS), application layer (PGP/SMIME, SSH, HTTPS is application-over-transport). Higher layers protect application data; lower layers protect all traffic between endpoints.
Worked example. IPsec VPN encrypts all traffic between two offices (including DNS, broadcasts). TLS encrypts only the browser-to-server connection. PGP encrypts email content end-to-end regardless of transport.
Comparison table.
| Layer | Example | Protects | Scope |
|---|---|---|---|
| Link | WPA2/WPA3 | wireless frames | one wireless link |
| Network | IPsec | IP packets | host/VPN gateway |
| Transport | TLS | TCP connection | application connection |
| Application | PGP, SSH | email/session | end-to-end |
Swipe to see all columns
Common mistakes. Assuming TLS encrypts email content stored on a server (it encrypts only in transit).
Exam points. Compare security layers; state which layer each protocol operates on.
Self-check. Q: Does IPsec operate below or above TCP? A: At the network layer, below TCP.
6.7 Seeing the protocols: tickets, handshakes and tunnels
Definition and why it matters. Sequence views (Kerberos tickets, TLS handshake, IPsec tunnel) show how messages flow and where keys are established.
Core theory. Kerberos: client↔AS↔TGS↔server ticket flow. TLS: client/server hello -> key exchange -> finished -> encrypted records. IPsec tunnel: original packet encapsulated and encrypted gateway-to-gateway.
Worked example. TLS handshake sequence: C->S ClientHello; S->C Certificate + ServerHello; C->S ClientKeyExchange + ChangeCipherSpec; S->C ChangeCipherSpec; then encrypted application data.
Use case. Troubleshooting a failed TLS handshake (certificate mismatch, cipher-suite mismatch).
Comparison. Ticket-based (Kerberos) vs handshake-based (TLS) vs tunnel-encapsulation (IPsec).
Common mistakes. Skipping certificate verification in the TLS handshake mentally (it is essential).
Exam points. Sketch a TLS handshake sequence; describe Kerberos ticket flow; contrast IPsec tunnel encapsulation.
Self-check. Q: In TLS, when does encrypted application data begin? A: After the ChangeCipherSpec/Finished messages complete the handshake.
Unit 6 summary
Unit 6 covers authentication (factors, MFA, attacks), Kerberos ticket-based authentication, TLS/HTTPS (handshake, record protocol), IPsec (AH, ESP, transport/tunnel, SAs), PGP/S/MIME/SSH, and layer comparisons. Students should trace a TLS handshake and Kerberos flow and contrast security layers.
Unit 7: Network and System Security - Firewalls, IDS, VPN and Wireless (5 hours)
Key terms
- Firewall: filters traffic by rules (packet-filtering, stateful, application proxy).
- Default deny: block everything not explicitly allowed.
- IDS: intrusion detection system (alerts only).
- IPS: intrusion prevention system (alerts + blocks).
- VPN: virtual private network (encrypted tunnel over public network).
- Wireless security: WEP, WPA, WPA2, WPA3.
- Sniffer: captures network traffic.
- Key management: generation, distribution, rotation of keys.
7.1 Firewalls
Definition and why it matters. A firewall controls traffic between networks or hosts based on rules, forming a perimeter defence.
Core theory. Packet-filtering firewall: inspects headers (source/dest IP, port, protocol) and allows/denies. Stateful firewall: tracks connection state. Application proxy: inspects application-layer content. Rules are evaluated first-match; default-deny is safest. Rule ordering matters — a broad early allow rule can shadow a later deny.
Worked example. Rules: (1) allow 10.0.0.0/8 to port 443; (2) deny all to port 443. A packet from 10.0.0.5 to port 443 matches rule 1 (allow). Reordering to put deny first blocks it — shadowing. Default deny: block all, allow only 80 and 443 from trusted IPs.
Use case. Perimeter firewall protecting a college network; host firewall on a laptop.
Comparison. Packet-filter (fast, header-only) vs stateful (tracks connections) vs proxy (deep inspection, slower).
Common mistakes. Default-allow (insecure); broad rules shadowing specific denies; not reviewing rules.
Exam points. Describe packet-filtering vs stateful vs proxy; explain first-match and shadowing; state why default-deny is recommended.
Self-check. Q: What is default deny? A: Block everything not explicitly allowed.
7.2 Intrusion detection and prevention
Definition and why it matters. IDS detects suspicious activity and alerts; IPS also blocks it. They complement firewalls by looking at content and behavior, not just headers.
Core theory. IDS types: network-based (NIDS, watches traffic) and host-based (HIDS, watches a host). Detection: signature-based (known patterns, accurate for known threats, misses new) and anomaly-based (baseline of normal, catches new, more false alarms). IPS = IDS + blocking capability. SIEM centralizes alerts.
Worked example. A NIDS sees many SYN packets to many ports from one host -> raises a port-scan alert. Signature-based IDS matches a known exploit byte pattern. Anomaly-based flags a sudden 100× spike in outbound DNS queries (possible exfiltration).
Use case. Detecting scans, brute-force logins, malware beaconing.
Comparison. IDS (detect/alert) vs IPS (detect/alert/block); signature (known threats) vs anomaly (novel, false positives).
Common mistakes. Relying only on signature-based detection (misses zero-days); not tuning anomaly baselines (alert fatigue).
Exam points. Describe IDS vs IPS; contrast signature and anomaly detection; name NIDS vs HIDS.
Self-check. Q: Can an IDS block traffic by itself? A: No — IDS alerts; IPS blocks.
7.3 VPNs
Definition and why it matters. A VPN creates an encrypted tunnel over a public network so remote users or branch offices appear on the private network.
Core theory. Tunnel: original packets are encapsulated and encrypted between endpoints (client->gateway or gateway->gateway). Types: remote-access VPN (user to corporate network), site-to-site VPN (network to network). Protocols: IPsec, SSL/TLS VPN, WireGuard. Split tunneling sends only corporate traffic through the VPN.
Worked example. A staff member working from home connects via an IPsec VPN to the college gateway; all traffic to college servers is encrypted, while personal browsing goes directly to the internet (split tunneling).
Use case. Remote work, accessing campus resources from outside.
Comparison. Remote-access (single user) vs site-to-site (two networks); IPsec vs SSL VPN.
Common mistakes. Full tunneling all traffic (unnecessary load, privacy concerns) when split tunneling suffices; weak authentication on the VPN gateway.
Exam points. Describe VPN tunnel encapsulation; contrast remote-access and site-to-site; name common VPN protocols.
Self-check. Q: What is split tunneling? A: Sending only selected (e.g., corporate) traffic through the VPN.
7.4 Wireless security
Definition and why it matters. Wireless networks broadcast radio, so anyone within range can capture frames; encryption and authentication are essential.
Core theory. WEP (RC4, static keys, broken — do not use). WPA (TKIP, interim fix). WPA2 (AES-CCMP, PSK or Enterprise with 802.1X/RADIUS, widely used). WPA3 (SAE dragonfly handshake, forward secrecy, stronger, newer). WPA2-Personal uses a pre-shared key; WPA2-Enterprise uses per-user credentials via RADIUS.
Worked example. WPA2 4-way handshake: authenticator and supplicant derive the Pairwise Transient Key (PTK) from the Pairwise Master Key and nonces, confirming both possess the PSK without sending it.
Use case. Campus Wi-Fi (WPA2-Enterprise with RADIUS), home Wi-Fi (WPA2-Personal or WPA3).
Comparison. WEP (broken, minutes to crack) < WPA < WPA2 < WPA3 (forward secrecy, resistant to offline dictionary attacks on weak passwords).
Common mistakes. Using WEP; using a short/common Wi-Fi password (offline dictionary attack on captured handshake).
Exam points. Order WEP/WPA/WPA2/WPA3 by security; describe WPA2-Personal vs Enterprise.
Self-check. Q: Which wireless standard is broken and must not be used? A: WEP.
7.5 Common attacks and defences
Definition and why it matters. Knowing common attacks lets students recognize and defend against them in lab and real settings.
Core theory. Attacks: eavesdropping/sniffing, spoofing (IP/MAC/ARP), man-in-the-middle, replay, denial of service, password guessing, session hijacking. Defences: encryption, authentication, certificate validation, ARP spoofing defenses (DHCP snooping, dynamic ARP inspection), rate limiting, MFA.
Worked example. ARP spoofing: attacker sends fake ARP replies to associate the gateway's IP with the attacker's MAC, intercepting traffic. Defence: dynamic ARP inspection on switch ports.
Use case. Detecting ARP spoofing on a lab network; defending a login page against brute force with rate limiting.
Comparison. Passive (sniffing) vs active (spoofing, MITM) attacks.
Common mistakes. Thinking HTTPS prevents all attacks (it protects the connection, not phishing or compromised endpoints).
Exam points. List common attacks and a defence for each; describe ARP spoofing and its defence.
Self-check. Q: Defend against ARP spoofing with what switch feature? A: Dynamic ARP inspection (or DHCP snooping).
7.6 Key management and a security checklist
Definition and why it matters. Cryptography is only as strong as its key management: generation, distribution, storage, rotation, and revocation.
Core theory. Generate keys with a CSPRNG; store private keys securely (HSM, encrypted file); rotate keys periodically; revoke compromised keys; separate keys by purpose (encryption vs signing). Checklist: default-deny firewall, patched systems, MFA, encrypted backups, logging, least privilege, incident plan.
Worked example. A server generates an RSA key pair; the private key is stored in an HSM or encrypted with a passphrase; the public key is published in a certificate. Keys are rotated every year; a suspected compromise triggers immediate revocation.
Use case. Managing TLS private keys and SSH keys in an organization.
Comparison. Symmetric key distribution (hard, needs secure channel) vs public key distribution (needs authentic binding via PKI).
Common mistakes. Hardcoding keys in source code; never rotating keys; using one key for everything.
Exam points. List key-management best practices; state why keys should be rotated and revoked.
Self-check. Q: Where should a private key be stored? A: Securely (HSM or encrypted), never in plain source code.
7.7 Seeing network defences: walls, zones, sensors and radios
Definition and why it matters. Visualizing firewall zones, IDS sensor placement, VPN tunnels, and wireless radios ties the unit's defences together.
Core theory. Network zones: public (DMZ), internal (staff), restricted (servers/database) separated by firewalls. IDS sensors at perimeter and inside. Wireless access points with WPA2/3. VPN gateways at the edge.
Worked example. A college network: DMZ holds the web server (public); staff VLAN holds offices (internal); database VLAN holds student records (restricted). Firewalls between zones with default-deny. IDS sensors at the internet edge and inside the staff VLAN.
Use case. Designing a defensible network segment layout.
Comparison. DMZ (exposed, hardened) vs internal zone (trusted, less exposed).
Common mistakes. Putting the database in the DMZ; no firewall between internal zones (flat network).
Exam points. Sketch a zoned network with firewall and IDS placement; state why the database should not be in the DMZ.
Self-check. Q: Which zone holds publicly accessible servers? A: The DMZ.
Unit 7 summary
Unit 7 covers firewalls (packet/stateful/proxy, default-deny, rule ordering), IDS/IPS (signature/anomaly, NIDS/HIDS), VPNs (tunnel, remote-access/site-to-site), wireless security (WEP/WPA/WPA2/WPA3), common attacks and defences, and key management with a security checklist. Students should describe a zoned network and defend against common attacks.
Unit 8: Malware, Intruders, Steganography, Network Management Security and Cyber Law (6 hours)
Key terms
- Malware: malicious software (virus, worm, trojan, ransomware, rootkit, botnet, spyware, keylogger).
- Intruder: unauthorized user gaining access.
- Steganography: hiding data inside other files (images, audio).
- Watermarking: embedding ownership information.
- SNMP: Simple Network Management Protocol.
- SET: Secure Electronic Transaction.
- Dual signature: links two messages (order and payment) without revealing each to the other party.
- Cybercrime law: legal offences and penalties.
8.1 Malicious software
Definition and why it matters. Malware is software designed to harm, steal, or covertly use systems. Understanding families and behaviours is the basis for defence.
Core theory. Virus (needs a host file/user action, four phases: dormant, propagation, triggering, execution), worm (self-propagating over networks, no host needed), trojan (disguised as legitimate), ransomware (encrypts files, demands payment), rootkit (hides itself and other malware), spyware (collects data secretly), keylogger (records keystrokes), botnet (army of compromised bots controlled by a command server).
Worked example. Worm spread model: one infected host contacts N others per time step with probability p; infections grow exponentially early, so manual response is too slow — automated patching and isolation are needed.
Use case. Detecting ransomware on a lab machine; cleaning a botnet-infected lab.
Comparison. Virus (needs host action) vs worm (network self-spread) vs trojan (user runs it) vs ransomware (encrypts for ransom).
Common mistakes. Calling all malware "viruses"; thinking antivirus alone is sufficient (need patching, backups, least privilege).
Exam points. Define virus, worm, trojan, ransomware, rootkit, botnet; list the four virus phases.
Self-check. Q: Which malware self-propagates without user action? A: Worm.
8.2 Intruders and password attacks
Definition and why it matters. Intruders gain unauthorized access; password attacks are a common entry point.
Core theory. Intruder types and goals. Password attacks: online (guessing against a live service, throttled by delay/lockout) and offline (attacker has a stolen hash database, limited only by hardware speed). Defences: long passphrases, MFA, rate limiting, account lockout, breach-password screening, slow salted hashing (Unit 5).
Worked example. Keyspace for an 8-character password from 36 symbols: 36⁸ ≈ 2.8×10¹². Online at 10 guesses/second ≈ 8,946 years to exhaust (half on average). Offline at 10¹⁰ guesses/second ≈ 282 seconds. Offline with bcrypt (~10⁴/sec) ≈ 9 years. This shows why offline hash theft is critical and why slow hashing matters.
Use case. A stolen user database: attackers crack hashes offline; strong hashing buys time for password resets.
Comparison. Online attack (throttled, network-bound) vs offline attack (fast, local, dangerous after a breach).
Common mistakes. Reusing passwords across sites (credential stuffing); short passwords.
Exam points. Contrast online vs offline password attacks; compute keyspace and cracking time; state defences.
Self-check. Q: Why is an offline password attack faster? A: No network delay, no lockout, limited only by hardware.
8.3 Steganography and watermarking
Definition and why it matters. Steganography hides the existence of data (unlike encryption, which hides content); watermarking embeds ownership/author info.
Core theory. Steganography hides data inside cover media (least-significant bits of image pixels, audio, video) so the presence of the message is undetectable. Used for data exfiltration and occasionally command channels. Watermarking embeds a visible/invisible mark to assert copyright or ownership.
Worked example. Hide a byte in the least-significant bit of 8 consecutive image pixels; the image looks unchanged but carries the hidden byte. Detecting it requires statistical analysis (steganalysis).
Use case. Covert channels (defensive lab: detect hidden data); copyright watermarking.
Comparison. Encryption (hides content, presence obvious) vs steganography (hides presence) vs watermarking (asserts ownership).
Common mistakes. Confusing steganography with encryption; assuming hidden data is secure (steganography ≠ encryption).
Exam points. Define steganography and watermarking; contrast with encryption; give a hiding example (LSB).
Self-check. Q: Does steganography hide that a message exists? A: Yes.
8.4 Network management security: SNMP
Definition and why it matters. SNMP manages network devices; insecure SNMP exposes device configuration and credentials.
Core theory. SNMP versions: v1/v2c (community strings, cleartext, weak), v3 (authentication, encryption, access control). Community strings like "public"/"private" are default and must be changed. SNMP can read device state and sometimes write configuration — a compromise lets an attacker reconfigure or sniff the network.
Worked example. SNMPv2c with community "public" lets anyone query router interface stats. SNMPv3 with auth+priv encrypts and authenticates queries, restricting access by user.
Use case. Securing network monitoring in a campus network.
Comparison. SNMPv1/v2c (insecure, cleartext community) vs SNMPv3 (secure, authenticated/encrypted).
Common mistakes. Leaving default community strings; exposing SNMP to the internet.
Exam points. Contrast SNMPv2c vs SNMPv3 security; state why default community strings are dangerous.
Self-check. Q: Which SNMP version provides authentication and encryption? A: SNMPv3.
8.5 Secure Electronic Transaction and the dual signature
Definition and why it matters. SET was a protocol for secure credit-card payments online; the dual signature links order information and payment information without revealing each to the other party.
Core theory. Customer, merchant, bank. The customer signs a dual signature: H(order info || payment info) structure where the merchant sees order info (not card details) and the bank sees payment info (not order details), linked by the dual signature so neither can alter without detection.
Worked example. Customer sends merchant: order info + dual signature (merchant can verify order integrity but not read card number). Customer sends bank: payment info + dual signature (bank verifies payment but not order contents). The dual signature binds them so the merchant cannot claim a different order and the bank cannot change the amount.
Use case. Historical secure card payments; understanding privacy-preserving designs.
Comparison. SET (dual signature separates order and payment) vs modern TLS card payment (merchant sees card via gateway).
Common mistakes. Confusing SET with SSL/TLS (SET is application-level payment security; TLS is transport security).
Exam points. Describe the dual signature and which party sees what; name participants (customer, merchant, bank).
Self-check. Q: In SET, does the merchant see the card number? A: No — the bank sees payment info; the merchant sees order info.
8.6 Cybercrime and the law
Definition and why it matters. Cybercrime law defines offences (unauthorized access, damage, fraud) and penalties, and sets the boundary between authorized security testing and illegal hacking.
Core theory. Offences typically include unauthorized access to a computer system, unauthorized interception, data damage/destruction, computer-related fraud, and misuse of devices. Penalties range from fines to imprisonment. Authorized penetration testing requires written rules of engagement (scope, permission, stop conditions) to remain legal.
Worked example. A student testing a college web server "to help" without permission commits unauthorized access. The lawful path: obtain written permission, define scope and stop conditions, test only in-scope systems, report findings.
Use case. Understanding legal risk before any lab testing; writing a rules-of-engagement document.
Comparison. Authorized testing (written permission, in scope) vs unauthorized access (illegal, regardless of intent).
Common mistakes. "I was just trying to help" is not a legal defence; testing systems you do not own without written authorization.
Exam points. Name common cybercrime offences; state the requirement for written authorization before testing.
Self-check. Q: Is good intent a defence for unauthorized access? A: No — written authorization is required.
8.7 Cloud, mobile and e-mail security in brief
Definition and why it matters. Modern systems span cloud, mobile devices, and email; each has specific threats and controls.
Core theory. Cloud: shared responsibility model (cloud provider secures the cloud; customer secures data/configuration); misconfigurations (open S3 buckets, disabled MFA) are common causes of breaches. Mobile: app sandboxing, OS updates, app permissions, MDM. Email: phishing, spam, malware attachments, Business Email Compromise; defences: SPF/DKIM/DMARC, user training, MFA.
Worked example. A cloud storage bucket left publicly readable exposes customer records — a customer-side misconfiguration, not the provider's fault. Mobile: an app requesting SMS access for no reason is suspicious.
Use case. Auditing cloud storage permissions; recognizing phishing email.
Comparison. Cloud provider security vs customer responsibility; mobile app sandbox vs desktop.
Common mistakes. Assuming the cloud provider handles all security; clicking links in unexpected emails.
Exam points. Describe the shared responsibility model; name email defences (SPF/DKIM/DMARC); list mobile risks.
Self-check. Q: Who secures customer data in the cloud under shared responsibility? A: The customer.
Unit 8 summary
Unit 8 covers malware (virus, worm, trojan, ransomware, rootkit, botnet), intruders and password attacks (online vs offline), steganography and watermarking, SNMP security (v1/v2c vs v3), SET dual signatures, cybercrime law, and cloud/mobile/email security. Students should distinguish malware families, compare online and offline password cracking, and state legal requirements for security testing.
Detailed practice questions and answer keys
Question 1: Compare symmetric and asymmetric cryptography.
Answer key:
- Symmetric cryptography uses one shared key for encryption and decryption; it is fast and suited to bulk data (AES, DES). The challenge is secure key distribution.
- Asymmetric cryptography uses a key pair: public key encrypts/verifies, private key decrypts/signs (RSA, ECC). It solves key distribution but is much slower.
- Hybrid systems combine both: public-key to exchange a session key, symmetric (AES) to encrypt the data.
- Exam difference: symmetric = one key, fast, key-distribution problem; asymmetric = two keys, slower, used for key exchange and signatures.
Question 2: Trace AES-128 encryption conceptually with a 128-bit block.
Answer key:
- The 128-bit block is arranged as a 4×4 byte state matrix.
- Initial round: AddRoundKey with round key 0.
- Rounds 1–9: SubBytes (S-box), ShiftRows (row i rotated by i), MixColumns (column mixing in GF(2⁸)), AddRoundKey.
- Final round 10: SubBytes, ShiftRows, AddRoundKey (MixColumns omitted).
- Each round uses a different round key derived by the key schedule. AES-128 uses 10 rounds; AES-192 uses 12; AES-256 uses 14.
Question 3: Describe the TLS handshake and how it establishes a secure connection.
Answer key:
- ClientHello: client sends supported versions, cipher suites, and a random.
- ServerHello: server selects cipher suite, sends its certificate and a random.
- Key exchange: client and server derive a shared secret (RSA or Diffie-Hellman/ECDHE).
- Certificate verification: client validates the server certificate against trusted root CAs.
- Finished/ChangeCipherSpec: both sides confirm and begin encrypted record traffic.
- TLS provides encryption, server authentication, and integrity for HTTPS.
Question 4: Compute an RSA key pair and encrypt/decrypt a small message (use tiny primes for illustration).
Answer key:
- Choose p = 11, q = 13. n = 143. φ(n) = (11−1)(13−1) = 10×12 = 120.
- Choose e = 7 (gcd(7,120) = 1). Compute d = 7⁻¹ mod 120 = 103 (7×103 = 721 = 6×120 + 1).
- Public key = (143, 7); private key = (143, 103).
- Encrypt m = 9: c = 9⁷ mod 143 = 48.
- Decrypt: 48¹⁰³ mod 143 = 9. ✓
- Note: these tiny primes are for illustration only; real RSA uses 2048+ bit primes and padding (OAEP/PKCS#1).
Question 5: Explain Diffie-Hellman key exchange with small numbers and state its security basis.
Answer key:
- Public: prime p and primitive root g. Alice picks private a, sends A = gᵃ mod p. Bob picks private b, sends B = gᵇ mod p.
- Alice computes s = Bᵃ mod p = g^(ab) mod p. Bob computes s = Aᵇ mod p = g^(ab) mod p. Both share s.
- An eavesdropper sees g, p, A, B but cannot easily compute g^(ab) (discrete-log problem).
- Example: p = 23, g = 5, a = 6 -> A = 8; b = 15 -> B = 19; shared s = 2.
- Security basis: computing gᵃ is easy; recovering a or g^(ab) from A, B is hard for large p.
Question 6: Describe HMAC and contrast it with a digital signature.
Answer key:
- HMAC = keyed hash: HMAC(K, m) = H((K⊕opad)||H((K⊕ipad)||m)). Both parties share K; it provides integrity and authenticity but not non-repudiation.
- Digital signature = sign(hash(m)) with a private key; anyone with the public key verifies; provides non-repudiation.
- HMAC is faster; signatures use public-key crypto and are slower.
- HMAC resists length-extension attacks that naive H(K||m) suffers.
Question 7: Describe a firewall, IDS, and VPN, and where each fits.
Answer key:
- Firewall: filters traffic by rules (packet/stateful/proxy), default-deny; network perimeter or host.
- IDS: detects and alerts (signature or anomaly; NIDS/HIDS); IPS also blocks.
- VPN: encrypted tunnel over a public network (remote-access or site-to-site; IPsec/SSL/WireGuard).
- Fit: firewall at the edge, IDS inside/at the edge for detection, VPN for remote/branch secure access.
Mermaid diagrams
RSA key generation and encryption flowchart
flowchart TD
A[Choose two large primes p, q] --> B[Compute n = p × q]
B --> C[Compute φ(n) = (p−1)(q−1)]
C --> D[Choose e: 1 < e < φ(n), gcd(e, φ(n)) = 1]
D --> E[Compute d = e⁻¹ mod φ(n)]
E --> F[Public key = (n, e); Private key = (n, d)]
F --> G[Encrypt: c = mᵉ mod n]
G --> H[Decrypt: m = cᵈ mod n]
H --> I[Verify: recovered m matches original]
Explanation: RSA key generation derives the public and private keys from two primes. Encryption uses the public key; only the private key can decrypt. Security relies on the difficulty of factoring n.
Diffie-Hellman key exchange sequence diagram
sequenceDiagram
participant A as Alice
participant B as Bob
A->>A: pick private a
B->>B: pick private b
A->>B: A = gᵃ mod p
B->>A: B = gᵇ mod p
A->>A: s = Bᵃ = g^(ab) mod p
B->>B: s = Aᵇ = g^(ab) mod p
note over A,B: Shared secret s established; eavesdropper sees only g, p, A, B
Explanation: Alice and Bob derive the same shared secret g^(ab) from exchanged values, without ever sending the secret itself. An eavesdropper cannot feasibly compute g^(ab) from A and B (discrete-log hardness).
AES round structure flowchart
flowchart TD
S[State: 4×4 byte matrix] --> AR0[AddRoundKey round 0]
AR0 --> R1[Round 1: SubBytes]
R1 --> SR[ShiftRows]
SR --> MC[MixColumns]
MC --> AR[AddRoundKey]
AR --> Rn[Rounds 2..(Nr−1) repeat]
Rn --> Final[Final round: SubBytes, ShiftRows, AddRoundKey (no MixColumns)]
Final --> C[Ciphertext]
Explanation: Each AES round applies SubBytes, ShiftRows, MixColumns, and AddRoundKey; the final round omits MixColumns. The number of rounds Nr depends on key size (10/12/14 for AES-128/192/256).
TLS handshake sequence diagram
sequenceDiagram
participant C as Client
participant S as Server
C->>S: ClientHello (versions, cipher suites, random)
S->>C: ServerHello, Certificate, ServerHelloDone
C->>S: ClientKeyExchange, ChangeCipherSpec, Finished
S->>C: ChangeCipherSpec, Finished
C-->>S: Encrypted application data (HTTPS)
Explanation: The handshake negotiates ciphers, authenticates the server via its certificate, and derives keys; then application data is encrypted.
Pitfalls and common mistakes
- Using ECB mode for real data: ECB reveals plaintext patterns (e.g., image outlines). Always use CBC, CTR, or an authenticated mode with a unique IV/nonce.
- Reusing an IV/nonce in CTR or GCM: Catastrophic — reveals XOR of plaintexts and can forge authentication tags.
- Textbook RSA without padding: Deterministic and insecure; always use OAEP for encryption or PSS for signatures.
- Using MD5 or SHA-1: Collision attacks are practical; use SHA-256 or SHA-3 for new work.
- Reusing OTP keys: A two-time pad exposes the XOR of two plaintexts; never reuse a one-time pad key.
- Weak or short passwords / no MFA: Easy to crack or stuff; enforce long passphrases and multi-factor authentication.
- Accepting invalid TLS/SSH certificates: Enables man-in-the-middle; always validate certificates and host keys.
- Storing passwords in plain text or unsalted fast hashes: Use unique salts and a slow KDF (Argon2id/bcrypt/scrypt/PBKDF2).
- Hardcoding keys in source code: Use environment variables, secrets vaults, or HSMs; rotate and revoke.
- Testing systems without written permission: Illegal regardless of intent; obtain written rules of engagement first.
References
- Stallings, W. (2017). Cryptography and Network Security: Principles and Practice (7th ed.). Pearson.
- FIPS PUB 197: Advanced Encryption Standard (AES).
- RFC 5246: The Transport Layer Security (TLS) Protocol Version 1.2.
- RFC 5869: HMAC-based Extract-and-Expand Key Derivation Function (HKDF).
- OWASP Password Storage Cheat Sheet (Argon2id, bcrypt, scrypt, PBKDF2 guidance).
- Tribhuvan University. (2025). Curriculum of Bachelor of Computer Applications (BCA), Semester VI — course record BCA353 (structure only; no verified numbered unit outline).
- NEBians syllabus pages (third-party candidate outline), https://nebians.consica.com.np/app/syllabus/bca-course/cryptography-network-security/, captured 2026-11-20. Not official, not verified.