HTTPS 和证书

发布于 2024-10-31 04:37:21 字数 20 浏览 4 评论 0原文

HTTPS 如何接受证书?

How does HTTPS work with respect to accepting a certificate?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

娇纵 2024-11-07 04:37:21

非常简单地讲一个小故事

客户端(连接到服务器并伸出手)“您好!这是我的加密详细信息。”

服务器:(握住客户端的手)“您好。这是我的加密详细信息。这是我的证书。” (握手协商完成,客户端检查证书)

客户:太好了,这是我的钥匙!所以从现在开始一切都使用这个密钥加密。可以吗?

服务器:好的! (SSL握手完成)

客户端:太棒了,这是我通过 HTTP 获取的数据!!

证书用于SSL 握手。服务器传递给客户端的证书由 签名 /en.wikipedia.org/wiki/Certificate_authority" rel="noreferrer">证书颁发机构 (CA),如 VeriSign,特定于服务器。 SSL 握手过程中会进行各种检查。要了解的重要事项之一是证书的通用名称属性必须与服务器的主机/DNS 名称匹配。

客户端拥有 CA 的公共证书(密钥) 的副本,因此可以使用它(计算为例如 SHA1)来查看服务器的证书是否仍然可以。

Very sipmly put with a little story:

Client : (Connects to the server and, sticks out it's hand) "Hello! Here are my encryption details."

Server : (Takes hand of the client) "Hello. Here are my encryption details. Here is my certificate." (Handshake negotiation complete. Client check the cerificate)

Client : Great, here's my key! So from now on everything is encrypted using this key. OK?

Server : OK! (SSL Handshake complete)

Client : Great, Here comes my data over HTTP!!

Certificates are used in the SSL handshake. The certificate that the server hands to the client is signed by a Certificate Authority (CA) like VeriSign and is specific to the server. There are various checks that happens in the SSL handshake. One of the important ones to know about is the Common Name attribute of the certificate must match the host / DNS name of the server.

The client has a copy of the CA's public certificate (key) and can thus use it (calculate with SHA1 for example) to see if the server's certificate is still ok.

皓月长歌 2024-11-07 04:37:21

首先我们需要区分服务器端和客户端证书。

大多数情况下仅使用服务器端证书。它用于让客户端通过验证服务器的证书来验证客户端所连接的服务器的真实性(验证过程将在下面介绍)。这样做应该可以防止中间人 (MITM) 攻击。

当我们需要将对服务器的访问限制为仅某些用户组时,可以使用客户端证书。为此,客户端使用证书对自身进行身份验证。由于用户集通常是有限的(根据某些标准,它在现实生活中可能非常大),因此验证过程通常与服务器证书验证过程有点不同。

接下来,关于验证本身。

在客户端验证服务器证书时,客户端执行以下步骤:

  1. 查找颁发者 (CA) 证书并使用颁发者证书检查服务器证书的签名(跳过技术细节)。
  2. 检查证书有效期(从何时到应接受证书的时间)。
  3. 检查证书的预期用途(每个证书只能限制为某些用途)。
  4. 检查服务器所在域名(或IP地址)是否已颁发证书。
  5. 检查证书是否未被 CA 取消(吊销)。这是通过检查证书吊销列表 (CRL) 并使用 OCSP 协议发送即时请求来完成的。
  6. 由于 CRL 和 OCSP 响应是使用证书进行签名的,因此它们的签名也会按上述方式进行验证。
  7. 对步骤 (1) 中提到的 CA 证书重复该过程,直到获得受信任的根 CA 证书(假设客户端拥有一组受信任的根证书)。

当服务器验证客户端的证书时,上述过程通常会被简化,因为同一个系统是 CA 和验证其访问的服务器。在这种情况下,证书可以直接与允许的证书列表匹配,或者上述大多数步骤可能是不必要的。

First of all we need to distinguish server-side and client-side certificates.

In most cases only the server-side certificate is used. It is used to let the client verify the authenticity of the server that the client has connected to by validating the server's certificate (validation procedure will be described below). Doing this should prevent man-in-the-middle (MITM) attack.

Client-side certificate is used when we need to restrict access to the server to only some set of users. To do this the client authenticates itself with the certificate. As the set of users is usually limited (by some criteria, it can be quite large in real life), validation procedure is often a bit different from the server cert validation procedure.

Next, about validation itself.

When validating the server's certificate on the client, the client takes the following steps:

  1. Find issuer (CA) certificate and check the signature of the server's certificate using issuer certificate (technical details skipped).
  2. Check certificate validity period (from when to when the certificate should be accepted).
  3. Check certificate intended usage (each certificate can be restricted to only some purposes).
  4. Check that the certificate has been issued for domain name (or IP address) that the server is located on.
  5. Check that the certificate has not been canceled (revoked) by the CA. This is done by checking certificate revocation lists (CRL) and by sending an on-the-fly request using OCSP protocol.
  6. As CRLs and OCSP responses are signed using certificates, their signatures are also validated as described above.
  7. The procedure is repeated for the CA certificate mentioned in step (1) and this goes on until you get to trusted root CA certificate (it is assumed that the client has a set of trusted root certificates).

When the server validates client's certificate, the above procedure is usually simplified because the same system is a CA and a server access to which is verified. In this case certificates can be either matched directly to the list of allowed certificates or most of the above steps can be unnecessary.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文