pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1853759 - in /pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox: pdfparser/NonSequentialPDFParser.java pdmodel/encryption/SecurityHandler.java
Date Sun, 17 Feb 2019 14:57:39 GMT
Author: tilman
Date: Sun Feb 17 14:57:39 2019
New Revision: 1853759

URL: http://svn.apache.org/viewvc?rev=1853759&view=rev
Log:
PDFBOX-4466: add more heuristics to detect a signature dictionary because /Type is optional

Modified:
    pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
    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/pdfparser/NonSequentialPDFParser.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java?rev=1853759&r1=1853758&r2=1853759&view=diff
==============================================================================
--- pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
(original)
+++ pdfbox/branches/1.8/pdfbox/src/main/java/org/apache/pdfbox/pdfparser/NonSequentialPDFParser.java
Sun Feb 17 14:57:39 2019
@@ -1560,7 +1560,7 @@ public class NonSequentialPDFParser exte
      * @param dict the dictionary to be decrypted
      * @param objNr the object number
      * @param objGenNr the object generation number
-     * @throws IOException ff something went wrong
+     * @throws IOException if something went wrong
      */
     protected final void decryptDictionary(COSDictionary dict, long objNr, long objGenNr)
throws IOException
     {
@@ -1570,7 +1570,11 @@ public class NonSequentialPDFParser exte
             return;
         }
         COSBase type = dict.getDictionaryObject(COSName.TYPE);
-        boolean isSignature = COSName.SIG.equals(type) || COSName.DOC_TIME_STAMP.equals(type);
+        boolean isSignature = COSName.SIG.equals(type) || COSName.DOC_TIME_STAMP.equals(type)
||
+                // PDFBOX-4466: /Type is optional, see
+                // https://ec.europa.eu/cefdigital/tracker/browse/DSS-1538
+                (dict.getDictionaryObject(COSName.CONTENTS) instanceof COSString &&

+                 dict.getDictionaryObject(COSName.BYTERANGE) instanceof COSArray);
         for (Entry<COSName, COSBase> entry : dict.entrySet())
         {
             if (isSignature && COSName.CONTENTS.equals(entry.getKey()))

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=1853759&r1=1853758&r2=1853759&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
Sun Feb 17 14:57:39 2019
@@ -550,7 +550,11 @@ public abstract class SecurityHandler
             IOException
     {
         COSBase type = dictionary.getDictionaryObject(COSName.TYPE);
-        boolean isSignature = COSName.SIG.equals(type) || COSName.DOC_TIME_STAMP.equals(type);
+        boolean isSignature = COSName.SIG.equals(type) || COSName.DOC_TIME_STAMP.equals(type)
||
+                // PDFBOX-4466: /Type is optional, see
+                // https://ec.europa.eu/cefdigital/tracker/browse/DSS-1538
+                (dictionary.getDictionaryObject(COSName.CONTENTS) instanceof COSString &&

+                 dictionary.getDictionaryObject(COSName.BYTERANGE) instanceof COSArray);
         for (Map.Entry<COSName, COSBase> entry : dictionary.entrySet())
         {
             if (isSignature && COSName.CONTENTS.equals(entry.getKey()))



Mime
View raw message