TLS握手的过程

翻译自 https://www.ibm.com/docs/en/ibm-mq/9.0?topic=tls-overview-ssltls-handshake

  1. The TLS client sends a client hello message that lists cryptographic information such as the TLS version and, in the client’s order of preference, the CipherSuites supported by the client. The message also contains a random byte string that is used in subsequent computations. The protocol allows for the client hello to include the data compression methods supported by the client.

TLS客户端发送client hello,里面包含了加密的信息,如TLS version, client支持的加密方式,客户端随机字符串,如下图所示

client hello

  1. The TLS server responds with a server hello message that contains the CipherSuite chosen by the server from the list provided by the client, the session ID, and another random byte string. The server also sends its digital certificate. If the server requires a digital certificate for client authentication, the server sends a client certificate request that includes a list of the types of certificates supported and the Distinguished Names of acceptable Certification Authorities (CAs).

TLS服务端响应server hello消息,包含了服务端选择的加密方式, session ID, 以及服务器端随机字符串。 服务器同时发送certificate给Client。 如果服务端要求客户端做证书验证,服务端会发起一个client certificate request(客户端证书验证请求),包含支持的加密方式和可接收的CA。
客户端验证不是必须的,它从另一层保证了client的真实有效性,避免了一些非法用户的攻击行为,但是同时也增加了服务器的资源开销。

server hello

certificate消息和Server Hello Done消息

  1. The TLS client verifies the server’s digital certificate. For more information, see How TLS provides identification, authentication, confidentiality, and integrity.

client验证server的certificate

  1. The TLS client sends the random byte string that enables both the client and the server to compute the secret key to be used for encrypting subsequent message data. The random byte string itself is encrypted with the server’s public key.

TLS client根据客户端和服务端的信息生成secret key,使用服务器证书的public key加密,然后发送给Server。后续的通信将采用该secret key做对称加密。

Client Key Exchange

  1. If the TLS server sent a client certificate request, the client sends a random byte string encrypted with the client’s private key, together with the client’s digital certificate, or a no digital certificate alert. This alert is only a warning, but with some implementations the handshake fails if client authentication is mandatory.

如果Serve要求client certificate request,那么client会发送client的certificate,同时使用client的certifcate私钥机密的随机字符串;如果客户端没有certificate,那么会给一个无证书的通告。这个通告仅仅是个告警,但是有些强制要求client验证的实现会导致tls握手失败。

  1. The TLS server verifies the client’s certificate. For more information, see How TLS provides identification, authentication, confidentiality, and integrity.

如果收到client certificate,Server会验证client‘s certificate

  1. The TLS client sends the server a finished message, which is encrypted with the secret key, indicating that the client part of the handshake is complete.

TLS client发送包含secret key的finished消息,表示client端TLS握手完成

  1. The TLS server sends the client a finished message, which is encrypted with the secret key, indicating that the server part of the handshake is complete.

TLS server发送finished消息,表示server端TLS握手完成

  1. For the duration of the TLS session, the server and client can now exchange messages that are symmetrically encrypted with the shared secret key.

握手完成后,整个session对话过程Server和Client可以使用协商好的secret key用对称加密方式通信了。

TLS handshake

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值