From 2a919c58dae02da975b1a2c0ea485f4338305b9d Mon Sep 17 00:00:00 2001 From: tknall Date: Thu, 27 Jan 2011 18:04:14 +0000 Subject: - more logging - commandline: signature mode (textual, binary) set optional (setting default mode, equivalent to api usage) - documentation updated git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@736 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../PDF-AS-3.2-Anwendungsbeschreibung.doc | Bin 611840 -> 0 bytes .../PDF-AS-3.2-Anwendungsbeschreibung.pdf | Bin 1357062 -> 0 bytes .../PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.doc | Bin 0 -> 611840 bytes .../PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.pdf | Bin 0 -> 1388384 bytes .../placeholder_embedded_binary.jpg | Bin 0 -> 77204 bytes ...laceholder_embedded_binary_SIGNATURBLOCK_DE.jpg | Bin 0 -> 77338 bytes ...laceholder_embedded_binary_SIGNATURBLOCK_EN.jpg | Bin 0 -> 77222 bytes .../placeholder_embedded_standard.jpg | Bin 0 -> 71566 bytes .../placeholder_embedded_textual.jpg | Bin 0 -> 76561 bytes ...aceholder_embedded_textual_SIGNATURBLOCK_DE.jpg | Bin 0 -> 77360 bytes ...aceholder_embedded_textual_SIGNATURBLOCK_EN.jpg | Bin 0 -> 77954 bytes dok/Spezifikation/PDF-AS-Spezifikation-2.2.pdf | Bin 0 -> 1722071 bytes ...pezifikation-Layout-Amtssignatur-las-v1.3.0.doc | Bin 0 -> 1089024 bytes src/main/assembly/assemble_distribution_cl.xml | 7 ++++ .../at/gv/egiz/pdfas/api/commons/Constants.java | 11 ++++++ .../at/gv/egiz/pdfas/api/sign/SignParameters.java | 2 +- .../java/at/gv/egiz/pdfas/commandline/Main.java | 28 ++++++------- .../at/gv/egiz/pdfas/impl/api/PdfAsObject.java | 3 +- .../placeholder/SignaturePlaceholderExtractor.java | 44 +++++++++++---------- 19 files changed, 58 insertions(+), 37 deletions(-) delete mode 100644 dok/Anwendungsbeschreibung/PDF-AS-3.2-Anwendungsbeschreibung.doc delete mode 100644 dok/Anwendungsbeschreibung/PDF-AS-3.2-Anwendungsbeschreibung.pdf create mode 100644 dok/Anwendungsbeschreibung/PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.doc create mode 100644 dok/Anwendungsbeschreibung/PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.pdf create mode 100644 dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary.jpg create mode 100644 dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary_SIGNATURBLOCK_DE.jpg create mode 100644 dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary_SIGNATURBLOCK_EN.jpg create mode 100644 dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_standard.jpg create mode 100644 dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual.jpg create mode 100644 dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual_SIGNATURBLOCK_DE.jpg create mode 100644 dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual_SIGNATURBLOCK_EN.jpg create mode 100644 dok/Spezifikation/PDF-AS-Spezifikation-2.2.pdf create mode 100644 dok/Spezifikation/Spezifikation-Layout-Amtssignatur-las-v1.3.0.doc diff --git a/dok/Anwendungsbeschreibung/PDF-AS-3.2-Anwendungsbeschreibung.doc b/dok/Anwendungsbeschreibung/PDF-AS-3.2-Anwendungsbeschreibung.doc deleted file mode 100644 index d8ef189..0000000 Binary files a/dok/Anwendungsbeschreibung/PDF-AS-3.2-Anwendungsbeschreibung.doc and /dev/null differ diff --git a/dok/Anwendungsbeschreibung/PDF-AS-3.2-Anwendungsbeschreibung.pdf b/dok/Anwendungsbeschreibung/PDF-AS-3.2-Anwendungsbeschreibung.pdf deleted file mode 100644 index 5aefe8a..0000000 Binary files a/dok/Anwendungsbeschreibung/PDF-AS-3.2-Anwendungsbeschreibung.pdf and /dev/null differ diff --git a/dok/Anwendungsbeschreibung/PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.doc b/dok/Anwendungsbeschreibung/PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.doc new file mode 100644 index 0000000..da3212d Binary files /dev/null and b/dok/Anwendungsbeschreibung/PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.doc differ diff --git a/dok/Anwendungsbeschreibung/PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.pdf b/dok/Anwendungsbeschreibung/PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.pdf new file mode 100644 index 0000000..a438e74 Binary files /dev/null and b/dok/Anwendungsbeschreibung/PDF-AS-3.2-SNAPSHOT-Anwendungsbeschreibung.pdf differ diff --git a/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary.jpg b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary.jpg new file mode 100644 index 0000000..ea6e488 Binary files /dev/null and b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary.jpg differ diff --git a/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary_SIGNATURBLOCK_DE.jpg b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary_SIGNATURBLOCK_DE.jpg new file mode 100644 index 0000000..5c82ba9 Binary files /dev/null and b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary_SIGNATURBLOCK_DE.jpg differ diff --git a/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary_SIGNATURBLOCK_EN.jpg b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary_SIGNATURBLOCK_EN.jpg new file mode 100644 index 0000000..875cca2 Binary files /dev/null and b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_binary_SIGNATURBLOCK_EN.jpg differ diff --git a/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_standard.jpg b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_standard.jpg new file mode 100644 index 0000000..c818576 Binary files /dev/null and b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_standard.jpg differ diff --git a/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual.jpg b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual.jpg new file mode 100644 index 0000000..07c2286 Binary files /dev/null and b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual.jpg differ diff --git a/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual_SIGNATURBLOCK_DE.jpg b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual_SIGNATURBLOCK_DE.jpg new file mode 100644 index 0000000..4626a77 Binary files /dev/null and b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual_SIGNATURBLOCK_DE.jpg differ diff --git a/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual_SIGNATURBLOCK_EN.jpg b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual_SIGNATURBLOCK_EN.jpg new file mode 100644 index 0000000..72be704 Binary files /dev/null and b/dok/Anwendungsbeschreibung/Platzhalter-Beispiele/placeholder_embedded_textual_SIGNATURBLOCK_EN.jpg differ diff --git a/dok/Spezifikation/PDF-AS-Spezifikation-2.2.pdf b/dok/Spezifikation/PDF-AS-Spezifikation-2.2.pdf new file mode 100644 index 0000000..6229f6a Binary files /dev/null and b/dok/Spezifikation/PDF-AS-Spezifikation-2.2.pdf differ diff --git a/dok/Spezifikation/Spezifikation-Layout-Amtssignatur-las-v1.3.0.doc b/dok/Spezifikation/Spezifikation-Layout-Amtssignatur-las-v1.3.0.doc new file mode 100644 index 0000000..882cc26 Binary files /dev/null and b/dok/Spezifikation/Spezifikation-Layout-Amtssignatur-las-v1.3.0.doc differ diff --git a/src/main/assembly/assemble_distribution_cl.xml b/src/main/assembly/assemble_distribution_cl.xml index c570ab7..134d045 100644 --- a/src/main/assembly/assemble_distribution_cl.xml +++ b/src/main/assembly/assemble_distribution_cl.xml @@ -41,6 +41,13 @@ PDF-AS-${project.version}-Anwendungsbeschreibung.pdf + + dok/Anwendungsbeschreibung/Platzhalter-Beispiele + doc/Platzhalter-Beispiele + + *.jpg + + dok/Konfiguration doc diff --git a/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java b/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java index 7f6ab4b..ee5b3ea 100644 --- a/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java +++ b/src/main/java/at/gv/egiz/pdfas/api/commons/Constants.java @@ -32,6 +32,11 @@ public final class Constants * This value should not be modified due to external dependencies! */ public static final String SIGNATURE_TYPE_TEXTUAL = "textual"; + + /** + * The default signature type (one of "textual", "binary", "detachedtextual"). + */ + public static final String DEFAULT_SIGNATURE_TYPE = SIGNATURE_TYPE_BINARY; /** * A "detached" textual signature. @@ -136,5 +141,11 @@ public final class Constants * If there is no placeholder at all, the signature will be placed as usual, according to the pos parameter of the signature profile used. */ public static final int PLACEHOLDER_MATCH_MODE_LENIENT = 2; + + /** + * Identifier for QR based placeholders. + */ + public static final String QR_PLACEHOLDER_IDENTIFIER = "PDF-AS-POS"; + } diff --git a/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java b/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java index a53a140..eaa0b1c 100644 --- a/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java +++ b/src/main/java/at/gv/egiz/pdfas/api/sign/SignParameters.java @@ -40,7 +40,7 @@ public class SignParameters * {@link Constants#SIGNATURE_TYPE_TEXTUAL}. *

*/ - protected String signatureType = Constants.SIGNATURE_TYPE_BINARY; + protected String signatureType = Constants.DEFAULT_SIGNATURE_TYPE; /** * The signature device to perform the actual signature. diff --git a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java index 17548f4..ec75d34 100644 --- a/src/main/java/at/gv/egiz/pdfas/commandline/Main.java +++ b/src/main/java/at/gv/egiz/pdfas/commandline/Main.java @@ -154,24 +154,24 @@ public abstract class Main public static final String VALUE_MODE_VERIFY = "verify"; /** - * The application mode sign + * The value for signature mode binary. */ - public static final String VALUE_SIGNATURE_MODE_BINARY = "binary"; + public static final String VALUE_SIGNATURE_MODE_BINARY = Constants.SIGNATURE_TYPE_BINARY; /** - * The application mode verify + * The value for signature mode textual. */ - public static final String VALUE_SIGNATURE_MODE_TEXTUAL = "textual"; + public static final String VALUE_SIGNATURE_MODE_TEXTUAL = Constants.SIGNATURE_TYPE_TEXTUAL; /** - * The application mode verify + * The value for signature mode detached. */ public static final String VALUE_SIGNATURE_MODE_DETACHED = "detached"; /** - * The application mode verify + * The value for signature mode detachedtextual. */ - public static final String VALUE_SIGNATURE_MODE_DETACHED_TEXT = "detachedtextual"; + public static final String VALUE_SIGNATURE_MODE_DETACHED_TEXT = Constants.SIGNATURE_TYPE_DETACHEDTEXTUAL; /** * The placeholder match mode STRICT @@ -187,7 +187,7 @@ public abstract class Main * The placeholder match mode STRICT */ public static final String VALUE_PLACEHOLDER_MATCH_MODE_LENIENT = "lenient"; - + /** * The log. */ @@ -231,7 +231,7 @@ public abstract class Main // printUsage(System.out); String mode = null; - String signature_mode = null; + String signature_mode = Constants.DEFAULT_SIGNATURE_TYPE; String connector = null; String signature_type = null; @@ -1038,12 +1038,10 @@ public abstract class Main writer.println(" OPTIONS for signation:"); - writer.println(" " + PARAMETER_SIGNATURE_MODE + " <" + VALUE_SIGNATURE_MODE_BINARY + "|" + VALUE_SIGNATURE_MODE_TEXTUAL + ">"); - writer.println(" " + VALUE_SIGNATURE_MODE_BINARY + " ... signs the complete binary document"); - writer.println(" " + VALUE_SIGNATURE_MODE_TEXTUAL + " ... signs only the textual portion of the document"); - // @iaik: why is this commented out? - //writer.println(" " + VALUE_SIGNATURE_MODE_DETACHED + " ... signs the document using the binary mode and returns the xml signature of it."); - writer.println(" " + VALUE_SIGNATURE_MODE_DETACHED_TEXT + " ... signs the document using the textual mode and returns the xml signature of it."); + writer.println(" " + PARAMETER_SIGNATURE_MODE + " <" + VALUE_SIGNATURE_MODE_BINARY + "|" + VALUE_SIGNATURE_MODE_TEXTUAL + "> [optional]"); + writer.println(" " + VALUE_SIGNATURE_MODE_BINARY + " ... signs the complete binary document" + (Constants.DEFAULT_SIGNATURE_TYPE.equals(VALUE_SIGNATURE_MODE_BINARY) ? " (default)" : "")); + writer.println(" " + VALUE_SIGNATURE_MODE_TEXTUAL + " ... signs only the textual portion of the document" + (Constants.DEFAULT_SIGNATURE_TYPE.equals(VALUE_SIGNATURE_MODE_TEXTUAL) ? " (default)" : "")); + writer.println(" " + VALUE_SIGNATURE_MODE_DETACHED_TEXT + " ... signs the document using the textual mode and returns the xml signature of it." + (Constants.DEFAULT_SIGNATURE_TYPE.equals(VALUE_SIGNATURE_MODE_DETACHED_TEXT) ? " (default)" : "")); writer.print(" " + PARAMETER_SIGNATURE_TYPE + " <"); SignatureTypes sig_types = SignatureTypes.getInstance(); diff --git a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java index 0640b97..4cc6b69 100644 --- a/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java +++ b/src/main/java/at/gv/egiz/pdfas/impl/api/PdfAsObject.java @@ -656,8 +656,9 @@ public class PdfAsObject implements PdfAs if (spd != null && spd.getTablePos() != null){ fromPlaceholder = true; pos = spd.getTablePos(); - } else + } else { pos = PosHelper.formTablePos(signParameters.getSignaturePositioning()); + } if (pos != null && !pos.isWauto() && pos.getWidth() < 150) { // very small, warn user diff --git a/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java index c9d5cd7..b33c7f3 100644 --- a/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java +++ b/src/main/java/at/gv/egiz/pdfas/placeholder/SignaturePlaceholderExtractor.java @@ -266,30 +266,34 @@ public class SignaturePlaceholderExtractor extends PDFStreamEngine { String type = null; String sigKey = null; String id = null; - if (text != null && text.startsWith("PDF-AS-POS")) { - String[] data = text.split(";"); - if (data.length > 1) { - for (int i = 1; i < data.length; i++) { - String kvPair = data[i]; - String[] kv = kvPair.split("="); - if (kv.length != 2) { - log.debug("invalid parameter in placeholder data: " + kvPair); - } else { - if (kv[0].equalsIgnoreCase(SignaturePlaceholderData.ID_KEY)) { - id = kv[1]; - } else if (kv[0].equalsIgnoreCase(SignaturePlaceholderData.PROFILE_KEY)) { - profile = kv[1]; - } else if (kv[0] - .equalsIgnoreCase(SignaturePlaceholderData.SIG_KEY_KEY)) { - sigKey = kv[1]; - } else if (kv[0] - .equalsIgnoreCase(SignaturePlaceholderData.TYPE_KEY)) { - type = kv[1]; + if (text != null) { + if (text.startsWith(Constants.QR_PLACEHOLDER_IDENTIFIER)) { + String[] data = text.split(";"); + if (data.length > 1) { + for (int i = 1; i < data.length; i++) { + String kvPair = data[i]; + String[] kv = kvPair.split("="); + if (kv.length != 2) { + log.debug("Invalid parameter in placeholder data: " + kvPair); + } else { + if (kv[0].equalsIgnoreCase(SignaturePlaceholderData.ID_KEY)) { + id = kv[1]; + } else if (kv[0].equalsIgnoreCase(SignaturePlaceholderData.PROFILE_KEY)) { + profile = kv[1]; + } else if (kv[0] + .equalsIgnoreCase(SignaturePlaceholderData.SIG_KEY_KEY)) { + sigKey = kv[1]; + } else if (kv[0] + .equalsIgnoreCase(SignaturePlaceholderData.TYPE_KEY)) { + type = kv[1]; + } } } } + return new SignaturePlaceholderData(profile, type, sigKey, id); + } else { + log.warn("QR-Code found but does not start with \"" + Constants.QR_PLACEHOLDER_IDENTIFIER + "\". Ignoring QR placeholder."); } - return new SignaturePlaceholderData(profile, type, sigKey, id); } } catch (ReaderException re) { if (log.isDebugEnabled()) { -- cgit v1.2.3