← [ BACK_TO_NOTES ]

密码学

现代密码学知识地图:从 Hash/MAC/KDF、对称密码与 AEAD、公钥密码与数字签名,到 PKI/TLS 组合协议,并单独保留 DES/3DES/ECB/CBC/CFB 等 legacy 知识用于兼容与理解演进。

#crypto #moc #evergreen #cs

密码学

知识总览

filters:
  and:
    - 'file.ext == "md"'
    - 'file.inFolder("z")'
    - 'this.file.links.contains(file)'
    - 'file.path != this.file.path'
formulas:
  knowledge: 'file.asLink(title)'
properties:
  formula.knowledge:
    displayName: 知识
  note.description:
    displayName: Description
  note.mastery:
    displayName: Mastery
views:
  - type: table
    name: 知识总览
    order:
      - formula.knowledge
      - note.description
      - note.mastery
    columnSize:
      formula.knowledge: 280
      note.description: 760
      note.mastery: 56

[!info] related notes

核心问题

现代密码学不是“把明文变乱码”这一件事。

它主要解决:

  • Confidentiality:未授权者不能读取内容;
  • Integrity:内容被改动时能够检测;
  • Authentication:确认消息/实体来自谁或由谁控制某个密钥;
  • Key Establishment:安全建立共享密钥;
  • Digital Signature:提供公钥可验证的签名;
  • Key Derivation:从 root secret 派生用途隔离密钥。

不同 primitive 解决不同问题。

Primitive Map

Hash

密码学哈希函数

message
→ fixed-length digest

不需要 secret key,不提供 confidentiality,也不能单独提供 message authentication。

MAC / HMAC

HMAC

message + shared secret
→ authentication tag

用于共享 secret 场景的 integrity/authentication。

KDF

KDF

secret/keying material
→ derived keys

区分:

  • HKDF 这类 general-purpose KDF;
  • PBKDF2 / Argon2 这类 password-based KDF。

Symmetric Cryptography

对称密码学

共享 secret key,适合高效保护大量数据。

Block cipher:

经典 mode:

Block Cipher Modes of Operation

AEAD

AEAD

现代消息保护优先心智模型:

plaintext + AAD + nonce + key
→ ciphertext + tag

典型:

  • AES-GCM;
  • ChaCha20-Poly1305。

Public-Key Cryptography

非对称密码学

至少区分:

  • public-key encryption;
  • digital signature;
  • key agreement。

典型数学体系:

Digital Signature

数字签名

private key → sign
public key → verify

签名不是“私钥加密”。

Trust Layer

PKI

PKI

解决:

为什么相信这个 public key 属于这个域名/主体?

核心:

  • certificate;
  • CA;
  • trust anchor;
  • path validation;
  • revocation/status。

Protocol Composition

真实协议不会只使用一种 primitive。

例如现代 TLS:

certificate / signature
→ authenticate server

ECDHE
→ establish shared secret

HKDF
→ derive traffic secrets

AEAD
→ protect records

详见:

Block Cipher Mode 演进

经典 confidentiality mode:

它们主要解决 confidentiality。

现代新协议更常直接选标准 AEAD,因为:

encryption 不等于 authentication。

Legacy 区域

DES

DES

  • 56-bit effective key;
  • FIPS 46-3 于 2005 年撤回;
  • 主要用于历史理解。

3DES / TDEA

3DES / TDEA

  • 继承 64-bit block;
  • 已进入 legacy-only 使用阶段。

ECB / CBC / CFB

仍需要学习,因为大量历史协议、文件格式和面试资料会出现。

但:

学习 legacy primitive ≠ 推荐新系统继续采用。

一个推荐学习顺序

Security goals
→ Hash
→ HMAC
→ KDF
→ Symmetric Cipher / AES
→ Block Cipher Modes
→ AEAD
→ Public-Key Cryptography
→ Signature / Key Agreement
→ PKI
→ TLS composition

这条顺序强调:

先理解 primitive,再理解 composition,最后理解 protocol。

不要从“背 TLS 消息顺序”反推整个密码学。

创建于 2025/1/1 更新于 2026/9/30
Digital Biome
Access

键盘导航

j / k / ↑ / ↓
选择对象
Enter / o
打开选择
/ 或 Ctrl+K
全站搜索
i / f / 1–4
筛选当前列表
g → h / l / p / t / a
首页 / 笔记 / 项目 / 工具 / About
r → 1–9
打开所选对象的关联
u
返回上一页
Esc
关闭浮层 / 取消命令;输入框内清空文本