๐Ÿ” PEC321 โ€” Network Security

Osmania University MCA 3 Credits 2025โ€“2026

โœ๏ธ Complete Visual Study Notes โ€” All 5 Units โœ๏ธ


๐Ÿ“˜ Unit I โ€” Introduction to Network Security
๐Ÿ›ก๏ธ Security Attributes (CIA + extras)
๐Ÿ”’
Confidentiality
Only authorized can read
โœ…
Integrity
Data not tampered
โšก
Availability
System always accessible
๐Ÿชช
Authenticity
Identity verified
๐Ÿ“œ
Non-Repudiation
Can't deny actions
๐Ÿ—๏ธ
Authorization
Permission granted
๐ŸŽญ
Anonymity
Identity hidden

โš”๏ธ Types of Attacks
๐Ÿ’ฃ DoS / DDoS

Denial of Service โ€” Overwhelms server with fake requests so legitimate users can't connect.
DDoS = Distributed (many sources)

Many Bots
โ†’
Flood Server
โ†’
๐Ÿ”ด Server Down
๐ŸŽญ IP Spoofing

Attacker fakes their IP address to impersonate a trusted host and bypass security filters.

Attacker
IP: X
โ†’
Fake IP
sends: Y
โ†’
Server
trusts Y
๐Ÿ” Replay Attack

Attacker captures valid data and retransmits it later to deceive the receiver.

Capture
Packet
โ†’
Wait &
Replay
โ†’
Server
deceived
๐Ÿ•ต๏ธ Man-in-the-Middle (MITM)

Attacker intercepts communication between two parties without their knowledge, can read, modify, or inject messages.

๐Ÿ‘ฉ Alice
โ†’
๐Ÿ˜ˆ Attacker
(intercepts)
โ†’
๐Ÿ‘จ Bob
โ† Alice thinks she's talking to Bob directly!

๐Ÿฆ  General Threats โ€” Worms, Viruses & Trojans

๐Ÿฆ  Virus

Attaches to legitimate files.
Needs human action to spread (opening file).
Corrupts or deletes data.
Example: ILOVEYOU virus

๐Ÿชฑ Worm

Self-replicating โ€” no human needed.
Spreads across networks automatically.
Consumes bandwidth & resources.
Example: WannaCry worm

๐Ÿด Trojan

Disguised as legitimate software.
Creates backdoor for attackers.
Doesn't self-replicate.
Example: RAT (Remote Access Trojan)
๐Ÿ“ Key difference: Virus needs host file, Worm is standalone, Trojan looks legitimate but is malicious!
๐Ÿ“— Unit II โ€” Cryptography (Secret & Public Key)
๐Ÿ”ต DES โ€” Data Encryption Standard
๐Ÿ“„ Plaintext
(64-bit)
โ†’
๐Ÿ”€ Initial
Permutation
โ†’
Lโ‚€ Left 32-bit
Rโ‚€ Right 32-bit
โ†’
๐Ÿ” 16 Feistel Rounds
Rแตขโ‚‹โ‚
โ†’
F(Rแตขโ‚‹โ‚, Kแตข)
โ†’
โŠ• Lแตขโ‚‹โ‚
๐Ÿ”‘ 56-bit key โ†’ 16 subkeys Kโ‚โ€ฆKโ‚โ‚†
โ†’
๐Ÿ”„ Swap
โ†’
๐Ÿ“‹ Final
Perm
โ†’
๐Ÿ”’ Cipher
64-bit
๐Ÿ“ Symmetric, 56-bit key, 64-bit block, 16 rounds โ€” now considered WEAK, replaced by AES

๐ŸŸข Triple DES (3DES) โ€” EDE Mode
๐Ÿ“„ Plaintext
โ†’
๐Ÿ” E(Kโ‚)
Encrypt
โ†’
๐Ÿ”“ D(Kโ‚‚)
Decrypt
โ†’
๐Ÿ” E(Kโ‚ƒ)
Encrypt
โ†’
๐Ÿ”’ Ciphertext
๐Ÿ“ 168-bit key (3ร—56), backward compatible with DES if Kโ‚=Kโ‚‚=Kโ‚ƒ, used in banking/legacy

