0

I am creating an ASP.Net website for first time and I want to store the password of login page into the database in any encoded format not directly as it is. But encryption and decryption should occur automatically.

Any suggestion for this ??

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Alok Kumar
  • 21
  • 1
  • 7

1 Answers1

3

Decryption of the stored password should not be possible for security reasons. If the user tries to authenticate, "encrypt" the entered password again and compare it to the value in the database.

The mathematical method to do this is called a cryptographic hash function. To protect against rainbow table attacks, the hash should also be salted.


If you want to implement this yourself, there are lots of questions here on SO on how to do this with .NET. Here are a few of them:


On the other hand, since you are using ASP.NET, you could make your life easier and just use the built-in ASP.NET membership provider, which already does all the necessary security stuff. Here's an MSDN article to get you started:

Community
  • 1
  • 1
Heinzi
  • 167,459
  • 57
  • 363
  • 519