ฟังก์ชันหลักของ Public Key Cryptography
1. การเข้ารหัส (Encryption)
- ให้ Confidentiality และ Integrity (ถ้าใช้ AEAD)
- กระบวนการ: Alice เข้ารหัสข้อความ M ด้วย Public Key ของ Bob (Pub_B) → Ciphertext C
- Bob ถอดรหัส C ด้วย Private Key ของตัวเอง (Prv_B) → M
- สูตร: C = Enc(Pub_B, M), M = Dec(Prv_B, C)
- ใช้จริง: Hybrid Encryption (KEM + DEM)
2. ลายเซ็นดิจิทัล (Digital Signature)
- ให้ Authentication, Integrity, Non-repudiation
- Alice เซ็นข้อความ M ด้วย Private Key ของตัวเอง (Prv_A) → Signature σ
- Bob ตรวจสอบ σ ด้วย Public Key ของ Alice (Pub_A)
- กระบวนการ: σ = Sign(Prv_A, Hash(M)), Verify(Pub_A, M, σ) = True/False
- อัลกอริทึม: RSA-PSS, ECDSA, EdDSA, ML-DSA (Dilithium - PQC)
3. Certificate (Digital Certificate)
- แก้ปัญหา: Man-in-the-Middle (MITM) แทนที่ Public Key ในเครือข่าย
- CA (Certificate Authority) เซ็น Certificate ผูก Identity กับ Public Key
- Format: X.509 v3 (มาตรฐาน PKI)
- เนื้อหา: Subject, Public Key, Issuer, Validity Period, Extensions (Key Usage, SAN), Signature Algorithm, Signature
- Chain of Trust: Root CA (Self-signed) → Intermediate → Leaf
สรุปการให้บริการความปลอดภัย
| ฟังก์ชัน | บริการความปลอดภัย | กุญแจที่ใช้ |
|---|---|---|
| Encryption | Confidentiality, Integrity (AEAD) | Receiver's Public Key (Enc), Private Key (Dec) |
| Digital Signature | Authentication, Integrity, Non-repudiation | Signer's Private Key (Sign), Public Key (Verify) |
| Key Agreement | Confidentiality (Shared Secret) | Ephemeral Key Pairs (DH/ECDH) |
| Certificate | Trust, Authentication | CA's Private Key (Sign), CA's Public Key (Verify) |
ข้อดีของ Asymmetric Crypto
- แก้ปัญหา Key Distribution (Public Key ส่งทางช่องไม่ปลอดภัยได้)
- Non-repudiation (Symmetric ไม่ทำได้)
- Scalable: n User ต้องการ n Key Pairs (Symmetric ต้องการ n(n-1)/2 Keys)
ข้อจำกัด
- ช้ามาก (~1000x Symmetric)
- Key Size ใหญ่ (RSA 2048-4096, ECC 256-384)
- Quantum Vulnerable (RSA, ECC) → ต้องย้าย PQC