You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2014/11/17 17:12:58 UTC

svn commit: r1640182 - /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java

Author: lehmi
Date: Mon Nov 17 16:12:58 2014
New Revision: 1640182

URL: http://svn.apache.org/r1640182
Log:
PDFBOX-2469: don't decrypt the Signature dictionary when using the old parser

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java

Modified: pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java?rev=1640182&r1=1640181&r2=1640182&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java (original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/SecurityHandler.java Mon Nov 17 16:12:58 2014
@@ -209,7 +209,14 @@ public abstract class SecurityHandler
         while (objectIter.hasNext())
         {
             COSObject nextObj = objectIter.next();
-            if (nextObj.getObject() != encryptionDict)
+            COSBase nextCOSBase = nextObj.getObject();
+            boolean isSignatureDictionary = false;
+            if (nextCOSBase instanceof COSDictionary)
+            {
+                isSignatureDictionary = COSName.SIG.equals(((COSDictionary) nextCOSBase)
+                        .getDictionaryObject(COSName.TYPE));
+            }
+            if (!isSignatureDictionary && nextCOSBase != encryptionDict)
             {
                 decryptObject(nextObj);
             }