Cryptography (การเข้ารหัสลับ) พื้นฐานความปลอดภัยข้อมูลบนเครือข่าย
Cryptography เป็นวิทยาศาสตร์ของการปกป้องข้อมูลโดยการเปลี่ยนข้อความต้นฉบับ (Plaintext) ให้กลายเป็นข้อความเข้ารหัส (Ciphertext) ที่อ่านไม่เข้าใจ โดยใช้ อัลกอริทึม (Algorithm) และ คีย์ (Key) เป้าหมายคือ CIA: Confidentiality, Integrity, Authentication, Non-repudiation
ประเภทหลักของ Cryptography
| ประเภท | ชื่ออื่น | คีย์ | ความเร็ว | ใช้สำหรับ | ตัวอย่าง |
|---|---|---|---|---|---|
| Symmetric Encryption | Secret Key / Private Key | คีย์เดียวกัน ใช้เข้ารหัส/ถอดรหัส | เร็วมาก | เข้ารหัสข้อมูลจำนวนมาก (Data at Rest, TLS Session) | AES, ChaCha20, DES (เก่า), 3DES (เลิกใช้) |
| Asymmetric Encryption | Public Key Cryptography | คู่คีย์: Public Key (แจกได้) + Private Key (เก็บไว้ลับ) | ช้า | Key Exchange, Digital Signature, PKI, Certificate | RSA, ECC (ECDSA, EdDSA), Diffie-Hellman |
| Hash Functions | One-way Function | ไม่มีคีย์ (Keyless) หรือ HMAC (มีคีย์) | เร็ว | Integrity Check, Password Storage, Digital Signature, Blockchain | SHA-256, SHA-3, BLAKE2, HMAC-SHA256 |
การใช้งานจริงในเครือข่าย (Real-world Usage)
- TLS/SSL (HTTPS): Asymmetric (RSA/ECDHE) สำหรับ Key Exchange + Symmetric (AES-GCM/ChaCha20-Poly1305) สำหรับเข้ารหัสข้อมูล
- VPN (IPsec, WireGuard): Symmetric Encryption (AES/ChaCha20) + Key Exchange (IKEv2, Noise Protocol)
- Wi-Fi (WPA2/WPA3): WPA2: AES-CCMP (Symmetric), WPA3: SAE (Dragonfly Key Exchange) + AES-GCMP
- Email (PGP/S/MIME): Asymmetric สำหรับ Signature/Encryption + Symmetric สำหรับข้อความยาว
- Blockchain/Bitcoin: ECDSA (secp256k1) สำหรับ Signature, SHA-256 สำหรับ Hash/PoW
- Password Storage: Argon2, bcrypt, scrypt, PBKDF2 (Key Derivation Functions) + Salt
หลักการสำคัญ: Kerckhoffs's Principle
"ระบบเข้ารหัสควรปลอดภัยแม้โจมตีจะรู้อัลกอริทึมทั้งหมด ความลับต้องอยู่ที่ คีย์ (Key) เท่านั้น"
คุณสมบัติที่ต้องการในอัลกอริทึมสมัยใหม่
- Confusion: ทำให้ความสัมพันธ์ Ciphertext-Key ซับซ้อน (Substitution/S-Box)
- Diffusion: กระจายสถิติ Plaintext ไปทั่ว Ciphertext (Permutation/MixColumns)
- Avalanche Effect: เปลี่ยน 1 บิต Input → เปลี่ยน ~50% บิต Output
- Resistance to Known Attacks: Linear, Differential, Side-channel, Quantum (สำหรับ Post-Quantum Crypto)
Post-Quantum Cryptography (PQC)
NIST กำลังมาตรฐาน hóaอัลกอริทึมทน Quantum Computer (CRYSTALS-Kyber สำหรับ KEM, CRYSTALS-Dilithium/FALCON/SPHINCS+ สำหรับ Signature) คาดว่าจะเริ่มมาตรฐาน 2024-2026