private static void ReadConfigFileValueAsSecureString(this SecureString value, string key, string configSectionName) { dynamic protectedAppSettings = new Formo.Configuration(configSectionName); char[] appSettingValueCharacters = protectedAppSettings.Get(key)?.ToCharArray() ?? new char[] { }; for (int i = 0; i < appSettingValueCharacters.Length; i++) { value.AppendChar(appSettingValueCharacters[i]); //erase the char values as we go so they are not in memory in the array, awaiting GC appSettingValueCharacters[i] = default(char); } value.MakeReadOnly(); }
public static byte[] ReadConfigFileAttributeAsByteArray(string key, string configSectionName) { dynamic protectedAppSettings = new Formo.Configuration(configSectionName); return(Convert.FromBase64String(protectedAppSettings.Get(key))); }
public static byte[] ReadProtectedAppSettingAsByteArray(string protectedAppSettingKey) { dynamic protectedAppSettings = new Formo.Configuration("protectedAppSettings"); return(Convert.FromBase64String(protectedAppSettings.Get(protectedAppSettingKey))); }