如何使用 SSL 和 SSL饼干有用吗?
据我了解,我们使用 SSL 来加密用户名和密码等敏感数据,以便传输到服务器,而不会被网络中的人员窃听。然后服务器通过 HTTPS 返回一个安全令牌并将其存储在 cookie 中。拥有安全令牌后,我们切换到 HTTP,我们将 cookie/安全令牌标头附加到每个 HTTP 请求。
现在任何人都可以看到我的安全令牌,他们可以窃听它并冒充我。我的理解正确吗?
I understand, we use SSL to encrypt sensitive data like user name and password to transported to server without people in the network eavesdropping. So then server returns a secure token over HTTPS and its stored in cookie. We switch to HTTP after we have secure token, we attach cookie/secure token header to every HTTP request.
Now anybody can see my secure token and they can eavesdrop it and impersonate me. Is my understanding correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以按协议设置 cookie,以便 HTTPS cookie 不会用于 HTTP,反之亦然。此外,正确构建的安全令牌应包含 IP 地址并且具有较短的过期时间。
但总的来说,最好的想法当然是将经过身份验证的会话保持在安全通道中 - 如今 SSL 并不是那么重量级(因为计算机变得比 SSL 首次引入时快得多),而且最重要的部分是握手,仅执行如果使用持久 HTTP 连接(或使用 SSL 会话恢复时),则执行一次。
The cookies can be set per protocol, so that HTTPS cookies are not used for HTTP and vice versa. Also, the properly constructed secure token should include an IP address and have short expiration time.
But in general the best idea is of course to keep the authenticated session in secure channel - SSL is not that heavyweight these days (as computers became much faster than when SSL was first introduced) and also the heaviest part is handshake, which is performed only once if persistent HTTP connection is used (or when SSL session resuming is used).