The problem is, crypt the php file by breaking it into 4096 bytes using the MCrypt library
while (!feof($fd)) { print $mcrypt->encrypt(fread($fd, 4096),true,$key); } fclose($fd);
and download it using DownloadManager.Request in the Android device, I don’t understand how to open the file to read it correctly and decrypt it? I do something like this, well, I think not right
byte[] read = null; // int size = file.read(read); StringBuffer buffer = new StringBuffer(); int size = 0; int chars = file.read(); while (size < 4096 && chars != -1) { buffer.append((char) chars); chars = file.read(); size++; } // String decrypted = new String(read, "UTF-8"); String decrypted = new String(buffer.toString().getBytes(), "UTF-8"); read = mCrypt.decrypt(decrypted);