AES (Advanced Encryption Standard) คืออะไร?
AES คือมาตรฐานการเข้ารหัสบล็อกแบบสมมาตร (Symmetric Block Cipher) ที่ NIST (National Institute of Standards and Technology) เลือกในปี 2001 แทน DES โดยอัลกอริทึมคือ Rijndael ที่พัฒนาโดย Joan Daemen และ Vincent Rijmen นักเข้ารหัสชาวเบลเยียม
ทำไม AES ถูกเลือกเป็นมาตรฐาน? (ตาม Stallings & NIST Criteria)
| เกณฑ์ | AES (Rijndael) | เหตุผล |
|---|---|---|
| Security (ความปลอดภัย) | ✅ Excellent | ทนทานต่อการโจมตีที่รู้จักทั้งหมด (Linear, Differential, Related-key, Side-channel) ไม่มีช่องโหว่เชิงปฏิบัติ |
| Performance (ประสิทธิภาพ) | ✅ Excellent | เร็วในทั้ง Software และ Hardware รองรับ 8-bit ถึง 64-bit CPU, DSP, Smart Card, ASIC, FPGA |
| Flexibility (ความยืดหยุ่น) | ✅ Excellent | Key size 128/192/256 bits, Block size 128 bits (Rijndael รองรับ 128/192/256 ทั้งคู่) |
| Simplicity (ความเรียบง่าย) | ✅ Excellent | โครงสร้างชัดเจน เข้าใจง่าย วิเคราะห์ง่าย Implement ง่าย ตรวจสอบได้ |
| Memory Efficiency | ✅ Good | ใช้หน่วยความจำน้อย เหมาะ Embedded Systems |
| Parallelism | ✅ Good | รองรับการประมวลผลแบบขนาน (Bit-slicing, AES-NI) |
คุณสมบัติทางเทคนิคสำคัญ
- Block Size: 128 bits (16 ไบต์) - คงที่
- Key Sizes: 128, 192, 256 bits
- Number of Rounds: 10 (128-bit), 12 (192-bit), 14 (256-bit)
- Structure: Substitution-Permutation Network (SPN) - ไม่ใช่ Feistel Network (เหมือน DES)
- Operations ต่อ Round: 1) SubBytes (S-Box), 2) ShiftRows, 3) MixColumns, 4) AddRoundKey
- Key Expansion: ขยายคีย์จาก Master Key เป็น Round Keys (11, 13, 15 Round Keys)
4 ขั้นตอนหลักในแต่ละ Round
- SubBytes: แทนที่แต่ละไบต์ใน State ด้วย S-Box (Non-linear substitution) - ให้ความสับสน (Confusion)
- ShiftRows: เลื่อนแถวของ State Matrix - กระจายความสัมพันธ์ (Diffusion)
- MixColumns: ผสมคอลัมน์ผ่าน Galois Field (GF(2⁸)) Multiplication - Diffusion แบบแนวตั้ง
- AddRoundKey: XOR State กับ Round Key - ผูกคีย์เข้ากับข้อมูล
Round สุดท้าย: ไม่มี MixColumns | Round เริ่มต้น: AddRoundKey เท่านั้น (Whitening)
ทำไม AES ถูกใช้กันอย่างแพร่หลาย? (Why Commonly Used?)
- มาตรฐานของรัฐบาลสหรัฐ (FIPS 197) - ใช้ปกป้องข้อมูล Confidential/Secret/Top Secret
- มาตรฐานอุตสาหกรรมโลก - TLS/SSL (HTTPS), IPsec, SSH, Wi-Fi (WPA2/WPA3), SSH, VPN, Disk Encryption (BitLocker, FileVault, LUKS)
- Hardware Acceleration (AES-NI) - CPU สากล (Intel/AMD/ARM) มีชุดคำสั่ง AES-NI ทำให้เร็วมาก (cycles/byte ต่ำมาก)
- ทนทานต่อ Quantum (Relative) - AES-256 ถือว่าปลอดภัยต่อ Grover's Algorithm (ต้องใช้ 2¹²⁸ operations)
- Open/Royalty-free - ไม่มีสิทธิบัตร ใช้ฟรีได้ทุกวัตถุประสงค์
โหมดการทำงาน (Modes of Operation)
| โหมด | ลักษณะ | ใช้เมื่อไหร่ |
|---|---|---|
| ECB | Electronic Codebook | ❌ ห้ามใช้ (Pattern เห็นได้ชัด) |
| CBC | Cipher Block Chaining | Legacy, ต้องการ Padding, Sequential |
| CTR | Counter | Parallelizable, Stream-like, Nonce-based |
| GCM | Galois/Counter Mode (AEAD) | ✅ แนะนำ - Authenticated Encryption (Confidentiality + Integrity) |
| CCM | Counter with CBC-MAC (AEAD) | Constrained Environments (IoT, 802.11i) |