C#: How do I store a secure password?
The eternal problems of encryption and data security is an ever present headache for all developers. This post provides a great introduction to the problem. Fortunately, C# provides a very powerful Windows Data Protection API to resolve this issue. Read more about it here and find the sample code here . Here is a simple extension method to achieve the required result: using System; using System.Security.Cryptography; using System.Text; namespace MyProject.Security { public static class SecurityExtensions { private const DataProtectionScope Scope = DataProtectionScope.CurrentUser; static readonly byte[] AdditionalEntropy = { 9, 8, 7, 6, 5, 4, 3, 2, 1 }; public static string Encrypt(this string plainText) { if (plainText == null) throw new ArgumentNullException("plainText"...