http://www.cnblogs.com/my_life/articles/5857614.htmlhttps://www.zhihu.com/question/37640500
image
第一步,爱丽丝给出协议版本号、一个客户端生成的随机数(Client random),以及客户端支持的加密方法。 第二步,鲍勃确认双方使用的加密方法,并给出数字证书、以及一个服务器生成的随机数(Server random)。 第三步,爱丽丝确认数字证书有效,然后生成一个新的随机数(Premaster secret),并使用数字证书中的公钥,加密这个随机数,发给鲍勃。 第四步,鲍勃使用自己的私钥,获取爱丽丝发来的随机数(即Premaster secret)。 第五步,爱丽丝和鲍勃根据约定的加密方法,使用前面的三个随机数,生成"对话密钥"(session key),用来加密接下来的整个对话过程。
为了足够安全,我们可以考虑把握手阶段的算法从默认的[RSA算法],改为 [Diffie-Hellman算法]。 采用DH算法后,Premaster secret不需要传递,双方只要交换各自的参数,就可以算出这个随机数。 上图中,第三步和第四步由传递Premaster secret变成了传递DH算法所需的参数,然后双方各自算出Premaster secret。这样就提高了安全性。
https://www.linuxidc.com/Linux/2015-07/120230.htm
image
其中Client Random和Server Random都是在前面的《Https(SSL/TLS)原理详解》中讲解过的,Client Hello 和Server Hello阶段都会发送各自的Random随机数给对方,最终都是用来计算Master Secret的。
至于PreMaster Secret(Key)的计算,主要是通过RSA或者Diffie-Hellman算法生成。我们可以看出,由于在Say Hello阶段,随机数都是明文传送的,如果PreMaster Secret泄漏的话,会导致整个SSL/TLS失效。
https://blog.csdn.net/dog250/article/details/5717162
https://www.linuxidc.com/Linux/2016-05/131147.htmhttp://seanlook.com/2015/01/07/tls-ssl/https://razeen.me/post/ssl-handshake-detail.htmlhttps://github.com/zhangyachen/zhangyachen.github.io/issues/31http://www.ruanyifeng.com/blog/2014/02/ssl_tls.htmlhttps://www.cryptologie.net/article/340/tls-pre-master-secrets-and-master-secrets/http://drops.xmd5.com/static/drops/tips-6002.html
https://security.stackexchange.com/questions/63971/how-is-the-premaster-secret-used-in-tls-generated
https://en.wikipedia.org/wiki/Transport_Layer_Security#Cipher
http://cakin24.iteye.com/blog/2346181
https://blog.csdn.net/mrpre/article/details/78025940
https://zhuanlan.zhihu.com/p/36538699
作者:Fitz_Lee 链接:https://www.jianshu.com/p/46e3ba3d9cdd 来源:简书 著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。