wood burning stoves 2.0*
The moose likes Java in General and the fly likes Encryption/decryption using core java and then insert into database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Encryption/decryption using core java and then insert into database" Watch "Encryption/decryption using core java and then insert into database" New topic
Author

Encryption/decryption using core java and then insert into database

Vinod Vinu
Ranch Hand

Joined: Aug 30, 2009
Posts: 217
Hi, i want to use encryption like RSA algorithm in java.
For e.g - during a registeration process in my application, whenever the user inputs a password, i want to encryp that password and pushed that encrypted key into database.
During login process, user will enter his/her username and password, this password will be matched with the decrypted password(encrypted in db) and once validated, it can go through.

Now i have no idea about it. Kindly provide me how to do that using core java ?

Thanks in advance.


Vinod Kumar Nair
"Any fool can write code that a computer can understan. Good programmers write code that humans can understand."
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41621
    
  55
The proper approach is not to encrypt passwords, but to hash (or digest) them using an algorithm like SHA-2 (or SHA-256/SHA-384/SHA-512, as it is known in the Java world). That way you can be sure that a password is never exposed. See the SecurityFaq for more information.


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19682
    
  20

javax.crypto.Cipher for encrypting
java.security.MessageDigest for hashing


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Encryption/decryption using core java and then insert into database