Wednesday, 5 November 2014

C#: How do I generate a SecureString password?

There is a simple function to generate a secure string password:

            public static SecureString StringToSecure(string password)
            {
                var secure = new SecureString();
                foreach (char c in password)
                {
                    secure.AppendChar(c);
                }
                return secure;
            }

No comments:

Post a Comment