๐ŸŸฉ AES โ€” Advanced Encryption Standard
๐Ÿ“„ Plaintext
128-bit
โ†’
โž• Initial
AddRoundKey
โ†’
N
Rounds
โ†’
๐Ÿ”’ Ciphertext
๐Ÿ”กSubBytes
S-Box substitution
โ†”๏ธShiftRows
Cyclic row shifts
๐Ÿ”€MixColumns
GF(2โธ) multiply
โŠ•AddRoundKey
XOR round key
128-bit โ†’ 10 rounds 192-bit โ†’ 12 rounds 256-bit โ†’ 14 rounds
๐Ÿ“ Current gold standard โ€” used in WPA2, TLS, file encryption. Much stronger than DES!

๐Ÿ”‘ Key Distribution Problem & Solutions

โŒ Problem

How do Alice & Bob share a secret key securely without meeting in person?
If you send key over insecure channel โ†’ attacker intercepts it!

โœ… Solutions

1๏ธโƒฃ Physical exchange (meet in person)
2๏ธโƒฃ Trusted Key Distribution Center (KDC)
3๏ธโƒฃ Diffie-Hellman key exchange
4๏ธโƒฃ Public Key Infrastructure (PKI)

๐Ÿ”ด RSA โ€” Public Key Cryptography

๐Ÿ—๏ธ Key Generation Steps

โ‘  Choose large primes p and q
โ‘ก Compute n = p ร— q
โ‘ข ฯ†(n) = (pโˆ’1)(qโˆ’1)
โ‘ฃ Choose e: gcd(e, ฯ†) = 1
โ‘ค Compute d: dยทe โ‰ก 1 (mod ฯ†)
๐Ÿ“ข Public Key: (e,n)   ๐Ÿ”’ Private Key: (d,n)
๐Ÿ“จ Message M
โ†“
๐Ÿ” C = Mแต‰ mod n  (use Public Key)
โ†“
๐Ÿ”’ Ciphertext C
โ†“
๐Ÿ”“ M = Cแตˆ mod n  (use Private Key)
โ†“
๐Ÿ“จ Original Message M
๐Ÿ“ Asymmetric โ€” 2 different keys. Security based on difficulty of factoring large numbers. Used in HTTPS, digital signatures.

๐ŸŸฃ ECC โ€” Elliptic Curve Cryptography

๐Ÿ“ What is ECC?

Based on algebraic structure of elliptic curves over finite fields.
Equation: yยฒ = xยณ + ax + b
Provides same security as RSA with much smaller keys!

RSA 2048-bit โ‰ˆ ECC 224-bit ๐ŸŽฏ

โœ… Advantages of ECC

๐Ÿ”‹ Less computation โ€” ideal for mobile
๐Ÿ”‘ Smaller key sizes โ€” faster operations
๐Ÿ“ถ Less bandwidth โ€” good for IoT
๐Ÿ›ก๏ธ Strong security โ€” discrete log on EC hard
Used in: Bitcoin, TLS 1.3, SSH

๐ŸŸ  Diffie-Hellman Key Exchange
๐ŸŒ Public: p (prime) and g (generator)

๐Ÿ‘ฉ Alice

๐ŸŽฒ Secret: a
Compute: A = gแตƒ mod p
๐Ÿ“ค Send A to Bob
๐Ÿ“ฅ Receive B
๐Ÿ”‘ Key = Bแตƒ mod p
A โ†’
public exchange
โ† B
๐Ÿค Shared Secret
S = gแตƒแต‡ mod p

๐Ÿ‘จ Bob

๐ŸŽฒ Secret: b
Compute: B = gแต‡ mod p
๐Ÿ“ค Send B to Alice
๐Ÿ“ฅ Receive A
๐Ÿ”‘ Key = Aแต‡ mod p
๐Ÿ“ Never transmits the secret! Eavesdropper sees A & B but can't compute gแตƒแต‡ (discrete log problem). Foundation of TLS!

โ˜• Java Cryptography Extensions (JCE) & Attacks

โ˜• JCE Overview

