Downloads
This module encrypts PDF file download products.
This is more of a proof of concept than a fully-fledged module, but it does work and is live on my own Ubercart site.
When enabled, this module intercepts the download of any file product with a '.pdf' extension and substitutes an encrypted version.
The encryption is set as follows:
1) All PDF restrictions are enabled (i.e. no printing, changing, copying, commenting etc.)
2) Title metadata is set to the Description field of the file
3) Author metadata is set to the name of your Drupal site
4) Keywords metadata is set as follows: "Copyright held by *your Drupal sitename*. This document may not be amended, copied or distributed without express written permission. Originally downloaded from *your Drupal site URL* via IP address *IP address of downloader* at time *time and date of download* by user *username of downloader* with email address *email address of downloader*"
5) A page is prepended to the PDF with the same data as the Keywords metadata.
Current issues:
1) It's currently all or nothing. When enabled all PDF file products are encrypted. Would like to introduce per-product optionality.
2) No optionality on how the PDF is encrypted. There could be many options, such as setting a PDF user password, setting a PDF admin password (currently randomly generated), what exactly to put in the PDF metatdata fields, whether or not to include the prepended copyright page and what the text should be, printing enabled/disabled, etc. etc. It's hard coded right now to give the strongest protection possible but eventually this should all be configurable by the user.
3) You have to manually create a temp directory to write the encrypted PDFs into prior to download, and a cron job to clear them up. I assume I could bypass all this using tempnam() somehow. Thoughts welcome on that please, I'm not that clear on how persistent files written by tempnam() are (do they automatically get deleted after a while?)
4) Since it uses PHP classes rather than libraries, it will be memory intensive when encrypting large PDFs. I have no idea how big a PDF can be encrypted or how many simultaneous encrytion operations can occur before you max out the memory limit of a typical webhost server. I have successfully tested this on PDFs up to 10mb but that was one at a time...
| Preview | Attachment | Size |
|---|---|---|
| uc_pdf_encrypt-5.x-0.2.tar.gz | 49.28 KB |


