Exemplo n.º 1
0
        public static void Encrypt(string text)
        {
            Console.WriteLine(text);
            Console.WriteLine("Encrytped Value");
            Console.WriteLine(ConfigProtect.Encrypt(text));

            Clipboard.SetText(ConfigProtect.Encrypt(text));
            Console.WriteLine("Encrytped Value has been copied to the clipboard");
            Console.WriteLine("Decrypting to test");
            Console.WriteLine(ConfigProtect.Decrypt(ConfigProtect.Encrypt(text)));
        }
Exemplo n.º 2
0
        public static string GetEnvironmentSpecificSetting(string key, bool encrypted = false)
        {
            var environmentSpecificKey = GetSettingKey(key);

            if (appSettings[environmentSpecificKey] != null)
            {
                Console.WriteLine("Config is using Environemnt Specific Setting Key: {0} Value: {1}", environmentSpecificKey, appSettings[environmentSpecificKey]);

                if (encrypted)
                {
                    return(ConfigProtect.Decrypt(appSettings[environmentSpecificKey]));
                }

                return(appSettings[environmentSpecificKey]);
            }
            return("");
        }