Digital Signature (ลายเซ็นดิจิทัล) ใน Network Security คืออะไร?
Digital Signature คือกลไกทางทฤษฎีการเข้ารหัส (Cryptographic Mechanism) ที่ใช้ ยืนยันความแท้จริง (Authenticity), ความสมบูรณ์ (Integrity) และการไม่สามารถปฏิเสธได้ (Non-repudiation) ของข้อความ ไฟล์ โปรแกรม หรือเอกสารดิจิทัล
เหมือน "ลายเซ็นมือ" หรือ "ตราประทับ" แต่มีความปลอดภัยทางคณิตศาสตร์สูงกว่ามาก ใช้ Asymmetric Cryptography (Public Key Cryptography)
Digital Signature ทำงานอย่างไร? (How It Works)
- Key Generation: ผู้ลงนาม (Signer) มีคู่คีย์: Private Key (Secret) และ Public Key (Public)
- Hashing: นำข้อมูลต้นฉบับ (Message/File) ผ่าน Hash Function (SHA-256, SHA-384, SHA-512) ได้ Message Digest (Hash Value) ความยาวคงที่ Unique
- Signing: ใช้ Private Key เข้ารหัส (Encrypt) Hash Value นี้ กลายเป็น Digital Signature (Algorithm: RSA-PSS, ECDSA, EdDSA/Ed25519, DSA)
- Transmission: ส่ง Original Message + Digital Signature (+ Public Key / Certificate)
- Verification (ฝั่งผู้รับ):
- คำนวณ Hash ของ Message ที่ได้รับ = Hash' (ใช้ Hash Function เดียวกัน)
- ใช้ Public Key ของผู้ลงนาม ถอดรหัส (Decrypt) Signature ได้ Hash''
- เปรียบเทียบ Hash' == Hash'' ?
- True: ข้อมูลไม่ถูกเปลี่ยนแปลง (Integrity) และมาจากเจ้าของ Private Key (Authenticity)
- False: ข้อมูลเสียหาย/ถูกแก้ไข หรือ Signature ไม่ใช่ของเจ้าของ Private Key
คุณสมบัติความปลอดภัย 3 อย่าง (Security Properties)
- Authentication (การยืนยันตัวตน): ยืนยันว่า ข้อความมาจากผู้ถือ Private Key จริง (เพราะแค่เขาเท่านั้นที่มี Private Key)
- Integrity (ความสมบูรณ์): ยืนยันว่า ข้อความ ไม่ถูกแก้ไข/เปลี่ยนแปลง แม้แต่ 1 บิต ตั้งแต่ลงนาม (Hash จะเปลี่ยนหมด)
- Non-repudiation (การไม่สามารถปฏิเสธได้): ผู้ลงนาม ไม่สามารถปฏิเสธได้** ว่า "ฉันไม่ได้ลงนามนี้" เพราะ Private Key มีเฉพาะเขา (Legal Evidence)
ประเภทของ Digital Signature (ตาม eIDAS / มาตรฐานกฎหมาย)
| ประเภท | คำอธิบาย | ระดับความเชื่อถือ | ใช้กับ |
|---|---|---|---|
| Simple/Basic Electronic Signature (SES) | ข้อมูลอิเล็กทรอนิกส์ที่ผูกกับข้อมูลอื่น เพื่อเป็นลายเซ็น (เช่น ชื่อพิมพ์ในอีเมล, รูปภาพลายเซ็น, Click "I Agree") | ต่ำ | ธุรกรรมทั่วไป ความเสี่ยงต่ำ |
| Advanced Electronic Signature (AES / AdES) | ลายเซ็นอิเล็กทรอนิกส์ขั้นสูง: 1) ผูกกับผู้ลงนาม uniquely 2) ระบุตัวตนผู้ลงนาม 3) สร้างด้วยข้อมูลที่ผู้ลงนามควบคุมได้ (Private Key) 4) ตรวจจับการเปลี่ยนแปลงได้ | ปานกลาง-สูง | สัญญา ธุรกรรมธุรกิจทั่วไป |
| Qualified Electronic Signature (QES) | AES ที่สร้างโดย Qualified Signature Creation Device (QSCD) และได้รับ Qualified Certificate จาก Qualified Trust Service Provider (QTSP) ที่ได้รับการรับรองภายใต้กฎหมาย (eIDAS ใน EU, ETDA ในไทย) | สูงสุด (เทียบเท่า ลายเซ็นมือหน้าสำนักงาน) | เอกสารทางกฎหมาย รัฐบาล การเงิน สุขภาพ ความเสี่ยงสูง |
Digital Signature Algorithms (อัลกอริทึมที่ใช้)
- RSA-PSS (RSA Probabilistic Signature Scheme): มาตรฐาน RSA แบบใหม่ ป้องกัน Bleichenbacher-style attacks (RSA-PKCS#1 v1.5 เก่า)
- ECDSA (Elliptic Curve DSA): ใช้ Elliptic Curve (secp256r1/P-256, secp384r1/P-384, secp521r1/P-521) - Key สั้นกว่า RSA ความปลอดภัยเท่ากัน
- EdDSA / Ed25519 / Ed448 (Edwards-curve DSA): ใหม่กว่า เร็วกว่า ป้องกัน Side-channel ดีกว่า Deterministic Nonce (ไม่ต้อง Random Nonce) - แนะนำสมัยใหม่
- DSA (Digital Signature Algorithm): มาตรฐานเก่า (FIPS 186) ใช้ Discrete Log Problem - ไม่ควรใช้ใหม่
Digital Certificate (ใบรับรองดิจิทัล) และ PKI
- Public Key ถูกผูกกับข้อมูลตัวตน (Subject: Name, Org, Email, Domain) โดย Certificate Authority (CA) ลงนาม (Sign) ให้ = X.509 Certificate
- Chain of Trust: Root CA (Self-signed, Offline, Highly Secured) > Intermediate CA > Leaf Certificate (Server/Client/Code Signing/Document Signing)
- TLS/SSL: ใช้ Digital Signature ใน Certificate Verification (Server Auth) และ Client Certificate Authentication (Mutual TLS)
- Code Signing: ลงนาม Executable/Script/Container Image (Microsoft Authenticode, Apple Developer ID, Android APK Signing, Docker Content Trust/Notary, Sigstore/Cosign)
- Document Signing: Adobe Approved Trust List (AATL), EU Trusted Lists, Thai Trust Service Providers (ETDA Licensed)
การใช้งาน Digital Signature ใน Network Security
- TLS/SSL Handshake: Server Signs Certificate Verify (Certificate Verify Message) / Client Certificate Auth
- IPsec (IKEv2): Signature Authentication (RSA/ECDSA) แทน PSK
- SSH: Host Key Verification (Server Signature), User Public Key Auth
- DNSSEC: Sign DNS Records (RRSIG) ด้วย Zone Signing Key (ZSK) และ Key Signing Key (KSK)
- Secure Email (S/MIME, PGP/GPG): Sign & Encrypt Email
- Blockchain/Cryptocurrency: Transaction Signing (ECDSA secp256k1, Ed25519)
- Firmware/Software Updates: Vendor Signs Update Package (Root of Trust) Device Verifies ก่อน Install (Secure Boot)
- API Security (mTLS, JWT Signing - JWS): Sign Payload ด้วย Private Key (RS256, ES256, EdDSA)
ความปลอดภัยของ Digital Signature (How Secure?)
- ขึ้นอยู่กับ: 1) ความแข็งแกร่งของ Algorithm & Key Size (RSA-3072+, ECDSA P-256+, Ed25519) 2) ความปลอดภัยของ Private Key (HSM, TPM, Secure Enclave, Smart Card, YubiKey - Non-exportable) 3) ความน่าเชื่อถือของ CA/PKI (Root Trust, Revocation Checking - CRL/OCSP) 4) การปฏิบัติตามมาตรฐาน (eIDAS, RFC, NIST, WebTrust)
- Quantum Threat: Shor's Algorithm แยก RSA/ECC ได้ (Future) > Post-Quantum Signatures (PQC): CRYSTALS-Dilithium, FALCON, SPHINCS+ (NIST PQC Standardization - 2024 Finalized)
คำถามที่พบบ่อย
- Q: Digital Signature ช่วย Network Security อย่างไร? A: รับรอง Authenticity, Integrity, Non-repudiation ของ Data/Code/Config ที่ส่งผ่านเครือข่าย (TLS, IPsec, SSH, DNSSEC, Code Signing, Firmware Update, API)
- Q: Digital Signature ใช้ Cryptography แบบไหน? A: Asymmetric (Public Key) - Private Key Sign, Public Key Verify
- Q: Digital Signature และ Encryption ต่างกันยังไง? A: Signature = Sign with Private, Verify with Public (Authenticity/Integrity) | Encryption = Encrypt with Public, Decrypt with Private (Confidentiality) - มักใช้ร่วมกัน (Sign-then-Encrypt / Encrypt-then-Sign)
- Q: ทำไมต้อง Hash ก่อน Sign? A: 1) Performance (Hash เร็ว, Sign ช้า) 2) Security (Sign arbitrary length) 3) Structure (Hash แทน Message)
สรุป: Digital Signature ใช้ Asymmetric Crypto (Private Key Sign Hash, Public Key Verify) ให้ Authenticity, Integrity, Non-repudiation เป็นหัวใจของ PKI, TLS, Code Signing, Document Signing (SES/AES/QES), DNSSEC, Blockchain, Secure Boot ต้องปกป้อง Private Key ใน HSM/TEE และใช้ Algorithm ทันสมัย (Ed25519, ECDSA, RSA-PSS) เตรียม PQC (Dilithium, FALCON)