• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Encryption/decryption using core java and then insert into database

 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
javax.crypto.Cipher for encrypting
java.security.MessageDigest for hashing
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic