Example #1
0
        private static Config UnsecureSensitiveProperties(Config config)
        {
            if (config.KeyA == null || config.KeyB == null || config.KeyC == null)
            {
                Log.Fatal("No keys are viable, something happened w/ the config file and we can't recover Email settings");
                Handler.NotifyError("[Fatal] Encryption Keys aren't viable/are missing, we can't recover Email settings, you will need to reconfigure them.");
                Console.WriteLine("[Fatal] Encryption Keys aren't viable/are missing, we can't recover Email settings, you will need to reconfigure them. Config is being backed up in case you believe you can recover the keys in the config directory/folder");
                Backup();
                UI.StopForMessage();
                return(null);
            }

            config.SMTPUsername  = string.IsNullOrWhiteSpace(config.SMTPUsername) ? "" : AESThenHMAC.SimpleDecrypt(config.SMTPUsername, config.KeyB, config.KeyA, config.KeyC.Length);
            config.SMTPPassword  = string.IsNullOrWhiteSpace(config.SMTPPassword) ? "" : AESThenHMAC.SimpleDecrypt(config.SMTPPassword, config.KeyA, config.KeyC, config.KeyB.Length);
            config.SMTPUrl       = string.IsNullOrWhiteSpace(config.SMTPUrl) ? "" : AESThenHMAC.SimpleDecrypt(config.SMTPUrl, config.KeyC, config.KeyA, config.KeyB.Length);
            config.SMTPEmailFrom = string.IsNullOrWhiteSpace(config.SMTPEmailFrom) ? "" : AESThenHMAC.SimpleDecrypt(config.SMTPEmailFrom, config.KeyB, config.KeyC, config.KeyA.Length);
            config.SMTPEmailName = string.IsNullOrWhiteSpace(config.SMTPEmailName) ? "" : AESThenHMAC.SimpleDecrypt(config.SMTPEmailName, config.KeyC, config.KeyB, config.KeyA.Length);
            return(config);
        }