Unit 1: Introduction and Mathematics of Cryptography
1. Introduction: Foundations of Information Security
In an interconnected digital civilization, information is transmitted across untrusted, broadcast-based physical media and multi-hop packet routing fabrics. Without mathematical safeguards, digital communications are fundamentally vulnerable to eavesdropping, unauthorized modification, impersonation, and repudiation.
Cryptography (from the Greek kryptos, meaning hidden, and graphein, meaning writing) is the scientific discipline that employs mathematical principles to secure communications and data storage. Network Security encompasses the protocols, architectural standards, and operational policies designed to defend data across all layers of the networking stack against adversaries.
2. Core Security Objectives: The CIA Triad and Beyond
CODE+-------------------+ | CONFIDENTIALITY | | (Encryption / ACL)| +-------------------+ ^ / \ / \ / \ v v +-------------------+ +-------------------+ | INTEGRITY |<=========>| AVAILABILITY | | (Hashes / HMACs) | | (DDoS Resilience) | +-------------------+ +-------------------+
The Three Pillars of the CIA Triad
- Confidentiality: Assures that sensitive information is accessible only to authorized entities and remains concealed from eavesdroppers and unauthorized processes. Achieved primarily via symmetric and asymmetric encryption algorithms.
- Integrity: Assures that data has not been altered, tampered with, deleted, or fabricated during transit or in storage. Enforced via cryptographic hash functions, Message Authentication Codes (MACs), and digital signatures.
- Availability: Assures that systems, networks, and data remain accessible to authorized parties upon request, providing resilience against Denial-of-Service (DoS) and Distributed Denial-of-Service (DDoS) disruptions.
Supporting Security Services
- Authentication: Verifies the true identity of a communicating principal (origin authentication) or confirms that data originated from its claimed source (data origin authentication).
- Non-Repudiation: Prevents a sender or receiver from denying having transmitted, received, or authorized a specific message or transaction (achieved using digital signatures).
- Access Control: Enforces permissions governing who or what process may access specific compute, network, or storage resources.
3. Cryptographic Attack Models & Kerckhoffs's Principle
Kerckhoffs's Principle (Shannon's Maxim)
Formulated by Auguste Kerckhoffs in 1883 and restated by Claude Shannon as "The enemy knows the system":
Kerckhoffs's Principle: A cryptosystem should be secure even if everything about the system, except the cryptographic key, is public knowledge.
Relying on keeping cryptographic algorithms secret (known as Security through Obscurity) invariably fails when the algorithm is reverse-engineered, leaked, or deduced from ciphertext samples.
Taxonomy of Adversary Attacks
- Passive Attacks: The adversary intercepts and observes network traffic without altering data packets or communicating actively.
- Eavesdropping (Packet Sniffing): Capturing plaintext transmission payloads.
- Traffic Analysis: Inspecting transmission frequencies, message volumes, packet sizes, and communicating IP endpoints to deduce operational intelligence even when payload is encrypted.
- Active Attacks: The adversary actively injects, alters, delays, or blocks communications.
- Masquerade (Spoofing): Impersonating another entity's identity or network address.
- Replay Attack: Intercepting a valid authentication or financial transmission and re-transmitting it later to produce unauthorized actions.
- Modification of Messages: Tampering with packet headers or body contents in transit.
- Denial of Service (DoS): Overwhelming server resources, network links, or routing buffers to render services unavailable.
4. Mathematics of Cryptography: Modular Arithmetic & Number Theory
Modern cryptosystems rely on discrete mathematics, modular arithmetic, and computational number theory.
A. Divisibility and the Division Algorithm
For any integers and (with ), there exist unique integers (quotient) and (remainder) such that:
We write (read: " divides ") if the remainder .
B. The Euclidean Algorithm for Greatest Common Divisor (GCD)
The Greatest Common Divisor is the largest positive integer that divides both and . If , and are said to be relatively prime (coprime).
The Euclidean Algorithm relies on the recurrence:
\gcd(a, b) = \gcd(b, a mod b)
Computational Example: Find
The remainder reaches zero; hence, .
C. The Extended Euclidean Algorithm & Modular Multiplicative Inverses
Bézout's identity states that for any integers and , there exist integers and such that:
When , the integer satisfies:
Here, is the modular multiplicative inverse of modulo , denoted .
Significance in Cryptography
Modular inverses are vital for decrypting classical ciphers (e.g., Affine and Hill ciphers) and generate public/private key pairs in RSA and Diffie-Hellman protocols. A modular inverse exists if and only if .
5. Classical Cryptographic Ciphers: Substitution vs. Transposition
Traditional ciphers operate on characters or bit permutations and fall into two primary mechanical archetypes:
CODEClassical Ciphers | +-----------------+-----------------+ | | Substitution Ciphers Transposition Ciphers (Replace character values) (Rearrange character positions) | | | | Monoalphabetic Polyalphabetic Rail Fence Columnar - Caesar Cipher - Vigenère Cipher Cipher Transposition - Affine Cipher - Playfair Cipher
A. Substitution Ciphers
In a substitution cipher, each character in the plaintext is replaced by another character, symbol, or number.
-
Caesar Cipher (Monoalphabetic):
- Shift each alphabet letter by a fixed key (traditionally ):
- Weakness: Trivial keyspace (25 possible shifts); easily broken via brute force in seconds.
- Shift each alphabet letter by a fixed key (traditionally ):
-
Affine Cipher:
- Multiplies plaintext value by and adds offset :
- Decryption requires modular inverse of :
- Multiplies plaintext value by and adds offset :
-
Vigenère Cipher (Polyalphabetic):
- Uses a repeating keyword where each letter dictates a distinct Caesar shift.
- Mitigates simple frequency analysis by mapping the same plaintext letter to different ciphertext letters depending on position.
- Cryptanalysis: Broken via Kasiski examination (finding repeating ciphertext patterns to deduce key length) followed by frequency analysis of individual slices.
B. Transposition (Permutation) Ciphers
In a transposition cipher, the letters themselves are unchanged, but their spatial positions are scrambled.
- Rail Fence Cipher: Letters are written diagonally down and up across imaginary "rails" and read off horizontally row by row.
- Columnar Transposition: Plaintext is written in rows of fixed width and read out column by column according to the alphabetical order of a key word.
- Cryptanalysis: Letter frequency counts match standard natural language frequencies, but digram and trigram patterns are broken.
6. Security Threats Across the Protocol Stack
| Network Layer | Primary Threat Vectors & Attacks | Cryptographic & Protocol Defenses |
|---|---|---|
| Physical Layer | Eavesdropping, signal jamming, wiretapping, RF interference. | Spread-spectrum communications (FHSS/DSSS), physical shielding. |
| MAC / Data Link | MAC address spoofing, ARP cache poisoning, rogue AP injection. | 802.1X port authentication, Dynamic ARP Inspection (DAI), WPA3. |
| Network Layer | IP spoofing, ICMP flooding, packet modification, routing attacks (BGP hijack). | IPsec (AH and ESP protocols), route filtering, RPKI validation. |
| Transport Layer | TCP SYN flooding, TCP session hijacking, reset (RST) injection. | SYN cookies, TLS (Transport Layer Security) encryption and MAC. |
| Application Layer | SQL Injection, XSS, DNS cache poisoning, cross-site request forgery. | HTTPS, DNSSEC, parameterized SQL queries, CSP headers. |
7. Security in Wireless Ad Hoc Networks & VANETs
Unique Vulnerabilities of Ad Hoc Networks
Unlike traditional wired networks with centralized firewalls, routers, and domain controllers, Mobile Ad Hoc Networks (MANETs) and Vehicular Ad Hoc Networks (VANETs) operate without fixed infrastructure:
- Open Wireless Medium: Anyone with an antenna can intercept or inject radio packets.
- Dynamic Topology: Nodes join, leave, and move rapidly, requiring distributed routing.
- Constrained Resources: Nodes rely on batteries and limited bandwidth, making them susceptible to exhaustion attacks.
Classical Ad Hoc & VANET Attacks
- Blackhole Attack: A malicious node falsely advertises the shortest route to a destination in routing protocols (like AODV) and silently drops all intercepted packets.
- Wormhole Attack: Two colluding adversaries tunnel packets captured at one end of the network through a private high-speed link and replay them at another location, distorting routing graphs.
- Sybil Attack: A single rogue node claims multiple forged identities or pseudo-addresses simultaneously, undermining voting consensus or reputation models.
- VANET-Specific Threats: Tampering with safety-critical Basic Safety Messages (BSMs), GPS position spoofing, and false accident broadcasting causing phantom traffic congestion.
8. Common Pitfalls & Exam Tips
- Confusing Kerckhoffs's Principle with Security by Obscurity: Kerckhoffs's principle dictates that security depends only on key confidentiality. Hiding an algorithm is not true security.
- Existence of Modular Inverse: Remember that exists only if . In modulo 26, values like 2, 4, 13 have no inverse because .
- Passive vs Active Attacks: Passive attacks compromise confidentiality (traffic sniffing); active attacks compromise integrity or availability (spoofing, DDoS).
- Caesar vs Vigenère: Caesar is monoalphabetic (one-to-one mapping; vulnerable to single-letter frequency analysis). Vigenère is polyalphabetic (one-to-many mapping; flattens simple single-letter frequency spikes).
9. Quick Revision Summary
- The CIA triad forms the core of security: Confidentiality (encryption), Integrity (hashes), Availability (resilience).
- Kerckhoffs's Principle assumes the adversary knows the algorithm; secrecy lies entirely in the key.
- is computed via the Euclidean Algorithm; modular inverse exists if and only if .
- Substitution ciphers replace characters (Caesar, Affine, Vigenère); transposition ciphers rearrange character orders.
- Classical ciphers are broken using frequency analysis, Kasiski examination, and exhaustive keyspace search.
- Each layer of the network stack faces specific threats, from physical jamming to transport SYN floods and application injection.
- Wireless ad hoc networks and VANETs face decentralized attacks like Blackhole, Wormhole, and Sybil attacks.