Java framework providing cryptographic APIs.
Supports: AES, DES, RSA, SHA, HMAC
Key classes: Cipher, KeyGenerator, MessageDigest, Signature
Provider model: Sun, BouncyCastle etc.

โš”๏ธ Crypto Attacks

๐Ÿ”‘ Brute Force โ€” try all keys
๐Ÿ“– Dictionary Attack โ€” common passwords
๐Ÿ”ค Known Plaintext โ€” attacker knows P & C
๐ŸŽฏ Chosen Plaintext โ€” attacker chooses P
๐Ÿ• Timing Attack โ€” measure execution time
๐Ÿ”ข Birthday Attack โ€” hash collisions
๐Ÿ“™ Unit III โ€” Integrity, Authentication & Non-Repudiation
๐ŸŸฃ Hash Functions โ€” MD5 & SHA
๐Ÿ“ "Hello"
โ†’
SHA-
256
โ†’
185f8db32921bd46d39f6a43
db8a6ce4a56a2a0de40923cd
(256-bit fixed output)

๐Ÿ” MD5 vs SHA Comparison

MD5: 128-bit output โ€” โš ๏ธ BROKEN (collisions found)
SHA-1: 160-bit output โ€” โš ๏ธ Deprecated
SHA-256: 256-bit output โ€” โœ… Secure
SHA-512: 512-bit output โ€” โœ… Very Secure

โšก Hash Properties

โœ… One-way โ€” can't reverse hash โ†’ input
โœ… Deterministic โ€” same input = same hash
โœ… Avalanche effect โ€” 1 bit change โ†’ totally different hash
โœ… Collision resistant โ€” no two inputs same hash
๐Ÿ“ Uses: Password storage, file integrity, blockchain, digital certificates, HMAC

๐Ÿ”‘ MAC โ€” Message Authentication Code
๐Ÿ“จ Message M
โ†’
MAC Algorithm
+ Secret Key K
โ†’
๐Ÿท๏ธ MAC Tag
โ†’
Send (M + MAC) together
Receiver computes MAC'
โ†’
Compare MAC' == MAC?
โ†’
โœ… Authentic if equal

HMAC โ€” Hash-based MAC

HMAC(K,M) = H((KโŠ•opad) || H((KโŠ•ipad)||M))
Uses hash function + secret key.
More secure than plain MAC.
Used in: TLS, JWT tokens, APIs

MAC vs Hash vs Encryption

๐Ÿ” Hash โ€” integrity only, no key
๐Ÿ”‘ MAC โ€” integrity + authentication (shared key)
๐Ÿ”’ Encryption โ€” confidentiality
๐Ÿ–Š๏ธ Digital Sig โ€” integrity + non-repudiation

โœ๏ธ Digital Signature using RSA
๐Ÿ“ค Signing (by Sender)
๐Ÿ“จ Message M
โ†“
Hash(M) โ†’ digest h
โ†“
Sign: S = hd mod n
(use Private Key)
โ†“
๐Ÿ“ค Send (M, S)
๐Ÿ“ฅ Verification (by Receiver)
๐Ÿ“ฅ Receive (M, S)
โ†“
Recover: h' = Se mod n
(use Public Key)
โ†“
Compute Hash(M) โ†’ h
โ†“
h == h' ? โœ… Valid!
๐Ÿ“ Provides Authentication + Integrity + Non-Repudiation! Sender can't deny signing!

๐Ÿ“ DSA โ€” Digital Signature Algorithm

How DSA Works

Based on discrete logarithm problem.
US Government standard (FIPS 186).
Signature = pair (r, s)
Uses prime p, q, generator g
Private key: x    Public key: y = gหฃ mod p

RSA vs DSA

RSA: Both encrypt AND sign
DSA: Only for digital signatures
RSA: Slower verification
DSA: Faster signing, slower verification
Both: Used in SSL/TLS certificates

๐Ÿซต Biometric Authentication

๐Ÿ‘† Physiological

Fingerprint ๐Ÿ–๏ธ
Face recognition ๐Ÿ˜Š
Iris scan ๐Ÿ‘๏ธ
Retina scan
Hand geometry

