# 在线证书状态协议

在线证书状态协议（OCSP）是一种互联网协议，规定于 RFC 6960 中，它让应用程序可以向指定的服务器——即 OCSP 响应器——询问某张 X.509 数字证书的当前吊销状态，而不必下载证书吊销列表（CRL）。<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup> 它的诞生是为了在高额资金转账或大规模股票交易等场景下，提供比周期性 CRL 更及时的吊销信息，并取代了 1999 年的原始规范 RFC 2560 以及 RFC 6277。<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup>

| 关键事实 | 详情 |
|---|---|
| 现行规范 | RFC 6960，2013 年 6 月由 IETF PKIX 工作组发布；取代 RFC 2560（1999）和 RFC 6277<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup> |
| 状态值 | 确定性响应针对每张证书返回三种指示之一：良好、已吊销或未知；“已吊销”也可用于从未签发过的证书<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup> |
| 传输 | 基于 HTTP 的请求使用 GET 或 POST，MIME 类型为 application/ocsp-request 和 application/ocsp-response<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup> |
| 重放防御 | nonce 扩展以密码学方式将响应与其请求绑定；RFC 8954（后已被 RFC 9654 取代）将 nonce 限制为 1 至 32 个八位组，并要求使用密码学强度高、新生成的随机值<sup>[2](https://www.rfc-editor.org/info/rfc8954/)</sup> |
| 失败行为 | 客户端可选择软失败（状态不可达时接受）或硬失败（拒绝）；软失败会让持有已吊销证书密钥的攻击者得以冒充该证书的主体<sup>[3](https://messervices.cyber.gouv.fr/documents-guides/security-recommendations-for-tls_v1.1.pdf)</sup> |
| 隐私暴露 | 除非使用装订，否则 CA 能看到每个客户端的 IP 地址以及它正在检查哪张证书<sup>[4](https://www.encryptionconsulting.com/ocsp-vs-crl/?trk=article-ssr-frontend-pulse_little-text-block)</sup> |
| 衰落 | 截至 2025 年 8 月 6 日，包括 Let's Encrypt 在内的主要 CA 正逐步淘汰 OCSP，转而青睐 CRL 和短寿命证书；Firefox 从版本 142 起对域名验证证书禁用 OCSP<sup>[4](https://www.encryptionconsulting.com/ocsp-vs-crl/?trk=article-ssr-frontend-pulse_little-text-block)</sup><sup> • </sup><sup>[5](https://hacks.mozilla.org/2025/08/crlite-fast-private-and-comprehensive-certificate-revocation-checking-in-firefox/)</sup> |

## 检查的工作原理

OCSP 客户端向响应器发送查询证书状态的请求，并在收到回复之前暂不信任所涉证书。<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup> 请求携带协议版本、服务请求、目标证书标识符以及可选扩展。<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup> 响应器收到后，会检查消息格式是否良好、自身是否被配置为提供所请求的服务、请求是否包含所需信息；任一条件不满足即返回错误消息，否则返回确定性响应。<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup>

确定性响应是经过签名的。它包含响应语法版本、响应器标识符（其名称或其公钥的哈希值）、响应生成时间、逐证书状态、可选扩展、签名算法 OID，以及对该响应哈希值计算出的签名。<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup> 每个逐证书条目包含目标证书标识符、状态值以及响应有效期区间（thisUpdate 和 nextUpdate），这样客户端就知道该答案可以复用多久。<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup>

由于响应经过签名并带有有效期区间，旧响应在未过期之前可以被重放，即便响应器的答案此后已经改变。nonce 扩展通过要求响应器回显客户端提供的随机值来应对这一点，但 RFC 5019 允许响应器省略 nonce，路径上的攻击者便可利用这一点重放早先不含 nonce 的响应；缩短 thisUpdate 与 nextUpdate 之间的间隔可以缓解此问题。<sup>[2](https://www.rfc-editor.org/info/rfc8954/)</sup>

## 软失败与硬失败

当无法获取吊销信息时，定义了两种行为：硬失败拒绝连接，软失败则接受证书并继续交换。<sup>[3](https://messervices.cyber.gouv.fr/documents-guides/security-recommendations-for-tls_v1.1.pdf)</sup> 选择取决于具体情境：偏重可用性的应用配置软失败，安全至上的应用则启用硬失败。<sup>[3](https://messervices.cyber.gouv.fr/documents-guides/security-recommendations-for-tls_v1.1.pdf)</sup> 在软失败模式下，如果 OCSP 响应器不可用，持有已吊销证书密钥的攻击者仍能冒充该证书的主体，因为浏览器在无法检查时便假定证书未被吊销。<sup>[3](https://messervices.cyber.gouv.fr/documents-guides/security-recommendations-for-tls_v1.1.pdf)</sup><sup> • </sup><sup>[6](https://blog.cloudflare.com/high-reliability-ocsp-stapling/)</sup>

硬失败也有其代价。它会让处于强制门户之后以及处于屏蔽 OCSP 请求的网络中的用户被迫面对不必要的安全警告，还会让一台故障的 OCSP 服务器成为 CA 所签发每张证书的集中故障点；一次 OCSP 中断实际上就会变成一次互联网中断。<sup>[6](https://blog.cloudflare.com/high-reliability-ocsp-stapling/)</sup> 出于这些原因，大多数浏览器采用了软失败，而对真实浏览器行为的研究发现，对于非扩展验证证书，通常遇到的是软失败做法，即便吊销数据不可用，浏览器仍会建立 TLS 连接，而 EV 证书则受到更严格的控制。<sup>[7](https://iris.polito.it/handle/11583/2980760)</sup>

## OCSP 装订

在普通 OCSP 中，客户端自行联系响应器，这要花费一个往返，并且会让 CA 知道谁在访问哪个站点。OCSP 装订把这项工作移到服务器端：服务器获取已签名的 OCSP 响应，并将其“装订”到 TLS 握手中，这样客户端无需向外查询即可获得最新状态。RFC 9325 建议 TLS 服务器使用 status_request 扩展支持 OCSP 和 OCSP 装订，并指出服务器运营者可以申请“必须装订”证书（RFC 7633），这类证书指示客户端必须要求装订响应。<sup>[8](https://www.rfc-editor.org/rfc/rfc9325.html)</sup> 装订既解决了客户端的延迟负担，也解决了隐私泄露问题，因为 CA 不再观察到个别访问。<sup>[7](https://iris.polito.it/handle/11583/2980760)</sup><sup> • </sup><sup>[9](https://arstechnica.com/information-technology/2017/07/https-certificate-revocation-is-broken-and-its-time-for-some-new-tools/)</sup>

## 隐私与运维弱点

每一次普通 OCSP 查询都会向第三方——CA 的响应器——暴露客户端的 IP 地址和正在检查的具体证书，这与 HTTPS 本应服务的隐私目标相冲突。<sup>[4](https://www.encryptionconsulting.com/ocsp-vs-crl/?trk=article-ssr-frontend-pulse_little-text-block)</sup><sup> • </sup><sup>[9](https://arstechnica.com/information-technology/2017/07/https-certificate-revocation-is-broken-and-its-time-for-some-new-tools/)</sup> 响应器还必须处理高查询量，其可用性成为每次验证的依赖项；RFC 6960 的安全考量指出，使用证书的系统必须能够访问状态服务，该服务才能有效。<sup>[1](https://datatracker.ietf.org/doc/html/rfc6960)</sup> 研究还描述了可对 OCSP 服务实施拒绝服务式攻击的设计缺陷。<sup>[10](https://arxiv.org/abs/1609.03047)</sup>

与 CRL 相比，OCSP 只检查所涉证书而非整个列表，因此单次请求带宽低，且响应器健康时答案近乎实时；相比之下，CRL 下载一次后在本地检查，保护了隐私，但依赖周期性更新且下载量可能很大。<sup>[4](https://www.encryptionconsulting.com/ocsp-vs-crl/?trk=article-ssr-frontend-pulse_little-text-block)</sup><sup> • </sup><sup>[11](https://nhimg.org/faq/how-should-security-teams-choose-between-crl-and-ocsp-for-certificate-revocation/)</sup> 对于高流量环境，RFC 5019 定义了一种轻量级 OCSP 规范，其中符合规范的请求只包含一个证书请求。<sup>[12](https://www.rfc-editor.org/pdfrfc/rfc5019.txt.pdf)</sup>

## 衰落与替代方案

Web PKI 一直在远离 OCSP。CA/浏览器论坛的基线要求规定，自 2025 年 1 月 15 日起，权威 OCSP 响应必须在证书首次发布后不超过 15 分钟内可用，这在支持逐步退场的同时收紧了响应器义务。<sup>[13](https://cabforum.org/working-groups/server/baseline-requirements/requirements/)</sup> [Let's Encrypt](https://www.edgepedia.org/zh/lets-encrypt) 宣布自 2025 年 8 月 6 日起停止提供 OCSP 响应器，行业方向将 CRL（有时与短寿命证书搭配）定位为主要吊销机制。<sup>[4](https://www.encryptionconsulting.com/ocsp-vs-crl/?trk=article-ssr-frontend-pulse_little-text-block)</sup> 证书颁发机构不再被要求支持 OCSP，Mozilla 将该协议的隐私泄露列为这一转变的首要原因。<sup>[5](https://hacks.mozilla.org/2025/08/crlite-fast-private-and-comprehensive-certificate-revocation-checking-in-firefox/)</sup>

浏览器引领了这场撤退。Firefox 直到版本 137 都使用 OCSP 进行实时状态查询，之后以 CRLite 取而代之——一种紧凑、保护隐私的吊销信息源——并在 Firefox 142 中对域名验证证书禁用了 OCSP。<sup>[5](https://hacks.mozilla.org/2025/08/crlite-fast-private-and-comprehensive-certificate-revocation-checking-in-firefox/)</sup> Chrome 通常根本不执行在线 OCSP 或 CRL 检查；它依赖 CRLSets（最多每几小时更新一次）作为快速阻止证书的主要手段，在线 OCSP 检查仅通过企业策略提供。<sup>[14](https://new.chromium.org/Home/chromium-security/crlsets/)</sup> 在企业环境中情况则较为复杂：微软的 Active Directory 证书服务在线响应器实现了 OCSP 以支持实时查询，而 Microsoft Entra ID 明确不支持基于证书的身份验证使用 OCSP，理由是性能和可靠性问题，并改用缓存的 CRL。<sup>[15](https://learn.microsoft.com/en-us/windows-server/identity/ad-cs/secure-monitor-scale-online-responders)</sup><sup> • </sup><sup>[16](https://learn.microsoft.com/en-us/entra/identity/authentication/concept-certificate-based-authentication-certificate-revocation-list)</sup>

协议本身仍在维护：RFC 9654 取代了 nonce 扩展规范 RFC 8954，并以修订后的 ASN.1 模块更新了 RFC 6960。<sup>[17](https://www.rfc-editor.org/rfc/rfc9654.pdf)</sup>

## References

1. [RFC 6960: X.509 Internet Public Key Infrastructure Online Certificate Status Protocol - OCSP, IETF](https://datatracker.ietf.org/doc/html/rfc6960)
2. [RFC 8954: Online Certificate Status Protocol (OCSP) Nonce Extension, RFC Editor](https://www.rfc-editor.org/info/rfc8954/)
3. [Security Recommendations for TLS, ANSSI (Revocation Information Deficiency)](https://messervices.cyber.gouv.fr/documents-guides/security-recommendations-for-tls_v1.1.pdf)
4. [OCSP vs. CRL, Encryption Consulting](https://www.encryptionconsulting.com/ocsp-vs-crl/?trk=article-ssr-frontend-pulse_little-text-block)
5. [CRLite: Fast, private, and comprehensive certificate revocation checking in Firefox, Mozilla Hacks](https://hacks.mozilla.org/2025/08/crlite-fast-private-and-comprehensive-certificate-revocation-checking-in-firefox/)
6. [High-reliability OCSP stapling and why it matters, Cloudflare Blog](https://blog.cloudflare.com/high-reliability-ocsp-stapling/)
7. [An Evaluation of X.509 Certificate Revocation and Related Privacy Issues in the Web PKI Ecosystem, IEEE Access (2023)](https://iris.polito.it/handle/11583/2980760)
8. [RFC 9325: Recommendations for Secure Use of TLS and DTLS, RFC Editor](https://www.rfc-editor.org/rfc/rfc9325.html)
9. [HTTPS Certificate Revocation is broken, and it's time for some new tools, Ars Technica](https://arstechnica.com/information-technology/2017/07/https-certificate-revocation-is-broken-and-its-time-for-some-new-tools/)
10. [Autonomous collision attack on OCSP services, arXiv](https://arxiv.org/abs/1609.03047)
11. [How should security teams choose between CRL and OCSP for certificate revocation checking?, NHI Mgmt Group](https://nhimg.org/faq/how-should-security-teams-choose-between-crl-and-ocsp-for-certificate-revocation/)
12. [RFC 5019: The Lightweight Online Certificate Status Protocol (OCSP) Profile for High-Volume Environments, RFC Editor](https://www.rfc-editor.org/pdfrfc/rfc5019.txt.pdf)
13. [Latest Baseline Requirements, CA/Browser Forum](https://cabforum.org/working-groups/server/baseline-requirements/requirements/)
14. [CRLSets, Chromium](https://new.chromium.org/Home/chromium-security/crlsets/)
15. [Secure, monitor, renew, and scale Online Responders, Microsoft Learn](https://learn.microsoft.com/en-us/windows-server/identity/ad-cs/secure-monitor-scale-online-responders)
16. [Understand Microsoft Entra certificate-based authentication: Certificate revocation list, Microsoft Learn](https://learn.microsoft.com/en-us/entra/identity/authentication/concept-certificate-based-authentication-certificate-revocation-list)
17. [RFC 9654: Online Certificate Status Protocol (OCSP) Nonce Extension, RFC Editor](https://www.rfc-editor.org/rfc/rfc9654.pdf)

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

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

Copyright 2026 Edgepedia

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

Source: https://www.edgepedia.org/zh/online-certificate-status-protocol

English original: https://www.edgepedia.org/online-certificate-status-protocol
