private static void ProtectConfigurationFile(string inputFileName, string outputFileName) { //var protector = new ProtectionNonDi(new ProtectionConstants()); string konfJson; using (var fs = File.OpenRead(inputFileName)) using (var tr = new StreamReader(fs)) { var konfStr = tr.ReadToEnd(); var konf = JsonConvert.DeserializeObject <dynamic>(konfStr); string value = konf["AzureAd"]["Instance"]; konf["AzureAd"]["Instance"] = protector.Protect(value); konfJson = JsonConvert.SerializeObject(konf, Formatting.Indented); } Console.WriteLine(konfJson); WriteToFile(outputFileName, konfJson); }
private static void WriteProtectedResultToFile() { var protector = new ProtectionNonDi(new ProtectionConstants()); var stringToProtect = "holaQueTal"; var protectedString = protector.Protect(stringToProtect); Console.WriteLine($"String to protect: {stringToProtect}"); Console.WriteLine($"Protected string: {protectedString}"); WriteToFile("resultat.txt", stringToProtect, true); }