Week - 8
Lecture 36:
Message Authentication
Message Authentication (Basic Idea)
- Goal: verify message is from sender
Using Symmetric Key
- Alice sends:
At Receiver
-
Compute:
-
Decrypt:
-
Compare
✔ If equal → authenticated
Issue
- Receiver can forge message
- No proof of origin
Hash Function
-
Input: arbitrary size
-
Output:
-
Public (no key)
MAC (Message Authentication Code)
- Uses secret key
Limitation
- Protects from third party
- Not from malicious receiver
Digital Signature
- Uses private key
Signing
Verification
✔ Only sender can sign
Property
- Non-repudiation
- Cannot be forged by receiver
Public Key Directory
-
Stores:
- Public keys of users
Authentication + Confidentiality (Hybrid)
Step 1: Sign
Step 2: Encrypt
Receiver
-
Decrypt:
-
Verify:
Alternative (Pure Public Key)
Sender
-
Sign:
-
Encrypt:
Receiver
-
Decrypt:
-
Verify:
Final Properties
-
Confidentiality:
-
Authentication:
Key Insight
- Signature → proves sender
- Encryption → hides message
Conclusion
-
Combine:
- Hash + MAC → basic authentication
- Digital signature → strong authentication
- Encryption → confidentiality
✔ Used together in secure communication
Lecture 37:
Digital Signature
Purpose
- Authentication
- Integrity
- Non-repudiation
Basic Idea
- Sender signs using private key
- Receiver verifies using public key
RSA Signature
Key Setup
Signing
Verification
Valid if:
Correctness
Signature Scheme (Formal)
-
Tuple:
-
→ plaintext space
-
→ signature space
-
→ key space
Functions
Property
ElGamal Signature
Setup
-
Choose prime:
-
Generator:
-
Private key:
-
Public key:
Signing
Choose random:
- Signature:
Verification
Correctness
Key Points
- RSA → based on factorization
- ElGamal → based on discrete log
- Signing uses private key
- Verification uses public key
Final Insight
-
Signature ensures:
- Message origin
- Message integrity
- Sender accountability
Lecture 38:
Key Management
Key Management
- Goal: securely obtain receiver’s public key before communication
Problem
- Alice needs Bob’s public key
- How to get it securely?
Public Key Distribution Methods
1. Public Announcement
- Users broadcast their public keys
Issue:
- Vulnerable to impersonation (attacker can replace key)
2. Public Key Directory (PKD)
-
Central directory storing:
- User ID
- Public key
-
Sender:
- Looks up receiver’s key
- Encrypts message
Issue:
- If directory is public → can be modified
- Needs protection
3. Trusted Public Key Authority
-
Central trusted authority maintains keys
-
Process:
- User requests receiver’s key from authority
- Authority provides authentic key
Issue:
- Bottleneck (handles all requests)
- High communication overhead
Solution → Public Key Certificates
-
Authority issues certificate containing:
- User ID
- Public key
- Timestamp
- Digital signature of authority
Certificate Creation
For user ( B ):
- Signed using authority’s private key
Certificate Verification
Alice verifies Bob’s certificate:
-
Check:
- Timestamp valid
- ID matches
- Signature valid
✔ Then trust ( e_B )
Communication Using Certificate
- Bob sends certificate ( C_B )
- Alice verifies it
- Extracts ( e_B )
- Encrypts message using ( e_B )
Advantages
- No need to contact authority every time
- Prevents key tampering
- Scalable
Certificate Update
-
If key compromised:
- User generates new key pair
- Requests new certificate
- Authority signs new certificate
Certificate Contains
- Timestamp
- User ID
- Public key
- Authority signature
X.509 Certificate Standard
- Widely used format
Fields:
- Version
- Serial number
- Signature algorithm
- Issuer (authority)
- Validity period
- Subject (user)
- Public key
- Extensions
- Digital signature
Key Insight
-
Trust shifts from:
- “Anyone can publish key” ❌
- To “Authority verifies identity” ✔
Final Flow
- Authority signs → certificate trusted
- User verifies → gets correct public key
- Secure communication enabled
Lecture 39:
Key Exchange
Key Exchange (Goal)
- Share symmetric key (k) over insecure channel
- Needed because symmetric crypto (DES/AES) is faster
Diffie–Hellman (Recap)
-
Public:
-
Secrets:
-
Exchange:
-
Shared key:
Problem → Active Attack (MITM)
-
Attacker (Oscar) intercepts messages
-
Replaces:
- (g^a, g^b) with (g^c)
Result
-
Alice computes:
-
Bob computes:
-
Oscar knows both:
✔ Can decrypt + re-encrypt messages
Using Public Key for Key Exchange
Basic Scheme
-
Alice sends:
-
Bob chooses:
-
Bob sends:
-
Alice decrypts:
✔ Shared key established
Problem → Still Vulnerable
- Oscar replaces Alice’s public key
- Bob encrypts (k) using Oscar’s key
- Oscar decrypts → learns (k)
- Re-encrypts for Alice
✔ Key leaked
Secure Key Exchange (Authenticated)
Step 1
Alice → Bob:
Step 2
Bob → Alice:
Step 3
Alice → Bob:
✔ Mutual authentication using nonces
Step 4 (Key Transfer)
Bob sends:
Then signs:
Final Decryption (Alice)
-
Verify signature:
-
Decrypt:
Why Secure?
- Nonces → prevent replay
- Encryption → confidentiality
- Signature → authentication
✔ Stops active attacker
Key Insight
- Diffie–Hellman alone ❌ (no authentication)
- Public key alone ❌ (key substitution attack)
- Combined (auth + encryption) ✔ secure
Final Flow
- Authenticate → verify identity
- Exchange key → securely
- Use symmetric key for communication
Lecture 40:
Hash Function
Hash Function (Concept)
-
Map large key space → fixed size table
-
Operations supported:
- Insert
- Delete
- Search
Hash Table
-
Size:
-
Keys:
-
Load factor:
Collision
-
When:
-
Happens because:
Good Hash Function
- Uniform distribution:
Division Method
-
Choose:
-
Avoid:
Multiplication Method
-
Formula:
-
Or binary form (practical):
Collision Resolution
1. Chaining
- Store list at each slot
2. Open Addressing
- No extra memory
Linear Probing
-
Problem:
- Clustering
Double Hashing
- Better distribution
- Reduces clustering
Deletion Issue
-
Cannot mark slot empty directly
-
Use:
- Deleted marker
Performance
-
Unsuccessful search (approx):
-
Examples:
- If → ~2 probes
- If → ~10 probes
Key Insight
- Small → faster search
- Good hash → uniform distribution
- Double hashing > linear probing