How to Encrypt Client side login before sending to server ?
-
1@user705956 - You're going to have to be a lot more specific to get useful answers =) – Rob Apr 13 '11 at 11:58
4 Answers
You should use HTTPS.
Building security by yourself is hard, and you are very likely to get it wrong.
You should stick with the systems that the experts use.
On the server, remember to hash and salt the passwords, preferably using bcrypt.

- 868,454
- 176
- 1,908
- 1,964
-
i have already use hash function but software told me there is security issue – user705956 Apr 13 '11 at 12:14
-
There's one very simple solution. SSL. Ensure that all your login activities are served via https://
URLs.
The way that you do this, at least the "setting the server up" part vary depending on what web server you're using. You'd be better off asking a question of that nature on http://www.serverfault.com/

- 45,296
- 24
- 122
- 150
You can only use https - any client side encryption would be viewable on the client and therefore useless. There is SO question on this: password encryption at client side
You should really use HTTPS, but if you can't use HTTPS then the alternative is to create a hash.
- Server generates a random 'salt' for the session
- JavaScript on client-side creates a cryptographically secure hash of the user's password and the salt.
- Hash is sent to the server, you can then retrieve the password from the database, create a hash using the salt for the session and the password from the DB and check if it is the same as the one sent from the client. - If it is then the password is a match.
An example of using JavaScript to protect passwords: http://pajhome.org.uk/crypt/md5/auth.html

- 1,390
- 8
- 15
-
And make sure that the salt cannot be reused. Also, this won't help; the attacker can insert his own Javascript. – SLaks Apr 13 '11 at 12:11