0 Replies Latest reply on Sep 29, 2010 1:21 AM by RyuMaster666

    Acrobat, Java, end ecription

    RyuMaster666

      Hi! There is php script called FPDF, it generates PDF files at runtime.  I added new function for it "add_java_script". It worked superb. Also it has function "SetProtection". It works superb as well, adding protection to the PDF file. Issues comes, when I use them together. Protection function encrypts everything with RC4. Same goes for my javascript which I put into PDF, I encrypt it with RC. But, PDF just can not decrypt it right! Like, in the same file, if I put some text stream, using same encryption function, it works for text. But not for java script!

       

       

      Also, I have found out, that if I encrypt some simple stuff like "function\n", then is works. But if I add space " " character, or "\r" it fails. But only in Javascript section!  

       

       

      '/JS('.$JAVAFUNCTIONHERE.')/S/JavaScript 

       

       

      Is it a bug? Or Adobe treats java encryption somehow a bit different? I just don't get it. Same function for encryption. Absolutely. But not working for javaScripts.

       

       

      Also. If I create encrypted document with fpdf(php). Open it in Adobe Pro. Remove security. Remove compression. Open its source. The text stream is not in ASCII format, but adobe recognizes it. Same goes for SWF files. But, JavaScript it not a ASCII as well now. I think that is the problem! Because, if I create PDF from scratch, using not php, but Adobe Pro. Put protection. Remove protection. Remove compression. Text stream becomes non-ASCII mess again, but Adobe recognizes it. And JavaScript - gets back to normal ASCII! So, how come? When I encrypt it with PHP, it is not converting back ("or converts back only, if I avoid using spaces and some special chars"). If with Adobe Pro, java text gets back to normal ASCII after decryption. So that is what I investigated so far. And thoughts?

       

       

      Regards,

      Konstantin