From 015dbf6dcdc56893bc97a062a905e90b1c2ea529 Mon Sep 17 00:00:00 2001 From: tknall Date: Fri, 11 Sep 2009 07:11:57 +0000 Subject: Bugfixes git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@339 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- pom.xml | 2 +- .../at/gv/egiz/pdfas/exceptions/ErrorCode.java | 1 + .../binary/BinaryVerificator_1_0_0.java | 4 +++- .../helper/VerificationFilterBinaryHelper.java | 20 ++++++++++++++++++-- .../java/at/knowcenter/wag/egov/egiz/PdfAS.java | 2 +- .../java/at/knowcenter/wag/egov/egiz/PdfASID.java | 7 ++++--- .../verificators/BinaryVerificator_1_0_0.java | 4 +++- .../knowcenter/wag/egov/egiz/pdf/StringInfo.java | 2 +- src/main/resources/DefaultConfiguration.zip | Bin 649973 -> 649988 bytes .../at/gv/egiz/pdfas/web/i18n/language.properties | 3 ++- .../gv/egiz/pdfas/web/i18n/language_de.properties | 3 ++- src/main/webapp/jsp/signupload.jsp | 8 ++++++-- work/cfg/help_text.properties | 1 + 13 files changed, 43 insertions(+), 14 deletions(-) diff --git a/pom.xml b/pom.xml index ed11916..cbc51c0 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ knowcenter pdf-as PDF-AS - 3.0.9-20090417 + 3.0.9-20090622 Amtssignatur fuer elektronische Aktenfuehrung diff --git a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java index c51d10a..d903c9b 100644 --- a/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java +++ b/src/main/java/at/gv/egiz/pdfas/exceptions/ErrorCode.java @@ -59,6 +59,7 @@ public final class ErrorCode public static final int PLACEHOLDER_EXCEPTION = 700; public static final int CAPTION_NOT_FOUND_EXCEPTION = 701; + public static final int UNABLE_TO_PARSE_ID = 800; public static final int CORRECTOR_EXCEPTION = 801; public static final int EXTERNAL_CORRECTOR_TIMEOUT_REACHED = 802; diff --git a/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java b/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java index c2ec8ff..3107368 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/verificator/binary/BinaryVerificator_1_0_0.java @@ -29,6 +29,7 @@ import at.gv.egiz.pdfas.framework.input.PdfDataSource; import at.gv.egiz.pdfas.framework.verificator.Verificator; import at.gv.egiz.pdfas.impl.input.CompoundPdfDataSourceImpl; import at.gv.egiz.pdfas.impl.input.DelimitedPdfDataSource; +import at.gv.egiz.pdfas.impl.vfilter.helper.VerificationFilterBinaryHelper; import at.knowcenter.wag.egov.egiz.PdfASID; import at.knowcenter.wag.egov.egiz.cfg.ConfigLogger; import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; @@ -150,7 +151,8 @@ public class BinaryVerificator_1_0_0 implements Verificator ArrayParseResult kz_apr = (ArrayParseResult) getRequiredValueOfKey(pdf, egiz_dict, EGIZ_KZ_NAME); PdfASID kz = null; - String kz_string = VerificationFilter.restoreKZ(pdf, kz_apr); +// String kz_string = VerificationFilter.restoreKZ(pdf, kz_apr); + String kz_string = VerificationFilterBinaryHelper.restoreKZ(pdf, kz_apr); kz = new PdfASID(kz_string); if (!kz_string.equals(getMyId().toString())) { diff --git a/src/main/java/at/gv/egiz/pdfas/impl/vfilter/helper/VerificationFilterBinaryHelper.java b/src/main/java/at/gv/egiz/pdfas/impl/vfilter/helper/VerificationFilterBinaryHelper.java index b7f36d1..3ee5da0 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/vfilter/helper/VerificationFilterBinaryHelper.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/vfilter/helper/VerificationFilterBinaryHelper.java @@ -7,8 +7,10 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import at.gv.egiz.pdfas.exceptions.ErrorCode; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import at.gv.egiz.pdfas.exceptions.ErrorCode; import at.knowcenter.wag.egov.egiz.PdfASID; import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException; import at.knowcenter.wag.egov.egiz.exceptions.PDFDocumentException; @@ -41,6 +43,11 @@ public final class VerificationFilterBinaryHelper */ public static final byte[] EGIZ_KZ_NAME = { 'I', 'D' }; + /** + * The log. + */ + private static final Log log = LogFactory.getLog(VerificationFilterBinaryHelper.class); + /** * Tells, if the given incremental update block contains a binary signature. * @@ -128,7 +135,13 @@ public final class VerificationFilterBinaryHelper { List partition = new ArrayList(); - for (int i = 0; i < kz_apr.elements.size() / 2; i++) + int linesToProcess = (kz_apr.elements.size() / 2); + log.trace("Lines to process for KZ: " + linesToProcess); + if (linesToProcess > 1) { + log.debug("HOTFIX: forcing single line to process"); + linesToProcess = 1; + } + for (int i = 0; i < linesToProcess; i++) { NumberParseResult start_npr = (NumberParseResult) kz_apr.elements.get(i * 2); NumberParseResult length_npr = (NumberParseResult) kz_apr.elements.get(i * 2 + 1); @@ -136,7 +149,10 @@ public final class VerificationFilterBinaryHelper StringInfo si = new StringInfo(); si.string_start = start_npr.number; si.string_length = length_npr.number; + si.pdf = pdf; + log.trace("Adding KZ: " + si.toString()); + partition.add(si); } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java index 2073714..cf6c9bf 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfAS.java @@ -96,7 +96,7 @@ public abstract class PdfAS * The current version of the pdf-as library. This version string is logged on every invocation * of the api or the web application. */ - public static final String PDFAS_VERSION = "3.0.9-20090417"; + public static final String PDFAS_VERSION = "3.0.9-20090622"; /** * The key of the strict mode setting. diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/PdfASID.java b/src/main/java/at/knowcenter/wag/egov/egiz/PdfASID.java index 0409bb7..cfa9636 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/PdfASID.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/PdfASID.java @@ -19,6 +19,7 @@ package at.knowcenter.wag.egov.egiz; import java.io.Serializable; +import at.gv.egiz.pdfas.exceptions.ErrorCode; import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException; /** @@ -88,17 +89,17 @@ public class PdfASID implements Serializable if (tokens.length != 5) { - throw new InvalidIDException(800, "The doesn't have enough tokens (" + id + ")"); + throw new InvalidIDException(ErrorCode.UNABLE_TO_PARSE_ID, "The doesn't have enough tokens (" + id + ")"); } if (!tokens[0].equals(URN)) { - throw new InvalidIDException(800, "The id must start with " + URN + " (" + id + ")"); + throw new InvalidIDException(ErrorCode.UNABLE_TO_PARSE_ID, "The id must start with " + URN + " (" + id + ")"); } if (!tokens[1].equals(NAMESPACE)) { - throw new InvalidIDException(800, "The namespace of the id must be " + NAMESPACE + " (" + id + ")"); + throw new InvalidIDException(ErrorCode.UNABLE_TO_PARSE_ID, "The namespace of the id must be " + NAMESPACE + " (" + id + ")"); } set(tokens[2], tokens[3], tokens[4]); diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/BinaryVerificator_1_0_0.java b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/BinaryVerificator_1_0_0.java index a6b87dc..080d828 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/BinaryVerificator_1_0_0.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/framework/verificators/BinaryVerificator_1_0_0.java @@ -25,6 +25,7 @@ import java.util.List; import at.gv.egiz.pdfas.exceptions.ErrorCode; import at.gv.egiz.pdfas.framework.input.PdfDataSource; import at.gv.egiz.pdfas.impl.input.ByteArrayPdfDataSourceImpl; +import at.gv.egiz.pdfas.impl.vfilter.helper.VerificationFilterBinaryHelper; import org.apache.log4j.Logger; @@ -149,7 +150,8 @@ public class BinaryVerificator_1_0_0 implements Verificator ArrayParseResult kz_apr = (ArrayParseResult) getRequiredValueOfKey(pdf, egiz_dict, EGIZ_KZ_NAME); PdfASID kz = null; - String kz_string = VerificationFilter.restoreKZ(pdf, kz_apr); +// String kz_string = VerificationFilter.restoreKZ(pdf, kz_apr); + String kz_string = VerificationFilterBinaryHelper.restoreKZ(pdf, kz_apr); kz = new PdfASID(kz_string); if (!kz_string.equals(getMyId().toString())) { diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StringInfo.java b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StringInfo.java index d2b28a4..08d53ee 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StringInfo.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/pdf/StringInfo.java @@ -45,7 +45,7 @@ public class StringInfo implements Serializable /** * The PDF document this range belongs to. */ - protected byte[] pdf = null; + public byte[] pdf = null; /** * The start offset of the range. diff --git a/src/main/resources/DefaultConfiguration.zip b/src/main/resources/DefaultConfiguration.zip index 40af0ed..c31c9d1 100644 Binary files a/src/main/resources/DefaultConfiguration.zip and b/src/main/resources/DefaultConfiguration.zip differ diff --git a/src/main/resources/at/gv/egiz/pdfas/web/i18n/language.properties b/src/main/resources/at/gv/egiz/pdfas/web/i18n/language.properties index 67a7d47..1fb6b13 100644 --- a/src/main/resources/at/gv/egiz/pdfas/web/i18n/language.properties +++ b/src/main/resources/at/gv/egiz/pdfas/web/i18n/language.properties @@ -4,6 +4,7 @@ common.backtolist = back to list common.binary = binary common.bku = Local CCS common.locale.param = locale=en +common.moa = MOA common.mocca = Online CCS common.textual = textual common.title = PDF Signature @@ -63,7 +64,7 @@ signupload.documentnotselected = Please select a pdf document to be s signupload.documentnotselected.preview = Please select a pdf document to be signed for preview. signupload.file = PDF document signupload.heading2 = Sign document -signupload.note = Documents signed in textual mode can only be verified if the underlying certificate can be retrieved from a directory service. +signupload.note = Textual signature mode is only practicable for simple documents without special structures (like tables, forms...) and graphics. Documents signed in textual mode can only be verified if the underlying certificate can be retrieved from a directory service. signupload.note.prefix = Please note signupload.noteonsigmark = The appearance of the signature mark depends on the signature type, signature mode, on the particular citizen card and on the given citizen card software. signupload.selectfilenote = Please select the signature parameters and the pdf document to be signed with your citizen card. diff --git a/src/main/resources/at/gv/egiz/pdfas/web/i18n/language_de.properties b/src/main/resources/at/gv/egiz/pdfas/web/i18n/language_de.properties index 32eed80..fe92ab0 100644 --- a/src/main/resources/at/gv/egiz/pdfas/web/i18n/language_de.properties +++ b/src/main/resources/at/gv/egiz/pdfas/web/i18n/language_de.properties @@ -4,6 +4,7 @@ common.backtolist = zur common.binary = binär common.bku = Lokale BKU common.locale.param = locale=de +common.moa = MOA common.mocca = Online BKU common.textual = textuell common.title = PDF-Signatur @@ -63,7 +64,7 @@ signupload.documentnotselected = Bitte w signupload.documentnotselected.preview = Bitte wählen Sie das zu signierende PDF-Dokument für die Vorschau aus. signupload.file = PDF Dokument signupload.heading2 = Dokument Signatur erstellen -signupload.note = Im textuellen Modus signierte Dokumente können nur dann geprüft werden, wenn das Zertifikat in einem Verzeichnisdienst verfügbar ist. +signupload.note = Der textuelle Signaturmodus ist nur für einfache Dokumente ohne Strukturierung (Tabellen, Formulare udgl.) und ohne Grafiken sinnvoll anwendbar. Textuell signierte Dokumente können nur dann geprüft werden, wenn das Zertifikat in einem Verzeichnisdienst verfügbar ist. signupload.note.prefix = Bitte beachten Sie signupload.noteonsigmark = Das Erscheinungsbild der Signaturmarke kann abhängig vom Signaturtyp, vom Signaturmodus, von der verwendeten Bürgerkarte, sowie von der verwendeten Bürgerkartenumgebung variieren. signupload.selectfilenote = Bitte wählen Sie die Signaturparameter sowie das zu signierende PDF Dokument. Dieses wird mit Ihrer Bürgerkarte signiert. diff --git a/src/main/webapp/jsp/signupload.jsp b/src/main/webapp/jsp/signupload.jsp index f372ecf..526d2c1 100644 --- a/src/main/webapp/jsp/signupload.jsp +++ b/src/main/webapp/jsp/signupload.jsp @@ -56,20 +56,24 @@ --> <% + // PRESETS + // signature device String device = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_DEVICE_KEY); if (device == null) { - device = Constants.SIGNATURE_DEVICE_MOC; + device = Constants.SIGNATURE_DEVICE_BKU; session.setAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_DEVICE_KEY, device); } + // signature mode String mode = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_MODE_KEY); if (forceTextualForMocca && Constants.SIGNATURE_DEVICE_MOC.equals(device)) { mode = FormFields.VALUE_MODE_TEXTUAL; session.setAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_MODE_KEY, mode); } if (mode == null) { - mode = FormFields.VALUE_MODE_TEXTUAL; + mode = FormFields.VALUE_MODE_BINARY; session.setAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_MODE_KEY, mode); } + // signature type String type = (String) session.getAttribute(UpdateFormServlet.UPLOADFORM_SIGNATURE_TYPE_KEY); if (type == null) { Locale locale = (Locale) session.getAttribute(LocaleParamFilter.LOCALE_SESSION_KEY); diff --git a/work/cfg/help_text.properties b/work/cfg/help_text.properties index 78d1644..4195ead 100644 --- a/work/cfg/help_text.properties +++ b/work/cfg/help_text.properties @@ -87,5 +87,6 @@ error.code.700=Der Platzhalter f error.code.701=Die Überschrift (Caption/Label) konnte nicht eindeutig wiedergefunden werden. Dies geschieht gewöhnlich wenn bei der (häufig absoluten) Positionierung zu wenig Platz für die Überschrift (Caption/Label) vorhanden ist und diese ungünstig umgebrochen werden muss. Bitte stellen Sie dieser Überschrift mehr Platz im Signaturblock zur Verfügung oder entfernen Sie aus dieser alle Leerzeichen. #CorrectorException +error.code.800=Fehler beim Parsen der binären Signatur. error.code.801=Das Dokument konnte nicht korrigiert werden. error.code.802=Die externe Korrektur konnte nicht innerhalb des festgesetzten Timeouts fertiggestellt werden. -- cgit v1.2.3