This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Encryption  RSS feed

 
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: 9429
12
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!