aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at/gv
diff options
context:
space:
mode:
Diffstat (limited to 'pdf-as-lib/src/main/java/at/gv')
-rw-r--r--pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java16
1 files changed, 15 insertions, 1 deletions
diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
index 40e7faf5..7815717e 100644
--- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
+++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/PdfAsImpl.java
@@ -232,6 +232,16 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
.getDictionaryObject(COSName.ACRO_FORM);
COSArray fields = (COSArray) acroForm
.getDictionaryObject(COSName.FIELDS);
+
+ int lastSig = -1;
+ for (int i = 0; i < fields.size(); i++) {
+ COSDictionary field = (COSDictionary) fields.getObject(i);
+ String type = field.getNameAsString("FT");
+ if ("Sig".equals(type)) {
+ lastSig = i;
+ }
+ }
+
for (int i = 0; i < fields.size(); i++) {
COSDictionary field = (COSDictionary) fields.getObject(i);
String type = field.getNameAsString("FT");
@@ -242,7 +252,11 @@ public class PdfAsImpl implements PdfAs, IConfigurationConstants {
// verify only specific siganture!
verifyThis = signatureToVerify == currentSignature;
}
-
+
+ if(signatureToVerify == -2) {
+ verifyThis = i == lastSig;
+ }
+
if (verifyThis) {
logger.trace("Found Signature: ");
COSBase base = field.getDictionaryObject("V");