Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to encrypt & decrypt password

 
Praveen Reddy
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone

please help me in encrypting and decrypting passwords while sending to database and retriving from database.

if possible please give me detail explanation.

Thanks in advance
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll most likely want to use the classes in the javax.crypto package. This link should give you some ideas.
 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For password, I'd suggest not to encrypt/decrypt it. Rather, it is better to store the MD5/hash value of the password in the database and only verify the MD5/hash of any user supplied password against the database. In this way, you never risk exposing the raw password to anyone including the database admin. Also, you don't have to worry about managing the encryption key which is very troublesome.

BTW, Tomcat 5 already have built-in support for storing hashed password if you use its database realm.
 
Praveen Reddy
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot it solved my problem
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic