Skip to main content
Introduction to Cryptography
  1. Resources/
  2. Study Materials/
  3. Information & Communication Technology Engineering/
  4. ICT Semester 5/
  5. Cyber Security (4353204)/
  6. Cyber Security Slidev Presentations/

Introduction to Cryptography

·
Milav Dabgar
Author
Milav Dabgar
Experienced lecturer in the electrical and electronic manufacturing industry. Skilled in Embedded Systems, Image Processing, Data Science, MATLAB, Python, STM32. Strong education professional with a Master’s degree in Communication Systems Engineering from L.D. College of Engineering - Ahmedabad.
Table of Contents

Introduction to Cryptography
#

Unit I: Introduction to Cyber Security & Cryptography
#

Lecture 7: The Science of Secret Communication
#

Course: Cyber Security (4353204) | Semester V | Diploma ICT | Author: Milav Dabgar

layout: default
#

What is Cryptography?
#

๐Ÿ” Definition
#

Cryptography is the science of protecting information by transforming it into an unreadable format for unauthorized users, while allowing authorized users to access the original information.

๐ŸŽฏ Core Objectives
#

  • Confidentiality - Keep information secret
  • Integrity - Ensure data hasn’t been altered
  • Authentication - Verify identity of sender
  • Non-repudiation - Prevent denial of actions

๐Ÿ“š Etymology
#

  • Crypto (Greek) = Hidden, Secret
  • Graphy (Greek) = Writing
  • Cryptography = Secret Writing

๐Ÿ”„ Cryptographic Process
#

graph LR
    A[Plaintext] --> B[Encryption Algorithm]
    B --> C[Ciphertext]
    C --> D[Decryption Algorithm]
    D --> E[Plaintext]
    
    F[Key] --> B
    G[Key] --> D
    
    style A fill:#e8f5e8
    style C fill:#fff3e0
    style E fill:#e8f5e8
    style F fill:#f3e5f5
    style G fill:#f3e5f5

๐Ÿ”‘ Key Components
#

  • Plaintext - Original readable message
  • Ciphertext - Encrypted unreadable message
  • Algorithm - Mathematical process
  • Key - Secret parameter that controls encryption
  • Keyspace - Set of all possible keys
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Historical Cryptography
#

๐Ÿ›๏ธ Ancient Cryptography
#

Caesar Cipher (50 BC)
#

Plaintext:  HELLO WORLD
Key:        3 (shift by 3)
Ciphertext: KHOOR ZRUOG

A B C D E F G H I J K L M
โ†“ โ†“ โ†“ โ†“ โ†“ โ†“ โ†“ โ†“ โ†“ โ†“ โ†“ โ†“ โ†“
D E F G H I J K L M N O P

Atbash Cipher
#

  • Hebrew origin - reverse alphabet
  • Aโ†”Z, Bโ†”Y, Cโ†”X…
  • Used in Biblical texts

Scytale (Ancient Greece)
#

  • Physical device - rod with leather strip
  • Transposition cipher
  • Military communications

๐Ÿ•ฐ๏ธ Evolution Timeline
#

Middle Ages (500-1500 AD)
#

  • Polyalphabetic ciphers
  • Vigenรจre cipher (1553)
  • Frequency analysis attacks

Renaissance (1400-1600)
#

  • Diplomatic cryptography
  • Cipher wheels and devices
  • Code breaking emergence

Modern Era (1900-1950)
#

  • Mechanical devices (Enigma)
  • World War cryptography
  • Breaking Enigma - Turing’s work

Computer Age (1950+)
#

  • DES (1976) - Data Encryption Standard
  • Public key cryptography (1976)
  • AES (2001) - Advanced Encryption Standard
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Types of Cryptographic Systems
#

๐Ÿ”‘ Symmetric Cryptography
#

๐ŸŽฏ Characteristics
#

  • Same key for encryption and decryption
  • Fast and efficient
  • Shared secret required
  • Key distribution problem

๐Ÿ“Š Process Flow
#

graph LR
    A[Alice] --> B[Message + Shared Key]
    B --> C[Encryption]
    C --> D[Ciphertext]
    D --> E[Network/Storage]
    E --> F[Ciphertext]
    F --> G[Decryption]
    G --> H[Message + Shared Key]
    H --> I[Bob]
    
    style A fill:#e3f2fd
    style I fill:#e3f2fd
    style C fill:#f3e5f5
    style G fill:#f3e5f5

