Esempio n. 1
0
 private static void DecryptPasswords(IList <ConnectionProfile> profiles)
 {
     foreach (ConnectionProfile profile in profiles)
     {
         if (profile.SavePassword &&
             !String.IsNullOrEmpty(profile.ServerSettings.Password))
         {
             profile.ServerSettings.Password = ClientUtility.Decrypt(profile.ServerSettings.Password);
         }
     }
 }
Esempio n. 2
0
        private static Dictionary <string, string> EncryptPasswords(IList <ConnectionProfile> profiles)
        {
            Dictionary <string, string> storedPasswords = new Dictionary <string, string>();

            foreach (ConnectionProfile profile in profiles)
            {
                storedPasswords[profile.Name] = profile.ServerSettings.Password;
                if (!String.IsNullOrEmpty(profile.ServerSettings.Password))
                {
                    if (profile.SavePassword)
                    {
                        profile.ServerSettings.Password = ClientUtility.Encrypt(profile.ServerSettings.Password);
                    }
                    else
                    {
                        profile.ServerSettings.Password = null;
                    }
                }
            }
            return(storedPasswords);
        }