//private static string file = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase + @"DBConn.config"; public static string GetConnectionString(string key) { String connstr = GetAttributeValue("//connectionStrings", key, "connectionString"); connstr = DESUtil.DecryptString(connstr, DESUtil.GenerateKey()); return(connstr); }
private void btn_Encode_ItemClick(object sender, ItemClickEventArgs e) { String str = spreadsheetMain.ActiveCell.DisplayText; String key = DESUtil.GenerateKey(); String[] strs = new string[] { "Provider=IBMDA400;Data Source=172.31.96.210;User Id=ITSDTS;Password = STD008;", "Data Source=srf-sql;User Id=MARS_E;Password = rs@996t!ty", "Data Source=ichart3d;User Id=MARS_E;Password = rs@996t!ty", "Data Source=ichart3d;User Id=MARS_E;Password = rs@996t!ty" }; str = DESUtil.EncryptString(str, key); Console.WriteLine(str); foreach (string item in strs) { Console.WriteLine("//////////////////////"); Console.WriteLine(item); Console.WriteLine(" "); String tmp = DESUtil.EncryptString(item, key); Console.WriteLine(tmp); Console.WriteLine(" "); Console.WriteLine(DESUtil.DecryptString(tmp, key)); } }
private void txt_Des_EditValueChanged(object sender, EventArgs e) { String input = txt_Des.Text; txt_Input.Text = DESUtil.DecryptString(input, DESUtil.GenerateKey()); }