# 密码

密码是一种密码系统，其中任意符号或符号组表示明文单元，或者其中明文单元被重新排列，或两者兼有<sup>[1](https://csrc.nist.gov/glossary/term/cipher)</sup>。在现代用法中，该词最常指加密算法本身：一种使用密码算法和密钥将明文转换为密文的过程，使得只有密钥持有者才能恢复原始数据<sup>[2](https://csrc.nist.gov/glossary/term/encryption)</sup>。将密文恢复为明文的可逆对应过程称为解密<sup>[2](https://csrc.nist.gov/glossary/term/encryption)</sup>。

| 关键事实 | 详情 |
|---|---|
| 定义 | 一种密码系统，其中符号表示或重新排列明文单元（CNSSI 4009-2022）<sup>[1](https://csrc.nist.gov/glossary/term/cipher)</sup> |
| 分组密码 | 一种可逆的对称密钥算法，使用秘密密钥对固定长度的输入分组进行运算；输出分组长度等于输入分组长度<sup>[3](https://csrc.nist.gov/glossary/term/block_cipher)</sup> |
| 密码套件 | 一组通用的密码算法，用于密钥建立、签名生成、哈希计算、加密和/或数据认证<sup>[4](https://csrc.nist.gov/glossary/term/cipher_suite)</sup> |
| TLS 1.3 套件 | RFC 8446 中定义的五个套件，命名为 TLS_AEAD_HASH，其两字节值为 {0x13,0x01} 至 {0x13,0x05}<sup>[5](https://www.rfc-editor.org/rfc/rfc8446.html)</sup> |
| 版本隔离 | TLS 1.3 密码套件不能为 TLS 1.2 连接协商，TLS 1.2 或更低版本的套件不能与 TLS 1.3 一起使用<sup>[6](https://www.iana.org/assignments/tls-parameters)</sup> |
| 已弃用示例 | DES 的有效密钥强度为56位；一个2006年的系统平均在不到九天内完成穷举密钥搜索，成本低于10,000美元<sup>[7](https://www.rfc-editor.org/pdfrfc/rfc5469.txt.pdf)</sup> |
| 当前下限 | 实现不得协商提供低于112位安全性的套件，且不应协商低于128位的套件<sup>[8](https://www.rfc-editor.org/rfc/rfc9325.html)</sup> |

## 密码与加密

加密是使用密码算法和密钥将明文变为密文以保障安全或隐私的过程<sup>[2](https://csrc.nist.gov/glossary/term/encryption)</sup>。密码算法是一种定义明确的计算过程，接受可变输入（通常包括密码密钥），并产生输出<sup>[9](https://csrc.nist.gov/glossary/term/Cryptographic_algorithm)</sup>。密钥使密码区别于单纯的编码：任何知道算法但不知道密钥的人都不应能读懂密文。

**分组密码。** 分组密码是一种可逆的对称密钥算法，它在秘密密钥下通过一种固定不变的变换来变换固定大小的输入分组，每个输出分组的长度与输入分组相同<sup>[3](https://csrc.nist.gov/glossary/term/block_cipher)</sup>。分组密码在工作模式内使用；工作模式是一种对数据进行密码变换的算法，以对称密钥分组密码为特征，并提供机密性或认证等服务<sup>[10](https://csrc.nist.gov/glossary/term/mode_of_operation)</sup>。[高级加密标准](https://www.edgepedia.org/zh/advanced-encryption-standard)（AES）是一种美国政府批准的对称分组密码，可加密和解密信息<sup>[11](https://csrc.nist.gov/glossary/term/advanced_encryption_standard)</sup>。

较旧的分组密码既展示了设计空间，也展示了其局限。IDEA（国际数据加密算法）由来学嘉（Xuejia Lai）和[詹姆斯·马西](https://www.edgepedia.org/zh/james-massey)（James Massey）设计，使用128位密钥，作用于64位分组<sup>[7](https://www.rfc-editor.org/pdfrfc/rfc5469.txt.pdf)</sup>。TLS 中的 Camellia 密码套件使用密码分组链接（CBC）模式下的 Camellia，密钥为128位或256位，初始向量（IV）为128位<sup>[12](https://www.rfc-editor.org/rfc/rfc5932.html)</sup>。数据加密标准（DES）于1976年被批准为美国联邦标准，有效密钥强度为56位，二十多年来一直已知易受实际暴力破解攻击；库马尔（Kumar）及其同事在2006年的一篇论文中描述了一个系统，平均在不到九天内完成穷举密钥搜索，构建成本低于10,000美元<sup>[7](https://www.rfc-editor.org/pdfrfc/rfc5469.txt.pdf)</sup>。

## 密码套件

在[传输层安全](https://www.edgepedia.org/zh/transport-layer-security)（TLS）等协议中，密码很少单独部署。密码套件是一组标准化的密码算法集合，用于建立密钥、创建签名、计算哈希函数、加密数据和认证数据等目的。<sup>[4](https://csrc.nist.gov/glossary/term/cipher_suite)</sup> 密码套件指定会话将使用的密码算法，协商在 TLS 握手期间进行：客户端出示其支持的套件，服务器选择其中一个来保护会话数据<sup>[13](https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-52r2.pdf)</sup>。

命名约定记录了套件结构的变化。在 TLS 1.0 到 TLS 1.2 中，套件形式为 TLS_KeyExchangeAlg_WITH_EncryptionAlg_MessageAuthenticationAlg；例如，TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 使用临时 [ECDH](https://www.edgepedia.org/zh/elliptic-curve-diffie-hellman) 密钥建立，参数用 RSA 签名，机密性来自 CBC 模式下的 AES-128，消息认证使用 HMAC_SHA<sup>[13](https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-52r2.pdf)</sup>。在 [TLS 1.3](https://www.edgepedia.org/zh/tls-1-3) 中，密钥交换算法仅在扩展中指定，套件形式为 TLS_AEAD_HASH：例如，TLS_AES_128_GCM_SHA256 使用伽罗瓦/计数器模式（GCM）下的 AES-128 进行加密和认证，并将 SHA-256 与密钥派生函数一起使用<sup>[13](https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-52r2.pdf)</sup>。

**TLS 1.3 套件。** RFC 8446 为 TLS 1.3 定义了五个密码套件，每个套件都指明用于记录保护的带关联数据的认证加密（AEAD）算法以及与 HKDF（基于 HMAC 的密钥派生函数）一起使用的哈希算法<sup>[5](https://www.rfc-editor.org/rfc/rfc8446.html)</sup>：

| 套件 | 值 |
|---|---|
| TLS_AES_128_GCM_SHA256 | {0x13,0x01} |
| TLS_AES_256_GCM_SHA384 | {0x13,0x02} |
| TLS_CHACHA20_POLY1305_SHA256 | {0x13,0x03} |
| TLS_AES_128_CCM_SHA256 | {0x13,0x04} |
| TLS_AES_128_CCM_8_SHA256 | {0x13,0x05} |

尽管 TLS 1.3 使用与先前版本相同的密码套件空间，但其套件定义方式不同，仅指定对称密码和哈希函数，且不能用于 TLS 1.2；TLS 1.2 及更低版本的套件值同样不能用于 TLS 1.3<sup>[6](https://www.iana.org/assignments/tls-parameters)</sup>。TLS 1.3 还从其列表中删除了所有遗留对称算法，只留下 AEAD 算法，这些算法在单次操作中提供机密性和完整性，并移除了静态 RSA 和 Diffie-Hellman 套件，使所有基于公钥的密钥交换都提供前向保密<sup>[14](https://www.rfc-editor.org/info/rfc8446/)</sup>。

套件集存在针对特定需求的扩展。RFC 9150 增加了仅提供完整性的 TLS 1.3 套件 TLS_SHA256_SHA256 {0xC0,0xB4} 和 TLS_SHA384_SHA384 {0xC0,0xB5}，它们使用 HMAC 认证标签在不加密的情况下模拟 AEAD 接口；由于它们不支持机密性，因此不得与依赖机密性的认证和密钥交换方法一起使用<sup>[15](https://www.rfc-editor.org/info/rfc9150/)</sup>。RFC 8998 定义了使用商密（SM）算法的套件，以 GCM 或 CCM 模式下的 SM4 作为 AEAD 加密算法<sup>[16](https://www.rfc-editor.org/rfc/rfc8998.pdf)</sup>。

## 选择与弃用

随着密码分析技术的进步，密码算法会随时间推移而变弱，因此使用弱算法的密码套件需要逐步淘汰并替换<sup>[8](https://www.rfc-editor.org/rfc/rfc9325.html)</sup>。互联网号码分配机构（IANA）注册表带有明确警告：密码算法和参数会随时间推移而被破解或削弱，不建议盲目实现所列出的密码套件<sup>[6](https://www.iana.org/assignments/tls-parameters)</sup>。

当前互联网工程任务组（IETF）的建议设定了一个下限，并移除了已知的弱构造。实现不得协商使用 NULL 加密（不提供机密性）的套件或 RC4 套件，也不得协商提供低于112位安全性的套件，包括40位或56位的出口级加密；低于128位的套件不应协商，而中间相遇攻击意味着某些遗留套件（如168位三重 DES）的有效密钥长度只有112位<sup>[8](https://www.rfc-editor.org/rfc/rfc9325.html)</sup>。实现不应协商静态 RSA 密钥传输或静态有限域和椭圆曲线 Diffie-Hellman 套件，因为这些套件缺乏前向保密；实现必须支持并优先选择提供前向保密的套件<sup>[8](https://www.rfc-editor.org/rfc/rfc9325.html)</sup>。RFC 10015 对 TLS 1.2 提出更进一步要求：客户端不得提供、服务器不得在 (D)TLS 1.2 连接中选择 RSA 或有限域 Diffie-Hellman 密码套件，同时允许在 TLS 1.3 中使用 FFDHE 套件<sup>[17](https://www.rfc-editor.org/rfc/rfc10015.html)</sup>。

**模式与标签选择。** 美国国家标准与技术研究院（NIST）指南倾向于使用临时密钥而非静态密钥，倾向于使用 GCM 或 CCM 认证加密模式而非 CBC 模式，并倾向于 CCM 而非 CCM_8，因为后者较短的认证标签提供较低的认证强度<sup>[13](https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-52r2.pdf)</sup>。因此，互联网号码分配机构（IANA）注册表未将 CCM_8 套件标记为“推荐”，并指出其显著截断的认证标签是一种安全权衡，可能不适用于一般环境<sup>[6](https://www.iana.org/assignments/tls-parameters)</sup>。

在美国政府系统内，NIST 特别出版物 800-52 第2版要求所有联邦 TLS 服务器和客户端在配置基于联邦信息处理标准（FIPS）的密码套件时支持 TLS 1.2，并且自2024年1月1日起支持 TLS 1.3。<sup>[18](https://www.nist.gov/publications/guidelines-selection-configuration-and-use-transport-layer-security-tls-0)</sup>

## References

1. [cipher, NIST CSRC Glossary (CNSSI 4009-2022)](https://csrc.nist.gov/glossary/term/cipher)
2. [encryption, NIST CSRC Glossary](https://csrc.nist.gov/glossary/term/encryption)
3. [block cipher, NIST CSRC Glossary](https://csrc.nist.gov/glossary/term/block_cipher)
4. [cipher suite, NIST CSRC Glossary (NIST CSWP 39-upd1)](https://csrc.nist.gov/glossary/term/cipher_suite)
5. [RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3, RFC Editor](https://www.rfc-editor.org/rfc/rfc8446.html)
6. [Transport Layer Security (TLS) Parameters, IANA](https://www.iana.org/assignments/tls-parameters)
7. [RFC 5469: DES and IDEA Cipher Suites for TLS, RFC Editor](https://www.rfc-editor.org/pdfrfc/rfc5469.txt.pdf)
8. [RFC 9325: Recommendations for Secure Use of TLS and DTLS, RFC Editor](https://www.rfc-editor.org/rfc/rfc9325.html)
9. [Cryptographic algorithm, NIST CSRC Glossary](https://csrc.nist.gov/glossary/term/Cryptographic_algorithm)
10. [Mode of Operation (Mode), NIST CSRC Glossary](https://csrc.nist.gov/glossary/term/mode_of_operation)
11. [Advanced Encryption Standard, NIST CSRC Glossary](https://csrc.nist.gov/glossary/term/advanced_encryption_standard)
12. [RFC 5932: Camellia Cipher Suites for TLS, RFC Editor](https://www.rfc-editor.org/rfc/rfc5932.html)
13. [NIST SP 800-52 Rev. 2: Guidelines for the Selection, Configuration, and Use of TLS Implementations](https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-52r2.pdf)
14. [RFC 8446 information page, RFC Editor](https://www.rfc-editor.org/info/rfc8446/)
15. [RFC 9150: TLS 1.3 Authentication and Integrity-Only Cipher Suites, RFC Editor](https://www.rfc-editor.org/info/rfc9150/)
16. [RFC 8998: ShangMi (SM) Cipher Suites for TLS 1.3, RFC Editor](https://www.rfc-editor.org/rfc/rfc8998.pdf)
17. [RFC 10015: Deprecating Obsolete Key Exchange Methods in TLS 1.2 and DTLS 1.2, RFC Editor](https://www.rfc-editor.org/rfc/rfc10015.html)
18. [NIST SP 800-52 Rev. 2 publication page](https://www.nist.gov/publications/guidelines-selection-configuration-and-use-transport-layer-security-tls-0)

---
*Initially written Sep 17, 2026 · Reviewed: Oct 15, 2026 · Edited: Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 网络与安全 › Security governance and internet policy › Cryptographic protocols › Protocol standards and specifications

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/cipher

English original: https://www.edgepedia.org/cipher
