From c6951feaf46d85fefc3a30d85c21ba09783a3a2b Mon Sep 17 00:00:00 2001 From: knowcenter Date: Tue, 17 Jul 2007 13:02:06 +0000 Subject: git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@133 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../knowcenter/wag/egov/egiz/commandline/Main.java | 1 + .../egov/egiz/sig/connectors/ConnectorChooser.java | 20 +++++++++++++++++--- .../sig/connectors/bku/DetachedBKUConnector.java | 22 +++++++++++----------- .../connectors/moa/DetachedLocRefMOAConnector.java | 4 ++-- .../wag/egov/egiz/sig/sigkz/SigKZIDHelper.java | 5 +++++ 5 files changed, 36 insertions(+), 16 deletions(-) (limited to 'src/main/java/at/knowcenter') 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 989bbd4..65c30b9 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 @@ -547,6 +547,7 @@ public abstract class Main List holders_to_verify = signature_holders; + // verify_which - optional argument in command line/web if (verify_which >= 0) { if (verify_which >= signature_holders.size()) diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java index 4c63ebf..32dcb72 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java @@ -249,6 +249,7 @@ public final class ConnectorChooser throw new ConnectorException(300, "The SIG_KZ version is 1.0.0, but SIG_ID is neither MOA nor Old base64 nor Hotfix base64 ???'"); } + if (sig_kz.getVersion().equals(SignatorFactory.VERSION_1_1_0)) { log.debug("Version is 1.1.0 -> chose a detached connector."); @@ -314,9 +315,22 @@ public final class ConnectorChooser { log.debug("sig_app is MOA ==> DetachedMOAConnector"); //$NON-NLS-1$ - String msg = "A Detached signature cannot be verified with the MOA connector (yet)."; //$NON-NLS-1$ - log.error(msg); - throw new ConnectorException(370, msg); + try + { + if(SettingsReader.getInstance().getValueFromKey(MOA_CMD_LINE_SUPPORTED_KEY).equals("false")) + { + String msg = "A Detached signature cannot be verified with the MOA connector (yet)."; //$NON-NLS-1$ + log.error(msg); + throw new ConnectorException(370, msg); + } else + { + // TODO: replace hardcoded constants + return new DetachedLocRefMOAConnector(profile, "formdata:fileupload"); + } + } catch (SettingsException e) + { + e.printStackTrace(); + } } throw new ConnectorException(310, "Unknown sig_app '" + sig_app + "'."); //$NON-NLS-1$ //$NON-NLS-2$ } diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java index 4895dd8..a48b04c 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java @@ -295,16 +295,16 @@ public class DetachedBKUConnector implements Connector, LocalConnector String verify_request_template = this.environment.getVerifyRequestTemplate(); String xml_content = null; - if (SigKZIDHelper.isMOASigned(so)) - { - log.debug("The signature is MOA signed -> getting XML content from DetachedLocRefMOA connector."); - DetachedLocRefMOAConnector moa_conn = new DetachedLocRefMOAConnector(this.environment.getProfile(), "loc ref not needed here"); - xml_content = moa_conn.prepareXMLContent(data, so); - } - else - { +// if (SigKZIDHelper.isMOASigned(so)) +// { +// log.debug("The signature is MOA signed -> getting XML content from DetachedLocRefMOA connector."); +// DetachedLocRefMOAConnector moa_conn = new DetachedLocRefMOAConnector(this.environment.getProfile(), "loc ref not needed here"); +// xml_content = moa_conn.prepareXMLContent(data, so); +// } +// else +// { xml_content = prepareXMLContent(data, so); - } +// } String verify_request_xml = verify_request_template.replaceFirst(TemplateReplaces.XML_CONTENT_REPLACE, xml_content); verify_request_xml = verify_request_xml.replaceFirst(TemplateReplaces.LOC_REF_CONTENT_REPLACE, this.environment.getLocRefContent()); @@ -460,12 +460,12 @@ public class DetachedBKUConnector implements Connector, LocalConnector /** * The configuration key of the verify request template. */ - protected static final String VERIFY_REQUEST_TEMPLATE_KEY = "bku.verify.request.detached"; //$NON-NLS-1$ + protected static final String VERIFY_REQUEST_TEMPLATE_KEY = "bku.verify.request.template"; //$NON-NLS-1$ /** * The configuration key of the verify template. */ - protected static final String VERIFY_TEMPLATE_KEY = "bku.verify.template.detached"; //$NON-NLS-1$ + protected static final String VERIFY_TEMPLATE_KEY = "bku.verify.request.template.keys"; //$NON-NLS-1$ /** * The configuration key of the verify URL. diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java index eca728f..eeb242f 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/DetachedLocRefMOAConnector.java @@ -326,12 +326,12 @@ public class DetachedLocRefMOAConnector implements Connector /** * The configuration key of the verify request template. */ - protected static final String VERIFY_REQUEST_TEMPLATE_KEY = "moa.verify.request.detached"; //$NON-NLS-1$ + protected static final String VERIFY_REQUEST_TEMPLATE_KEY = "moa.verify.request.template"; //$NON-NLS-1$ /** * The configuration key of the verify template. */ - protected static final String VERIFY_TEMPLATE_KEY = "moa.verify.template.detached"; //$NON-NLS-1$ + protected static final String VERIFY_TEMPLATE_KEY = "moa.verify.request.template.keys"; //$NON-NLS-1$ /** * The configuration key of the verify URL. diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigkz/SigKZIDHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigkz/SigKZIDHelper.java index 7260063..8a831bd 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigkz/SigKZIDHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/sigkz/SigKZIDHelper.java @@ -4,6 +4,7 @@ package at.knowcenter.wag.egov.egiz.sig.sigkz; import at.knowcenter.wag.egov.egiz.PdfASID; +import at.knowcenter.wag.egov.egiz.cfg.SettingsReader; import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException; import at.knowcenter.wag.egov.egiz.exceptions.InvalidIDException; import at.knowcenter.wag.egov.egiz.framework.SignatorFactory; @@ -46,6 +47,10 @@ public final class SigKZIDHelper return sig_id == null; } + // new signatures may or may not have the SIG_ID value + if(sig_id == null) + return true; + // new signature - sig_id decides String [] ids = sig_id.split("@"); String prefix = ids[0]; -- cgit v1.2.3