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

Hi Gordon,

The spec says use the low order 3 bytes of the object id and low order 2
bytes of the generation number.  Thus encoding for obj = 10 (hex 0A),
gen = 0 would be 0A 00 00 00 00, for obj = 30 (hex 1E) would be 1E 00 00
00 00.  This can be done in c++ using shifts or unions:

int obj = 10; // Object number
int gen = 0;  // generation number
unsigned char appendage[5]; 
appendage[0] = obj & 0xff; // low byte of word
appendage[1] = (obj >> 8) & 0xff; // low middle byte of word
appendage[2] = (obj >> 16) & 0xff; // high middle byte
appendage[3] = gen & 0xff;
appendage[4] = (gen >> 8) & 0xff;
..

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 9:05 AM
To: [EMAIL PROTECTED]
Subject: [PDFdev] Encryption



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

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