0% found this document useful (0 votes)
2 views31 pages

Cryptography Complete Notes

The document provides comprehensive semester notes on Cryptography and Network Security for B.Tech students, covering five units that include security trends, cryptographic techniques, message authentication, and system security practices. It emphasizes the importance of the CIA Triad (Confidentiality, Integrity, Availability) and outlines various security threats, legal frameworks, and ethical considerations in cybersecurity. Additionally, it discusses classical and modern cryptographic methods, including encryption techniques and the principles of information security.

Uploaded by

joydebroy3669
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views31 pages

Cryptography Complete Notes

The document provides comprehensive semester notes on Cryptography and Network Security for B.Tech students, covering five units that include security trends, cryptographic techniques, message authentication, and system security practices. It emphasizes the importance of the CIA Triad (Confidentiality, Integrity, Availability) and outlines various security threats, legal frameworks, and ethical considerations in cybersecurity. Additionally, it discusses classical and modern cryptographic methods, including encryption techniques and the principles of information security.

Uploaded by

joydebroy3669
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CRYPTOGRAPHY

AND NETWORK SECURITY


Complete Semester Notes
Subject Code: PCC-CS8B16
Maulana Abul Kalam Azad University of Technology, West Bengal
[Link] – IT and Computer Science & Business Systems

Units Covered: 1 · 2 · 3 · 4 · 5
Includes: All Topics · Key Formulas · Examples · Exam Tips

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 1


TABLE OF CONTENTS
Unit 1: Security Trends, Legal, Ethical & Professional Aspects of Security

Unit 2: Symmetric Key Cryptography

Unit 3: Public Key Cryptography

Unit 4: Message Authentication and Integrity

Unit 5: Security Practice and System Security

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 2


UNIT 1 – SECURITY TRENDS, LEGAL, ETHICAL &
PROFESSIONAL ASPECTS

1.1 What is Information Security?


Information Security (InfoSec) is the practice of protecting information and information systems from
unauthorized access, use, disclosure, disruption, modification, or destruction. It encompasses people,
processes, and technology working together to protect digital and physical information assets.

CIA Triad – The Three Pillars of Security


The CIA Triad is the core model that guides information security policies.

<b>Principle</b> <b>Definition</b> <b>Example</b>

Confidentiality
Only authorized users can access information
Password-protected files, encryption

Integrity
Data cannot be modified withoutBank
authorization
transaction records, digital signatures

Information
Availability
is accessible when needed by24×7
authorized
online users
banking, cloud services

■ Exam Tip: CIA Triad appears in 5-mark questions every year. Be able to define each with an example.

Additional Security Goals


• Authentication – Verifying identity of a user or system
• Non-Repudiation – Sender cannot deny having sent a message
• Access Control – Restricting access to resources based on privileges
• Accountability – Actions can be traced back to entities

1.2 Security Trends


Modern cybersecurity is evolving rapidly. Key current trends include:

Trend Description

Cloud Security
Protecting data, apps and services hosted in cloud environments

AI in Security
Using ML/AI for threat detection, anomaly detection, automated response

Zero Trust Architecture


'Never trust, always verify' – no implicit trust even inside network

Multi-Factor AuthenticationCombining
(MFA) passwords with OTPs, biometrics, tokens

IoT Security Securing billions of connected devices with limited compute

Blockchain Security
Immutable, distributed ledger used in secure transactions

Cyber Threat Intelligence


Gathering and analyzing threat data to prevent attacks proactively

1.3 Common Cyber Threats


• Malware – Software designed to damage or disrupt systems
• Ransomware – Encrypts victim data; demands payment for decryption
• Phishing – Fraudulent attempts to steal credentials via fake emails/sites
• DDoS Attacks – Overwhelming a server with traffic to deny service to users
• Insider Threats – Malicious or negligent actions by employees or trusted users
• Man-in-the-Middle (MitM) – Attacker secretly intercepts communications
• SQL Injection – Injecting malicious SQL into web application queries

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 3


• Zero-Day Exploits – Attacks on unknown, unpatched software vulnerabilities

1.4 Legal Aspects of Security


Legal aspects define laws and regulations that govern cybersecurity behavior, protect users, and punish
criminals.

Key Legislation (India)


<b>Law</b> <b>Key Provisions</b>

IT Act,
Covers
2000 cybercrimes, digital signatures, data protection, e-commerce legality

IT (Amendment)
Added Act,
cyber2008
terrorism, data theft, identity theft, Section 66A (later struck down)

Digital Personal Data Protection


Regulates
Act, 2023
how personal data is collected, stored, processed

Digital Signature Laws


Gives legal validity to electronic signatures under IT Act

Indian Penal CodeSections


(IPC) applicable to computer-related fraud, impersonation

Objectives of Cyber Laws


• Protect user privacy and personal data
• Prevent, investigate and prosecute cybercrime
• Define legal validity of electronic records and signatures
• Establish punishments and penalties for attackers
• Regulate e-commerce and online transactions

1.5 Ethical Aspects of Security


Ethics refers to the moral principles that govern behavior while using computer systems and networks.

Ethical vs Unethical Behavior


<b>Ethical Behavior ✔</b> <b>Unethical Behavior ✘</b>

Respect user privacy Hacking into systems without authorization

Use only authorized access Stealing or misusing personal data

Report vulnerabilities responsibly Spreading malware or viruses

Use licensed software Software piracy

Maintain confidentiality of data Identity theft and fraud

Follow organizational policies Cyberbullying or harassment

1.6 Professional Aspects of Security


Security professionals have specific responsibilities that go beyond technical skills.
• Maintain strict confidentiality of organizational data and client information
• Follow all company security policies and legal requirements
• Be honest, transparent and act with integrity at all times
• Protect organizational resources – hardware, software, data
• Report security incidents promptly and accurately
• Keep professional skills and knowledge up to date
• Obtain proper authorization before performing security testing

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 4


1.7 Need for Security at Multiple Levels
Security must be applied in layers – a defense-in-depth approach. Compromising one layer should not
compromise the whole system.

<b>Level</b> <b>Protects</b> <b>Mechanisms</b>

Physical Security Hardware, premises,


CCTV,
people
security guards, biometric access, locks

Network Security
Data in transit, network infrastructure
Firewalls, VPNs, IDS/IPS, packet filtering

Application Security
Software and web applications
Authentication, secure coding, input validation

Data Security Stored data and databases


Encryption, backup, access control, DLP

User SecurityHuman layer – users & employees


Strong passwords, security training, MFA

Operational SecurityProcesses and procedures


Security policies, audits, incident response

1.8 Security Policies


A security policy is a formal, written document that defines rules, guidelines and procedures for protecting an
organization's information resources.

Components of a Security Policy


• 1. Purpose – Why the policy exists
• 2. Scope – Who and what the policy applies to
• 3. Roles and Responsibilities – Who is accountable
• 4. Access Control Rules – Who can access what
• 5. Acceptable Use Policy – What users can and cannot do
• 6. Incident Response Procedure – How to handle breaches
• 7. Review and Update Schedule – When the policy is reviewed

Types of Security Policies


<b>Type</b> <b>Description</b> <b>Example</b>

Organizational Security
Broad
Policy
policy covering entire organization
Corporate acceptable use policy

Issue-Specific SecurityFocuses
Policy on one specific security issue
Email security policy

System-Specific SecurityCovers
Policya specific technology/system
Firewall configuration policy

1.9 Model of Network Security


The network security model describes how secure communication happens between two parties over an
insecure network.

Components of the Model


• Sender (Principal) – Source of the message
• Plaintext – Original readable message
• Encryption Algorithm – Converts plaintext to ciphertext using a key
• Secret Key – Used for encryption and decryption
• Network/Channel – The (insecure) transmission medium
• Decryption Algorithm – Converts ciphertext back to plaintext
• Receiver – Intended destination of message
• Trusted Third Party (optional) – Key distribution authority

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 5


