PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com
_____________________________________________________________


This stuff is tricky to debug. It would be 19 since that is your stream
object id.  Also, I believe that the encryption key is the md5 digest of
the user key + object/generation appendage.  Make sure you clamp the key
length to a maximum of 16 bytes.

Jon Anderson
Bengt Computer Graphics LLC
http://www.bengtcg.com


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gordon Campbell
Sent: Monday, December 22, 2003 11:52 AM
To: Gordon Campbell; [EMAIL PROTECTED]
Subject: [PDFdev] RE: Encryption



PDFdev is a service provided by PDFzone.com | http://www.pdfzone.com
_____________________________________________________________

I'm still having trouble encrypting my stream.  Even though  I have no
issues encrypting the strings (such as Author, Creation Date etc) in my
PDF
header (Object 1).  I'm wondering if I'm referencing the wrong object
when
trying to convert my stream.  Below is a sample:

Object 18 - Page Dictionary
Object 19 - Page Contents
Object 20 - Stream Length

18 0 obj
<<
/Type /Page
/Parent 3 0 R
/Resources 17 0 R
/Contents 19 0 R
/Rotate 0
/MediaBox [ 0 0 612 792]
/Annots [
 ]
>>
endobj
19 0 obj
<<
/Length 20 0 R
>>
stream

BT
/F1 10 Tf
1 0 0 1 10 742 Tm
(Hello World!) Tj
ET
BT
/F1 10 Tf
1 0 0 1 10 742 Tm
ETendstream
endobj

Now should my Encryption Key be composed of the first 5 bytes of the
original plus 18 or 19?  If 19 I'm appending the bytes 13 00 00 00 00 to
the
Key.  First of, am I correct in using 19 (doesn't seem to work that way
though)?  And secondly, am I appending in the correct sequence (my
header
was appended using 01 00 00 00 00 and it worked okay.

If I decrypt the string using the key I'm using I get the exact same
unencrypted stream contents .. so I'm assuming that my enrcyption
routine is
ok.  Any other ideas of where to look?

Thanks,
Gordon

-----Original Message-----
From: Gordon Campbell [mailto:[EMAIL PROTECTED]
Sent: Monday, December 22, 2003 9:05 AM
To: [EMAIL PROTECTED]
Subject: Encryption


In order to give myself something to do over the Christmas holiday I'm
revisiting my attempt at encrypting a PDF document via my open-source
(for
Progress 4GL) project.

Now, I've gotten to the point where I can correctly generate the User
(/U)
and Master (/M) entries correctly so I know that my md5 hashing is
working.
Now I just need to determine the next step ... encrypting the stream or
string content.  So for this I thought that I'd start simple.  Try
encrypting the Author ...

I got this working ... I can see that it is correct via the Document
Properties.  With this my Obj ID = 1 and Gen ID = 0 (zero).  So it was
easy
enough to determine how to append that value to my original string.  Now
my
question .... if I had an Object ID of 20 (or say 30) how would I go
about
determining this 5 byte appendage?

For Object ID = 1, the appendage (so to speak) was 0100000000 (in hex).
What would the appendage look like for 20 or 30 and how did you do that
conversion?

Thanks and have a Merry Christmas,
Gordon



To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html



To change your subscription:
http://www.pdfzone.com/discussions/lists-pdfdev.html

Reply via email to