Encrypt data from database
Hi friends,
I am using Asp.Net 2.0 application. I have a user information form like username, password,name,lastname etc., I stored this information in a database. In the user information form one view button available. Suppose user click the view button, i show the information of user from database. What my query is that i need to show some fields like encrypted method from database. ie password and mobile no like **** or some encrypted no.Is it possible in .Net that encrypted data from database to our front end.
Hope Your's reply.
Re: Encrypt data from database
Hey,
Are you using the Membership, Role and Profile Provider that ship with ASP.NET or have you created your own database?
Gary
Re: Encrypt data from database
Hi,
Thanks for yours reply. I am asking how encrypt data??
Re: Encrypt data from database
Hello,
I am aware of what the question was, the reason that I am asking if becuase the encryption and retrieval of passwords is provided out of the box if you are using the Membership Provider which comes shipped with ASP.NET.
So again, are you using the Memebership provider, or are you using your own custom code?
Gary
Re: Encrypt data from database
I am using my own custom code. Not use membership.
Re: Encrypt data from database
In which case you are going to want to start looking into using the System.Security.Cryptography Namespace which includes methods for encrypting data.
Gary
Re: Encrypt data from database
while user want to view his details at that time i show username and password address,phone no.
I want to encrypt password and phone no only.
Re: Encrypt data from database
I am not quite sure I follow what you are saying but as a brief overview, I would have thought something like this would work for you:
When the user resgisters with your site you are going to gather their information, i.e. username, password, address, phone etc. Once you have collected these, and before they are sent to the database, encrypt the password and phone number and store them in the database in their encrypted form. When you then display the informtion to the user, you can decrypt them.
Having said that, it is more normal to hash the password rather than encrypt it. i.e. it is not possible to retrieve the password, but rather reset it to something else.
Gary
Re: Encrypt data from database
ok gary. How will encrypt the data and decrypt again. If it is possible , could you please tell me how?
Re: Encrypt data from database
Hello,
There are various ways that you can do this, and you have to make a decision about what kind of encryption that you want to use, that is why I pointed you at the MSDN reference so that you can read up on the different classes available.
The only examples that I would have are in C#, which I am not sure would be much help for you.
If you search through the code banks though, I am sure there are examples there.
Gary
Re: Encrypt data from database
Re: Encrypt data from database
Re: Encrypt data from database
Hi!
May I ask what the purpose is of encrypting the data in the first place? Do you have some dba's that you don't trust? Or do you store information that is strictly confidential like?
Anyway,
When it comes to passwords, the best option is to simply hash +salt it. Of course this means there is no way to read the password in plain text again, but I don't see when this case would ever happen.
Not exactly direct answers to your questions, but perhaps give you some ideas to your solution?
/henrik
Re: Encrypt data from database
I think the answer is simpler. You want your information to appear as ****** on the form for viewing this information. So you simply don't show it or retrieve it from the database. You simply place ****** on the form.