aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authortknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-05-22 15:03:19 +0000
committertknall <tknall@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2007-05-22 15:03:19 +0000
commite4c22a05b08be72a0117b30fd89e5db5b5d7cf50 (patch)
treecce9936d3ccc891aad9130f43f7b2194aaf1b9a2 /src/main
parentd96c401b9a1cdbe433412f7a614d34bf429811f5 (diff)
downloadpdf-as-3-e4c22a05b08be72a0117b30fd89e5db5b5d7cf50.tar.gz
pdf-as-3-e4c22a05b08be72a0117b30fd89e5db5b5d7cf50.tar.bz2
pdf-as-3-e4c22a05b08be72a0117b30fd89e5db5b5d7cf50.zip
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@95 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main')
-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++)