aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-02-01 16:52:43 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2011-02-01 16:52:43 +0000
commitf471d8a5ac76cff2f6a6c833c7c4aa08d24fecab (patch)
tree842561df91493c49d342a356c20e7ede22bacad6
parent55d1e4bff92d92902d4c7e24927c6d98b536c836 (diff)
downloadpdf-as-3-f471d8a5ac76cff2f6a6c833c7c4aa08d24fecab.tar.gz
pdf-as-3-f471d8a5ac76cff2f6a6c833c7c4aa08d24fecab.tar.bz2
pdf-as-3-f471d8a5ac76cff2f6a6c833c7c4aa08d24fecab.zip
New (optional) configuration key introduced that supressed the Exception when incremental updates without further signatures are found.
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@742 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r--src/main/java/at/gv/egiz/pdfas/impl/vfilter/VerificationFilterImpl.java20
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java13
-rw-r--r--src/main/resources/DefaultConfiguration.zipbin673774 -> 673902 bytes
-rw-r--r--work/cfg/config.properties7
4 files changed, 29 insertions, 11 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.");
+ }
+
}
}
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java
index b218062..5a5712e 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java
@@ -17,18 +17,15 @@
*/
package at.knowcenter.wag.egov.egiz.framework;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
-import at.gv.egiz.pdfas.exceptions.ErrorCode;
-
import org.apache.log4j.Logger;
+import at.gv.egiz.pdfas.exceptions.ErrorCode;
+import at.gv.egiz.pdfas.impl.vfilter.VerificationFilterImpl;
import at.knowcenter.wag.egov.egiz.PdfAS;
import at.knowcenter.wag.egov.egiz.PdfASID;
import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger;
@@ -118,6 +115,7 @@ public class VerificationFilter
// tzefferer: get allow_post_sign_modifications property from property file
SettingsReader settings = SettingsReader.getInstance();
String allow_post_sign_mods = settings.getSetting(ALLOW_POST_SIGN_MODIFICATIONS, "false");
+ boolean supressException = "true".equalsIgnoreCase(settings.getSetting(VerificationFilterImpl.SUPRESS_EXCEPTION_WHEN_LAST_UIBLOCK_IS_NO_SIGNATURE, "false"));
List holders = new ArrayList();
@@ -252,7 +250,10 @@ public class VerificationFilter
{
if (signature_block_detected && !current_block_contains_signature)
{
- throw new PDFDocumentException(ErrorCode.MODIFIED_AFTER_SIGNATION, "Das Dokument wurde nach erfolgter Signierung verändert.");
+ if (!supressException) {
+ throw new PDFDocumentException(ErrorCode.MODIFIED_AFTER_SIGNATION, "Das Dokument wurde nach erfolgter Signierung verändert.");
+ }
+
}
}
}
diff --git a/src/main/resources/DefaultConfiguration.zip b/src/main/resources/DefaultConfiguration.zip
index 6940943..211c8cb 100644
--- a/src/main/resources/DefaultConfiguration.zip
+++ b/src/main/resources/DefaultConfiguration.zip
Binary files differ
diff --git a/work/cfg/config.properties b/work/cfg/config.properties
index a75d0ba..83c78ed 100644
--- a/work/cfg/config.properties
+++ b/work/cfg/config.properties
@@ -48,6 +48,12 @@ external_corrector_timeout=15000
# In beiden Fällen wird check_old_textual_sigs berücksichtigt.
check_document=true
+# Falls der letzte inkrementelle Updateblock keine Signatur enthält würde sofern
+# check_document=true gesetzt ist eine Exception geworfen werden und die Prüfung
+# abgebrochen werden. Mit diesem Schalter ist es möglich, diese Exception zu
+# unterdrücken, um die Auswertung extern vornehmen zu können (standard: false)
+# supress_exception_when_last_iublock_is_no_signature=false
+
# Aktiviert, oder deaktiviert grundsätzlich das - potenziell zeit- und ressourcen-aufwaendige
# Suchen nach Platzhalter-Bildern in PDF-Dokumenten
# Festlegung fuer einzelnes Profil
@@ -68,7 +74,6 @@ moa.sign.console.detached.enabled=false
# Signaturdienste
# lokale BKU
-
bku.available_for_web=true
bku.available_for_commandline=true