๐Ÿšถ Behavioral

Keystroke dynamics โŒจ๏ธ
Voice recognition ๐ŸŽ™๏ธ
Signature dynamics โœ๏ธ
Gait analysis ๐Ÿšถ
Mouse movements

โš™๏ธ Auth Flow

1. Enroll & store template
2. Scan biometric input
3. Extract features
4. Compare with template
5. Match? โœ… Grant access
๐Ÿ“ FAR (False Accept Rate) and FRR (False Reject Rate) are key metrics for biometric systems
๐Ÿ“• Unit IV โ€” PKI, Smart Cards & Firewalls
๐Ÿ” PKI โ€” Public Key Infrastructure
Root CA
๐Ÿ›๏ธ (Trust Anchor)
โ†’
Intermediate CA
๐Ÿข
โ†’
End Entity
Certificate ๐Ÿ“œ
โ†’
User/Server
๐Ÿ–ฅ๏ธ๐Ÿ‘ฉ

๐Ÿ›๏ธ Digital Certificates (X.509)

Certificate contains:
๐Ÿ“‹ Owner's name & public key
๐Ÿ” CA's digital signature
๐Ÿ“… Validity period
๐Ÿ”ข Serial number
๐ŸŒ Subject Alternative Name (SAN)

๐Ÿข Certifying Authority (CA)

Trusted third party that issues certificates.
Verifies identity before issuing.
Maintains Certificate Revocation List (CRL).
Examples: DigiCert, Let's Encrypt, VeriSign
OCSP โ€” Online Certificate Status Protocol

๐Ÿ”‘ POP โ€” Proof of Possession Key Interface

Proves the user actually possesses the private key corresponding to the public key in the certificate.
Methods: Signature-based POP (sign a challenge), Encryption-based POP (decrypt a challenge), Key agreement POP.
Used in certificate enrollment protocols like CRMF/CMP.

๐Ÿ”ฅ Firewalls โ€” System Security
๐ŸŒ Internet
(Untrusted)
โ†’
๐Ÿ”ฅ
FIREWALL
Block / Allow rules
โ†’
๐Ÿ  Internal
Network (Safe)

๐Ÿ“ฆ Packet Filter

Inspects IP headers.
Rules based on src/dest IP, port, protocol.
Stateless โ€” no connection memory.
Fast but limited!

๐Ÿ” Stateful Inspection

Tracks TCP connection state.
Maintains connection table.
More secure than packet filter.
Knows if packet is NEW or ESTABLISHED

๐Ÿ–ฅ๏ธ Application Gateway

Works at application layer.
Acts as proxy server.
Deep packet inspection.
Understands HTTP, FTP, SMTP etc.

๐Ÿ›ก๏ธ VPN โ€” Virtual Private Network
๐Ÿ  User
(Home)
โ†’
๐Ÿ” Encrypted
Tunnel
โ†’
๐Ÿ”’ VPN
Server
โ†’
๐Ÿข Corporate
Network

VPN Protocols

๐Ÿ”ต IPSec โ€” network layer, strong encryption
๐ŸŸข SSL/TLS โ€” application layer, web-based
๐ŸŸ  OpenVPN โ€” open source, flexible
๐ŸŸฃ WireGuard โ€” modern, fast, simple

VPN Modes

๐Ÿ‘ค Remote Access โ€” user to network
๐Ÿข Site-to-Site โ€” network to network
๐Ÿ“ฑ Client VPN โ€” device to server
Tunneling: encapsulates encrypted packets inside normal packets

๐Ÿ’ณ Smart Cards & Zero Knowledge Protocols
๐Ÿ’ณ Smart Card Anatomy
Contains: Microprocessor + Memory (ROM/RAM/EEPROM)
๐Ÿ“ก Contact or contactless interface
๐Ÿ”‘ Stores cryptographic keys securely
๐Ÿ›ก๏ธ Tamper-resistant hardware
Types: EMV cards, SIM cards, ID cards, transit cards
๐Ÿ’ณ Card
Inserted
โ†’
Mutual
Auth
โ†’
โœ… Access
Granted

