public ActionResult Cifrar(string Key, string message, string ToUser) { SDES cifradoSDES = new SDES(); var P10 = "8537926014"; var P8 = "79358216"; var P4 = "0321"; var EP = "01323210"; var IP = "63572014"; var ReverseIP = cifradoSDES.GenerarIPInverso(IP); //generar claves var resultanteLS1 = cifradoSDES.GenerarLS1(Key, P10); var K1 = cifradoSDES.GenerarK1(resultanteLS1, P8); var K2 = cifradoSDES.GenerarK2(resultanteLS1, P8); //cifrar var BinaryList = cifradoSDES.LecturaArchivo(message); //var byteList = new List<byte>(); var ciphertext = string.Empty; var cifrar = true; foreach (string binary in BinaryList) { byte bytefinal = cifradoSDES.CifrarODecifrar(binary, IP, EP, K1, P4, K2, ReverseIP, cifrar); ciphertext += (char)bytefinal; } //enviar el texto MessagesElements elemento = new MessagesElements(); elemento.Transmitter = Request.Cookies["User"]["username"]; elemento.Reciever = ToUser; elemento.text = ciphertext; using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:58992/"); var postjob = client.PostAsync("api/Messages", new StringContent(new JavaScriptSerializer().Serialize(elemento), Encoding.UTF8, "application/json")); postjob.Wait(); } mensajeValido = 1; return(RedirectToAction("Index")); }