简体   繁体   English

SSL证书和身份验证

[英]SSL Certificate and identity verification

I've been looking for information about SSL certificates and encryption protocols. 我一直在寻找有关SSL证书和加密协议的信息。 I got very good answers, especially on this website. 我得到了很好的答案,尤其是在此网站上。

There's only one thing I don't get. 我只有一件事。 If I got this right, the verification of the identity (I mean the verification of the server identity, not the certificate identity) is made using asymmetric cryptography. 如果我理解正确,则使用非对称密码学进行身份验证(即服务器身份验证,而不是证书身份验证)。

That means the steps would be (stop me if I'm wrong): 这意味着步骤将是(如果我错了就阻止我):

  • Client uses verified public key to encrypt a random challenge string and send it to server. 客户端使用经过验证的公共密钥来加密随机质询字符串并将其发送到服务器。
  • Server decrypts it using its private key and sends it back to the client. 服务器使用其私钥对其解密,然后将其发送回客户端。
  • Client checks if the response from server matches the random challenge string it just sent. 客户端检查来自服务器的响应是否匹配它刚发送的随机质询字符串。

What prevents a fake server to do it like this, with a real certificate for, say, www.example.com but without having the private key? 是什么阻止伪造的服务器使用真实的证书(例如www.example.com)却没有私钥来做到这一点呢?

  • Client uses verified public key to encrypt a random challenge string and send it to server. 客户端使用经过验证的公共密钥来加密随机质询字符串并将其发送到服务器。
  • Fake server sends the encrypted random challenge string to www.example.com, as a client wanting to check its identity. 假服务器将加密的随机质询字符串发送到www.example.com,作为要检查其身份的客户端。
  • www.example.com sends back the decrypted random challenge string to fake server. www.example.com将解密的随机质询字符串发送回假服务器。
  • Fake server sends it back to client. 假服务器将其发送回客户端。
  • Identity is confirmed? 身份已确认?

Client uses verified public key to encrypt a random challenge string and send it to server. 客户端使用经过验证的公共密钥来加密随机质询字符串并将其发送到服务器。

The key exchange mode where the client encrypts something with the server's public key is the RSA key exchange mode. 客户端使用服务器的公共密钥加密某些内容的密钥交换模式是RSA密钥交换模式。 There's a full description of it in section F.1.1.2 of the TLS specification . TLS规范的F.1.1.2节对此有完整描述。

Essentially, the client generates the pre-master secret, encrypts it with the server's public key (found in the server certificate the server has sent), and sends it to the server (in a Client Key Exchange Message). 本质上,客户端生成主密码,使用服务器的公钥(在服务器已发送的服务器证书中找到)对其进行加密,然后将其发送到服务器(在客户端密钥交换消息中)。 That's it. 而已。 Only the server with the matching private key can decipher it. 只有具有匹配私钥的服务器才能解密它。 The server doesn't send any deciphered version back to the client, so couldn't ask for a 3rd party to do whatever operation you seem to have in mind with it. 服务器不会将任何解密后的版本发送回客户端,因此无法要求第三方进行您似乎想对它进行的任何操作。

This is just a straw-man argument. 这只是一个稻草人的论点。 The steps you have listed are completely imaginary. 您列出的步骤完全是虚构的。 The actual steps are: 实际步骤为:

  1. The server sends its certificate as part of the TLS handshake. 服务器将其证书作为TLS握手的一部分发送。
  2. The server sends a digital signature over its certificate and the other handshake messages, signed by its private key. 服务器通过其证书发送数字签名,并通过其私钥签名其他握手消息。
  3. The client uses the public key in the certificate to verify the digital signature. 客户端使用证书中的公钥来验证数字签名。

Only a server that has the private key corresponding to the public key in the certificate can succeed. 只有具有与证书中的公钥相对应的私钥的服务器才能成功。

I suggest you do some reading, and not of random postings on the Internet: try the normative reference: RFC 2246 . 我建议您阅读一些内容,而不是在互联网上随意阅读:尝试使用标准参考: RFC 2246

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM