study_security_l6


"/home/yossef/notes/Su/security/study_security_l6.md"

path: Su/security/study_security_l6.md

- **fileName**: study_security_l6
- **Created on**: 2025-06-02 21:21:56

Public Key Cryptography Explained

Core Concepts

Symmetric vs Asymmetric Encryption

Key Features


How Public Key Crypto Works

Encryption Flow:

  1. Bob generates key pair (PUB_b, PRIV_b)
  2. Bob shares PUB_b publicly
  3. Alice encrypts with PUB_b: C = E(PUB_b, M)
  4. Bob decrypts with PRIV_b: M = D(PRIV_b, C)

Digital Signature Flow:

  1. Alice hashes message: H = SHA(M)
  2. Signs with PRIV_a: S = Sign(PRIV_a, H)
  3. Bob verifies with PUB_a: Verify(PUB_a, S, H)

Public Key Infrastructure (PKI)

Certificate Components:

Verification Process:

  1. Get certificate (e.g., from website)
  2. Check CA's digital signature
  3. Verify validity period
  4. Extract public key

Review Questions & Solutions

1. Compare Symmetric/Asymmetric Crypto

Aspect Symmetric Asymmetric
Keys Single shared key Key pairs (public/private)
Speed Fast Slow
Key Distribution Problematic (needs secure channel) Solves distribution problem
Use Cases Bulk encryption Key exchange, signatures

2. Hybrid Encryption

3. Digital Signatures & Non-Repudiation

4. Digital Signature Benefits

    # Signing
    hash = SHA256(message)
    signature = Encrypt(PRIV_key, hash)

    # Verification
    decrypted_hash = Decrypt(PUB_key, signature)
    assert SHA256(message) == decrypted_hash

continue:./study_security_l7.md
before:./study_security_l5.md