在内存中生成(.zip)附件(带密码)

Following problem:

I would like to generate an attachment with php in memory for a business application. The attachment has to be password protected as well. Afterwards Id like to send this out with an Email.

I did some research on .zip attachment with php. It seems that it is impossible with this type of attachment without using command line wrappers like exec() etc. I rather would like to avoid using a pdf (Still dont feel happy with pdf security).

Any advice how I can achieve that with some kind of package?

Thanks in advance!

Its easy if you can execute commands using 'system' function.

<?php 
echo system('zip -P pass file.zip file.txt'); 
?>

But you already mentioned that you are not interested in commands.

Here is a nice library to generate zip file: http://www.devco.net/code/zipfile.inc.txt . But It misses the ability to add password.

Another alternative is DotnetZip. It supports AES Encryption with password! But It runs only on Windows. Am not sure which platform you use. Here is an example code. http://code.google.com/p/earlgrey/source/browse/trunk/vendor/DotNetZipLib-DevKit-v1.9/Examples/PHP/CreateZip-DotNetZip.php?r=571