Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello.
I want to make an app that encrypt and decrypt password. And I found this link in microsoft but I didn't understand it.

http://msdn.microsoft.com/en-us/library/ms172831.aspx[^]
Please help me understanding THIS METHOD

Or if you have an other solution post it IF YOU WANT ;)
Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 5-May-12 22:00pm    
Not a question. How can we explain what is already explained? If you have more specific question, please ask it. Use "Improve question" above.
--SA

1 solution

You don't have to decrypt a password: it is unsafe and absolutely not needed for authentication.

You should never ever store passwords in their original form. If you think about it: you never need them for authentication, as you can always compare ciphered log-in password with you stored ciphered password. With public-key cryptography, you also don't have to store a private key (which is a ciphering key in this case; knowledge of a public key helps to decipher, but not cipher).

You can also store cryptographic hash of the password. In this case, you store only the hashed form of the password, not its original form which should be known only to the use and no one else, not matter what access to the system other people have. You need to compare hash with hash during authentication.

For strong ciphering I would advice RSA, see http://en.wikipedia.org/wiki/RSA[^], use System.Security.Cryptography.RSA, System.Security.Cryptography.RSACryptoServiceProvider, see http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsa.aspx[^]. You need to understand Public-key Cryptography, see http://en.wikipedia.org/wiki/Public-key_cryptography[^].

For the Cryptographic Hash approach, you need to understand how a Cryptographic Hash Function work, see http://en.wikipedia.org/wiki/Cryptographic_hash_function[^].
For a Cryptographic Hash function, you can use, for example the one from the SHA-2 family, see http://en.wikipedia.org/wiki/SHA1[^]. It is implemented in .NET, see http://msdn.microsoft.com/en-us/library/system.security.cryptography.sha1.aspx[^].

Warning: Do not use MD5! (See http://en.wikipedia.org/wiki/MD5[^].) This algorithm is considered "broken", should never be used for any security purposes.

Also, don't use SHA-1 for security purposes — a security flaw was found. Please see
http://en.wikipedia.org/wiki/Sha-1[^].

—SA
 
Share this answer
 
Comments
Maciej Los 6-May-12 6:59am    
+5!
Sergey Alexandrovich Kryukov 6-May-12 11:23am    
Thank you.
--SA
MoDy kareem 6-May-12 13:57pm    
Thank you very much ;) +5 XD
Sergey Alexandrovich Kryukov 6-May-12 14:05pm    
You are very welcome.
Good luck, call again.
--SA
Espen Harlinn 7-May-12 6:04am    
Good reply :-D

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