static string GetConfigurationValue(string key, bool cryptMe) { // Read values from configuration string setting = ConfigurationManager.AppSettings[key]; if (setting == "") { return("Error"); } else { if (crypt == true & cryptMe == true) { return(BlockEncrypter.DecryptStringBlock(setting, Encoding.ASCII.GetBytes("Pa55w0rd"))); } else { return(setting); } } }
/// <summary> /// Decrypt a ciphertext string using the BlockEncrypter library. /// </summary> /// <param name="ciphertext"></param> /// <returns></returns> public static string Decrypt(string ciphertext) { return(BlockEncrypter.DecryptStringBlock(ciphertext, Encoding.ASCII.GetBytes(ApplicationSettings.EncryptionKey))); }