diff options
author | ferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-11-02 09:21:12 +0000 |
---|---|---|
committer | ferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2009-11-02 09:21:12 +0000 |
commit | f7fcf33ac95f498238e5e79059e2aaf05f659fd6 (patch) | |
tree | 656bb9ab869d64299f01e65aa06ed4dd4f8dc938 /src/main | |
parent | a99904402ba043319f7fd2d6db9edb76320800a4 (diff) | |
download | pdf-as-3-f7fcf33ac95f498238e5e79059e2aaf05f659fd6.tar.gz pdf-as-3-f7fcf33ac95f498238e5e79059e2aaf05f659fd6.tar.bz2 pdf-as-3-f7fcf33ac95f498238e5e79059e2aaf05f659fd6.zip |
dynamic algorithm support, compatibility mode
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@380 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java | 2 | ||||
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/MOCCAHelper.java | 21 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java index a16dbf8..4b91328 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/LocRefDetachedMOCCAConnector.java @@ -146,7 +146,7 @@ public class LocRefDetachedMOCCAConnector implements Connector, LocalConnector { BKUHelper.checkResponseForError(response_string);
// SignSignatureObject so = MOCCAHelper.parseCreateXMLResponse(response_string, new DetachedMOCIdFormatter());
- SignSignatureObject so = sigLayout.parseCreateXMLSignatureResponse(response_string);
+ SignSignatureObject so = sigLayout.parseCreateXMLSignatureResponse(response_string, this.environment);
so.response_properties = response_properties;
log.debug("analyzeSignResponse finished.");
return so;
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/MOCCAHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/MOCCAHelper.java index 1a68eca..6f4bc65 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/MOCCAHelper.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/mocca/MOCCAHelper.java @@ -13,12 +13,16 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
+import at.gv.egiz.pdfas.algorithmSuite.AlgorithmMapper;
+import at.gv.egiz.pdfas.algorithmSuite.AlgorithmSuiteObject;
import at.gv.egiz.pdfas.algorithmSuite.AlgorithmSuiteUtil;
import at.knowcenter.wag.egov.egiz.exceptions.ConnectorException;
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
import at.knowcenter.wag.egov.egiz.sig.X509Cert;
+import at.knowcenter.wag.egov.egiz.sig.connectors.ConnectorEnvironment;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.BKUHelper;
import at.knowcenter.wag.egov.egiz.sig.connectors.bku.SignSignatureObject;
+import at.knowcenter.wag.egov.egiz.sig.connectors.moa.MOASoapWithAttachmentConnector.Environment;
import at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter;
import at.knowcenter.wag.egov.egiz.tools.CodingHelper;
@@ -50,7 +54,7 @@ public final class MOCCAHelper { * @see CodingHelper
* @see X509Cert
*/
- public final static SignSignatureObject parseCreateXMLResponse(String xmlResponse, IdFormatter id_formatter) throws ConnectorException {
+ public final static SignSignatureObject parseCreateXMLResponse(String xmlResponse, IdFormatter id_formatter, ConnectorEnvironment environment) throws ConnectorException {
if (log.isDebugEnabled()) {
log.debug("xmlResponse = " + xmlResponse);
@@ -137,13 +141,26 @@ public final class MOCCAHelper { log.debug("ser number matches = " + cert.getSerialNumber().toString().equals(ser_num));
}
+ SignSignatureObject so = new SignSignatureObject();
+
// extract Signature Id's
String[] ids = extractIds(xmlResponse);
// dferbas
String algs = AlgorithmSuiteUtil.extractAlgorithmSuiteString(xmlResponse);
+
+ AlgorithmSuiteObject suite = new AlgorithmSuiteObject(algs, false);
+ so.sigAlgorithm = AlgorithmMapper.getUri(suite.getSignatureMethod());
+
+ String defaultCertAlg = environment.getDefaultAlgForCert(cert);
+
+ if (AlgorithmSuiteUtil.isDefaultCertAlg(algs, defaultCertAlg)) {
+ // do not embed default alg
+ algs = null;
+ }
+
String final_ids = id_formatter.formatIds(ids, algs);
- SignSignatureObject so = new SignSignatureObject();
+
so.date = sig_tim;
so.issuer = iss_nam;
so.signatureValue = sig_val;
|