Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 防止会话劫持的最佳方法是什么? 在 cookie 中加密会话 ID(或其他身份验证值)是否有用?
我的会话处理程序将会话 ID 存储在 cookie 中并返回 cookie 的值以用作对数据库的引用。
我的问题很简短。我应该在 cookie 中加密会话 ID 还是毫无意义?
谢谢!:)
这是完全没有意义的。即使您加密了会话 ID,加密版本也会通过 cookie 发送到您的服务器。如果有人想劫持它,他会窃取该加密会话 ID 并将其发送到您的服务器。您的服务器将愉快地解密它。