public void TestSecureString() { using (CaptureConsole) { var password = "******"; var p = password.ToCharArray(); var s = new SecureString(); foreach (char c in p) { s.AppendChar(c); } UseSecretData(s); var ps = s.ToProtectedString("garrett"); Console.WriteLine("PS: {0}", ps); var ss = ps.FromProtectedString("garret"); //Console.WriteLine("ss: {0}", ss); UseSecretData(ss); } }