aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authornetconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-01-25 14:26:54 +0000
committernetconomy <netconomy@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2008-01-25 14:26:54 +0000
commit7404b3f95c03d9c872d32e9fff73a394081a80ff (patch)
tree1468cf81836c1222532534db167c83df7036916e /src/main
parent877758d9ec4deb53aad8a6c1d8669cc7186b1a48 (diff)
downloadpdf-as-3-7404b3f95c03d9c872d32e9fff73a394081a80ff.tar.gz
pdf-as-3-7404b3f95c03d9c872d32e9fff73a394081a80ff.tar.bz2
pdf-as-3-7404b3f95c03d9c872d32e9fff73a394081a80ff.zip
RHID und VTime für EnvelopingBase64MOAConnector
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@249 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/at/gv/egiz/pdfas/framework/ConnectorFactory.java3
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/ConnectorChooser.java13
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java62
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/EnvelopingBase64MOAConnector.java20
4 files changed, 60 insertions, 38 deletions
diff --git a/src/main/java/at/gv/egiz/pdfas/framework/ConnectorFactory.java b/src/main/java/at/gv/egiz/pdfas/framework/ConnectorFactory.java
index 99d692e..a430518 100644
--- a/src/main/java/at/gv/egiz/pdfas/framework/ConnectorFactory.java
+++ b/src/main/java/at/gv/egiz/pdfas/framework/ConnectorFactory.java
@@ -9,7 +9,6 @@ import at.knowcenter.wag.egov.egiz.sig.connectors.Connector;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.EnvelopedBase64BKUConnector;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.MultipartDetachedBKUConnector;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.OldEnvelopingBase64BKUConnector;
-import at.knowcenter.wag.egov.egiz.sig.connectors.moa.DetachedLocRefMOAConnector;
import at.knowcenter.wag.egov.egiz.sig.connectors.moa.EnvelopingBase64MOAConnector;
import at.knowcenter.wag.egov.egiz.sig.connectors.moa.MOASoapWithAttachmentConnector;
@@ -60,7 +59,7 @@ public class ConnectorFactory
if (connectorId.equals(ENVELOPING_BASE64_MOA_CONNECTOR))
{
// TODO Hier wird NICHT der neue Connector verwendet
- return new EnvelopingBase64MOAConnector(connectorParameters.getProfileId());
+ return new EnvelopingBase64MOAConnector(connectorParameters);
// return new MOASoapWithAttachmentConnector(profile);
}
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 cbdee42..e991e04 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
@@ -14,7 +14,6 @@ import at.knowcenter.wag.egov.egiz.sig.connectors.bku.EnvelopedBase64BKUConnecto
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.LocRefDetachedBKUConnector;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.MultipartDetachedBKUConnector;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.OldEnvelopingBase64BKUConnector;
-import at.knowcenter.wag.egov.egiz.sig.connectors.moa.DetachedLocRefMOAConnector;
import at.knowcenter.wag.egov.egiz.sig.connectors.moa.EnvelopingBase64MOAConnector;
import at.knowcenter.wag.egov.egiz.sig.connectors.moa.MOASoapWithAttachmentConnector;
import at.knowcenter.wag.egov.egiz.sig.sigid.HotfixIdFormatter;
@@ -178,7 +177,9 @@ public final class ConnectorChooser
{
log.debug("sig_kz is null or sig_kz version is 1.0.0 -> choosing Base64 connector.");
- return new EnvelopingBase64MOAConnector(profile);
+ ConnectorParameters cp = new ConnectorParameters();
+ cp.setProfileId(profile);
+ return new EnvelopingBase64MOAConnector(cp);
}
if (sig_kz.getVersion().equals(SignatorFactory.VERSION_1_1_0))
@@ -270,7 +271,9 @@ public final class ConnectorChooser
{
log.debug("sig_app is MOA ==> EnvelopingBase64MOAConnector"); //$NON-NLS-1$
- return new EnvelopingBase64MOAConnector(profile);
+ ConnectorParameters cp = new ConnectorParameters();
+ cp.setProfileId(profile);
+ return new EnvelopingBase64MOAConnector(cp);
}
throw new ConnectorException(310, "Unknown sig_app '" + sig_app + "'."); //$NON-NLS-1$ //$NON-NLS-2$
@@ -289,7 +292,9 @@ public final class ConnectorChooser
{
log.debug("sig_app is MOA ==> EnvelopedBase64MOAConnector"); //$NON-NLS-1$
- return new EnvelopingBase64MOAConnector(profile);
+ ConnectorParameters cp = new ConnectorParameters();
+ cp.setProfileId(profile);
+ return new EnvelopingBase64MOAConnector(cp);
}
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/EnvelopedBase64BKUConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java
index 82ec9bd..742a9a8 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java
@@ -11,6 +11,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import at.gv.egiz.pdfas.exceptions.ErrorCode;
+import at.gv.egiz.pdfas.framework.ConnectorParameters;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
@@ -24,7 +25,6 @@ import at.knowcenter.wag.egov.egiz.sig.connectors.moa.EnvelopingBase64MOAConnect
import at.knowcenter.wag.egov.egiz.sig.sigid.HotfixIdFormatter;
import at.knowcenter.wag.egov.egiz.sig.sigkz.SigKZIDHelper;
import at.knowcenter.wag.egov.egiz.tools.CodingHelper;
-import at.knowcenter.wag.egov.egiz.tools.DebugHelper;
import at.knowcenter.wag.egov.egiz.tools.FileHelper;
/**
@@ -111,34 +111,34 @@ public class EnvelopedBase64BKUConnector implements Connector, LocalConnector
return signature_response;
}
- /**
- * This emthod extracts id-values from a text. The id is given by the name.
- *
- * @param text
- * the id-value that should extract from
- * @param name
- * the id-key
- * @return the value of the given key in the text
- */
- private String extractId(String text, String name)
- {
- String id = null;
- int start_idx = text.indexOf(name) + name.length();
- int end_idx = text.indexOf("\"", start_idx);
-
- // TODO hotfix!
- final int quot_end_idx = end_idx;
- final int squot_end_idx = text.indexOf("'", start_idx);
- end_idx = Math.min(quot_end_idx, squot_end_idx);
- // TODO hotfix end!
-
- id = text.substring(start_idx, end_idx);
- if (log.isDebugEnabled())
- {
- log.debug("extract id:" + name + id);
- }
- return id;
- }
+// /**
+// * This emthod extracts id-values from a text. The id is given by the name.
+// *
+// * @param text
+// * the id-value that should extract from
+// * @param name
+// * the id-key
+// * @return the value of the given key in the text
+// */
+// private String extractId(String text, String name)
+// {
+// String id = null;
+// int start_idx = text.indexOf(name) + name.length();
+// int end_idx = text.indexOf("\"", start_idx);
+//
+// // TODO hotfix!
+// final int quot_end_idx = end_idx;
+// final int squot_end_idx = text.indexOf("'", start_idx);
+// end_idx = Math.min(quot_end_idx, squot_end_idx);
+// // TODO hotfix end!
+//
+// id = text.substring(start_idx, end_idx);
+// if (log.isDebugEnabled())
+// {
+// log.debug("extract id:" + name + id);
+// }
+// return id;
+// }
/**
* Prepares the XML content the holds the actual signature data.
@@ -301,7 +301,9 @@ public class EnvelopedBase64BKUConnector implements Connector, LocalConnector
if (SigKZIDHelper.isMOASigned(so))
{
log.debug("The signature is MOA signed -> getting XML content from Base64MOA connector.");
- EnvelopingBase64MOAConnector moa_conn = new EnvelopingBase64MOAConnector(this.environment.getProfile());
+ ConnectorParameters cp = new ConnectorParameters();
+ cp.setProfileId(this.environment.getProfile());
+ EnvelopingBase64MOAConnector moa_conn = new EnvelopingBase64MOAConnector(cp);
xml_content = moa_conn.prepareXMLContent(data, so);
}
else
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/EnvelopingBase64MOAConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/EnvelopingBase64MOAConnector.java
index c8a8717..7d58d79 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/EnvelopingBase64MOAConnector.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/EnvelopingBase64MOAConnector.java
@@ -9,6 +9,7 @@ import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import at.gv.egiz.pdfas.framework.ConnectorParameters;
import at.knowcenter.wag.egov.egiz.cfg.SettingsReader;
import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
import at.knowcenter.wag.egov.egiz.exceptions.SettingsException;
@@ -42,6 +43,8 @@ public class EnvelopingBase64MOAConnector implements Connector
* other configurable elements.
*/
protected Environment environment = null;
+
+ protected ConnectorParameters params = null;
/**
* Constructor that builds the configuration environment for this connector
@@ -57,9 +60,10 @@ public class EnvelopingBase64MOAConnector implements Connector
* @throws ConnectorException
* f.e.
*/
- public EnvelopingBase64MOAConnector(String profile) throws ConnectorException
+ public EnvelopingBase64MOAConnector(ConnectorParameters connectorParameters) throws ConnectorException
{
- this.environment = new Environment(profile);
+ this.params = connectorParameters;
+ this.environment = new Environment(connectorParameters.getProfileId());
}
/**
@@ -181,6 +185,18 @@ public class EnvelopingBase64MOAConnector implements Connector
String verify_request_xml = verify_request_template.replaceFirst(TemplateReplaces.XML_CONTENT_REPLACE, xml_content);
verify_request_xml = verify_request_xml.replaceFirst(TemplateReplaces.TRUST_PROFILE_ID_REPLACE, this.environment.getVerifyTrustProfileId());
+ String returnHashInputDataElement = "";
+ if (this.params.isReturnHashInputData())
+ {
+ returnHashInputDataElement = MOASoapWithAttachmentConnector.RETURN_HASH_INPUT_DATA;
+ }
+ verify_request_xml = verify_request_xml.replaceFirst(TemplateReplaces.RETURN_HASH_INPUT_DATA_REPLACE, returnHashInputDataElement);
+
+ verify_request_xml = verify_request_xml.replaceFirst(TemplateReplaces.DATE_TIME_REPLACE, BKUHelper.formDateTimeElement(this.params.getVerificationTime()));
+
+
+ log.debug("\r\n\r\n" + verify_request_xml + "\r\n\r\n");
+
return verify_request_xml;
}