Hi Rüdiger,

Thanks for the hint. This was indeed the problem. I commited a fix, so that 
PoDoFo will get stream length for encrypted streams from PdfEncrypt.

I can load AES encrypted PDFs generated by PoDoFo now, with Acrobat Reader and 
Poppler based viewers. Ghostscript still shows errors.

Regards,
        Dom

On Monday 23 August 2010 07:25:34 Rüdiger Politzer wrote:
> Hello Dom,
>  
> I'm testing the (buggy) AES encryption implementation of libpodofo and I
> hope that I detected the error! The solution is that the length of the
> encrypted object streams has to be adapted. 
> That means that not the original stream length should be written in the
> encrypted pdf but the new stream length (including padding and initial
> vector).. You get this new length by calling the CalculateStreamLength()
> function of the PdfEncryptAES class.
>  
> My (dirty) solution is to extend the PdfEncrypt class with functions to set
> marker for object streams and object stream length in case of AES
> encryption. First I set the object stream marker in
> PdfObject::WriteObject() in case of object streams and second the object
> stream length marker in PdfDictionary::Write(..). So I got all my
> information and when writting the value of the object stream length in
> PdfVariant::Write() I check for object stream (and AES encryption) and
> adjust the stream length. 
> I know that this is certainly a dirty solution but it works and I got
> aes-128bit encrypted pdf's. 
> I hope that with this information the AES encryption bug could be fixed in
> a future version of the podofo library. I you want more information or my
> patches just send me an email. 
> Best regards
> Rüdiger
>
>
> freenetMail mobil – Alle E-Mails auf Ihrem Handy versenden und empfangen.
> Jetzt kinderleicht und kostenlos einrichten. Hier informieren!


------------------------------------------------------------------------------
Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
Be part of this innovative community and reach millions of netbook users 
worldwide. Take advantage of special opportunities to increase revenue and 
speed time-to-market. Join now, and jumpstart your future.
http://p.sf.net/sfu/intel-atom-d2d
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to