//CheckConectionEnrypt public string CheckDataConection() { //aligual que las demas aplicaciones cargaremos nuestra llave al servidor de oficinas para la conexion directa string cadena = "C:/SEMP2013/EKPolizaGastos/EKPolizaGastos/cdb.txt"; using (StreamReader sr1 = new StreamReader(cadena, true)) { string lineA = sr1.ReadLine(); string lineB = sr1.ReadLine(); string lineC = sr1.ReadLine(); string lineF = sr1.ReadLine(); //ahroa desecrypto la informacion a = Encriptar_Desencriptar.DecryptKeyMD5(lineA); b = Encriptar_Desencriptar.DecryptKeyMD5(lineB); c = Encriptar_Desencriptar.DecryptKeyMD5(lineC); f = Encriptar_Desencriptar.DecryptKeyMD5(lineF); //ahora realizo la conexion par amostrar las sucursales sqlcnx = "Data Source=" + a + " ;" + "Initial Catalog=" + b + ";" + "Persist Security Info=True;" + "User ID=" + c + ";Password="******""; SqlConnection conexion = new SqlConnection(); conexion.ConnectionString = sqlcnx; conexion.Open(); if (true) { return(sqlcnx); } } }
public String[] Scan() { bool IsCorrect; String[] array = new string[7]; foreach (var file in archivos) { //anow chek if connection is correct StreamReader reader = new StreamReader(file.ToString(), true); if (System.IO.File.Exists(file.ToString())) { suc = reader.ReadLine(); //suc tienda = reader.ReadLine(); //tienda dir = reader.ReadLine(); //Direccion server = reader.ReadLine(); //server database = reader.ReadLine(); //database user = reader.ReadLine(); //user pass = reader.ReadLine(); //password Suc = Encriptar_Desencriptar.DecryptKeyMD5(suc); Tienda = Encriptar_Desencriptar.DecryptKeyMD5(tienda); Dir = Encriptar_Desencriptar.DecryptKeyMD5(dir); Server = Encriptar_Desencriptar.DecryptKeyMD5(server); Database = Encriptar_Desencriptar.DecryptKeyMD5(database); User = Encriptar_Desencriptar.DecryptKeyMD5(user); Pass = Encriptar_Desencriptar.DecryptKeyMD5(pass); //check connectio IsCorrect = checkConnection(Server, Database, User, Pass); if (IsCorrect == true) { array[0] = Suc; array[1] = Tienda; array[2] = Dir; array[3] = Server; array[4] = Database; array[5] = User; array[6] = Pass; //entiyFramework SaveConnectionString("SEMP2013_Context", "", Server, Database, User, Pass, 1); //sqlconnection client SaveConnectionString("SEMP2013_CNX", "", Server, Database, User, Pass, 2); return(array); } } } array[0] = "Error in Directory"; return(array); }
public string Result(string type, string leyend) { string result = ""; switch (type) { case "MD5": if (swtSelect.Value == true) //encryp { result = Encriptar_Desencriptar.EncryptKeyMD5(leyend); return(result); } result = Encriptar_Desencriptar.DecryptKeyMD5(leyend); return(result); case "StringSapher": if (swtSelect.Value == true) //encryp { result = Encriptar_Desencriptar.EncryptStringSapher(leyend); return(result); } result = Encriptar_Desencriptar.DecryptSapher(leyend); return(result); case "RSA Encryption": if (swtSelect.Value == true) //encryp { result = Encriptar_Desencriptar.EncryptStringRSA(leyend); return(result); } result = Encriptar_Desencriptar.DecryptStringRSA(leyend); return(result); case "Tripple": if (swtSelect.Value == true) //encryp { result = Encriptar_Desencriptar.EncryptTripple(leyend, false); return(result); } result = Encriptar_Desencriptar.DecryptTripple(leyend, false); return(result); default: return(result); } }