How Encrypt and discrypt password in asp.net 2.0 C#
-
Hi, I want to encrypt a password and insert it into SQL DB and then discrypt it for sending it to user . how could i do it Thanx n regards Amit sahu
Hi Amit, There are lots of javascripts available to encrypt/decrypt passwords. They come in combinations for encrypt/decrypt. apply encrypt script when u insert password. and decrypt while u r checking. U can use only incrypting script only and check incrypted version of password directly with database. thus your original decypted password never travells through network and no possibility to be hacked via channel. Just type "Encrypt Password + Javascript" in goole and u will get tons of scripts. u can prepare urself also simple script like replace "D" with ASCII(D) --> ASCII(D) + 25.
Anand Desai Developer Atharva Infotech
-
Hi, I want to encrypt a password and insert it into SQL DB and then discrypt it for sending it to user . how could i do it Thanx n regards Amit sahu
There is a method to encrypt a password,but it can't discrypt. string pass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbPass.Text, "MD5"); If you want to find pass,you can reset pass when user have answered your question rightly.
studing is processing in this life.
-
Hi Amit, There are lots of javascripts available to encrypt/decrypt passwords. They come in combinations for encrypt/decrypt. apply encrypt script when u insert password. and decrypt while u r checking. U can use only incrypting script only and check incrypted version of password directly with database. thus your original decypted password never travells through network and no possibility to be hacked via channel. Just type "Encrypt Password + Javascript" in goole and u will get tons of scripts. u can prepare urself also simple script like replace "D" with ASCII(D) --> ASCII(D) + 25.
Anand Desai Developer Atharva Infotech
hi Amit, Forgot to tell one thing more. IF u use javascript for that , dont write JS function inline with HTML... because then ur script will be exposed to client machine. Instead of that write JS function in separate Javascript ffile and include that file in ur html.
Anand Desai Developer Atharva Infotech
-
There is a method to encrypt a password,but it can't discrypt. string pass = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbPass.Text, "MD5"); If you want to find pass,you can reset pass when user have answered your question rightly.
studing is processing in this life.
thanx nyeying But i have already use this FormsAuthentication.HashPasswordForStoringInConfigFile() method in my code now the problem here is on forget password . i have to send it to user mail it, but i can't able to discrypt it
-
hi Amit, Forgot to tell one thing more. IF u use javascript for that , dont write JS function inline with HTML... because then ur script will be exposed to client machine. Instead of that write JS function in separate Javascript ffile and include that file in ur html.
Anand Desai Developer Atharva Infotech
thanx anand a js file can also be get by just write the url by getting the name of js file from source view of html page. Is there is no such C# code that will help me
-
thanx anand a js file can also be get by just write the url by getting the name of js file from source view of html page. Is there is no such C# code that will help me
U can set the acces parameter anyways.. or if u doubt this way.. then u can crate your own method and steps in cs file also. just like first add any number in ASCII code of character then subtract any fix number then add/multiply/divide or anything.. I advice u to create your own steps and do exactly reverse steps to decryt. That would be simplest and best for u.
Anand Desai Developer Atharva Infotech
-
U can set the acces parameter anyways.. or if u doubt this way.. then u can crate your own method and steps in cs file also. just like first add any number in ASCII code of character then subtract any fix number then add/multiply/divide or anything.. I advice u to create your own steps and do exactly reverse steps to decryt. That would be simplest and best for u.
Anand Desai Developer Atharva Infotech
thanx once again ............ for helping me and interest.. i'll try it and yes its a good way
-
thanx nyeying But i have already use this FormsAuthentication.HashPasswordForStoringInConfigFile() method in my code now the problem here is on forget password . i have to send it to user mail it, but i can't able to discrypt it
The purpose of hashing the password is that noone can read it. The price that you pay is that you can't read it yourself, so if the user has lost the password, you have to set a new password. If you want to be able to read the password, you can use encryption instead of hashing. Look in the System.Security.Cryptography namespace.
Despite everything, the person most likely to be fooling you next is yourself.
-
thanx once again ............ for helping me and interest.. i'll try it and yes its a good way
Note that this is not encryption, it's only scrambling. An encrypted password is hard to crack, a scrambled password is not. Also, any solution involving Javascript is totally unsafe. Any Javascript that the browser uses can easily be viewed and debugged using well-known tools like FireBug. Internet Explorer 8 will come with a similar tool built in.
Despite everything, the person most likely to be fooling you next is yourself.
-
thanx nyeying But i have already use this FormsAuthentication.HashPasswordForStoringInConfigFile() method in my code now the problem here is on forget password . i have to send it to user mail it, but i can't able to discrypt it