如何实际处理吊销证书的验证?

How to practically handle validation of revoked certificates?

据我所知,在证书链验证期间应验证每个证书的吊销情况,以保护连接免受 MITM 攻击。

据我所知,出于这个原因,我应该使用 CRL/CRL 增量或 OCSP。我是这个领域的新手,但即使阅读了一些相关的 RFC(但不是很仔细),我也不知道 use/check 撤销的实际程度。

  1. 什么样的协议被广泛用作 OCSP "transport layer" - 我只知道 HTTP - 还有其他有竞争力的替代方案,现代客户端应该支持哪些?

  2. 如果我理解正确,CA 将在每个证书中指出在哪里可以找到 CRL(除了根 CA/它是自签名的)(在 "CRL Distribution Points" 的列表中?),所以要实施严格客户端应该在证书链握手期间下载 CRL。我知道为此目的可能会使用 HTTP 和 LDAP - 是否有其他有竞争力的替代方案,哪些现代客户端需要支持?用于此目的的 LDAP 仍然很常见(或者这可能只是遗留问题)?

  3. 是否以 CRL 方式检测它的有效期,所以我可以以某种方式缓存它以供进一步连接吗?

  4. 是否有使用 CRL "offline" 的实用方法?据我所知,要让它正常工作,我应该为世界上每个可能的 CA 下载(和更新)CRL,这比 "online".

    需要更多 resources/effort
  5. 典型的证书链有多深?例如。超过例如 10 个链中的证书是可能的吗?

  6. boost asio 是否以某种方式原生支持 CRL and/or OCSP?我需要自己做吗?

  7. botan如何实现证书链的CRL"online"验证?也许它是开箱即用的(因为实施了 OCSP)?

  8. 应该支持这两种方法,或者大多数 CA 使用 OCSP 而 CRL 仅出于遗留 sw 支持的原因由它们定义?如果我只想连接到 95% 的服务器,那么我只需要实施 OCSP 而不关心 CRL 并拒绝无法使用 OCSP 验证的证书?或者可能对 OCSP 的支持相对较少?我发现 ocsp 支持 EV 证书,但不支持 OV 和 DV。是真的吗?

  9. 也许我应该通过 OCSP 和 CRL 检查撤销。有一个 "preferred" 就够了吗?还是我需要两个?

吊销检查无法避免 MITM 攻击。

要防止 MITM,您需要在客户端信任库中包含服务器根 CA 证书,并检查服务器证书是否由受信任的 CA 颁发(存在于您的信任库中)。您还可以在信任库中包含服务器证书。在攻击者窃取证书的情况下,吊销检查可能有意义


1) What kind of protocols are widely used as OCSP "transport layer" - I know only HTTP - there are other competitive alternatives, which modern client should support?

HTTP 和 HTTPS

2) If I understand correctly CA will point in every certificate where to find CRL (except root CA / which is self signed) (in list of "CRL Distribution Points"?), so to implement strict client should I download CRL during certificate chain handshake. I know that for this purpose may be used HTTP and ldap - are there other competitive alternatives, which modern client need to support? ldap for this purpose is still common(or meybe this is just legacy)?

HTTP 是通常的方式。但它可以是 HTTP、FTP、LDAP 或 FILE。 LDAP 也用于一些环境

3) Is in CRL way to detect how long it is valid, so can I cache it somehow for further connections?

CRL 包含一个 nextUpdate 字段,指示下一个 CRL 的发布日期

4) Is there practical way to work "offline" with CRL? As I understand to have it working in general, I should download(and update) CRL for every possible CA in world, which will require a much more resources/effort than doing so "online".

通常的做法是在需要的时候下载CRL,缓存起来,下次检查时,检查是否已经有了

5) How deep may be typical certificate chain? Eg. more than for example 10 certificates in chain is possible?

没有限制,但通常值为2-4

6) Does boost asio support somehow natively CRL and/or OCSP? I need to do this by myself?

asio的证书验证部分没有参考所以恐怕你必须自己实现它

7) How in botan implement CRL "online" validation for cert chain? Maybe it is out of the box(as OCSP is implemented)?

OCSP 是在线证书状态协议。在网络上,他们在谈论在线验证时似乎指的是 OCSP,但仅支持 CRL

8) Both methods should be supported or meybe OCSP is used by most CA and CRL is defined by them only for legacy sw support reasons? If I would like just connect to 95% servers, then I need implement only OCSP and not care about CRL and reject certificates which cannot be verified using OCSP? Or maybe support for OCSP is relatively rare? As I found ocsp is supported for EV certs but not for OV and DV. That's true?

CA 通常支持 OCSP 和 CRL。你需要支持两者。即使在同一个 CA 中,也可能是必须使用 OCSP 检查的证书和其他使用 CRL

检查的证书

9) Maybe I should check revocation both through OCSP and CRL if both available or just one "preferred" is enough?

OCSP 更可取,因为它速度更快且使用的资源更少。正常的实现是对两个服务并行启动查询并使用之前的响应