Is there any way to use Zend_Filter_Encrypt with large files, without rising memory limit to an unacceptable amount?
This is my code so far, but when i have to encrypt files larger than 32 MB (thats my memory limit) it fails, if I set memory to 48MB it works:
$vector = 'XX';
$algorithm = 'rijndael-192';
$options = array(
'adapter' => 'mcrypt',
'vector' => $vector,
'algorithm' => $algorithm,
'key' => $key
);
$encrypt = new Zend_Filter_File_Encrypt($options);
$result = $encrypt->filter($file);
No, there isn’t.
Zend_Filter_Encryptworks by encrypting/decrypting the data in one pass, thus requiring the full data in order to function.If you need to decrypt a large file, you can do it manually in smaller chunks.
Just make sure the amount of data that you read (fread) is a multiple of the block size used by the algorithm, otherwise the results can be unexpected.