๐Ÿง™ Zero Knowledge Proof (ZKP)

Prover convinces Verifier they know a secret without revealing the secret!

๐ŸŽฎ Classic example: Peggy knows path in a cave, Victor verifies without seeing the path.

Properties:
โœ… Completeness โ€” honest prover always convinces
โœ… Soundness โ€” cheater can't fool verifier
โœ… Zero-Knowledge โ€” no info leaked

Used in: Smart cards, zkSNARKs, blockchain privacy

โš”๏ธ Attacks on Smart Cards

โšก Power Analysis (SPA/DPA)
Measures power consumption to extract keys
โฑ๏ธ Timing Attack
Measures time to execute operations to infer secrets
๐Ÿ”ง Fault Injection
Induces errors via voltage glitches, laser, EM fields
๐Ÿ“’ Unit V โ€” Applications of Network Security
๐ŸŽซ Kerberos Authentication Protocol
Ticket-based authentication โ€” no passwords sent over network!

Step 1: AS Exchange

๐Ÿ‘ค Client โ†’ AS (Auth Server)
Send: Username
Receive: TGT (Ticket Granting Ticket)
encrypted with client's password hash

Step 2: TGS Exchange

๐Ÿ‘ค Client โ†’ TGS (Ticket Granting Server)
Send: TGT + requested service
Receive: Service Ticket (ST)
encrypted with service's key

Step 3: Client-Server

๐Ÿ‘ค Client โ†’ Application Server
Send: Service Ticket (ST)
Server decrypts โ†’ verifies
โœ… Access Granted!
๐Ÿ‘ค Client
โ‡„
๐Ÿ›๏ธ AS
Auth Server
โ‡„
๐ŸŽซ TGS
Ticket Server
โ‡„
๐Ÿ–ฅ๏ธ App
Server
๐Ÿ“ Kerberos uses symmetric key crypto (AES). Uses timestamps to prevent replay attacks. Default in Windows AD!

๐ŸŒ SSL / TLS โ€” Web Security Protocol

๐Ÿค TLS Handshake

1๏ธโƒฃ Client Hello โ€” supported ciphers, random
2๏ธโƒฃ Server Hello โ€” chosen cipher, certificate
3๏ธโƒฃ Client verifies certificate (CA chain)
4๏ธโƒฃ Key Exchange (RSA or DH)
5๏ธโƒฃ Both compute session key
6๏ธโƒฃ Finished โ€” encrypted channel ready! ๐Ÿ”

๐Ÿ“‹ TLS Protocol Stack

Application (HTTP, FTP, SMTP)
โ†•
TLS Record Layer (encrypt/decrypt)
โ†•
TLS Handshake Protocol
โ†•
TCP / IP Transport
๐Ÿ“ SSL 3.0 is deprecated! Use TLS 1.2 or TLS 1.3. HTTPS = HTTP over TLS. Provides confidentiality + authentication + integrity!

๐Ÿ” IPSec โ€” IP Security Protocol

๐Ÿ“ฆ IPSec Protocols

AH (Authentication Header)
โ†’ Provides Integrity + Authentication
โ†’ No encryption of payload

ESP (Encapsulating Security Payload)
โ†’ Provides Confidentiality + Integrity + Auth
โ†’ Encrypts the payload

๐Ÿš‡ IPSec Modes

Transport Mode:
โ†’ Encrypts only payload
โ†’ Original IP header preserved
โ†’ Used for host-to-host

Tunnel Mode:
โ†’ Encrypts entire IP packet
โ†’ New IP header added
โ†’ Used for VPNs (gateway-to-gateway)
Original
IP Packet
โ†’
IKE
Key Exchange
โ†’
SA
(Security Assoc.)
โ†’
ESP/AH
Applied
โ†’
๐Ÿ”’ Secure
Packet

๐Ÿ’ณ Electronic Payments, E-Cash & Micro Payments

๐Ÿ’ป E-Commerce Payment

Customer โ†’ Merchant โ†’ Payment Gateway โ†’ Bank

Uses SSL/TLS for transmission.
Credit card details encrypted.
3D Secure (3DS) for extra auth.
PCI-DSS compliance required.

