File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Security and the fly likes encryption Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Security
Bookmark "encryption" Watch "encryption" New topic


Raj Joe
Ranch Hand

Joined: Oct 15, 2004
Posts: 41
how do i encrypt my password and store in my database and then decrypt and show it to user.

What are the types of algorithms used?
Fisher Daniel
Ranch Hand

Joined: Sep 14, 2001
Posts: 582
Hi Raj Joe,
You can use Java Cryptography Extension

correct me if I am wrong
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Moving this to the Security forum...

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Kishore Dandu
Ranch Hand

Joined: Jul 10, 2001
Posts: 1934
At the basic, you can Base64 encode the password into the database & then base64 decode from the database; and then do the comparision.

SCJP, blog
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
And you may also need to UUencode the hash in order to prevent it from getting corrupted in the database (depending on the characterset the database uses to store string data).

We once found that out to our shagrin, luckily we caught it before going life (was luck, someone tried a password which happened to result in a non-printable character in the hash, had that not happened we'd not have caught it in testing).

I agree. Here's the link:
subject: encryption
It's not a secret anymore!