You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2020/10/10 11:29:54 UTC

svn commit: r1882390 - /pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/SigUtils.java

Author: tilman
Date: Sat Oct 10 11:29:54 2020
New Revision: 1882390

URL: http://svn.apache.org/viewvc?rev=1882390&view=rev
Log:
PDFBOX-3017: don't bother with timestamp signatures, as mentioned by Michael Klink

Modified:
    pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/SigUtils.java

Modified: pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/SigUtils.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/SigUtils.java?rev=1882390&r1=1882389&r2=1882390&view=diff
==============================================================================
--- pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/SigUtils.java (original)
+++ pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/signature/SigUtils.java Sat Oct 10 11:29:54 2020
@@ -137,11 +137,15 @@ public class SigUtils
     {
         for (PDSignature sig : doc.getSignatureDictionaries())
         {
+            // "Approval signatures shall follow the certification signature if one is present"
+            // thus we don't care about timestamp signatures
+            if (COSName.DOC_TIME_STAMP.equals(sig.getCOSObject().getItem(COSName.TYPE)))
+            {
+                continue;
+            }
             if (sig.getCOSObject().containsKey(COSName.CONTENTS))
             {
-                // "A document can contain only one signature field that contains
-                // a DocMDP transform method; it shall be the first signed field in the document."            
-                throw new IOException("DocMDP transform method not allowed if a signature exists");
+                throw new IOException("DocMDP transform method not allowed if an approval signature exists");
             }
         }