[Gs-devel] Progress, not perfection, in pdf_sec.ps

Raph Levien raph at levien.com
Sun Sep 2 01:31:41 PDT 2001

I've been hacking a bit on pdf_sec.ps to make it use the C crypto
implementations (including the Arcfour that Ralph just finished),
rather than the current implementation in PostScript. The current
version can easily handle the 40rc4.pdf file, but fails with the
40ibm.pdf I'm using as a tougher test case.

Here's the error message I get:

Error: /undefined in /afii10040
Operand stack:
   --dict:7/7(L)--   2   --dict:82/82(ro)(G)--   1 (then a bit of garbage)

I'm puzzled where the afii10040 is coming from. It sounds like the
glyph name of a non-Roman font (cyrillic, perhaps?), but I don't
see it present in the original ibm.pdf, even when I run Peter's handy
decompression thingy on it. Also, just opening ibm.pdf and saving it
in Acrobat 5 also doesn't create any problems (gs renders it just fine
in either case).

In any case, the file doesn't run with the old pdf_sec.ps either.

I suspected that the problem might be processing of encrypted strings
in PDF objects. However, this error appears to be happening before

I'm having trouble grasping the logic for encrypted strings in the
existing PDF code. I can't easily find or create a test file that has
strings in it, especially more than one string per object. If you have
such files handy, I would appreciate them.

All files are at http://www.artofcode.com/files/

I won't be able to get back to this until Monday. I consider the 40
bit key generation and password handling to be done. Ralph, feel free
to move forward on 128 bit (/V 2) key generation based on the
pdf_sec.ps in this email - this should result in successful processing
of 128rc4.pdf.

It's possible that actual decryption is as good as it was before, but
it's also possible that I've introduced a new bug. In particular, I
have little confidence in the correctness of string decryption (not
that I have much better confidence in the correctness of the existing
code). In any case, I don't feel comfortable checking in the new
pdf_sec.ps to stable (7.01) until we have done quite a bit more


-------------- next part --------------
A non-text attachment was scrubbed...
Name: pdf_sec.ps
Type: application/postscript
Size: 6252 bytes
Desc: not available
Url : http://ghostscript.com/pipermail/gs-devel/attachments/20010902/38853d50/pdf_sec.ps

More information about the gs-devel mailing list