๐Ÿ”ง Common Algorithms
#

  • AES (Advanced Encryption Standard)
  • 3DES (Triple Data Encryption Standard)
  • ChaCha20 (Stream cipher)
  • Blowfish (Block cipher)

๐Ÿ” Asymmetric Cryptography
#

๐ŸŽฏ Characteristics
#

  • Different keys (public/private pair)
  • Slower than symmetric
  • No shared secret needed
  • Solves key distribution problem

๐Ÿ“Š Process Flow
#

graph LR
    A[Alice] --> B[Message + Bob's Public Key]
    B --> C[Encryption]
    C --> D[Ciphertext]
    D --> E[Network]
    E --> F[Ciphertext]
    F --> G[Decryption]
    G --> H[Message + Bob's Private Key]
    H --> I[Bob]
    
    style A fill:#e3f2fd
    style I fill:#e3f2fd
    style C fill:#e8f5e8
    style G fill:#e8f5e8

๐Ÿ”ง Common Algorithms
#

  • RSA (Rivest-Shamir-Adleman)
  • ECC (Elliptic Curve Cryptography)
  • DSA (Digital Signature Algorithm)
  • Diffie-Hellman (Key exchange)
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Symmetric Encryption: AES Algorithm
#

๐Ÿ† AES Overview
#

๐Ÿ“‹ Specifications
#

  • Block size: 128 bits
  • Key sizes: 128, 192, 256 bits
  • Rounds: 10, 12, 14 (based on key size)
  • Standard: NIST FIPS 197

๐Ÿ”„ AES Operations
#

  1. SubBytes - Byte substitution using S-box
  2. ShiftRows - Cyclic shift of rows
  3. MixColumns - Linear transformation
  4. AddRoundKey - XOR with round key

๐Ÿ“Š AES Structure
#

Round 1-9:  SubBytes โ†’ ShiftRows โ†’ MixColumns โ†’ AddRoundKey
Round 10:   SubBytes โ†’ ShiftRows โ†’ AddRoundKey

๐Ÿ”ง AES Implementation Example
#

from cryptography.fernet import Fernet
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
import os

# AES encryption example
def aes_encrypt(plaintext, key):
    # Generate random IV
    iv = os.urandom(16)
    
    # Create cipher object
    cipher = Cipher(
        algorithms.AES(key),
        modes.CBC(iv),
        backend=default_backend()
    )
    
    encryptor = cipher.encryptor()
    
    # Pad plaintext to block size
    padded_text = pad(plaintext.encode(), 16)
    
    # Encrypt
    ciphertext = encryptor.update(padded_text) + encryptor.finalize()
    
    return iv + ciphertext

# Key generation
key = os.urandom(32)  # 256-bit key

๐Ÿ›ก๏ธ Security Features
#

  • Proven security through extensive analysis
  • Resistant to known attacks
  • Hardware optimization available
  • Government approved (FIPS 140-2)
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Asymmetric Encryption: RSA Algorithm
#

๐Ÿ”ข RSA Mathematical Foundation
#

๐ŸŽฏ Key Generation Process
#

  1. Choose two large prime numbers p and q
  2. Compute n = p ร— q (modulus)
  3. Compute ฯ†(n) = (p-1)(q-1)
  4. Choose e such that gcd(e, ฯ†(n)) = 1
  5. Compute d such that e ร— d โ‰ก 1 (mod ฯ†(n))

๐Ÿ”‘ Keys
#

  • Public Key: (n, e)
  • Private Key: (n, d)

๐Ÿ“Š RSA Operations
#

Encryption: C = M^e mod n
Decryption: M = C^d mod n

Where:
- M = Message (plaintext)
- C = Ciphertext
- e = Public exponent
- d = Private exponent
- n = Modulus

๐Ÿ”’ RSA Security & Applications
#

๐Ÿ›ก๏ธ Security Basis
#

  • Integer factorization problem
  • Large prime factorization difficulty
  • Computational complexity theory

โšก Performance Considerations
#

  • Slow compared to symmetric encryption
  • Key size affects performance (1024, 2048, 4096 bits)
  • Hybrid cryptography common approach

๐Ÿ”ง RSA Applications
#

  • Digital signatures
  • Key exchange protocols
  • Certificate authorities
  • Secure communications (TLS/SSL)

๐Ÿ“ˆ Hybrid Cryptography Example
#

1. Generate random AES key
2. Encrypt data with AES (fast)
3. Encrypt AES key with RSA (secure)
4. Send both encrypted data and encrypted key
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Digital Signatures
#

โœ๏ธ Digital Signature Concept
#

๐ŸŽฏ Purpose
#

  • Authentication - Verify sender identity
  • Integrity - Detect message tampering
  • Non-repudiation - Prevent denial of signing

๐Ÿ”„ Signature Process
#

graph TB
    A[Message] --> B[Hash Function]
    B --> C[Message Digest]
    C --> D[Sign with Private Key]
    D --> E[Digital Signature]
    
    F[Message + Signature] --> G[Hash Function]
    G --> H[Message Digest]
    E --> I[Verify with Public Key]
    I --> J[Original Digest]
    H --> K{Compare}
    J --> K
    K --> L[Valid/Invalid]
    
    style A fill:#e8f5e8
    style E fill:#f3e5f5
    style L fill:#fff3e0

๐Ÿ”ง Digital Signature Implementation
#

๐Ÿ“‹ Common Algorithms
#

  • RSA signatures
  • DSA (Digital Signature Algorithm)
  • ECDSA (Elliptic Curve DSA)
  • EdDSA (Edwards-curve DSA)

๐Ÿ’ป Example: RSA Signature
#

from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import rsa, padding
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat

# Generate key pair
private_key = rsa.generate_private_key(
    public_exponent=65537,
    key_size=2048
)
public_key = private_key.public_key()

# Sign message
message = b"Important document content"
signature = private_key.sign(
    message,
    padding.PSS(
        mgf=padding.MGF1(hashes.SHA256()),
        salt_length=padding.PSS.MAX_LENGTH
    ),
    hashes.SHA256()
)

# Verify signature
try:
    public_key.verify(signature, message, ...)
    print("Signature valid")
except:
    print("Signature invalid")
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Key Management
#

๐Ÿ—๏ธ Key Management Lifecycle
#

๐Ÿ”„ Key Lifecycle Phases
#

  1. Generation - Create cryptographic keys
  2. Distribution - Securely share keys
  3. Storage - Protect keys at rest
  4. Usage - Apply keys for cryptographic operations
  5. Rotation - Replace keys periodically
  6. Revocation - Invalidate compromised keys
  7. Destruction - Securely delete old keys

โšก Key Generation Requirements
#

  • True randomness (entropy)
  • Sufficient length
  • Proper algorithms
  • Secure random generators

๐Ÿ”’ Key Storage Options
#

  • Hardware Security Modules (HSM)
  • Key management systems
  • Secure software storage
  • Cloud key management

๐Ÿ›ก๏ธ Key Management Best Practices
#

๐Ÿ“‹ Security Principles
#

  • Separation of duties in key handling
  • Least privilege access
  • Key escrow for recovery
  • Audit trails for key operations
  • Regular key rotation

๐Ÿ”ง Key Distribution Methods
#

  • Public Key Infrastructure (PKI)
  • Key exchange protocols
  • Symmetric key pre-distribution
  • Key derivation functions

๐Ÿ“Š Key Management Challenges
#

  • Scalability - Managing thousands of keys
  • Compliance - Meeting regulatory requirements
  • Integration - Working with existing systems
  • Cost - Hardware and operational expenses
  • Availability - Ensuring key access when needed

๐Ÿ’ก Best Practice Example
#

Key Management Policy:
  Generation: FIPS 140-2 Level 3 HSM
  Storage: Encrypted key vault with RBAC
  Rotation: Every 90 days for signing keys
  Backup: Encrypted offsite storage
  Destruction: Crypto-shredding approved methods
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Cryptographic Applications
#

๐ŸŒ Modern Applications
#

๐Ÿ’ณ E-Commerce Security
#

  • Payment card encryption (PCI DSS)
  • Transaction integrity
  • Customer data protection
  • Secure communications (TLS)

๐Ÿ“ฑ Mobile Security
#

  • Device encryption (full disk)
  • App data protection
  • Secure messaging
  • Mobile payments (Apple Pay, Google Pay)

โ˜๏ธ Cloud Security
#

  • Data at rest encryption
  • Data in transit protection
  • Key management as a service
  • Homomorphic encryption (future)

๐Ÿฆ Financial Services
#

  • Banking transactions
  • ATM communications
  • Trading systems
  • Regulatory compliance

๐Ÿ”ฎ Emerging Cryptography
#

๐Ÿงฎ Quantum Cryptography
#

  • Quantum key distribution (QKD)
  • Post-quantum cryptography
  • Quantum-resistant algorithms
  • NIST standardization process

๐Ÿ” Advanced Techniques
#

  • Zero-knowledge proofs
  • Homomorphic encryption
  • Multi-party computation
  • Blockchain cryptography

๐Ÿ›ก๏ธ Cryptography Challenges
#

  • Quantum computing threat
  • Implementation vulnerabilities
  • Side-channel attacks
  • Performance vs. security trade-offs

๐Ÿ“ˆ Future Trends#

  • Quantum-safe migration
  • Lightweight cryptography for IoT
  • Privacy-preserving technologies
  • Automated key management
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Practical Exercise: Cryptographic Analysis
#

๐ŸŽฏ Individual Activity (20 minutes)
#

Scenario: Secure Communication System Design
#

You’re designing a secure communication system for a healthcare organization that needs to:

  • Exchange patient records between hospitals
  • Store sensitive medical data
  • Authenticate healthcare providers
  • Ensure compliance with HIPAA regulations
  • Support mobile devices for doctors

Task: Design Cryptographic Solution
#

Address these requirements:

  1. Data Protection:

    • What encryption algorithms would you use?
    • How would you protect data at rest vs. in transit?
    • What key sizes are appropriate?
  2. Authentication:

    • How would you verify healthcare provider identities?
    • What digital signature approach would you use?
    • How would you handle user certificates?
  3. Key Management:

    • How would you generate and distribute keys?
    • What key rotation schedule would you implement?
    • How would you handle key recovery?
  4. Implementation:

    • Symmetric vs. asymmetric encryption usage
    • Performance considerations
    • Mobile device constraints

Deliverables:

  • Cryptographic architecture diagram
  • Algorithm selection justification
  • Key management plan
  • Security analysis
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Cryptography Best Practices
#

โœ… Do’s
#

๐Ÿ”’ Algorithm Selection
#

  • Use proven algorithms (AES, RSA, ECC)
  • Follow current standards (NIST, FIPS)
  • Adequate key sizes (AES-256, RSA-2048+)
  • Regular algorithm reviews

๐Ÿ”‘ Key Management
#

  • Strong key generation
  • Secure key storage
  • Regular key rotation
  • Proper key disposal

๐Ÿ›ก๏ธ Implementation
#

  • Use established libraries
  • Follow secure coding practices
  • Regular security updates
  • Proper error handling

โŒ Don’ts
#

๐Ÿšซ Common Mistakes
#

  • Don’t create custom algorithms
  • Don’t use deprecated algorithms (MD5, SHA-1, DES)
  • Don’t hardcode keys in code
  • Don’t ignore side-channel attacks
  • Don’t implement crypto from scratch

โš ๏ธ Security Anti-patterns
#

  • Insufficient key lengths
  • Poor random number generation
  • Improper padding schemes
  • Inadequate key storage
  • Missing integrity checks

๐Ÿ’ก Success Factors
#

  • Security by design
  • Regular security audits
  • Compliance monitoring
  • Incident response planning
  • Continuous learning
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: default
#

Next Lecture Preview
#

๐Ÿ”œ Lecture 8: Hash Algorithms
#

๐ŸŽฏ Focus Topics:
#

  • Hash function properties and applications
  • SHA family algorithms (SHA-1, SHA-2, SHA-3)
  • Message authentication codes (MAC)
  • Digital fingerprints and integrity checking
  • Hash-based applications
  • Collision attacks and resistance

๐Ÿ“ Preparation Tasks:
#

  • Review hash function mathematical properties
  • Research recent hash algorithm developments
  • Think about data integrity use cases
  • Consider hash function security requirements

๐ŸŽ“ Key Takeaways Today
#

Cryptography Fundamentals
#

  • Cryptography is essential for modern security
  • Symmetric encryption is fast and efficient
  • Asymmetric encryption solves key distribution
  • Digital signatures provide authentication and non-repudiation

Critical Concepts
#

  • Key management is crucial for security
  • Algorithm selection impacts overall security
  • Implementation quality matters as much as algorithms
  • Regular updates and rotation are essential
Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: center class: text-center
#

Questions & Discussion
#

๐Ÿค” Discussion Points:
#

  • What are the main challenges in implementing cryptography?
  • How do you balance security and performance in encryption?
  • What role will quantum computing play in future cryptography?

๐Ÿ’ก Exercise Review
#

Share your cryptographic system designs for the healthcare scenario

Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar

layout: center class: text-center
#

Thank You!
#

Next Lecture: Hash Algorithms
#

Digital Fingerprints and Data Integrity
#

Cyber Security (4353204) - Lecture 7 Complete

The art of keeping secrets! ๐Ÿ”โœจ

Course: Cyber Security (4353204) | Unit I | Lecture 7 | Author: Milav Dabgar