From 8f2a983cb8e9be9e71e3df04edd00a4bc0673862 Mon Sep 17 00:00:00 2001 From: knowcenter Date: Fri, 18 May 2007 15:42:55 +0000 Subject: detached connectors git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@92 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../knowcenter/wag/egov/egiz/commandline/Main.java | 32 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) (limited to 'src/main/java/at/knowcenter/wag/egov/egiz/commandline') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java index 614005e..73ee69a 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/commandline/Main.java @@ -45,7 +45,9 @@ import at.knowcenter.wag.egov.egiz.exceptions.SignatureTypesException; import at.knowcenter.wag.egov.egiz.framework.SignResult; import at.knowcenter.wag.egov.egiz.framework.SignatorFactory; import at.knowcenter.wag.egov.egiz.framework.VerificationFilter; +import at.knowcenter.wag.egov.egiz.framework.signators.BinarySignator_1_0_0; import at.knowcenter.wag.egov.egiz.framework.signators.DetachedSignator_1_0_0; +import at.knowcenter.wag.egov.egiz.framework.signators.TextualSignator_1_0_0; import at.knowcenter.wag.egov.egiz.pdf.SignatureHolder; import at.knowcenter.wag.egov.egiz.pdf.TablePos; import at.knowcenter.wag.egov.egiz.sig.ConnectorFactory; @@ -126,7 +128,7 @@ public abstract class Main * The application mode verify */ public static final String VALUE_SIGNATURE_MODE_DETACHED = "detached"; - + /** * The application mode verify */ @@ -470,6 +472,26 @@ public abstract class Main } PdfASID algorithm = translateSignatureModeToPdfASID(signature_mode); + + // TODO MOA detached signing is not allowed at the commandline + logger_.debug("Suggested sign algorithm = " + algorithm); + if (connector.equals("moa")) + { + String msg = "Hinweis: Der MOA Detached Connector ist für die Kommandozeile nicht geeignet. Die Signatur wird daher im alten Base64 enveloping Format ausgeführt."; + System.out.println(msg); + logger_.warn(msg); + + if (signature_mode.equals(VALUE_SIGNATURE_MODE_BINARY)) + { + algorithm = BinarySignator_1_0_0.MY_ID; + } + if (signature_mode.equals(VALUE_SIGNATURE_MODE_TEXTUAL)) + { + algorithm = TextualSignator_1_0_0.MY_ID; + } + } + logger_.debug("Finally used sign algorithm = " + algorithm); + SignResult sign_result = PdfAS.sign(algorithm, input_bytes, signature_type, connector, user_name, user_password, pos); try @@ -770,12 +792,12 @@ public abstract class Main writer.println(" y_algo:='auto' ... automatic positioning y"); writer.println(" floatvalue ... absolute y must be >= 0"); writer.println(" w_algo:='auto' ... automatic width"); - writer.println(" floatvalue ... absolute width must be > 0"); + writer.println(" floatvalue ... absolute width must be > 0"); writer.println(" p_algo:='auto' ... automatic last page"); - writer.println(" 'new' ... new page"); + writer.println(" 'new' ... new page"); writer.println(" intvalue ... pagenumber must be > 0 if p>number of pages in document p-->handled like p:'new'"); writer.println(" f_algo floatvalue ... consider footerline must be >= 0 (only if y_algo is auto and p_algo is not 'new')"); - + writer.println(" OPTIONS for verification:"); writer.println(" " + PARAMETER_VERIFY_WHICH + " ... [optional] zero based number of the signature"); writer.println(" to be verified. If omitted, all signatures are verified."); @@ -870,7 +892,7 @@ public abstract class Main if (signature_mode.equals(VALUE_SIGNATURE_MODE_DETACHED_TEXt)) { return SignatorFactory.MOST_RECENT_DETACHEDTEXT_SIGNATOR_ID; - } + } return null; } -- cgit v1.2.3