[gs-cvs] rev 7112 - trunk/gs/lib
dan at ghostscript.com
dan at ghostscript.com
Wed Oct 18 00:01:10 PDT 2006
Author: dan
Date: 2006-10-18 00:01:10 -0700 (Wed, 18 Oct 2006)
New Revision: 7112
Modified:
trunk/gs/lib/pdf_sec.ps
Log:
Fix for 688880 Encrypted PDF can not be processed.
DETAILS:
The problem file specifies both V = 1 and and a Length = 128
bits in the encryption dict. This is contradictory since page 93 of
the PDF 1.6 spec says that if V = 1 then the key length should be
40 bits.
This change ignores the the Length value if V = 1. This matches the
observed behavior with Adobe Acrobat 7.0.
Modified: trunk/gs/lib/pdf_sec.ps
===================================================================
--- trunk/gs/lib/pdf_sec.ps 2006-10-17 13:33:02 UTC (rev 7111)
+++ trunk/gs/lib/pdf_sec.ps 2006-10-18 07:01:10 UTC (rev 7112)
@@ -84,7 +84,11 @@
% Get length of encryption key in bytes
/pdf_key_length { % pdf_key_length <key_length>
- Trailer /Encrypt oget /Length knownoget { -3 bitshift } { 5 } ifelse
+ Trailer /Encrypt oget
+ dup /V knownoget not { 0 } if 1 eq
+ { pop 5 } % If V == 1 then always use 40 bits
+ { /Length knownoget { -3 bitshift } { 5 } ifelse }
+ ifelse
} bind def
% Algorithm 3.2
More information about the gs-cvs
mailing list