与第三方服务共享 md5(cookie, some_string) 是否安全?
我需要我的用户使用与我的网站相同的 cookie 对第三方服务进行身份验证。
与服务共享 md5(cookie, service_name) 是否安全,其中 service_name 是所有用户都会使用的常量字符串。
为了对服务进行身份验证,js 函数将在客户端执行 cookie 的 md5 并使用它。
是否有更好、更安全的散列可供使用,或者 md5 是否足够安全?
在执行 md5 之前是否需要对 cookie 进行 Base64 解码?
谢谢
I need my users to authenticate against a third party service with the same cookie the use with my website.
Is it safe to share the md5(cookie, service_name) with the service, where service_name
is a constant string that all the users will use.
To authenticate against the service a js function will do the md5 of the cookie on the client side and use it.
Is there a better and safer hashing to use or is md5 secure enough?
Do I need to base64 decode the cookie before doing the md5?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
逆转散列以获得原始 cookie 数据的可能性很小,因此在这方面它是安全的。
您可以使用 SHA-1 哈希来代替,但是两者都容易受到冲突攻击,可能允许未经授权的攻击者(没有 cookie)访问第 3 方服务。我不知道这种可能性有多大。
至于base64解码,首先检查它是否是base64编码的。
There is little chance of reversing the hash to obtain the original cookie data so it is safe in that regard.
You could use SHA-1 hash instead however both are vulnerable to collision attacks, perhaps allowing an unauthorized attacker (who doesn't have the cookie) to gain access to the 3rd party service. I don't know how likely that would be.
As far as base64 decoding it, check and see if it is base64 encoded first.