๐Ÿ’ฐ E-Cash (Digital Cash)

Electronic equivalent of physical cash.
Anonymous โ€” like real cash!
Uses blind signatures (Chaum protocol).
Bank issues signed digital coins.
Can't trace who spent which coin.

๐Ÿช™ Micro Payments

Very small transactions (< $1).
Need low overhead protocols.
Examples: Pay-per-article, streaming bits.
Protocols: HashCash, PayWord, MicroMint.
Also: Lightning Network (Bitcoin)

๐Ÿ›’ SET โ€” Secure Electronic Transaction

๐ŸŽญ SET Participants

๐Ÿ‘ค Cardholder โ€” buyer
๐Ÿช Merchant โ€” seller
๐Ÿฆ Issuer โ€” cardholder's bank
๐Ÿ›๏ธ Acquirer โ€” merchant's bank
๐Ÿ” CA โ€” issues digital certificates
๐Ÿ’ณ Payment Gateway โ€” connects networks

๐Ÿ” SET Security Features

โœ… Dual Signature โ€” merchant sees order, bank sees payment info (neither sees both!)
โœ… Cardholder authentication via certificate
โœ… Merchant authentication via certificate
โœ… DES for bulk encryption
โœ… RSA for key exchange

๐Ÿข Case Studies โ€” .NET & J2EE Security

๐Ÿ”ท .NET Security Model

Code Access Security (CAS) โ€” controls what code can do
Role-Based Security โ€” user roles & permissions
Cryptography: System.Security.Cryptography namespace
AES, RSA, SHA, HMAC built-in
ASP.NET: Forms auth, Windows auth, SSL
Claims-based identity โ€” modern approach

โ˜• J2EE Security Model

JAAS โ€” Java Authentication & Authorization Service
JSSE โ€” Java Secure Socket Extension (SSL/TLS)
JCE โ€” Java Cryptography Extension
Declarative Security โ€” in deployment descriptor
Programmatic Security โ€” in code
Servlet containers handle authentication

๐Ÿ“Š Master Quick Reference Table
Topic Unit Key Points Use Case
๐Ÿ”ต DESIISymmetric, 56-bit key, 16 Feistel roundsโš ๏ธ Legacy only
๐ŸŸข 3DESIIEDE mode, 168-bit, 3ร— DES operationsBanking (legacy)
๐ŸŸฉ AESIISymmetric, 128/192/256-bit, 128-bit blockโœ… WPA2, TLS, files
๐Ÿ”ด RSAIIAsymmetric, public/private key pairโœ… HTTPS, email
๐ŸŸฃ ECCIIAsymmetric, smaller keys, elliptic curvesโœ… Mobile, IoT, TLS 1.3
๐ŸŸ  Diffie-HellmanIIKey exchange, discrete log problemโœ… TLS handshake
๐ŸŸฃ SHA-256/MD5IIIHash function, one-way, fixed outputโœ… Passwords, blockchain
๐Ÿ”‘ MAC/HMACIIIMessage authentication + integrityโœ… API auth, JWT
โœ๏ธ Digital Sig RSA/DSAIIINon-repudiation + authenticationโœ… Certs, contracts
๐Ÿ” PKI/CAIVCertificate hierarchy, X.509โœ… HTTPS everywhere
๐Ÿ”ฅ FirewallIVPacket filter / Stateful / App gatewayโœ… Network protection
๐Ÿ’ณ Smart Card/ZKPIVTamper-resistant, zero knowledge proofsโœ… Banking, ID cards
๐ŸŽซ KerberosVTicket-based auth, AS+TGS+Serviceโœ… Windows AD, SSO
๐ŸŒ SSL/TLSVHandshake โ†’ session key โ†’ encrypted channelโœ… All HTTPS traffic
๐Ÿ” IPSecVAH + ESP, Transport/Tunnel modeโœ… VPNs, site-to-site
๐Ÿ›’ SETVDual signature, e-commerce securityE-commerce
โœ๏ธ Osmania University MCA โ€” PEC321 Network Security โ€” 2025-2026 ๐Ÿ”