aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-lib/src/main/java/at
diff options
context:
space:
mode:
authorAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-07-11 13:38:49 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2014-07-11 13:38:49 +0200
commit1219abaf9f0029e39f5fbdf342fd4ebf07144b5b (patch)
tree1baeb54030e016158ea287a9c87d70597e0f19f5 /pdf-as-lib/src/main/java/at
parent0bfafff409078ef49b2d4a0d71405e8f5b0eb078 (diff)
downloadpdf-as-4-1219abaf9f0029e39f5fbdf342fd4ebf07144b5b.tar.gz
pdf-as-4-1219abaf9f0029e39f5fbdf342fd4ebf07144b5b.tar.bz2
pdf-as-4-1219abaf9f0029e39f5fbdf342fd4ebf07144b5b.zip
added Signature Verification Level
Diffstat (limited to 'pdf-as-lib/src/main/java/at')
-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");