Digital Certificate (ใบรับรองดิจิทัล) ใน Network Security คืออะไร?
Digital Certificate (X.509 Certificate) เป็น "บัตรประจำตัวดิจิทัล" ที่ใช้ยืนยันตัวตน (Identity) ของ Entity (User, Device, Server, Service, Code) บนเครือข่าย โดยใช้ Public Key Infrastructure (PKI) เป็นพื้นฐาน
โครงสร้าง Certificate (X.509 v3)
| Field | คำอธิบาย |
| Version | v3 (รองรับ Extensions) |
| Serial Number | เลขลำดับที่ CA มอบหมาย (Unique per CA) |
| Signature Algorithm | อัลกอริทึมที่ CA ใช้ลงนาม (เช่น sha256WithRSAEncryption) |
| Issuer (CA) | ชื่อผู้ออก Certificate (CA Distinguished Name) |
| Validity Period | Not Before / Not After (วันหมดอายุ - มัก 1 ปี, 90 วันสำหรับ Public TLS) |
| Subject | เจ้าของ Certificate (CN=common name, O=org, OU=unit, C=country) |
| Subject Public Key Info | Public Key + Algorithm (RSA 2048/3072/4096, ECDSA P-256/P-384, Ed25519) |
| Extensions (v3) | Key Usage, Extended Key Usage, Subject Alternative Name (SAN), Basic Constraints, CRL/OCSP Distribution Points |
| Signature Value | ลายเซ็นดิจิทัลของ CA บน tbsCertificate (To Be Signed Certificate) |
ประเภท Certificate ตามการใช้งาน (Key Usage / EKU)
| ประเภท | Extended Key Usage (EKU) | ใช้ทำอะไร |
| TLS/SSL Server Certificate | Server Authentication (1.3.6.1.5.5.7.3.1) | HTTPS, LDAPS, FTPS, SMTP STARTTLS - ยืนยัน Server Identity |
| Client Authentication Cert | Client Authentication (1.3.6.1.5.5.7.3.2) | 802.1X (Wi-Fi/VPN), Mutual TLS (mTLS), Smart Card Logon |
| Code Signing Certificate | Code Signing (1.3.6.1.5.5.7.3.3) | ลงนาม Software, Driver, Script, Firmware, Container Image |
| Email Signing/Encryption (S/MIME) | Email Protection (1.3.6.1.5.5.7.3.4) | Sign/Encrypt Email, Document Signing |
| Document Signing | Document Signing (1.3.6.1.5.5.7.3.36) | PDF Signing (PAdES), Legal Documents |
| Timestamping | Time Stamping (1.3.6.1.5.5.7.3.8) | พิสูจน์เวลาที่ข้อมูลมีอยู่ (Long-term Validation) |
| OCSP Signing | OCSP Signing (1.3.6.1.5.5.7.3.9) | ลงนาม Response ตรวจสอบสถานะ Certificate |
PKI (Public Key Infrastructure) - โครงสร้างพื้นฐาน
- Root CA (Offline, Highly Secured): Self-signed, จำกัดการใช้งาน มักอยู่ใน HSM/Air-gapped
- Intermediate/Subordinate CA (Online): ออก Certificate ให้ End-Entities, สามารถ Revoke ได้
- End-Entity (Leaf) Certificate: Certificate ของ User/Device/Server จริง
- Certificate Chain (Chain of Trust): Leaf → Intermediate → Root (Trust Anchor ใน Trust Store)
- Revocation Checking: CRL (Certificate Revocation List) หรือ OCSP (Online Certificate Status Protocol)
Certificate Formats (File Extensions)
| Format | Extension | คำอธิบาย |
| PEM (Base64) | .pem, .crt, .cer, .key | Text-based, เริ่ม/จบด้วย -----BEGIN/END CERTIFICATE----- (Linux/Unix Standard) |
| DER (Binary) | .der, .cer | Binary encoded (Windows/Java บางครั้ง) |
| PKCS#7 / CMS | .p7b, .p7c | Certificate Chain only (No Private Key) |
| PKCS#12 / PFX | .p12, .pfx | Certificate + Private Key + Chain (Encrypted with Password) - Windows/IIS/Java Keystore |
| JKS / JCEKS | .jks, .jceks | Java KeyStore (Keytool) |
การใช้งานใน Network Security
- TLS/SSL (HTTPS): Server Cert + CA Chain → Browser/Client Verify Trust
- Mutual TLS (mTLS): Client Cert + Server Cert → Two-way Authentication (Zero Trust, Service Mesh)
- 802.1X (Wi-Fi/VPN Enterprise): Client Cert (EAP-TLS) หรือ User/Pass (PEAP-MSCHAPv2) → RADIUS
- IPsec VPN: Machine Certificates (IKEv2) หรือ PSK
- Code Signing: Driver, App, Script, Firmware, Container (Notary, Cosign, Sigstore)
- S/MIME: Email Signing + Encryption
- Device Identity (IoT/MDM): SCEP/EST Enrollment, Certificate-based Auth
Certificate Lifecycle Management
- Enrollment/Request: CSR (Certificate Signing Request) → Submit to CA
- Issuance: CA Validate → Sign → Issue Cert
- Deployment/Installation: Install on Server/Device/App (with Private Key)
- Monitoring: Expiry Alert (30/60/90 days), CT Logs Monitoring
- Renewal/Re-issuance: Before Expiry (Automated: ACME/Let's Encrypt, Cert-Manager, Venafi)
- Revocation: Compromise, Name Change, CA Compromise → CRL/OCSP Update
- Archival/Backup: Private Key Backup (HSM, Secure Vault)
สรุป
Digital Certificate = Identity + Public Key + CA Signature ใช้ PKI (Root → Intermediate → Leaf) จัดการวงจรชีวิต: Request → Issue → Deploy → Monitor → Renew → Revoke สำคัญสำหรับ TLS, mTLS, 802.1X, VPN, Code Signing, S/MIME, IoT Identity ต้อง Automate (ACME/Cert-Manager) เพื่อป้องกัน Outage จาก Expired Cert