Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL/TLS协议运行机制 #79

Open
lxfriday opened this issue Dec 16, 2019 · 2 comments
Open

SSL/TLS协议运行机制 #79

lxfriday opened this issue Dec 16, 2019 · 2 comments
Labels
协议 协议

Comments

@lxfriday
Copy link
Owner Author

lxfriday commented Dec 18, 2019

HTTPS 是什么,为什么用HTTPS

HTTPS=HTTP+TLS,在HTTP 和TCP协议之间加上TLS加密协议

明文传播的危害:

  • 窃听风险
  • 篡改风险
  • 冒充风险

目前,应用最广泛的是TLS 1.0,接下来是SSL 3.0。但是,主流浏览器都已经实现了TLS 1.2的支持。

TLS 1.0通常被标示为SSL 3.1,TLS 1.1为SSL 3.2,TLS 1.2为SSL 3.3。

@lxfriday
Copy link
Owner Author

SSL 握手过程

SSL/TLS协议的基本思路是采用公钥加密法,也就是说,客户端先向服务器端索要公钥,然后用公钥加密信息,服务器收到密文后,用自己的私钥解密,整个过程中只有服务器拥有私钥,而公钥是任何一个客户端都可以获取到的,但是公钥加密的内容只能用服务器端的撕咬才能够解密。

传输过程中有几个问题需要解决:

1. 如何保证公钥不被篡改?

将公钥放在数字证书中。只要证书是可信的,公钥就是可信的。

2. 公钥加密计算量太大,如何减少耗用的时间?

解决方法:每一次对话(session),客户端和服务器端都生成一个"对话密钥"(session key),用它来加密信息。由于"对话密钥"是对称加密,所以运算速度非常快,而服务器公钥只用于加密"对话密钥"本身,这样就减少了加密运算的消耗时间。

会话密钥使用前三次的随机数依据算法生成,会话密钥用来加密信息的内容。而每次传输时客户端公钥加密和服务器

开始加密通信之前,客户端和服务器首先必须建立连接和交换参数,这个过程叫做握手(handshake)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
协议 协议
Projects
None yet
Development

No branches or pull requests

1 participant