■ Note: The attacker may attempt to intercept the ciphertext, modify it, or replay it. The encryption ensures
confidentiality even if intercepted.

1.10 Security Attacks, Services and Mechanisms


Security Attacks
Any action that compromises the security of information owned by an organization or individual.

Passive Attacks
The attacker only monitors, observes, or reads data without altering it.

<b>Type</b> <b>Description</b>

Eavesdropping Listening to private communications on a network

Traffic
Analyzing
Analysispatterns of communication (frequency, timing, size) even if encrypted
• Characteristics: Very difficult to detect | Data is not altered | Goal is information theft
Active Attacks
The attacker modifies data, creates false data, or disrupts communication.

<b>Type</b> <b>Description</b>

Masquerade Attacker pretends to be a legitimate user

Replay Attack
Captures and retransmits valid data to cause unauthorized effect

Modification Attack Alters intercepted messages before forwarding

Denial of Service (DoS)


Floods a system/network to deny service to legitimate users
• Characteristics: Easier to detect | Difficult to prevent completely | Causes actual damage

Passive vs Active Attacks Comparison


<b>Feature</b> <b>Passive Attack</b> <b>Active Attack</b>

Nature Monitoring only Modification/disruption

Detection Very difficult Relatively easier

Data Change No Yes

Prevention Encryption can prevent Difficult to fully prevent

Examples Eavesdropping, Traffic Analysis


DoS, Replay, Masquerade

Security Services (X.800)


<b>Service</b> <b>Description</b>

Authentication Assurance that communicating entity is the one claimed

Access Control Prevention of unauthorized use of resources

Data Confidentiality Protection of data from unauthorized disclosure

Data Integrity Assurance that data received is as sent – no modification

Non-Repudiation
Protection against denial of a previous action by sender/receiver

Availability
Ensuring systems work and services are accessible when needed

Security Mechanisms

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 6


<b>Mechanism</b> <b>Purpose</b>

Encryption Transforms data to hide its meaning – provides confidentiality

Digital Signature
Proves authenticity and integrity – provides non-repudiation

Access Control Enforces authorization policies on resources

Data Integrity Mechanisms Checksums, MACs to detect modification

Authentication Exchange
Protocols to verify identity (challenge-response, certificates)

Traffic Padding Inserts dummy bits to frustrate traffic analysis

Routing Control Selects secure routes for data transmission

Notarization Uses trusted third party to assure message properties

1.11 OSI Security Architecture


The OSI Security Architecture (ITU-T X.800) provides a systematic framework for understanding and
implementing security in communication systems. It classifies security into three main categories: attacks,
services, and mechanisms.
■ Note: OSI Security Architecture was developed by the International Telecommunication Union (ITU-T) and
provides a standardized way to define security requirements.

1.12 Classical Encryption Techniques


Classical cryptography predates modern computing. These techniques are studied to understand the
foundations of modern cryptography.

Substitution Techniques
Characters in the plaintext are replaced by other characters according to a rule.

Caesar Cipher
The simplest substitution cipher. Each letter is shifted by a fixed number of positions in the alphabet.
Formula: C = (P + K) mod 26
Decryption: P = (C - K + 26) mod 26
• C = Ciphertext letter (as number 0-25)
• P = Plaintext letter (as number 0-25)
• K = Key (shift value)
Example: Plaintext = HELLO, Key (K) = 3
H(7)+3=10=K, E(4)+3=7=H, L(11)+3=14=O, L(11)+3=14=O, O(14)+3=17=R
Ciphertext = KHOOR
Monoalphabetic Cipher
Uses a single fixed substitution alphabet throughout the message. Every letter maps to a unique different letter.
More secure than Caesar but still breakable via frequency analysis.

Vigenère Cipher (Polyalphabetic)


Uses a keyword to vary the Caesar shift. Each letter of the keyword specifies a different shift. Much stronger
than monoalphabetic ciphers.
C[i] = (P[i] + K[i mod keylen]) mod 26

Transposition Techniques

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 7


Characters remain the same but their positions are rearranged according to a pattern.

Rail Fence Cipher


Write message in a zigzag pattern across multiple 'rails', then read off each rail.
Example: HELLO with 2 rails:
• Rail 1: H _ L _ O → HLO
• Rail 2: _ E _ L _ → EL
• Ciphertext: HLOEL
Columnar Transposition
Write message in rows under a keyword, then read columns in keyword alphabetical order.

Substitution vs Transposition
<b>Aspect</b> <b>Substitution</b> <b>Transposition</b>

Operation Replaces characters Rearranges characters

Character values Changed Unchanged

Position May be unchanged Changed

Example Caesar Cipher Rail Fence Cipher

Security Low (frequency analysis) Low (anagram analysis)

1.13 Steganography
Steganography is the practice of hiding secret information within ordinary, non-secret data or a physical object
to avoid detection. Unlike encryption which hides the content, steganography hides the very existence of the
message.

Steganography vs Encryption
<b>Feature</b> <b>Encryption</b> <b>Steganography</b>

Goal Hides message content Hides message existence

Visibility Ciphertext is visible Hidden message is invisible

Detection Known to exist, can't read Unknown to exist

Key Encryption key required Stego key or technique

Applications Secure communication


Covert communication, digital watermarking

• Images – Least Significant Bit (LSB) modification


• Audio files – Echo hiding, phase coding
• Videos – Frame manipulation
• Text – Whitespace manipulation, font variations

1.14 Foundations of Modern Cryptography


Modern cryptography is built on rigorous mathematical principles and computational complexity theory rather
than linguistic patterns.
• Confidentiality – Data is hidden from unauthorized parties
• Integrity – Data cannot be modified undetected
• Authentication – Identity of communicating parties is verified
• Non-Repudiation – Actions cannot be denied after the fact

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 8


