We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
因为RSA不具备前向安全,当服务器的秘钥要破解之后,以前的加密数据也可以被解析出来, 而DH是在每次TLS握手时都随机生成对称秘钥,从而保证了前向安全(或者说前向保密)
发送方: 随机生成一个基数g, 一个整数p, 一个发送方的随机生成的秘密整数a, 生成一个公钥A A = g^a mod p, 然后将生成的公钥发送给接收方 接收方: 同样生成一个秘密整数b,然后拿到发送方的公钥,可以生产一个接收方的公钥B B = g^b mod p, 然后将生成的公钥发送给发送方
这个时候发送方和接收方都有彼此的公私钥,然后生成共同秘钥K
发送方: k = B^a mode p 接收方: k = A^b mode p
例如
协定使用p = 23, 基数g = 5
client: 秘密整数 a=6, A = g^a mode p = 5^6%23 = 8 server: 秘密整数 b=15, B = g^b mode p = 5^15%23 = 19
生成最终的共同秘钥K client: k = 19^6%23 = 2 server: k = 8^15%23 = 2
当中间人假装自己是服务端,进行了一次DH秘钥交换, 与此同时中间人再假装自己是客户端跟服务端通信,又进行了一次DH秘钥交换
解决方式: 使用KPI证书, 达到身份验证即可解决
The text was updated successfully, but these errors were encountered:
No branches or pull requests
流程
发送方:
随机生成一个基数g, 一个整数p, 一个发送方的随机生成的秘密整数a, 生成一个公钥A
A = g^a mod p, 然后将生成的公钥发送给接收方
接收方:
同样生成一个秘密整数b,然后拿到发送方的公钥,可以生产一个接收方的公钥B
B = g^b mod p, 然后将生成的公钥发送给发送方
这个时候发送方和接收方都有彼此的公私钥,然后生成共同秘钥K
发送方: k = B^a mode p
接收方: k = A^b mode p
协定使用p = 23, 基数g = 5
client: 秘密整数 a=6, A = g^a mode p = 5^6%23 = 8
server: 秘密整数 b=15, B = g^b mode p = 5^15%23 = 19
生成最终的共同秘钥K
client: k = 19^6%23 = 2
server: k = 8^15%23 = 2
中间人攻击
当中间人假装自己是服务端,进行了一次DH秘钥交换, 与此同时中间人再假装自己是客户端跟服务端通信,又进行了一次DH秘钥交换
解决方式: 使用KPI证书, 达到身份验证即可解决
The text was updated successfully, but these errors were encountered: