Information Security
1. Mathematical Foundations¶
1.1 Number Theory¶
Basic Properties¶
- Prime Numbers: Integers greater than 1 divisible only by 1 and themselves
- Greatest Common Divisor (GCD):
is the largest integer that divides both and - Extended Euclidean Algorithm: Computes
and coefficients such that - Coprime: Integers
and are coprime if
Modular Arithmetic¶
- Congruence:
means divides - Modular Addition:
- Modular Multiplication:
- Modular Inverse:
is a number such that - Exists only when
- Can be computed using the extended Euclidean algorithm
Groups, Fields, and Cyclic Groups¶
- Group: Set with an operation that is closed, associative, has identity, and inverses
- Field: Set with two operations (addition and multiplication) that form abelian groups
- Cyclic Group: Group where every element can be expressed as powers of one element
- Generator: Element
such that generates the entire group - Order of an element: Smallest positive integer
such that
1.2 Computational Complexity¶
Asymptotic Notation¶
- Big-O Notation:
means grows no faster than - Polynomial Time: Algorithm runs in time
for some constant - Negligible Function: Function
that decreases faster than the inverse of any polynomial - Formally:
Computational Models¶
- Probabilistic Polynomial Time (PPT): Algorithms that run in polynomial time with access to random bits
- Uniform vs. Non-uniform Computation: Distinction between algorithms (uniform) and circuit families (non-uniform)
1.3 Computational Hardness Assumptions¶
One-way Functions¶
- Functions easy to compute but difficult to invert
- Formally:
is one-way if for any PPT adversary :
where
Discrete Logarithm Problem¶
- Given
and in a group , find - Believed to be hard in:
- Multiplicative groups of prime fields
with large - Elliptic curve groups over finite fields
- Best known classical algorithm: Index calculus, sub-exponential time for
- Best known quantum algorithm: Shor's algorithm, polynomial time
Integer Factorization Problem¶
- Given
(product of two large primes), find and - Best known classical algorithm: General Number Field Sieve (GNFS)
- Running time:
- Best known quantum algorithm: Shor's algorithm, polynomial time
Decisional Diffie-Hellman (DDH) Assumption¶
- The distributions
and are computationally indistinguishable - Where
are randomly chosen from the appropriate range
RSA Assumption¶
- Given
, such that , and , it's hard to compute - Weaker than factoring (breaking RSA doesn't necessarily mean factoring
)
2. Information-Theoretic vs. Computational Security¶
2.1 Information-Theoretic Security¶
Perfect Secrecy¶
- Definition: A cryptosystem has perfect secrecy if:
- Equivalent formulation: For any two messages
and any ciphertext :
- One-time Pad: Achieves perfect secrecy:
- Key: Random bit string
- Encryption:
- Decryption:
Shannon's Theorem¶
- Any encryption scheme with perfect secrecy must have
- Proof sketch:
- For each ciphertext
, define - For perfect secrecy, each key in
must encrypt to a different message - Therefore,
for each - Since sets
are disjoint,
Statistical Security¶
- Relaxation of perfect secrecy
- Distributions of ciphertexts are statistically close
- Still requires keys as long as messages
2.2 Computational Security¶
Basic Concept¶
- Security against computationally bounded adversaries
- Based on hardness assumptions (problems believed to be difficult)
- Allows for much more efficient cryptographic schemes
Advantages over Information-Theoretic Security¶
- Can use keys much shorter than messages
- Enables public-key cryptography
- Practical for real-world applications
Limitations¶
- Security is conditional on unproven computational assumptions
- Vulnerable to unforeseen algorithmic breakthroughs
- Potentially vulnerable to quantum computers
2.3 Key Differences¶
Adversary Power¶
- Information-theoretic: Secure against unbounded adversaries
- Computational: Secure only against bounded (typically polynomial-time) adversaries
Proof Techniques¶
- Information-theoretic: Based on probability theory
- Computational: Based on reductions to hard computational problems
Practical Applicability¶
- Information-theoretic: Limited to key distribution, authentication codes
- Computational: Basis for nearly all practical cryptography
3. Symmetric Cryptography¶
3.1 Computational Security Models¶
Indistinguishability Experiments¶
- IND-CPA Game:
- Challenger generates key
- Adversary
can make polynomial queries to encryption oracle selects of equal length- Challenger selects
uniformly and sends can continue making encryption queries outputs guess-
wins if -
Advantage:
- CPA Security: Scheme is CPA-secure if for all PPT adversaries
, is negligible
CCA Security¶
- IND-CCA Game:
- Same as IND-CPA, but adversary also has access to decryption oracle
-
Cannot decrypt the challenge ciphertext
-
Advantage:
- CCA Security: Scheme is CCA-secure if for all PPT adversaries
, is negligible
Real-vs-Random Security¶
- Alternative definition equivalent to IND-CPA
- Adversary cannot distinguish encryptions of chosen messages from encryptions of random messages
3.2 Pseudorandom Functions and Permutations¶
PRF (Pseudorandom Function):
- A function family
- For a key
, where - Security definition: For any probabilistic polynomial-time adversary
with oracle access:
where
PRG (Pseudorandom Generator):
- A deterministic function
where - Security definition: For any probabilistic polynomial-time adversary
:
PRP (Pseudorandom Permutation):
- A keyed family of permutations
- For each key
, is a bijection on - Security definition: For any probabilistic polynomial-time adversary
with oracle access:
where
Relationship construction examples:
- PRG from PRF:
for seed - PRF from PRG (GGM): For a PRG
that doubles input length with as its output halves: - PRP from PRF (Luby-Rackoff): A 3-round Feistel network using a PRF creates a PRP
Pseudorandom Functions (PRFs)¶
- Family of functions
- Security: Computationally indistinguishable from a truly random function
- Formally: For any PPT distinguisher
:
where
Pseudorandom Permutations (PRPs)¶
- Family of permutations
- Each
is a bijection - Security: Computationally indistinguishable from a truly random permutation
PRF/PRP Switching Lemma¶
- For any distinguisher making
queries:
where
PRG from PRF¶
A pseudorandom generator can be constructed from a pseudorandom function by using the PRF to expand a seed into a longer output:
Elaboration:
- Start with a seed
PRF from PRG (GGM Construction)¶
The Goldreich-Goldwasser-Micali (GGM) construction builds a PRF from a PRG:
Elaboration:
- Start with a PRG
PRP from PRF (Luby-Rackoff Construction)¶
The Luby-Rackoff construction uses the Feistel network to convert a PRF into a PRP:
Elaboration:
- Start with a PRF
Other Important Relationships¶
PRP to PRF¶
- A PRP can be used as a PRF directly when the input domain is large
- For
-bit inputs, the statistical distance is bounded by where is the number of queries - This is known as the PRP/PRF switching lemma
PRG from One-Way Functions¶
- Håstad, Impagliazzo, Levin, and Luby showed that PRGs can be constructed from any one-way function
- This is a fundamental result showing that pseudorandomness can be built from minimal cryptographic assumptions
PRP Composition¶
- The composition of secure PRPs results in another secure PRP
- This justifies multi-round block cipher designs that compose multiple simpler permutations
3.3 Block Ciphers¶
- Fixed-length permutations parameterized by a key
- Examples: DES (56-bit key, 64-bit block), AES (128/192/256-bit key, 128-bit block)
- Design principles: Substitution-permutation networks, Feistel networks
- Security goal: Behave as a PRP
DES (Data Encryption Standard)¶
- Feistel network with 16 rounds
- 56-bit key (effectively 48 bits of security due to complementation property)
- Vulnerable to exhaustive search
AES (Advanced Encryption Standard)¶
- Substitution-permutation network with 10/12/14 rounds
- 128/192/256-bit key
- Operations: SubBytes, ShiftRows, MixColumns, AddRoundKey
3.4 Modes of Operation¶
Electronic Codebook (ECB)¶
- Insecure for multiple blocks (patterns in plaintext visible in ciphertext)
Cipher Block Chaining (CBC)¶
with- CPA-secure if IV is random and unpredictable
- Vulnerable to padding oracle attacks
Counter Mode (CTR)¶
- Effectively turns block cipher into stream cipher
- CPA-secure if
never repeats - Parallelizable
Galois/Counter Mode (GCM)¶
- Combines CTR mode encryption with authentication
- Provides authenticated encryption
- Fast and parallelizable
3.5 Stream Ciphers¶
- Generate pseudorandom keystream from seed
- XOR keystream with plaintext:
- Examples: RC4 (insecure), ChaCha20
RC4¶
- Simple key scheduling algorithm and byte generation
- Various weaknesses, no longer recommended
ChaCha20¶
- Based on add-rotate-XOR (ARX) operations
- 256-bit key, 96-bit nonce, 32-bit counter
- Often paired with Poly1305 for authentication (ChaCha20-Poly1305)
4. Cryptographic Hash Functions¶
4.1 Security Properties¶
- Pre-image Resistance: Given
, hard to find any such that - Formally: For all PPT adversaries
:
where $x$ is chosen uniformly
- Second Pre-image Resistance: Given
, hard to find such that - Formally: For all PPT adversaries
:
where $x$ is chosen uniformly
- Collision Resistance: Hard to find any
such that - Formally: For all PPT adversaries
:
- Relationships: Collision resistance ⟹ Second pre-image resistance ⟹̸ Pre-image resistance
4.2 Birthday Attack¶
- Finds collisions in
time for -bit hash - Based on birthday paradox probability:
where
- For 50% probability of collision:
-
Need approximately
samples from -bit hash -
Implications:
- 128-bit hash provides only 64 bits of collision resistance
- 256-bit hash needed for 128-bit collision resistance
4.3 Hash Function Constructions¶
Merkle-Damgård Construction¶
- Foundation for many hash functions (MD5, SHA-1, SHA-2)
- Message
split into blocks - Compression function
iteratively applied: (initialization vector) for- Length padding: Append message length to prevent length extension attacks
- Security: If compression function is collision-resistant, so is the hash function
Sponge Construction¶
- Used in SHA-3 (Keccak)
- Based on permutation
of fixed size - Two phases:
- Absorbing: Incorporate message blocks
- Squeezing: Extract hash bits
- Resistant to length extension attacks
4.4 Common Hash Functions¶
MD5¶
- 128-bit output
- Merkle-Damgård construction
- Broken (collisions can be found in seconds)
SHA-1¶
- 160-bit output
- Merkle-Damgård construction
- Broken (collisions demonstrated in practice)
SHA-2 Family¶
- Includes SHA-224, SHA-256, SHA-384, SHA-512
- Merkle-Damgård construction
- Currently secure, but similar design to SHA-1
SHA-3 (Keccak)¶
- Sponge construction
- More resistant to attacks that affect SHA-2
- Flexible output size
5. Message Authentication¶
5.1 Message Authentication Codes (MACs)¶
- Provide data integrity and authentication
- Function
- Security goal: Existential unforgeability under chosen message attack (EU-CMA)
Security Definition¶
- EU-CMA Game:
- Challenger generates key
- Adversary
can make queries to outputs-
wins if and was not queried -
Advantage:
- Security: MAC is secure if for all PPT adversaries
, is negligible
5.2 MAC Constructions¶
CBC-MAC¶
- Based on block cipher in CBC mode
for- Output
as the MAC tag - Secure only for fixed-length messages
- For variable-length messages, use:
- EMAC: Encrypt the final output with a different key
- CMAC: Use different masks for final block, handle padding
HMAC¶
- Hash-based MAC:
where
- More secure than naive
approach - Security based on compression function properties
Poly1305¶
- Based on polynomial evaluation in a finite field
- Often used with ChaCha20
- Strong information-theoretic security guarantees
- Extremely efficient
5.3 Authenticated Encryption¶
Definition¶
- Provides both confidentiality and integrity
- Formally:
where: outputs key outputs ciphertext outputs or (invalid)
Security¶
- IND-CCA security
- Ciphertext integrity: Cannot forge valid ciphertexts
Generic Compositions¶
- Encrypt-then-MAC:
- Provably secure
-
Preferred approach
-
MAC-then-Encrypt:
-
Can be vulnerable (e.g., TLS CBC padding oracle attacks)
-
Encrypt-and-MAC:
- May leak information about plaintext
AEAD Modes¶
- GCM (Galois/Counter Mode):
- CTR mode encryption with GHASH authentication
- Uses Galois field multiplication
-
Fast and widely deployed
-
ChaCha20-Poly1305:
- ChaCha20 stream cipher with Poly1305 MAC
-
More secure on platforms without AES hardware acceleration
-
CCM (Counter with CBC-MAC):
- Combines CTR mode with CBC-MAC
- Less efficient than GCM
5.4 Replay Attack Prevention¶
- Replay Attack: Adversary captures valid message and resends later
- MACs alone don't prevent replay attacks
Prevention Techniques¶
- Sequence Numbers: Include monotonically increasing counter in authenticated data
- Timestamps: Include timestamp in authenticated data
- Nonces (Numbers Used Once): Include random/unique value in authenticated data
- Challenge-Response: Server sends random challenge that must be included in authenticated response
6. Public Key Cryptography¶
6.1 Fundamental Differences from Symmetric Cryptography¶
Structural Differences¶
- Symmetric: Same key for encryption and decryption
- Public Key: Different keys for encryption (public) and decryption (private)
Underlying Assumptions¶
- Symmetric: Based on confusion and diffusion (information-theoretic concepts)
- Public Key: Based on mathematical hardness assumptions (computational concepts)
Key Distribution Problem¶
- Symmetric Problem:
users need keys for pairwise communication - Public Key Solution:
users need only keys (public + private for each)
Performance¶
- Symmetric: Typically 1000-10000x faster than public key operations
- Public Key: Computationally intensive
- Hybrid Systems: Use public key crypto for key exchange, symmetric for data encryption
6.2 Key Distribution Approaches¶
Key Distribution Center (KDC)¶
- Trusted third party that distributes session keys
- Each user shares a long-term key with the KDC
- Example: Kerberos authentication protocol
Key Agreement Protocols¶
- Allow two parties to derive a shared secret over an insecure channel
- Example: Diffie-Hellman key exchange
Public Key Infrastructure (PKI)¶
- System for distributing and validating public keys
- Components: Certificate Authorities (CAs), certificates, revocation
6.3 RSA Cryptosystem¶
Key Generation¶
- Generate large primes
(typically 1024-2048 bits each) - Compute
- Compute
- Choose
such that (typically 65537) - Compute
such that - Public key:
, Private key:
Encryption/Decryption¶
- Encryption:
- Decryption:
Correctness¶
- For any
:
where
Security¶
- Based on hardness of factoring
or solving the RSA problem - Basic (textbook) RSA is deterministic and NOT CPA secure
- Vulnerable to:
- Chosen ciphertext attacks
- Common modulus attacks
- Low public exponent attacks
- Timing attacks
6.4 RSA Padding Schemes¶
PKCS#1 v1.5 Padding¶
- Format:
- Where PS is random non-zero bytes of appropriate length
- Prevents certain mathematical attacks
- Vulnerable to Bleichenbacher's attack
Optimal Asymmetric Encryption Padding (OAEP)¶
- Combines message with random seed through hash functions
- Provides provable security in the random oracle model
- More complex but stronger security properties
6.5 Chinese Remainder Theorem (CRT)¶
Theorem Statement¶
- If
are pairwise coprime, then the system of congruences:
has a unique solution modulo
RSA-CRT Decryption¶
- Compute
- Compute
- Compute
- Approximately 4x faster than standard RSA decryption
6.6 Diffie-Hellman Key Exchange¶
Protocol¶
- Setup: Public parameters
where is prime and is a generator of - Alice:
- Choose random
- Compute
- Send
to Bob - Bob:
- Choose random
- Compute
- Send
to Alice - Shared secret:
Security¶
- Security based on Computational Diffie-Hellman (CDH) assumption
- Vulnerable to man-in-the-middle attacks without authentication
- Variants:
- Static-Static: Both parties have long-term DH keys
- Ephemeral-Ephemeral: Both parties generate new DH keys per exchange
- Static-Ephemeral: One party has long-term key, other generates new key
6.7 ElGamal Encryption¶
Key Generation¶
- Choose prime
and generator of - Choose random
- Compute
- Public key:
, Private key:
Encryption/Decryption¶
- Encryption:
- Choose random
- Compute
- Compute
-
Ciphertext:
-
Decryption:
- Compute
- Compute
Properties¶
- CPA secure under the Decisional Diffie-Hellman (DDH) assumption
- Naturally randomized (different ciphertexts for same plaintext)
- Ciphertext expansion: 2x plaintext size
- Multiplicatively homomorphic:
6.8 Security Definitions for Public Key Cryptography¶
CPA Security¶
- Similar to symmetric CPA security
- Adversary always has the public key, so can encrypt any message
- Game:
- Challenger generates
- Adversary gets
- Adversary selects
of equal length - Challenger selects
uniformly and sends - Adversary outputs guess
- Adversary wins if
CCA Security¶
- As above, but adversary can also query decryption oracle
- Cannot decrypt the challenge ciphertext
- Important for practical security
- Achieved by schemes like RSA-OAEP, Cramer-Shoup
7. Digital Signatures¶
7.1 Basic Concepts¶
- Digital analog of handwritten signatures
- Only the signer can create valid signatures, but anyone can verify
- Scheme
: : Outputs key pair : Outputs signature : Outputs 1 (valid) or 0 (invalid)
7.2 Security Definition¶
Existential Unforgeability under Chosen Message Attack (EU-CMA)¶
- Game:
- Challenger generates
- Adversary gets
and access to - Adversary outputs
- Adversary wins if
and was not queried to signing oracle
Strong Unforgeability¶
- As above, but adversary also wins if it produces a new signature for a previously signed message
7.3 RSA Signatures¶
- Basic idea: "Decrypt" the message with private key
- Signing:
(uses private key) - Verification: Check if
(uses public key) - In practice, sign a hash:
- Need padding schemes for security (e.g., PKCS#1 v1.5, PSS)
7.4 Digital Signature Algorithm (DSA)¶
Key Generation¶
- Choose prime
and prime such that divides - Choose
of order in - Choose random
- Compute
- Public key:
, Private key:
Signing¶
- Choose random
- Compute
- Compute
- Signature:
Verification¶
- Check that
- Compute
- Compute
- Compute
- Compute
- Signature is valid if
7.5 Elliptic Curve Digital Signature Algorithm (ECDSA)¶
- Variant of DSA using elliptic curve groups
- Smaller key sizes for equivalent security
- Basic structure similar to DSA with operations in elliptic curve group
8. Security Reductions¶
8.1 Reduction Concept¶
- Proof technique to establish security based on hardness assumptions
- If problem A can be reduced to problem B:
- Algorithm for B can be used to solve A
- Hardness of A implies hardness of B
8.2 Types of Reductions¶
Polynomial-time Reductions¶
- Mapping problem instances in polynomial time
- Standard for computational complexity
Concrete Security Reductions¶
- Preserves exact security parameters
- Example: "If attacker breaks scheme with advantage
, we can solve hard problem with advantage "
8.3 Example Reductions¶
ElGamal Security Reduction¶
- CPA security of ElGamal reduces to the Decisional Diffie-Hellman (DDH) problem
- Reduction transforms a DDH challenge into an ElGamal encryption
RSA-OAEP Security Reduction¶
- CCA security of RSA-OAEP reduces to RSA assumption in the random oracle model
- More complex reduction using properties of the OAEP transform
9. Advanced Topics¶
9.1 Quantum Effects on Cryptography¶
Shor's Algorithm¶
- Polynomial-time quantum algorithm for factoring integers and computing discrete logarithms
- Breaks RSA, DSA, ECDSA, and Diffie-Hellman
Grover's Algorithm¶
- Quadratic speedup for brute-force search
- Reduces symmetric key security by half (e.g., 128-bit keys provide 64-bit security)
- Implication: Double key lengths for symmetric algorithms
9.2 Post-Quantum Cryptography¶
Lattice-based Cryptography¶
- Based on hardness of lattice problems
- Examples: NTRU, Ring-LWE, Module-LWE
- NIST candidates: CRYSTALS-Kyber, SABER
Code-based Cryptography¶
- Based on hardness of decoding random linear codes
- Example: McEliece cryptosystem
- NIST candidates: Classic McEliece
Multivariate Cryptography¶
- Based on hardness of solving multivariate polynomial equations
- Examples: HFE, UOV
- NIST candidates: Rainbow
Hash-based Signatures¶
- Security based solely on hash function properties
- Examples: Lamport signatures, XMSS, SPHINCS+
- Stateful vs. stateless designs
9.3 Zero-Knowledge Proofs¶
Definition¶
- Interactive protocol between prover and verifier
- Properties:
- Completeness: Honest prover convinces honest verifier
- Soundness: Dishonest prover cannot convince honest verifier
- Zero-knowledge: Verifier learns nothing but truth of statement
Non-interactive Zero-Knowledge (NIZK)¶
- Zero-knowledge proofs without interaction
- Often uses a common reference string
Applications¶
- Authentication without revealing secrets
- Private transactions in cryptocurrencies
- Secure multi-party computation
9.4 Secure Multi-party Computation¶
Definition¶
- Multiple parties compute function on private inputs
- No party learns anything beyond their output
Approaches¶
- Garbled circuits
- Secret sharing
- Homomorphic encryption
Applications¶
- Privacy-preserving analytics
- Secure auctions
- Private machine learning
9.5 Homomorphic Encryption¶
Partial Homomorphism¶
- ElGamal: Multiplicative homomorphism
- Paillier: Additive homomorphism
Fully Homomorphic Encryption (FHE)¶
- Allows arbitrary computations on encrypted data
- First construction: Gentry (2009)
- Current schemes: BGV, BFV, CKKS, GSW
- Still impractical for many applications but improving rapidly
10. Cryptographic Protocols¶
10.1 Secure Communication Protocols¶
Transport Layer Security (TLS)¶
- Provides secure communication over computer networks
- Components:
- Handshake protocol (key exchange, authentication)
- Record protocol (data encryption, integrity)
- Versions: TLS 1.2, TLS 1.3 (removes vulnerable constructions)
Secure Shell (SSH)¶
- Secure remote login and command execution
- Components:
- Transport layer (encryption, integrity)
- Authentication protocol
- Connection protocol
10.2 Authentication Protocols¶
Password-based Authentication¶
- Vulnerable to various attacks
- Mitigations: Salting, key derivation functions (PBKDF2, bcrypt, Argon2)
Challenge-Response Protocols¶
- Server sends random challenge
- Client proves knowledge of secret without revealing it
OAuth and OpenID Connect¶
- Delegated authentication and authorization
- Allows third-party access without sharing credentials
10.3 Key Exchange Protocols¶
Station-to-Station (STS) Protocol¶
- Authenticated Diffie-Hellman
- Prevents man-in-the-middle attacks
Internet Key Exchange (IKE)¶
- Key exchange protocol used in IPsec
- Complex with many options and modes
11. Practical Considerations¶
11.1 Implementation Security¶
Side-Channel Attacks¶
- Timing attacks
- Power analysis
- Cache attacks
- Countermeasures: Constant-time operations, masking, blinding
Fault Attacks¶
- Induce errors during computation
- Extract secrets from faulty outputs
- Countermeasures: Verification, redundancy
11.2 Random Number Generation¶
True Random Number Generators (TRNGs)¶
- Based on physical processes
- Examples: Radioactive decay, atmospheric noise, circuit noise
Deterministic Random Bit Generators (DRBGs)¶
- Pseudo-random generators with entropy input
- Examples: HMAC-DRBG, CTR-DRBG
Catastrophic Failures¶
- Debian OpenSSL vulnerability (2008)
- Dual EC DRBG backdoor controversy
11.3 Standards and Best Practices¶
NIST Recommendations¶
- Symmetric algorithms: AES, SHA-2/SHA-3
- Asymmetric algorithms: RSA, ECDSA, DH, ECDH
- Key lengths: 128-bit symmetric, 3072-bit RSA, 256-bit ECC
IETF Recommendations¶
- Protocols: TLS 1.3, SSH, IPsec
- Cipher suites: AES-GCM, ChaCha20-Poly1305
- Key exchange: ECDHE, DHE
Cryptographic Agility¶
- Design systems to easily update algorithms and parameters
- Prepare for quantum computer threat