Perfect Security (Shannon's Perfect Secrecy)
A cryptosystem is perfectly secure (perfectly secret) if the ciphertext provides no information about the plaintext
to an attacker with unlimited computational resources.
P(M | C) = P(M) for all M and C
This means knowledge of the ciphertext does NOT change the probability of the plaintext.

One-Time Pad (OTP)


The only known cryptosystem that achieves perfect secrecy. Encryption is done by XOR-ing the message with a
truly random key of the same length.
• Key must be truly random
• Key length must equal the message length
• Key must be used only once (never reused)
• Key must be kept completely secret
■ Note: OTP is theoretically unbreakable but impractical for large-scale use because of key management
complexity.

Information Theory (Shannon, 1949)


Claude Shannon's information theory provides the mathematical foundation for modern cryptography.
• Entropy – Measure of uncertainty/randomness in information (H = -Σ p log p)
• Redundancy – Excess information in natural languages that aids cryptanalysis
• Confusion – Property making relationship between key and ciphertext complex
• Diffusion – Property spreading influence of each plaintext bit across ciphertext

Product Cryptosystem
Combines multiple basic encryption operations (substitution + transposition) in multiple rounds to achieve
stronger security. The combination makes the overall system much harder to break than individual components.
• Example: AES uses multiple rounds of SubBytes (substitution) + ShiftRows + MixColumns (diffusion)
■ Exam Tip: Confusion and Diffusion are key concepts – know their definitions and examples.

1.15 Cryptanalysis
Cryptanalysis is the science and art of breaking cryptographic systems without prior knowledge of the key. It is
essential for evaluating cryptographic strength.

Types of Cryptanalytic Attacks


<b>Attack Type</b><b>Attacker Has</b> <b>Goal</b> <b>Strength</b>

Ciphertext-Only (COA) Ciphertext only Find key or plaintext


Hardest for attacker

Known Plaintext (KPA)


Some plaintext-ciphertext pairsFind the key Medium

Chosen Plaintext
Can(CPA)
choose plaintext & get ciphertext
Deduce key/algorithm Stronger

Chosen Ciphertext
Can(CCA)
choose ciphertext & get plaintext
Find key Strongest attacker

Brute Force Ciphertext only Try all possible Always


keys possible but slow

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 9


UNIT 2 – SYMMETRIC KEY CRYPTOGRAPHY

2.1 What is Symmetric Key Cryptography?


In symmetric key (secret key) cryptography, the same key is used for both encryption and decryption. The key
must be shared securely between sender and receiver before communication.

<b>Advantages</b> <b>Disadvantages</b>

Very fast computation Key distribution is a major challenge

Efficient for large dataKey


volumes
management scales poorly (n users need n(n-1)/2 keys)

Simple implementation No non-repudiation support

Low computational overhead


If key is compromised, all communication is compromised

2.2 Mathematics of Symmetric Key Cryptography


Modular Arithmetic
Modular arithmetic (clock arithmetic) is the backbone of modern cryptography. It deals with the remainder after
division.
a mod n = r where a = qn + r and 0 ≤ r < n
• 17 mod 5 = 2 (because 17 = 5×3 + 2)
• 22 mod 7 = 1 (because 22 = 7×3 + 1)
• (-3) mod 5 = 2 (because -3 = 5×(-1) + 2)
Properties of Modular Arithmetic
(a + b) mod n = ((a mod n) + (b mod n)) mod n
(a × b) mod n = ((a mod n) × (b mod n)) mod n
(a - b) mod n = ((a mod n) - (b mod n) + n) mod n

Euclid's Algorithm (GCD)


The Euclidean Algorithm finds the Greatest Common Divisor (GCD) of two numbers. Used in key generation
and modular inverse.
GCD(a, b) = GCD(b, a mod b) [repeat until remainder = 0]
Example: Find GCD(48, 18)
• 48 = 18×2 + 12
• 18 = 12×1 + 6
• 12 = 6×2 + 0 → GCD = 6
Extended Euclidean Algorithm
Finds integers x, y such that: ax + by = GCD(a,b). Used to find the modular multiplicative inverse – essential for
RSA.

Congruence
Two integers a and b are congruent modulo n if they leave the same remainder when divided by n.
a ≡ b (mod n) ■ n | (a - b)
• 17 ≡ 5 (mod 12) [both leave remainder 5 when divided by 12]
• 26 ≡ 0 (mod 13) [26 = 2×13 + 0]
• 38 ≡ 2 (mod 12) [38 = 3×12 + 2]

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 10


Matrices in Cryptography
Matrices represent multi-character transformations. Used in Hill Cipher and AES's MixColumns step.
• Hill Cipher: C = K × P (mod 26) where K is the key matrix, P is plaintext vector
• Advantages: Can encrypt multiple characters simultaneously; harder to break

2.3 Groups, Rings and Fields


Group
A set G with a binary operation * satisfying four properties:

<b>Property</b> <b>Definition</b> <b>Example (Integers under +)</b>

Closure a*b ∈ G for all a,b ∈ G 3+5=8 ∈ Z

Associativity (a*b)*c = a*(b*c) (1+2)+3 = 1+(2+3)

Identity ∃ e: a*e = e*a = a a+0 = a (identity = 0)

Inverse ∀a ∃a■¹: a*a■¹ = e a + (-a) = 0


• Abelian (Commutative) Group: a*b = b*a for all elements

Ring
A set R with two operations (+ and ×) where:
• (R, +) is an abelian group
• Multiplication is associative: (a×b)×c = a×(b×c)
• Distributive laws hold: a×(b+c) = a×b + a×c
• Example: Integers Z form a ring under addition and multiplication

Field
A ring where every non-zero element has a multiplicative inverse. Fields support addition, subtraction,
multiplication, and division (by non-zero elements).
• Rational numbers Q
• Real numbers R
• Finite (Galois) Fields GF(p) – critical for AES

Finite Fields (Galois Fields)


A finite field GF(p^n) has a finite number of elements. The simplest is GF(2) = {0, 1} with mod 2 arithmetic.
GF(2^8) has 256 elements – this is the field used in AES

<b>Operation in GF(2)</b> <b>Result</b>

0+0=0 0×0=0

0+1=1 0×1=0

1+0=1 1×0=0

1 + 1 = 0 (mod 2) 1×1=1

■ Note: AES extensively uses GF(2^8) for its SubBytes and MixColumns operations.

2.4 Simplified DES (S-DES)


S-DES is a simplified educational version of DES created to help students understand the structure of block
ciphers without the complexity of full DES.

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 11


<b>Feature</b> <b>S-DES</b> <b>Full DES</b>

Block Size 8 bits 64 bits

Key Size 10 bits 56 bits

Rounds 2 16

Purpose Educational Commercial encryption

S-DES Components
• Key Generation: P10 permutation → split → LS-1 shifts → P8 gives K1; LS-2 shifts → P8 gives K2
• Encryption: Initial Permutation (IP) → fK1 (with K1) → Switch (SW) → fK2 (with K2) → IP■¹
• fK function: Expansion/Permutation (EP) → XOR with subkey → S-Boxes → P4 permutation

2.5 DES – Data Encryption Standard


DES is a symmetric block cipher developed by IBM and standardized by NIST in 1977. It was the dominant
encryption standard for 20+ years.

<b>Parameter</b> <b>Value</b>

Block Size 64 bits

Key Size 56 bits (64-bit key with 8 parity bits)

Number of Rounds 16 Feistel rounds

Structure Feistel Network

Subkey Size 48 bits per round

DES Structure (Feistel Network)


• Initial Permutation (IP) – Rearranges 64 input bits
• 16 Rounds – Each uses a 48-bit subkey derived from the 56-bit key
• In each round: Right half expanded to 48 bits → XOR with subkey → through S-boxes → P-box
• Final Permutation (IP■¹) – Inverse of initial permutation
• Key Schedule – Generates 16 subkeys (K1–K16) via PC-1 and PC-2 permutations

Feistel Round Function


For round i: L[i] = R[i-1]
R[i] = L[i-1] XOR F(R[i-1], K[i])
■ Note: Feistel structure allows decryption using the same algorithm as encryption – just reverse the subkey order.

DES Strength and Weaknesses


<b>Strengths</b> <b>Weaknesses</b>

Well-tested, proven design for its era Key size of 56 bits is too small

Strong confusion and


Vulnerable
diffusion to
properties
brute-force (EFF DES Cracker cracked it in 22 hours in 1999)

Efficient hardware implementation


Three weak keys and six semi-weak keys

Basis for 3DES Replaced by AES since 2001

Triple DES (3DES)


Applies DES three times to increase key length and security.

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 12


C = E(K3, D(K2, E(K1, P)))
• EDE (Encrypt-Decrypt-Encrypt) with three keys → effective key length 168 bits
• With K1=K3 → 112-bit effective key; With K1=K2=K3 → equivalent to single DES

2.6 Differential and Linear Cryptanalysis


Differential Cryptanalysis
Introduced by Biham and Shamir (1990). A chosen plaintext attack that studies how differences in input pairs
affect output differences.
• Choose pairs of plaintexts with specific XOR difference
• Encrypt both plaintexts and analyze output XOR differences
• Use statistical patterns to deduce key bits
• DES was designed with awareness of differential cryptanalysis – its S-boxes resist it

Linear Cryptanalysis
Introduced by Matsui (1993). A known plaintext attack that finds linear approximations between plaintext,
ciphertext and key bits.
P[i1,...] XOR C[j1,...] = K[k1,...] with probability p ≠ 1/2
• The larger the bias (|p - 0.5|), the more effective the attack
• Requires 2^43 known plaintexts to break DES
<b>Feature</b> <b>Differential</b> <b>Linear</b>

Type Chosen plaintext Known plaintext

Key concept Input/output XOR differences Linear equations

Introduced by Biham & Shamir, 1990 Matsui, 1993

Data needed 2^47 chosen plaintexts for DES2^43 known plaintexts for DES

2.7 Block Cipher Design Principles


Shannon's two fundamental properties for a strong block cipher:

Confusion
Makes the relationship between the key and ciphertext as complex as possible. Achieved through substitution
(S-boxes).

Diffusion
Spreads the influence of a single plaintext bit or key bit across many ciphertext bits. Achieved through
permutation (P-boxes, ShiftRows, MixColumns).
• Large block size (e.g., 128 bits)
• Strong key schedule producing independent subkeys
• Multiple rounds (10+ rounds for AES)
• Non-linear S-boxes with good differential and linear resistance
• Efficient software and hardware implementations

2.8 Block Cipher Modes of Operation


Since a block cipher can only encrypt one fixed-size block at a time, modes of operation define how to encrypt
messages of arbitrary length.

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 13


<b>Mode</b>
<b>Full Name</b> <b>How it Works</b> <b>Best For</b>

ECB Electronic Each


Code block
Book encrypted independently
Small random
with same
data
key
(NOT recommended)

CBC CipherEach
Block
block
Chaining
XORed with previous ciphertext before
Files,
encryption
databases

CFBBlock
Cipher
cipher
Feedback
used as a stream cipher; previous ciphertext
Real-time
feeds
data
encryption
streams

OFB Output
Keystream
Feedbackgenerated from IV chain; XORed
Noisy
withchannels
plaintext(satellite)

CTR Counter
Counter value encrypted to High-speed
generate keystream
networking, parallel processing

ECB vs CBC (Key Differences)


• ECB: Identical plaintext blocks produce identical ciphertext blocks → pattern leakage (famous 'ECB penguin'
problem)
• CBC: Uses Initialization Vector (IV) + previous ciphertext block to ensure identical plaintext gives different
ciphertext
CBC Encryption: C[i] = E(K, P[i] XOR C[i-1]) [C[0] = IV]
CTR: C[i] = P[i] XOR E(K, Counter + i)
■ Exam Tip: Know the formula for CBC and CTR modes. ECB vs CBC comparison is a common exam question.

2.9 AES – Advanced Encryption Standard


AES (Rijndael) was selected by NIST in 2001 after a 5-year competition to replace DES. Designed by Joan
Daemen and Vincent Rijmen.

AES Evaluation Criteria (NIST Requirements)


• Security – Resistance to all known cryptanalytic attacks
• Efficiency – Fast in both hardware and software implementations
• Flexibility – Support for 128, 192, and 256-bit key lengths
• Simplicity – Easy to understand and implement
• Portability – Works on various platforms and devices

AES Specifications
<b>Parameter</b> <b>Value</b>

Block Size 128 bits (fixed)

Key Sizes128 bits (10 rounds), 192 bits (12 rounds), 256 bits (14 rounds)

Structure Substitution-Permutation Network (not Feistel)

State 4×4 matrix of bytes (128 bits = 16 bytes)

AES Round Structure (4 Operations)


<b>Operation</b> <b>Description</b> <b>Purpose</b>

SubBytes
Each byte replaced using S-box lookupConfusion
table (non-linearity)

ShiftRows
Row i of state is cyclically shifted left by Diffusion
i bytes across columns

MixColumns
Each column multiplied by fixed polynomial inDiffusion
GF(2^8) across rows

AddRoundKey
State XORed with round key derived from master key
Key mixing

■ Note: The final round omits MixColumns. The first operation before rounds is AddRoundKey (initial key
whitening).

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 14


■ Exam Tip: Remember: SubBytes → ShiftRows → MixColumns → AddRoundKey. This order is frequently asked.

AES vs DES Comparison


<b>Feature</b> <b>DES</b> <b>AES</b>

Key Length 56 bits 128/192/256 bits

Block Size 64 bits 128 bits

Rounds 16 10/12/14

Structure Feistel Network SP Network

Security Broken (brute force) Secure (no practical attacks)

Speed Moderate Fast in hardware/software

Status Deprecated Current standard

2.10 RC4 Stream Cipher


RC4 is a symmetric stream cipher designed by Ron Rivest in 1987. It generates a pseudorandom keystream
that is XORed with plaintext.

<b>Feature</b> <b>Detail</b>

Type Stream cipher

Key Length Variable (40 to 2048 bits)

Operation KSA (Key Scheduling) + PRGA (Pseudo-Random Generation)

Was Used In WEP, WPA, SSL/TLS (all now deprecated)

Current Status Considered insecure – no longer recommended

2.11 Key Distribution


Key distribution is the process of securely delivering cryptographic keys to parties who need them while keeping
them secret from others.

Key Distribution Challenges


• The key must be kept completely secret during distribution
• Physical delivery is impractical for internet-scale use
• Key exchange over an insecure channel seems paradoxical
• Man-in-the-middle attacks can intercept keys

Key Distribution Methods


<b>Method</b> <b>Description</b> <b>Limitations</b>

Physical Delivery
Key delivered in person or via courier
Impractical for remote parties

Trusted
Central
Third
Key
Party
Distribution
(KDC) Center generates & distributes
KDC is session
a single keys
point of failure

Public KeyUse
Assisted
PKI to encrypt and exchange symmetric
Requireskeys
public key infrastructure

Diffie-Hellman
Two parties derive shared secret
Vulnerable
over public
to man-in-the-middle
channel without authentication

Pre-shared Key (PSK)Keys agreed upon in advance Impractical for large scale

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 15


UNIT 3 – PUBLIC KEY CRYPTOGRAPHY

3.1 What is Public Key Cryptography?


Public key (asymmetric) cryptography uses two mathematically related but different keys: a public key (freely
shared) and a private key (kept secret). Data encrypted with one key can only be decrypted with the other.

<b>Feature</b> <b>Symmetric</b><b>Asymmetric (Public Key)</b>

Keys 1 shared secret key 2 keys: public + private

Key distribution
Hard (secure channel needed)
Easy (public key freely shared)

Speed Fast Slow (10–1000× slower)

Non-repudiation No Yes (with private key signature)

Key management
Complex (n² keys for n users)
Simple (2n keys for n users)

Examples AES, DES, 3DES, RC4 RSA, ECC, ElGamal, DH

Uses of Public Key Cryptography


• Encryption: Sender encrypts with receiver's PUBLIC key; receiver decrypts with their PRIVATE key
• Digital Signatures: Signer signs with their PRIVATE key; verifier checks with signer's PUBLIC key
• Key Exchange: Two parties establish a shared secret without prior shared key

3.2 Mathematics of Asymmetric Cryptography


Prime Numbers
A prime number p > 1 has exactly two divisors: 1 and itself. The security of RSA relies on the difficulty of
factoring large products of two primes.
Primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, ...
• There are infinitely many primes (Euclid's theorem)
• RSA uses primes of 1024–4096 bits (300+ decimal digits)

Primality Testing
Determining if a large number is prime is computationally important.

<b>Method</b> <b>Type</b> <b>Description</b>

Trial Division Check all primes up to √n – too slow for large n


Deterministic

Fermat Test Probabilistic


Based on Fermat's Little Theorem – may have false positives

Miller-Rabin Test More


Probabilistic
reliable than Fermat; used in practice (standard in RSA libraries)

AKS Test Deterministic


Polynomial time but slower than Miller-Rabin in practice

Integer Factorization
Expressing a composite number as a product of prime factors. The RSA Problem is that factoring n = p×q into
its prime factors p and q is computationally infeasible for large n.
n = p × q (easy to compute)
Given n, find p and q (computationally hard for large primes)
• 15 = 3 × 5
• 21 = 3 × 7

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 16


• 35 = 5 × 7
• Factoring a 2048-bit RSA modulus would take longer than the age of the universe

Euler's Totient Function φ(n)


φ(n) counts the positive integers up to n that are coprime (GCD = 1) with n. It is fundamental to RSA.
For prime p: φ(p) = p - 1
For prime power p^k: φ(p^k) = p^(k-1)(p-1)
For n = p × q (p,q prime): φ(n) = (p-1)(q-1)
Examples
• φ(7) = 6 (numbers 1,2,3,4,5,6 all coprime with 7)
• φ(11) = 10
• φ(12) = 4 (1,5,7,11 are coprime with 12)
• φ(33) = φ(3×11) = (3-1)(11-1) = 20

Fermat's Little Theorem


If p is prime and a is not divisible by p:
a^(p-1) ≡ 1 (mod p)
Example: a=2, p=11: 2^10 = 1024 ≡ 1 (mod 11) ✓
• Used in RSA for encryption/decryption
• Basis for Fermat primality test

Euler's Theorem
Generalization of Fermat's theorem. If gcd(a, n) = 1:
a^φ(n) ≡ 1 (mod n)
Example: a=3, n=10, φ(10)=4: 3^4=81 ≡ 1 (mod 10) ✓
• This theorem directly proves the correctness of RSA encryption-decryption

Chinese Remainder Theorem (CRT)


CRT states that if n1, n2, ..., nk are pairwise coprime, then the system of congruences has a unique solution
modulo N = n1 × n2 × ... × nk.
System: x ≡ a1 (mod n1), x ≡ a2 (mod n2), ..., x ≡ ak (mod nk)
Example: Solve x ≡ 2 (mod 3), x ≡ 3 (mod 5)
• x = 8 is the solution (check: 8 mod 3 = 2 ✓, 8 mod 5 = 3 ✓)
• CRT speeds up RSA operations by doing computations modulo p and q separately
• Provides approximately 4× speedup for RSA decryption

Modular Exponentiation and Discrete Logarithm


Modular Exponentiation
Compute a^b mod n efficiently using fast exponentiation (square-and-multiply)
• Example: 3^13 mod 7 = (decompose 13 = 8+4+1) compute step by step
• Square-and-multiply reduces computation from O(b) to O(log b) multiplications
Discrete Logarithm Problem (DLP)
Given g, h, and prime p, find x such that: g^x ≡ h (mod p)
Easy: g^x mod p (fast) Hard: find x given g^x mod p (computationally infeasible)
• DLP is the basis for Diffie-Hellman, ElGamal, DSA, and ECC

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 17


3.3 RSA Cryptosystem
RSA (Rivest-Shamir-Adleman, 1977) is the most widely deployed public key algorithm. Security is based on the
difficulty of factoring large composite numbers.

RSA Key Generation (Step by Step)


Step Operation Example

Step 1Choose two large distinct primes p and q p=3, q=11

Step 2 Compute modulus n = p × q n = 3 × 11 = 33

Step 3 Compute Euler's totient φ(n) = (p-1)(q-1) φ(33) = 2 × 10 = 20

Step 4 public exponent e: 1 < e < φ(n), gcd(e, φ(n))


Choose e = 3= (gcd(3,20)=1
1 ✓)

Step
Compute
5 private exponent d: e×d ≡ 1 (mod
d=φ(n))
7 (3×7=21≡1 mod 20 ✓)

Public Key (e, n) (3, 33)

Private Key (d, n) (7, 33)

RSA Encryption and Decryption


Encryption: C = M^e mod n
Decryption: M = C^d mod n
Example: Encrypt M=4 with public key (e=3, n=33):
• C = 4^3 mod 33 = 64 mod 33 = 31
• Decrypt: M = 31^7 mod 33 = 4 ✓

RSA Security
<b>Security Basis</b> <b>Detail</b>

Integer Factorization Given n, cannot efficiently find p and q for large n

Key Size RecommendationMinimum 2048 bits; 4096 bits for high security

Padding Required
RSA must use padding (OAEP) – raw RSA is textbook/deterministic

Vulnerabilities
Small e attacks, timing attacks, chosen ciphertext attacks if no padding

3.4 Key Distribution and Key Management


Key Distribution for Public Keys
• Manual – Physically exchange keys in person
• Trusted Third Party – Certificate Authority (CA) vouches for key ownership
• Public Key Infrastructure (PKI) – Formal system of CAs, certificates, and revocation

Key Management Lifecycle


<b>Phase</b> <b>Description</b>

Key Generation
Create cryptographically strong keys using approved algorithms

Key Storage
Store securely (HSM – Hardware Security Module, encrypted key stores)

Key Distribution Deliver keys securely to authorized parties

Key Use Use keys only for authorized purposes; monitor usage

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 18


<b>Phase</b> <b>Description</b>

Key Revocation
Invalidate compromised or expired keys via CRLs or OCSP

Key Destruction Securely delete keys when no longer needed

3.5 Diffie-Hellman Key Exchange


Diffie-Hellman (1976) was the first published public key algorithm. It allows two parties to establish a shared
secret key over an insecure channel without any prior shared secret.

DH Working (Step by Step)


Step Action Example

Agree on
1 public parameters: large prime p, generator g (1 < g p=23,
< p) g=5

Alice
2 chooses private key a, computes A = g^a mod
a=6,
p A=5^6 mod 23=8

Bob
3 chooses private key b, computes B = g^b mod
b=15,
p B=5^15 mod 23=19

4 Alice sends A to Bob; Bob sends B to Alice Exchange A=8, B=19

5 Alice computes shared key: s = B^a mod p s=19^6 mod 23=2

6 Bob computes shared key: s = A^b mod p s=8^15 mod 23=2 ✓

■ Note: Attacker sees p, g, A=g^a mod p, and B=g^b mod p but cannot compute s without solving DLP.
• Advantage: Perfect forward secrecy (new key each session)
• Vulnerability: Susceptible to man-in-the-middle attack if A and B are not authenticated

3.6 ElGamal Cryptosystem


Proposed by Taher ElGamal (1985). Based on the Discrete Logarithm Problem. Used for both encryption and
digital signatures.

ElGamal Encryption
• Public parameters: prime p, generator g
• Private key: x (random integer)
• Public key: y = g^x mod p
• Encryption of M: choose random k, compute C1 = g^k mod p, C2 = M × y^k mod p
• Ciphertext: (C1, C2)
• Decryption: M = C2 × C1^(-x) mod p
■ Note: ElGamal ciphertext is twice the size of the plaintext – a significant disadvantage.
■ Exam Tip: ElGamal vs DH: ElGamal provides encryption; DH provides key agreement only.

3.7 Elliptic Curve Cryptography (ECC)


ECC uses the algebraic structure of elliptic curves over finite fields. It provides the same security as RSA/DH
with much smaller key sizes.

Elliptic Curve Equation


y^2 = x^3 + ax + b (mod p) [with condition: 4a^3 + 27b^2 ≠ 0]
• The curve must be smooth (no cusps or self-intersections)

Elliptic Curve Point Operations

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 19


<b>Operation</b> <b>Description</b> <b>Algebraic Formula</b>

Point Addition
P + Q = R (reflection of third Using
intersection)
slope formula with mod p arithmetic

Point Doubling P + P = 2P (tangent line method)


Special formula when P = Q

Scalar Multiplication n × P = P + P + ... + Using


P (n times)
double-and-add (like square-and-multiply)

Point at Infinity Identity element: P + O = P O plays role of 0 in the group

ECDLP – Security Basis


Elliptic Curve Discrete Logarithm Problem: Given P and Q on the curve, find k such that Q = k × P. This is
computationally infeasible for large k.

ECC vs RSA Key Size Comparison


<b>Security Level</b>
<b>RSA Key Size</b>
<b>ECC Key Size</b>
<b>Ratio</b>

80-bit 1024 bits 160 bits 6:1

112-bit 2048 bits 224 bits 9:1

128-bit 3072 bits 256 bits 12:1

192-bit 7680 bits 384 bits 20:1

256-bit 15360 bits 521 bits 30:1

ECC Advantages
• Much smaller key sizes → less storage and bandwidth
• Faster computations → ideal for mobile/IoT devices
• Lower power consumption → important for battery-powered devices
• Used in TLS 1.3, Bitcoin/blockchain, signal protocol

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 20


UNIT 4 – MESSAGE AUTHENTICATION AND INTEGRITY

4.1 Introduction
Message Authentication ensures a message comes from a legitimate sender and has not been altered. Integrity
ensures data has not been modified. These are separate from confidentiality – an encrypted message can still
be modified!

Authentication Requirements
<b>Requirement</b> <b>Description</b>

Data Origin Authentication


Assurance that the message originated from the claimed sender

Message Integrity
Assurance that the message has not been modified since sending

Non-Repudiation Sender cannot later deny having sent the message

Replay Attack Prevention


Each message is unique; old messages cannot be reused

Timeliness Message is recent (using timestamps or nonces)

4.2 Message Authentication Code (MAC)


A MAC is a short fixed-size value generated from a message and a secret key. Both sender and receiver share
the secret key. MAC provides both authentication and integrity but NOT non-repudiation (since both parties
have the key).
MAC = C(K, M) where K = secret key, M = message

MAC Process
• Sender computes: MAC = C(K, M) and sends (M, MAC)
• Receiver receives (M', MAC')
• Receiver independently computes: MAC* = C(K, M')
• If MAC* = MAC' → message authentic and unmodified
• If MAC* ≠ MAC' → message was tampered with or key is wrong

HMAC (Hash-based MAC)


HMAC combines a cryptographic hash function with a secret key for stronger MAC.
HMAC(K, M) = H((K' XOR opad) || H((K' XOR ipad) || M))

MAC Security Requirements


• Computation Resistance – Cannot compute MAC without knowing the key
• Forgery Resistance – Cannot create valid MAC for new message without key
• Key Non-Recovery – Cannot determine key from known message-MAC pairs
■ Note: MAC does NOT provide non-repudiation because both sender and receiver know the key – either could
have created the MAC.

4.3 Hash Functions


A cryptographic hash function H takes an input of arbitrary length and produces a fixed-length output
(digest/hash). It is a one-way function – computationally infeasible to reverse.
h = H(M) where |h| is fixed regardless of |M|

Required Properties of a Cryptographic Hash Function

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 21


<b>Property</b> <b>Definition</b> <b>Attack if Broken</b>

Pre-image Resistance
Given h, infeasible to find M such that H(M)=h
Reveal original message

Second Pre-image M1, infeasible to find M2 ≠ M1 with H(M1)=H(M2)


GivenResistance Substitute forged message

Infeasible to find any M1 ≠ M2 such that H(M1)=H(M2)


Collision Resistance Accept forged document

Avalanche
Small change
Effect
in input causes large change in output Linear
(≈50% cryptanalysis
bits flip)

Deterministic Same input always gives same output


None – required property

Fast to ComputeH(M) is efficient to compute for anyNone


M – required property

Applications of Hash Functions


• Digital Signatures – Hash the message, then sign the hash (more efficient)
• Password Storage – Store H(password) instead of plaintext password
• Message Integrity – Compare H(received) with H(original)
• Certificate Fingerprints – Identify certificates by their hash
• Blockchain – Each block contains hash of previous block
• File Integrity – Hash of downloaded file verifies no corruption

4.4 SHA – Secure Hash Algorithm Family


SHA is a family of cryptographic hash functions developed by NIST (National Institute of Standards and
Technology) in collaboration with NSA.

<b>Algorithm</b>
<b>Output Size</b>
<b>Block Size</b>
<b>Rounds</b> <b>Status</b>

SHA-1 160 bits 512 bits 80Deprecated (collision found 2017)

SHA-224 224 bits 512 bits 64 Acceptable

SHA-256 256 bits 512 bits 64 Widely used (TLS, Bitcoin)

SHA-384 384 bits 1024 bits 80 Used in TLS

SHA-512 512 bits 1024 bits 80 High security applications

SHA-3 224-512 bits Variable 24 New standard (Keccak sponge)

■ Exam Tip: Know SHA-256 output size (256 bits) and SHA-1 (160 bits). SHA-1 is deprecated.

SHA-256 Applications
• TLS/HTTPS certificates and handshakes
• Bitcoin and cryptocurrency transactions
• Code signing and software integrity
• Password hashing (with salt)
• Git version control (commit hashes)

4.5 Digital Signatures


A digital signature is the cryptographic equivalent of a handwritten signature. It uses the signer's private key to
sign and the corresponding public key to verify. Provides authentication, integrity, and non-repudiation.

Digital Signature Process


<b>Signing (Sender)</b> <b>Verification (Receiver)</b>

1. Compute message hash: h =1.H(M)


Compute hash of received message: h = H(M')

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 22


<b>Signing (Sender)</b> <b>Verification (Receiver)</b>

2. Encrypt hash with private key:


2. Decrypt
S = E(Kprivate,
signature
h)with sender's public key: h' = D(Kpublic, S)

3. Send (M, S) together 3. Compare h and h'

4. If h = h': valid signature ✓ | If h ≠ h': invalid ✗

Why Hash Before Signing?


• Efficiency: Signing entire message with RSA is very slow; signing the hash is fast
• Fixed size: Hash has constant size regardless of message length
• Security: Direct RSA signing of message is vulnerable to certain attacks

Digital Signature vs MAC


<b>Feature</b> <b>MAC</b> <b>Digital Signature</b>

Keys Symmetric (shared) Asymmetric (private/public)

Non-repudiation No Yes

Verification Only parties with key Anyone with public key

Speed Fast Slower

Algorithm HMAC-SHA256 RSA-SHA256, ECDSA

4.6 DSS – Digital Signature Standard


DSS (FIPS 186) is a US federal standard for digital signatures published by NIST. It specifies the Digital
Signature Algorithm (DSA) as well as allowing RSA and ECDSA.

DSA Parameters
• p: large prime (1024-3072 bits)
• q: prime factor of (p-1), 160-256 bits
• g: generator of subgroup of order q
• x: private key (random integer < q)
• y = g^x mod p: public key

DSS Applications
• E-government systems and digital contracts
• Electronic banking and financial transactions
• Code signing for software distribution
• Email signing (S/MIME)

4.7 Entity Authentication


Entity authentication (identification) verifies the identity of a communicating party at a specific time. Unlike
message authentication which verifies a message, entity authentication verifies a user or system.

Biometric Authentication
Uses unique biological or behavioral characteristics.

<b>Type</b> <b>Examples</b> <b>Accuracy</b>

Physiological
Fingerprint, iris scan, face recognition, hand geometry
High

Behavioral
Keystroke dynamics, voice recognition, signature dynamics
Medium

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 23


Biometric System Errors
• FAR (False Acceptance Rate) – accepting an impostor as legitimate
• FRR (False Rejection Rate) – rejecting a legitimate user
• EER (Equal Error Rate) – point where FAR = FRR; lower EER = better system

Password Authentication
<b>Type</b> <b>Description</b> <b>Security</b>

Static Password Fixed password, does not change


Low (if simple/reused)

One-Time Password
New password
(OTP) for each login (SMS, authenticator app)
High

Passphrase Longer password phrase (5+ words) Medium-High

Challenge-ResponsePassword derived from a challenge


High (no password transmitted)

Good Password Practices


• Minimum 12 characters
• Mix uppercase, lowercase, numbers, and symbols
• Never reuse passwords
• Use a password manager
• Enable MFA wherever possible

Challenge-Response Protocol
Server sends a random challenge (nonce); client responds with a value derived from the challenge using the
secret key or password. Password is never transmitted.
• Server sends random challenge C to client
• Client computes response R = H(password || C) or E(Kprivate, C)
• Server independently computes expected R
• If they match: authentication success

4.8 Kerberos
Kerberos is a network authentication protocol based on symmetric key cryptography and a trusted third party.
Developed at MIT in 1988 as part of Project Athena. Provides Single Sign-On (SSO).

Kerberos Architecture
<b>Component</b> <b>Role</b>

Authentication Server
Verifies
(AS) user identity and issues Ticket Granting Ticket (TGT)

Ticket Granting Server (TGS) Issues service tickets based on valid TGT

Client (C) User requesting access to services

Service Server (SS) Provides requested services; verifies service ticket

Key Distribution Center (KDC)Contains both AS and TGS; central authority

Kerberos Authentication Process


• Step 1: User logs in, AS verifies credentials, issues TGT (encrypted with user's long-term key)
• Step 2: Client presents TGT to TGS along with authenticator
• Step 3: TGS issues a Service Ticket for the requested service
• Step 4: Client presents Service Ticket to Service Server
• Step 5: Service Server validates ticket; grants access to service

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 24


Kerberos Advantages and Limitations
<b>Advantages</b> <b>Limitations</b>

Single Sign-On – login once, access many


Kerberos
servicesserver is a single point of failure

Mutual authentication – both sides verify


Clockeach
synchronization
other required (5-minute tolerance)

Tickets are time-limited (typically 8 hours)


Complex to configure and maintain

Password never transmitted over


Does
network
not work well across organizational boundaries

4.9 X.509 Digital Certificates


X.509 is an ITU-T standard for public key certificates. It defines the format of certificates that bind a public key to
an identity (person, organization, or server), signed by a Certificate Authority (CA).

X.509 Certificate Structure


<b>Field</b> <b>Description</b>

Version Certificate version (V1, V2, V3)

Serial Number Unique identifier assigned by CA

Signature Algorithm
Algorithm used to sign the certificate (e.g., SHA256withRSA)

Issuer Name Distinguished Name of the Certificate Authority

Validity Period Not Before and Not After dates

Subject Name Entity the certificate belongs to

Subject Public Key Info Public key and algorithm

Extensions (V3)
Key usage, Subject Alternative Names, CRL Distribution Points

CA's Digital Signature Verifies certificate authenticity

Public Key Infrastructure (PKI)


• Certificate Authority (CA) – Issues and signs digital certificates
• Registration Authority (RA) – Verifies identity before CA issues certificate
• Certificate Revocation List (CRL) – List of revoked certificates
• OCSP – Online Certificate Status Protocol – Real-time revocation check
■ Exam Tip: X.509 is used in HTTPS (TLS), S/MIME email security, and code signing. Know the certificate fields.

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 25


UNIT 5 – SECURITY PRACTICE AND SYSTEM SECURITY

5.1 Electronic Mail Security


Email is one of the most widely exploited attack vectors. Email security addresses threats including
eavesdropping, message modification, spoofing, phishing, and spam.

Email Security Requirements


• Confidentiality – Only intended recipient can read the message
• Integrity – Message cannot be altered in transit undetected
• Authentication – Sender identity is verified
• Non-Repudiation – Sender cannot deny having sent the email
• Access Control – Prevent unauthorized access to mailboxes

5.2 PGP – Pretty Good Privacy


PGP was designed by Phil Zimmermann in 1991. It is a widely used email encryption system that provides
confidentiality, authentication, compression, and email compatibility.

PGP Services
<b>Service</b> <b>Mechanism Used</b>

Authentication SHA-1/256 hash + RSA/DSA digital signature

Confidentiality
CAST-128/AES encryption with session key; RSA encrypts session key

Compression ZIP compression applied before encryption

Email Compatibility Radix-64 (Base64) conversion for binary-to-ASCII

Segmentation Large messages split for email size limits

PGP Processing Steps (Sending)


• 1. Create message M
• 2. Compute hash H(M) and sign with sender's private key → signature S
• 3. Concatenate M and S
• 4. Generate random one-time session key Ks
• 5. Encrypt (M||S) with Ks using AES/CAST
• 6. Encrypt Ks with receiver's RSA public key
• 7. Combine encrypted Ks + encrypted (M||S) → convert to Base64 and send

PGP Web of Trust


Instead of a central CA, PGP uses a web of trust. Users sign each other's keys. The more signatures a key has
from trusted sources, the more trustworthy it is.

5.3 S/MIME – Secure/Multipurpose Internet Mail Extensions


S/MIME is the industry-standard protocol for secure email. Used in corporate environments. Based on X.509
certificates and public key cryptography.

S/MIME Services
• Enveloped Data (Encryption) – Message encrypted with session key; session key encrypted for each recipient
• Signed Data – Message signed with sender's private key

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 26


• Clear Signed Data – Signature appended but message readable without S/MIME
• Signed and Enveloped – Both signing and encryption

PGP vs S/MIME
<b>Feature</b> <b>PGP</b> <b>S/MIME</b>

Trust Model Web of Trust (decentralized) Certificate Authority (centralized)

Orientation Individual users Enterprise / corporate email

Certificate Format PGP key format X.509 certificates

Standardization Open, flexible Formally standardized (RFC)

Availability Free (GPG) Built into Outlook, Apple Mail

Complexity Moderate Simpler for enterprise deployment

5.4 IP Security (IPSec)


IPSec is a suite of protocols that provides security at the IP layer (Network Layer / Layer 3). Unlike SSL/TLS
which operates at the application layer, IPSec secures all traffic between two hosts or networks, regardless of
the application.

IPSec Services
• Data Origin Authentication – Verify packets come from claimed source
• Data Integrity – Detect any modification of packets
• Confidentiality – Encrypt packet contents
• Anti-Replay – Prevent replay of captured packets (using sequence numbers)
• Access Control – Filter IP traffic based on policies

IPSec Protocols
Authentication Header (AH)
<b>AH Property</b> <b>Detail</b>

Provides Authentication + Integrity

Does NOT provide Confidentiality (no encryption)

Covers Entire IP packet including header

Protocol Number 51

Use Case When only authentication needed, no encryption

Encapsulating Security Payload (ESP)


<b>ESP Property</b> <b>Detail</b>

Provides Confidentiality + Authentication + Integrity

Encryption Algorithms AES, 3DES

Authentication Optional but strongly recommended

Protocol Number 50

Most Common Yes – preferred over AH in practice

IPSec Modes

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 27


<b>Mode</b> <b>What is Encrypted</b> <b>Use Case</b><b>New Header?</b>

Transport Mode
Payload only (data); IP header visible
Host-to-host communication No

Tunnel Entire
Mode original IP packet (header + payload)
VPNs, gateway-to-gateway
Yes (new IP header added)

Security Association (SA)


An SA is a one-way logical connection that defines cryptographic parameters (algorithm, key, lifetime) for IPSec
communication. A two-way secure channel requires two SAs.

IKE – Internet Key Exchange


IKE (IKEv2) is used to automatically negotiate and establish SAs. It performs mutual authentication and derives
session keys using Diffie-Hellman.

5.5 Web Security


Web security protects web servers, web applications, and users against a wide range of attacks targeting
HTTP/HTTPS communications.

Common Web Attack Types


<b>Attack</b> <b>Description</b> <b>Prevention</b>

Phishing
Fake website mimics legitimate site to steal
User
credentials
awareness, 2FA, HTTPS

SQL Injection
Malicious SQL input manipulates database
Prepared
queries
statements, input validation

Cross-Site
Injects
Scripting
malicious
(XSS)scripts into web pages viewed
Input
bysanitization,
other users CSP headers

Tricks
CSRF
user into executing unwanted actions on
CSRF
authenticated
tokens, SameSite
site cookies

SessionSteals
Hijacking
session cookie to impersonateSecure
authenticated
cookies,
user
HTTPS, session expiry

Clickjacking
Tricks user into clicking hidden malicious elements
X-Frame-Options, CSP

Directory Traversal
Accesses files outside web root via ../
Input
sequences
validation, web server config

SSL/TLS
SSL (Secure Sockets Layer) and its successor TLS (Transport Layer Security) are the cryptographic protocols
that secure HTTPS connections. TLS 1.3 (2018) is the current standard.

<b>TLS Service</b> <b>How Provided</b>

Confidentiality AES-GCM or ChaCha20 symmetric encryption

Authentication X.509 digital certificates (server, optionally client)

Integrity HMAC or AEAD (Authenticated Encryption)

Key Exchange
ECDHE or DHE (Elliptic Curve or regular Diffie-Hellman Ephemeral)

TLS Handshake Overview (TLS 1.3)


• Client Hello: Client sends supported cipher suites and key share
• Server Hello: Server selects cipher suite, sends key share and certificate
• Client verifies server certificate against trusted CAs
• Both compute shared session keys from key shares (ECDHE)
• Encrypted application data exchange begins

5.6 System Security – Intruders

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 28


An intruder (cracker/hacker) attempts unauthorized access to computer systems. Understanding attacker types
helps in designing appropriate defenses.

Types of Intruders
<b>Type</b> <b>Definition</b> <b>Example</b>

Masquerader
Outside attacker who impersonates a legitimate
Using stolen
user credentials to log in

Misfeasor
Authorized user who misuses their
Employee
privileges
accessing unauthorized HR files

Clandestine
Gains
User
supervisory/admin control to evade
Privilege
logging
escalation to root/admin

Intrusion Detection Systems (IDS)


<b>IDS Type</b> <b>Monitors</b> <b>Advantages</b> <b>Disadvantages</b>

Host-Based
Individual
(HIDS)host: system calls, file changes,
Detailed
logs
host-level Overhead
visibility on host; agent needed per system

Network-Based (NIDS)
Network traffic across segments
No host overhead; wide coverage
Cannot see encrypted payloads

Hybrid Both host and network Comprehensive coverage Complexity of management

IDS Detection Methods


• Signature-based (Misuse Detection) – Matches known attack patterns; fast but misses new attacks
• Anomaly-based – Detects deviations from normal behavior baseline; catches new attacks but more false
positives
• Specification-based – Checks against defined correct behavior

5.7 Malicious Software (Malware)


Malware is any software designed to disrupt, damage, or gain unauthorized access to a computer system or its
data.

Types of Malware
<b>Type</b> <b>Description</b> <b>Propagation</b>

Attaches
Virus
to programs; executes when host runs; may
Host
corrupt
program
files execution

Self-replicating;
Worm spreads across networks without
Network
user action
vulnerabilities, email

Trojan
AppearsHorse
legitimate; performs malicious actions hidden
User downloads/installs
inside

Ransomware
Encrypts user files; demands payment for decryption
Phishing,
key vulnerabilities

SpywareSecretly monitors user activity; steals data


Bundled software, ads

Displays
Adware unwanted advertisements; may redirectFree
browser
software bundles

Hides
Rootkitmalware and attacker activity at OS/firmware
Privilege
level escalation

Keylogger
Records all keystrokes to capture passwords
Remote access trojan

Network
Botnet of compromised machines controlled by attacker
Various malware

5.8 Viruses in Detail


Virus Life Cycle

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 29


<b>Phase</b> <b>Description</b>

Dormant Virus is present but inactive; waiting for trigger

Propagation / InfectionVirus copies itself into other programs or disk areas

TriggeringActivated by event: date, user action, counter reaching threshold

Execution
Payload executes: deletes files, encrypts data, displays messages

Types of Viruses
<b>Type</b> <b>Target</b> <b>Example</b>

Boot SectorMaster
Virus Boot Record or Volume Boot Record
Stoned, Michelangelo

File/Program VirusExecutable files (.exe, .com, .dll) Jerusalem, Cascade

Macro Virus
Documents with macro support (Word, Excel)
Melissa, Concept

Polymorphic
Changes its
Virus
own code each time to evade signature detection
Storm Worm

Metamorphic Completely
Virus rewrites itself each generation Win32/Simile

Network Virus
Spreads via network shares and protocols Nimda

Virus Prevention and Detection


• Antivirus software with up-to-date signatures
• Regular OS and application security updates
• Email filtering and attachment scanning
• Safe browsing habits; avoid suspicious downloads
• Disable autorun for removable media
• Application whitelisting
• Regular backups (3-2-1 backup rule)

5.9 Firewalls
A firewall is a network security device (hardware, software, or both) that monitors and controls network traffic
based on predefined security rules. It establishes a barrier between trusted internal networks and untrusted
external networks.

Firewall Functions
• Packet Filtering – Allow or block packets based on IP, port, protocol
• Stateful Inspection – Track active connections; only allow valid responses
• Application Control – Allow/block based on application type
• Logging and Monitoring – Record all traffic decisions for audit
• NAT (Network Address Translation) – Hide internal IP addresses

Types of Firewalls
<b>Type</b> <b>Layer</b> <b>How it Works</b> <b>Advantage</b> <b>Limitation</b>

Packet Filtering Network


Checks(L3)
IP header fields (src/dst IP, port,Fast,
protocol)
low overhead
No state tracking; easily spoofed

Stateful Inspection
Tracks
Transport
connection
(L4) state table; validates response
Better than
packets
packet filtering
Limited application awareness

Application Gateway (Proxy)


Application
Full content
(L7)
inspection; acts as relay forVery
specific
thorough
apps inspection
Slow; separate proxy per app

Next-Gen Firewall (NGFW)


L3-L7
DPI + IDS/IPS + app control + SSLComprehensive
inspection protectionExpensive, complex

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 30


<b>Type</b> <b>Layer</b> <b>How it Works</b> <b>Advantage</b> <b>Limitation</b>

WAF (Web App Firewall)


Application
Inspects
(L7) HTTP/HTTPS; filters web attacks
Protects web apps Application-specific only

Firewall Architecture: DMZ


A DMZ (Demilitarized Zone) is a network segment that sits between the internal network and the internet,
containing publicly accessible servers (web, email, DNS).
Internet ← Outer Firewall → DMZ (web/mail servers) ← Inner Firewall → Internal Network
• This architecture limits exposure: if DMZ server is compromised, inner firewall still protects internal network

Firewall Limitations
• Cannot prevent attacks originating from inside the network
• Cannot inspect encrypted traffic without SSL/TLS interception
• Does not protect against malware in allowed traffic
• Social engineering attacks bypass firewalls entirely
• Misconfiguration is a major risk – overly permissive rules

★ END OF NOTES ★ All 5 Units Covered ★ All Syllabus Topics Included ★


Maulana Abul Kalam Azad University of Technology, West Bengal | PCC-CS8B16: Cryptography

Cryptography & Network Security | PCC-CS8B16 | MAKAUT Page 31

You might also like