diff options
Diffstat (limited to 'src/main/java/at/gv')
-rw-r--r-- | src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java b/src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java index 34b461e..c067c8f 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java @@ -57,6 +57,7 @@ public class VerificationFilterImpl implements VerificationFilter public static final String CHECK_DOCUMENT = "check_document";
+ public static final String SUPRESS_EXCEPTION_WHEN_LAST_UIBLOCK_IS_NO_SIGNATURE = "supress_exception_when_last_iublock_is_no_signature";
public static final String BINARY_ONLY = "binary_only";
public static final String ASSUME_ONLY_SIGNATURE_BLOCKS = "assume_only_signature_blocks";
@@ -291,6 +292,7 @@ public class VerificationFilterImpl implements VerificationFilter throw new VerificationFilterException(e);
}
String check_doc = settings.getSetting(CHECK_DOCUMENT, "false");
+ boolean supressException = "true".equalsIgnoreCase(settings.getSetting(SUPRESS_EXCEPTION_WHEN_LAST_UIBLOCK_IS_NO_SIGNATURE, "false"));
// flag indicating that the last IU-block of the document is a non-signature IU-block
boolean lastBlockWasModified = false;
@@ -381,7 +383,7 @@ public class VerificationFilterImpl implements VerificationFilter // if document checking is enabled, at least one signature has been found so far, we are dealing with a
// non-signature IU-block
- if((check_doc.equalsIgnoreCase("true"))&& (sigFound && !partitionContainsNewTextSignatures)) {
+ if ((check_doc.equalsIgnoreCase("true"))&& (sigFound && !partitionContainsNewTextSignatures)) {
nshList.add(new NoSignatureHolder(signatureCounter));
lastBlockWasModified = true;
@@ -394,8 +396,12 @@ public class VerificationFilterImpl implements VerificationFilter }
// throw an exception if the last update block does not contain a signature and signatures have been found in this document
- if(lastBlockWasModified) {
- throw new VerificationFilterException(ErrorCode.MODIFIED_AFTER_SIGNATION, "The document has been modified after being signed.");
+ if (lastBlockWasModified) {
+ if (!supressException) {
+ throw new VerificationFilterException(ErrorCode.MODIFIED_AFTER_SIGNATION, "The document has been modified after being signed.");
+ } else {
+ log.debug("The document has been modified after being signed. According to the configuration, no exception is thrown.");
+ }
}
List extractedSignatures = new ArrayList();
@@ -646,6 +652,7 @@ public class VerificationFilterImpl implements VerificationFilter String check_doc = settings.getSetting(CHECK_DOCUMENT, "false");
String binary_only = settings.getSetting(BINARY_ONLY, "false");
String assume_sigs_only = settings.getSetting(ASSUME_ONLY_SIGNATURE_BLOCKS, "false");
+ boolean supressException = "true".equalsIgnoreCase(settings.getSetting(SUPRESS_EXCEPTION_WHEN_LAST_UIBLOCK_IS_NO_SIGNATURE, "false"));
try
{
@@ -689,7 +696,12 @@ public class VerificationFilterImpl implements VerificationFilter assume_sigs_only.equalsIgnoreCase("false") &&
sig_detected) {
- throw new VerificationFilterException(ErrorCode.MODIFIED_AFTER_SIGNATION, "The document has been modified after being signed.");
+ if (!supressException) {
+ throw new VerificationFilterException(ErrorCode.MODIFIED_AFTER_SIGNATION, "The document has been modified after being signed.");
+ } else {
+ log.debug("The document has been modified after being signed. According to the configuration, no exception is thrown.");
+ }
+
}
}
|