/// <summary>Decrypt the message in the file</summary> /// <param name="path">The path to the file</param> /// <param name="key">The key for the encription</param> /// <param name="newPath">The path of the new file</param> /// <returns>True if the file was decrypted correct</returns> public bool Decrypt(string path, int key, ref string newPath) { if (permutations.CheckPermutations()) { string binaryKey = Convert.ToString(key, 2).PadLeft(10, '0'); (string K1, string K2) = GenerateKeys(binaryKey, permutations.P10, permutations.P8); List <string> binaries = ReadFile(path); List <byte> bytes = DecryptBytes(binaries, K1, K2, permutations.IP, permutations.EP, permutations.P4, permutations.IIP); string name = Path.GetFileNameWithoutExtension(path); newPath = new FileUtils().CreateFile(name, ".txt", "~/App_Data/Downloads"); WriteFile(bytes, newPath); return(true); } return(false); }