简体   繁体   English

安全登录页面:javascript md5 function vs SSL,如果登录块在主页面上

[英]secure login page: javascript md5 function vs SSL, if login block is on the main page

I'm thinking of increasing security when transfer login and password from sign in page. 我正在考虑从登录页面转移登录名和密码时提高安全性。 I've found a javascript md5 function in the Internet so the first way to send password is to send md5 hash instead of the password using POST method. 我在Internet上找到了一个javascript md5函数,所以发送密码的第一种方法是使用POST方法发送md5哈希而不是密码。 As I understand there are still many problems with that and that method should be improved. 据我所知,仍有许多问题,应该改进这种方法。 Passwords in the database are not stored, only md5 hash (with some other functions are also used to complicate it a bit) stored. 不存储数据库中的密码,只存储md5哈希(其他一些函数也用于使其复杂化)。 But, my question is: does it all make sense or better to prefer ssl encryption from hosting provider? 但是,我的问题是:从托管服务提供商那里选择ssl加密是否有意义或更好? It costs about $100 per year (let's suppose that a good price regarding my question) instead of reinventing the wheel. 它每年花费大约100美元(假设我的问题价格不错)而不是重新发明轮子。 The minus of ssl (if I'm not wrong) is: if login part is on the main page, the main page will load slower (although Yahoo! login page with https loads pretty fast) and any user will see https in the browser string (that's not bad, but is it good?) ssl的减号(如果我没有错)是:如果登录部分在主页面上,主页面将加载较慢(尽管带有https的Yahoo!登录页面加载速度非常快)并且任何用户都会在浏览器中看到https字符串(这不错,但它好吗?)

How is the idea to use (no SSL): 1)wher user logs in, md5(password) is sent instead of his real password 2)server receives md5(password), makes it md5(md5(password)+'kjhgkjhg') and compares with a hash that is stored in the db. 如何使用(无SSL):1)用户登录,发送md5(密码)而不是他的真实密码2)服务器收到md5(密码),使其成为md5(md5(密码)+'kjhgkjhg' )并与存储在db中的哈希进行比较。 db stores md5(md5(password)+'kjhgkjhg') hashes for all users. db存储md5(md5(密码)+'kjhgkjhg')所有用户的哈希值。 As result, if md5(password) is sniffed, it will not help to get md5(md5(password)+'kjhgkjhg') because 'kjhgkjhg' is not known. 结果,如果md5(密码)被嗅探,它将无助于获取md5(md5(密码)+'kjhgkjhg')因为'kjhgkjhg'未知。 Is it good a good enough way to make the login page secured? 使登录页面安全是否足够好?

Thank you. 谢谢。

You would need to get browser to create hash MD5(password + random()) and send that instead of MD5(password) so that no one could use the hash in the future. 您需要让浏览器创建哈希MD5(密码+随机())并发送它而不是MD5(密码),以便将来没有人可以使用哈希。 Then you would need to have the clear text or two-way crypted password in the server and do the same in the server end and compare the results. 然后,您需要在服务器中使用明文或双向加密密码,并在服务器端执行相同操作并比较结果。 You will need to save the random string sent to browser in the server so that same random cannot be used again. 您需要保存发送到服务器中浏览器的随机字符串,以便不能再次使用相同的随机字符串。 This would work, but. 这可行,但是。

  • Someone could hijack the session in the middle. 有人可能会在中间劫持会议。 Just capture the cookies and use same IP and server is all defenseless. 只需捕获cookie并使用相同的IP和服务器都是手无寸铁的。
  • Without SSL user has no way of knowing he/she has contacted the correct server and the content is unaltered. 没有SSL,用户无法知道他/她是否已联系正确的服务器且内容未发生变化。
  • The user's website address and traffic can still be read by man in the middle or trojans on his/her computer. 用户的网站地址和流量仍然可以由中间的人或他/她的计算机上的特洛伊木马读取。
  • Usually the browser password saving fails. 通常浏览器密码保存失败。

But yes. 但是,是的。 SSL tends to be slow and those darn certificates expire and break everything. SSL往往很慢,那些证书到期并破坏一切。

Use SSL . 使用SSL There really is very little more to say about this. 关于这一点真的没什么好说的。 If you try to re-invent secure authentication you will get it wrong. 如果您尝试重新发明安全身份验证, 则会出错。

The two reasons you suggested for not using SSL are cost and speed. 您建议不使用SSL的两个原因是成本和速度。

Cost: There is no difference between the security of a normal SSL certificate and an EV SSL certificate. 成本:普通SSL证书和EV SSL证书的安全性没有区别。 The EV stands for ( E )xtended ( V )alidation and it means that the certificate authority spends a little more time checking that you are who you say you are. EV代表( E )xtended( V )alidation,这意味着证书颁发机构花费更多时间检查您是否是您所说的人。 If cost is a problem, get the cheaper SSL certificates. 如果成本有问题,请获得更便宜的SSL证书。

Speed: The slowdown caused by SSL negotiations is quite small these days. 速度:如今,由SSL谈判引起的放缓非常小。 I just did a quick test doing HEAD requests to yahoo.com and I got an average of 0.2 seconds across 1000 SSL conections and 0.1 seconds across 1000 non-SSL connections. 我刚刚对yahoo.com进行了HEAD请求的快速测试,我在1000个SSL连接中平均得到0.2秒,在1000个非SSL连接上得到0.1秒。 If your page requests are taking 0.2 seconds then SSL latency might matter to you but if they are taking a whole second then something else is the reason for it being slow. 如果您的页面请求花费0.2秒,那么SSL延迟可能对您很重要,但如果它们需要一秒钟,那么其他原因就是它变慢。

If you search for how to store and transmit passwords on http://security.stackexchange.com you will find a whole lot of good advice on how to do it securely. 如果您在http://security.stackexchange.com上搜索如何存储和传输密码,您会发现有很多关于如何安全地进行操作的好建议。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM