aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/framework/VerificationFilter.java35
1 files changed, 35 insertions, 0 deletions
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 26f46e8..be375ec 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
@@ -52,6 +52,7 @@ import at.knowcenter.wag.exactparser.parsing.results.FooterParseResult;
import at.knowcenter.wag.exactparser.parsing.results.IndirectObjectReferenceParseResult;
import at.knowcenter.wag.exactparser.parsing.results.NumberParseResult;
import at.knowcenter.wag.exactparser.parsing.results.ObjectParseResult;
+import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
/**
@@ -72,6 +73,9 @@ public class VerificationFilter
'g', 'D', 'i', 'c', 't' };
public static final byte[] EGIZ_KZ_NAME = { 'I', 'D' };
+
+ //tzefferer: flag for accepting post-sign modifications
+ public static final String ALLOW_POST_SIGN_MODIFICATIONS = "allow_post_sign_modifications";
/**
* The logger definition.
@@ -98,6 +102,11 @@ public class VerificationFilter
*/
public List extractSignaturesFromPdf(final byte[] pdf) throws PresentableException
{
+
+ // 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");
+
List holders = new ArrayList();
List blocks = null;
@@ -119,9 +128,12 @@ public class VerificationFilter
// }
unrollLinearization(blocks);
+
+ boolean signature_block_detected = false;
for (int i = 0; i < blocks.size(); i++)
{
+ boolean current_block_contains_signature = false;
FooterParseResult bpr = (FooterParseResult) blocks.get(i);
int prev_end = 0;
@@ -149,6 +161,13 @@ public class VerificationFilter
List binary_holders = verificator.parseBlock(pdf, bpr, prev_end);
holders.addAll(binary_holders);
+
+ // tzefferer: check if signatures have been detected in current block
+ if(binary_holders.size() > 0)
+ {
+ signature_block_detected = true;
+ current_block_contains_signature = true;
+ }
logger_.debug(":Parsing Binary Sig END - holders.size = " + holders.size());
}
@@ -160,6 +179,13 @@ public class VerificationFilter
List text_holders = verificator.parseBlock(pdf, bpr, prev_end);
logger_.debug("text_holders = " + text_holders.size());
+ // tzefferer: check if signatures have been detected in current block
+ if(text_holders.size() > 0)
+ {
+ signature_block_detected = true;
+ current_block_contains_signature = true;
+ }
+
if (prev_end == 0)
{
String rest_text = null;
@@ -191,6 +217,15 @@ public class VerificationFilter
logger_.debug(":Extracting tex END - holders.size = " + holders.size());
}
+
+ // tzefferer: check if illegal modifications have been performed on the document after performing a signation
+ if(allow_post_sign_mods.equals("false"))
+ {
+ if((signature_block_detected == true) && (current_block_contains_signature == false))
+ {
+ throw new PDFDocumentException(316, "Das Dokument wurde nach erfolgter Signierung verändert.");
+ }
+ }
}
for (int i = 0; i < holders.size(); i++)