Computer >> Hướng Dẫn Máy Tính >  >> Kết Nối Mạng >> An Ninh Mạng

Master Key (Khóa chính) trong An ninh mạng và Mật mã học

Master Key trong Mật mã học (Cryptography) là gì?

Là khóa cấp cao nhất trong hệ thống phân cấp khóa (Key Hierarchy). Dùng để mã hóa (encrypt/protect) các khóa khác (Data Encryption Keys - DEK, Key Encryption Keys - KEK, Session Keys). Master Key thường được lưu trữ trong phần cứng bảo mật: HSM (Hardware Security Module), TPM, Secure Enclave, KMS (Key Management Service).

Master Key vs Session Key

Master Key trong các hệ thống thực tế

  • AWS KMS: Customer Master Key (CMK) - mã hóa DEK dùng cho S3, EBS, RDS encryption. CMK không rời HSM.
  • PKI/CA: Root CA Private Key = Master Key ký Intermediate CA → ký End-entity Cert (TLS/SSL, Code Signing, Document).
  • Database TDE (Transparent Data Encryption): Database Master Key (DMK) bảo vệ Certificate/Asymmetric Key → bảo vệ DEK mã hóa data file.
  • Password Manager: Master Password → derive Master Key (PBKDF2/Argon2) →encrypt vault (DEK).
  • Signal/Double Ratchet: Root Key (Master) → Chain Key → Message Key (per message).

Key Hierarchy (Phân cấp khóa) tiêu chuẩn

Root Master Key (Offline HSM/Root CA)
    │
    ├── Key Encryption Key (KEK) - Online HSM/KMS
    │       │
    │       ├── Data Encryption Key (DEK) - Per dataset/file/volume
    │       │       │
    │       │       └── Data (AES-256-GCM/ChaCha20-Poly1305)
    │       │
    │       └── Session Key (TLS, IPsec, SSH) - Ephemeral
    │
    └── Signing Key (Code Signing, Doc Signing, Timestamp)

Yêu cầu bảo vệ Master Key

  1. Phân tách nhiệm vụ: Không ai một mình truy xuất được (M-of-N, Shamir Secret Sharing).
  2. HSM FIPS 140-2 Level 3/4: Tamper-evident, tamper-responsive, zeroization.
  3. Key Rotation: Xoay vòng Master Key/KEK định kỳ (1-3 năm), re-encrypt DEK.
  4. Audit Trail: Log mọi thao tác: generate, export, encrypt, decrypt, rotate, destroy.
  5. Backup an toàn: Split knowledge, encrypted backup, offline storage, geo-redundant.

CMK (Customer Master Key) trong Cloud

Khái niệm BYOK (Bring Your Own Key) / HYOK (Hold Your Own Key). Khách hàng tự tạo/quản lý Master Key trong HSM của mình hoặc Cloud HSM chuyên dụng (AWS CloudHSM, Azure Dedicated HSM, Google Cloud HSM), cloud provider chỉ dùng để encrypt/decrypt DEK theo yêu cầu, không thấy plaintext Master Key.

Đặc điểmMaster Key (Khóa chính)Session Key (Khóa phiên)
Vòng đờiDài (năm), xoay vòng định kỳ (key rotation)Ngắn (một phiên/kết nối), dùng xong hủy
Mục đíchBảo vệ các khóa con (KEK, DEK), ký chứng chỉ CAMã hóa dữ liệu truyền tải (TLS, IPsec, SSH)
Lưu trữHSM, KMS, TPM, offline root CAMemory (RAM), không ghi disk
Ví dụAWS KMS CMK, Root CA Key, KMIP Master KeyTLS Session Key, IPsec SA Key, SSH Session Key