GWT/Javascript client side password encryption

后端 未结 3 1077
Happy的楠姐
Happy的楠姐 2021-01-31 11:20

I\'m implementing authorization in my gwt app, and at the moment it\'s done in the following fashion:

  1. The user signs up by putting his credentials in a form, and I
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 11:59

    If SSL isn't an option then you obviously don't care enough about security ;)

    But seriously - like you mentioned, client side encryption of the password is not a good idea. In fact, it's a very bad one. You can't trust the client side for jack - what if an attacker managed to alter the JS code (through XSS or while it was sent through the wire), so that your MD5/whatever hash function just passes the pass in cleartext? Not to mention that you should be using a good, strong, salted encryption method, like bCrypt - something which is just slow on the client and like mentioned before, doesn't quite add to the security of the app.

    You could try bypassing some of those problems: by sending the hash library through some secure means (if that was possible in the first place, we wouldn't have to bother with all this now, would we?), by somehow sharing a common secret between the server and client and using that for encryption... but the bottom line is: use HTTPS when possible (in GWT it's hard to mix HTTPS and HTTP) and justified (if the user is stupid enough to use the same password for your not-security-related app and for his banking account, then it's highly likely that he/she used the same password on a number of other sites, any of which could lead to hijacking the password). Other means will just make you think that your application is more secure than it is and make you less vigilant.

提交回复
热议问题