Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบเครือข่าย >> ความปลอดภัยเครือข่าย

การใช้ Cryptography ใน Network Security: หลักการ ประเภท และการประยุกต์ใช้จริง

Cryptography (การเข้ารหัส) ใน Network Security คืออะไร?

**Cryptography** เป็นวิทยาศาสตร์ของการ **ปกป้องข้อมูล** โดยการแปลงข้อมูลให้อ่านไม่เข้าใจ (Encryption) และกลับมาอ่านได้ (Decryption) เพื่อให้บรรลุเป้าหมาย CIA Triad บนเครือข่ายที่ไม่น่าเชื่อถือ (Untrusted Network เช่น Internet)

เป้าหมายหลักของ Cryptography (Security Services)

บริการคำอธิบายเทคนิค/อัลกอริทึม
Confidentiality (ความลับ)ข้อมูลอ่านได้เฉพาะฝ่ายที่ได้รับอนุญาตSymmetric (AES, ChaCha20), Asymmetric (RSA, ECC), Hybrid (TLS, IPsec)
Integrity (ความสมบูรณ์)ข้อมูลไม่ถูกแก้ไข/เสียหายระหว่างทางHash (SHA-256/384/512, SHA-3, BLAKE2), HMAC, GMAC
Authentication (การยืนยันตัวตน)ยืนยันตัวตนผู้ส่ง/ผู้รับ (Entity Authentication)Digital Signature (RSA, ECDSA, EdDSA), Certificates (X.509), MFA, Kerberos
Non-repudiation (ไม่สามารถปฏิเสธได้)ผู้ส่งไม่สามารถปฏิเสธการส่งข้อมูลได้Digital Signature + Timestamp + Audit Log + Certificate
Availability (ความพร้อมใช้งาน)ระบบพร้อมใช้งาน (Cryptography ช่วยป้องกัน DoS บางรูปแบบ)Rate Limiting, Proof-of-Work, Verifiable Delay Functions

ประเภทของ Cryptography (3 ประเภทหลัก)

Hybrid Cryptography (ใน Real-world Protocols)

จริงๆ แล้ว ใช้ **ผสมผสาน (Hybrid)** เพื่อได้ข้อดีทั้งสอง:

  1. Asymmetric สำหรับ **Key Exchange / Authentication** (ช้า แต่ปลอดภัยสำหรับ Key Distribution)
  2. Symmetric สำหรับ **Bulk Data Encryption** (เร็ว ประหยัด CPU)
  3. Hash/HMAC สำหรับ **Integrity & Authentication

ตัวอย่าง: TLS 1.3, IPsec IKEv2, SSH, WireGuard, Signal Protocol, PGP/GPG, S/MIME

Network Security Protocols ที่ใช้ Cryptography

ประเภทหลักการKeyอัลกอริทึมยอดนิยมUse Case
Symmetric (Secret Key)Key เดียว ใช้ Encrypt และ DecryptShared Secret (128-256 bits)AES-GCM, ChaCha20-Poly1305, AES-CCMBulk Data Encryption (TLS Record, IPsec ESP, Disk, File)
Asymmetric (Public Key)Key Pair: Public (Encrypt/Verify) + Private (Decrypt/Sign)Key Pair (2048-4096 bits RSA, 256-521 bits ECC)RSA-OAEP, ECDH, ECDSA, Ed25519, X25519, Kyber (PQC)Key Exchange, Digital Signature, Certificates, PKI, Email (PGP/S/MIME)
Hash Functions (Keyless)One-way: Input -> Fixed-length Digest (ไม่กลับกันได้)ไม่มี Key (แต่มี HMAC ใช้ Key)SHA-256/384/512, SHA-3 (Keccak), BLAKE2/3Integrity, Password Hashing (Argon2, bcrypt, PBKDF2), Blockchain, Certificates
ProtocolLayerCrypto Primitivesวัตถุประสงค์
TLS 1.3 (HTTPS)L7AEAD (AES-GCM/ChaCha20-Poly1305), ECDHE (X25519/P-256), ECDSA/Ed25519/RSA Sig, HKDF, SHA-256/384Web, API, gRPC, Email (SMTP/IMAP/POP over TLS)
IPsec (ESP/AH)L3AES-GCM/CCMP, ChaCha20-Poly1305, HMAC-SHA-256, IKEv2 (ECDH, Cert/PSK)Site-to-Site VPN, Remote Access, Host-to-Host
SSH v2L7AEAD (ChaCha20-Poly1305, AES-GCM), ECDH (Curve25519), Ed25519, SHA-2Remote Shell, SFTP, Port Forwarding, Git
WireGuardL3ChaCha20-Poly1305, Curve25519 (ECDH), BLAKE2s, HKDFModern VPN (Simple, Fast, Auditable)
MACsec (802.1AE)L2AES-GCM/XPN (GCM-AES-128/256), CKN/CAK, EAP-TLSEthernet Link Encryption (Data Center, Campus)
DTLS 1.3L4 (UDP)Same as TLS 1.3 over UDPVPN (OpenConnect), WebRTC, IoT (CoAP), QUIC
QUIC / HTTP/3L4+L7TLS 1.3 Built-in, AEAD, 0-RTTWeb Performance, Mobile, UDP-based

