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); 
  • And what is the purpose of this? - Naumov
  • there is a pdf file it needs to be encrypted and encrypted to download, and then open with the help of the library radaeepdf can anyone have a solution to encrypt the file so that this can open, that is, there is a PDFAESStream and now with the help of this class open? - Dmitry_Kon 1:01 pm

0