• Post Reply Bookmark Topic Watch Topic
  • New Topic

Encryption

 
mah kumar
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to encrypt username and password in java/jsp?.
Is there any sample code?.
 
Joe Ess
Bartender
Posts: 9361
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean in transit between client and server? Use HTTPS. Consult your server documentation for steps to set it up.
Do you mean on the server? It is common to use a one-way hash like MD5 or SHA to store the password rather than store the password itself. You compare the hash to the value the user sent in and if they match, the user sent the correct password. Of course, there is no way to "undo" a one-way hash, so should a user lose his password you would have to generate one for him and store the hash of it on the server. Take a look at the Java Cryptography Extension for more information.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!