Cryptography ใน Real-world Applications

  • 🏧 **ATM/Financial:** HSM (Hardware Security Module), PIN Block (ISO 9564), DUKPT, EMV (Chip), 3D Secure
  • 📺 **Pay TV / DRM:** Conditional Access (CSA, DVB-CSA), Widevine, PlayReady, FairPlay
  • 📧 **Email Security:** PGP/GPG (OpenPGP), S/MIME (X.509), DKIM/DMARC/SPF (Domain Auth)
  • 🌐 **Web Browsing:** TLS 1.3, Certificate Transparency, HSTS, HPKP (Deprecated), OCSP Stapling
  • 📱 **Mobile (GSM/LTE/5G):** A3/A8 (Authentication), A5/1/3 (Ciphering), 5G: TUAK, 5G-AKA, SEAF
  • 💰 **Cryptocurrency/Blockchain:** ECDSA/secp256k1 (Bitcoin/Ethereum), Ed25519 (Solana), BLS Signatures (Eth2), ZK-SNARKs/STARKs
  • 🔐 **Password Managers:** Argon2id (KDF), AES-256-GCM (Vault), PBKDF2 (Legacy), Zero-knowledge Architecture

Post-Quantum Cryptography (PQC) - อนาคต

  • Quantum Computer (Shor's Algorithm) แตก **RSA, ECC, DH** ได้ -> ต้องย้ายไป **PQC Algorithms
  • NIST PQC Standards (2024):
    • ML-KEM (Kyber): Key Encapsulation Mechanism (KEM) - General Encryption
    • ML-DSA (Dilithium): Digital Signature Algorithm
    • SLH-DSA (SPHINCS+): Stateless Hash-based Signature (Backup)
  • Migration: Hybrid (Classical + PQC) ใน TLS 1.3, IPsec, SSH, Signal -> เริ่ม Deploy ตอนนี้ (Google, Cloudflare, AWS, Apple, Signal)

คำถามที่พบบ่อย (FAQ)

Cryptography และ Cryptology ต่างกันยังไง?

Cryptography = การสร้าง/ใช้ระบบเข้ารหัส | Cryptology = Cryptography + Cryptanalysis (การวิเคราะห์/แตกรหัส) = วิทยาศาสตร์รวม

Symmetric vs Asymmetric ใช้เมื่อไหร่?

Symmetric: Encrypt ข้อมูลเยอะ (Speed) | Asymmetric: Key Exchange, Digital Signature, Identity (Key Distribution)

TLS 1.2 vs 1.3 ต่างกันที่ไหน?

TLS 1.3: ลด Round-trip (1-RTT/0-RTT), ตัด Cipher Suites อ่อนออก (RSA Key Exch, CBC, RC4, SHA-1), บังคับ AEAD (AES-GCM, ChaCha20-Poly1305), Forward Secrecy บังคับ (ECDHE)

WPA2-Personal ใช้ Cryptography อะไร?

4-Way Handshake (PBKDF2-SHA1 -> PMK -> PTK) + AES-CCMP (Encryption) + MIC (Integrity) | WPA3: SAE (Dragonfly) + AES-GCMP

Cryptography ใช้ใน Network Security ทุก Layer ได้จริงไหม?

**ได้** L2 (MACsec), L3 (IPsec, WireGuard), L4 (DTLS, QUIC), L7 (TLS, SSH, S/MIME, PGP) - Defense in Depth ด้วย Crypto ทุกชั้น