Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Struts and the fly likes how to encrypt & decrypt password Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "how to encrypt & decrypt password" Watch "how to encrypt & decrypt password" New topic
Author

how to encrypt & decrypt password

Praveen Reddy
Ranch Hand

Joined: Jul 12, 2006
Posts: 51
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

Joined: Feb 15, 2005
Posts: 4864
You'll most likely want to use the classes in the javax.crypto package. This link should give you some ideas.


Merrill
Consultant, Sima Solutions
Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 568
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

Joined: Jul 12, 2006
Posts: 51
thanks a lot it solved my problem
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: how to encrypt & decrypt password
 
Similar Threads
mySql connection
Struts2-Database configuration
How Upload Image to DataBase
Connection to Dbase
Example on struts database connectivity