PGP คืออะไร?
**PGP (Pretty Good Privacy)** เป็นโปรแกรมเข้ารหัสข้อมูลที่ให้ **ความเป็นส่วนตัว (Privacy)** และ **การยืนยันตัวตน (Authentication)** สำหรับการสื่อสารทางอิเล็กทรอนิกส์ — โดดเด่นที่สุดคือ **การเข้ารหัสอีเมล** และ **การลงนามดิจิทัล (Digital Signature)**
สร้างขึ้นโดย **Phil Zimmermann ปี 1991** ปัจจุบันเป็นมาตรฐานเปิด **OpenPGP (RFC 4880)** มีการใช้งานแพร่หลาย: **GnuPG (GPG), OpenPGP.js, ProtonMail, Tutanota, Enigmail/Thunderbird**
หลักการทำงาน: Hybrid Cryptosystem
PGP ใช้ **Symmetric + Asymmetric Encryption ร่วมกัน**:
- สร้าง **Session Key (Symmetric Key)** แบบสุ่มสำหรับแต่ละข้อความ
- เข้ารหัส **ข้อความ (Message)** ด้วย Session Key (AES-256, ChaCha20 — เร็ว)
- เข้ารหัส **Session Key** ด้วย **Public Key ของผู้รับ** (RSA/ECC — ช้า แต่ปลอดภัย)
- ส่ง:
Encrypted Session Key + Encrypted Message - ผู้รับถอดรหัส Session Key ด้วย **Private Key ของตน** → ถอดรหัสข้อความ
คุณสมบัติหลัก
| คุณสมบัติ | คำอธิบาย |
|---|---|
| Confidentiality | เฉพาะผู้รับที่มี Private Key ถอดรหัสอ่านได้ |
| Authentication | Digital Signature ยืนยันว่าข้อความมาจากผู้ส่งจริง |
| Integrity | Hash (SHA-256) ตรวจสอบข้อความไม่ถูกแก้ไขระหว่างทาง |
| Non-repudiation | ผู้ส่งไม่สามารถปฏิเสธได้ว่าไม่ได้ส่ง (Digital Signature) |
| Compression | บีบอัดข้อมูลก่อนเข้ารหัส (ZIP, ZLIB, BZIP2) — ลดขนาด เพิ่มเอนโทรปี |
Web of Trust vs PKI
PGP ใช้ **Web of Trust (WoT)** แทน CA แบบดั้งเดิม:
- ผู้ใช้ **ลงนาม (Sign) Public Key** ของกันและกัน เพื่อยืนยันตัวตน
- Trust แบบกระจายศูนย์ (Decentralized) — ไม่มี Root CA เดียว
- Key Signing Party: พบกันจริงตรวจสอบ Fingerprint แล้วลงนามให้กัน
ปัจจุบันหลายระบบใช้ **PKI/CA** ร่วมกับ PGP (เช่น ProtonMail, Keybase)
การใช้งาน PGP ในทางปฏิบัติ
1. อีเมลเข้ารหัส (Encrypted Email)
- Thunderbird + **Enigmail** (Built-in ตั้งแต่ TB 78+)
- Outlook + **GpgOL (Gpg4win)**
- Webmail: **ProtonMail, Tutanota, Mailvelope (Browser Extension)**
2. ไฟล์และดิสก์ (File/Disk Encryption)
- `gpg --encrypt --recipient user@example.com file.txt` → `file.txt.gpg`
- `gpg --decrypt file.txt.gpg` → ใส่ Passphrase Private Key
- Full Disk: **VeraCrypt** (ใช้ PGP format สำหรับ Keyfiles)
3. Digital Signature
- `gpg --sign file.txt` → `file.txt.gpg` (Clearsign: `gpg --clearsign`)
- `gpg --verify file.txt.gpg` → ตรวจสอบลายเซ็น
4. การจัดการ Key
- สร้างคู่กุญแจ: `gpg --full-generate-key` (แนะนำ **ECC Curve25519** หรือ **RSA 4096**)
- Key Server: `keys.openpgp.org`, `keyserver.ubuntu.com` (โหลด/ค้นหา Public Key)
- Revocation Certificate: สร้างไว้ล่วงหน้า เผื่อ Private Key หาย/โดนขโมย
PGP ในองค์กร (Enterprise)
- Symantec PGP (Broadcom): Enterprise Management, Policy Enforcement, Key Recovery
- GnuPG + Gpg4win: ฟรี Open Source ใช้ในองค์กรได้ (ต้องจัดการเอง)
- ใช้สำหรับ: **Email Encryption, File Transfer (SFTP+PGP), Backup Encryption, Code Signing**
ข้อจำกัดและข้อควรระวัง
- Key Management ยาก: ผู้ใช้ทั่วไปทำ Key Management ผิดพลาดบ่อย (Lost key, No revocation, Weak passphrase)
- Forward Secrecy: PGP ไม่มี Forward Secrecy — หาก Private Key รั่ว ข้อความเก่าทั้งหมดถูกถอดรหัสได้
- Metadata Leakage: Subject, From, To, Date ไม่ได้เข้ารหัส (ใช้ Header Protection หรือ Signal/Matrix แทน)
- Usability: UX ยากสำหรับผู้ใช้ทั่วไป → ใช้ ProtonMail, Signal ดีกว่า
สรุป
PGP เป็น **มาตรฐานทองคำ (Gold Standard)** สำหรับการเข้ารหัสอีเมลและไฟล์ ใช้ Hybrid Crypto + Web of Trust เหมาะสำหรับ **High-value Communication, Legal Documents, Source Code Signing, Journalist/Activist** — แต่ต้องมีความรู้จัดการ Key ให้ถูกต้อง