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

How to encrypt Database?

tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
I have created a log in page, using servlet for validation and jsp for display.

However, I would not want my passwords and userid to be "sniffed".

Hope to hear the experts' views on how to make sure data are secured in my ms access. Do I need to write any codes in my servlet to make it secure?

Any reference codes or materials would be most useful.

Thank you.
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Best practice is to store passwords as hashed (or digested) values; that way, nobody can get at them.

More generally, security is a multi-faceted process that needs to be considered in each part of the system; if you're asking how to make a system more secure in general, then the SecurityFaq points to many areas you may want to address.
Vinod Tiwari
Ranch Hand

Joined: Feb 06, 2008
Posts: 466

You may encrypt password and persist in database and for user authentication again encrypt entered passoword and compare with that in database.

Vinod Tiwari | Twitter | Shikshanirman | Guftgu
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Posts: 820

here is pseudo code for what I used to hash the password before storage into the database:

MessageDigests are secure one-way hash functions that take arbitrary-sized data and output a fixed-length hash value
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

Make encryption a one-way process. In other words, users enter passwords that get converted to encrypted values that *NEVER* get decrypted. This means that to verify login you compare the stored value against the encrypted value the user enters. This also means you never display or send the password to a user (which is actually a feature of this model, not a bug). If someone wants to log in as a user without knowing the password, the user's password has to be reset.

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: How to encrypt Database?
It's not a secret anymore!