Click here to Skip to main content
15,898,772 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello All,
I am developing a job search website in C# ASP.Net.

I have used a RSA Encryption Alogrithm which Encrypts login Id and Password in Database while logging in.

Now when for the second time the same client logs in the webpage. I am not able to track his count for the same website because it gives RSA Encryption error for unmatched Login ID and password.

I don't want a Static Count method provided by Microsoft IDE 2008.

Can any one provide a solution for this
Regards
Amul
Posted
Updated 11-Mar-11 21:19pm
v2

1 solution

Without code? No.

First rule of passwords: don't encrypt.
Instead, store the Login ID in clear. That way you can just search for the user, and check the password. Much safer than looking for an encrypted combination which could conceivably be for a different user...
You can also reset a password for a user based on this login name if he forgets.

Then, combine the user entered password with the database stored Login ID (to ensure that Login ID is always the same case) and generate a hash value. It used to be an MD5, but that is not recommended for new systems, so use SHA instead. Compare this value against the database stored value. If it matches, the login passes. If it doesn't, he don't get in.

This way the password is never stored in a form which can in any way be re-generated, even if your entire database is copied. The inclusion of the Login ID in the hash value means that two users with the same password still have different hash values.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900