aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-11-02 09:20:14 +0000
committerferbas <ferbas@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c>2009-11-02 09:20:14 +0000
commit3286713dfe8f1a63178a5f6f9ff68ebd4d3ada4f (patch)
treecc0a9aef662fc032747a161c572fae2163df7cc1
parentd1d5c8bfbcc62967b7884a61b16b38a24cc2a366 (diff)
downloadpdf-as-3-3286713dfe8f1a63178a5f6f9ff68ebd4d3ada4f.tar.gz
pdf-as-3-3286713dfe8f1a63178a5f6f9ff68ebd4d3ada4f.tar.bz2
pdf-as-3-3286713dfe8f1a63178a5f6f9ff68ebd4d3ada4f.zip
dynamic algorithm support, compatibility mode
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@378 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java14
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java2
-rw-r--r--src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/EnvelopedBase64BKUConnector.java2
3 files changed, 15 insertions, 3 deletions
diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java
index b5d7cc3..3b262c3 100644
--- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java
+++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/BKUHelper.java
@@ -22,6 +22,7 @@ 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.gv.egiz.pdfas.api.commons.Constants;
import at.gv.egiz.pdfas.exceptions.external.ExternalErrorException;
@@ -31,6 +32,7 @@ import at.knowcenter.wag.egov.egiz.sig.SignatureData;
import at.knowcenter.wag.egov.egiz.sig.SignatureObject;
import at.knowcenter.wag.egov.egiz.sig.SignatureResponse;
import at.knowcenter.wag.egov.egiz.sig.X509Cert;
+import at.knowcenter.wag.egov.egiz.sig.connectors.ConnectorEnvironment;
import at.knowcenter.wag.egov.egiz.sig.sigid.IdFormatter;
import at.knowcenter.wag.egov.egiz.tools.CodingHelper;
@@ -162,7 +164,7 @@ public final class BKUHelper
* @see X509Cert
*/
public static SignSignatureObject parseCreateXMLResponse(String xmlResponse,
- IdFormatter id_formatter) throws ConnectorException
+ IdFormatter id_formatter, ConnectorEnvironment environment) throws ConnectorException
{
if (log.isDebugEnabled()) {
log.debug("xmlResponse = " + xmlResponse);
@@ -326,6 +328,16 @@ public final class BKUHelper
so.issuer = iss_nam;
so.signatureValue = sig_val;
so.x509Certificate = cert;
+
+ 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);
so.id = final_ids;
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 db47233..abed090 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
@@ -143,7 +143,7 @@ public class DetachedBKUConnector implements Connector, LocalConnector
BKUHelper.checkResponseForError(response_string);
- SignSignatureObject so = sigLayout.parseCreateXMLSignatureResponse(response_string);
+ SignSignatureObject so = sigLayout.parseCreateXMLSignatureResponse(response_string, this.environment);
so.response_properties = response_properties;
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 3d48865..ee8ea6e 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
@@ -368,7 +368,7 @@ public class EnvelopedBase64BKUConnector implements Connector, LocalConnector
String bkuIdentifier = BKUHelper.getBKUIdentifier(response_properties);
log.debug("BKU identifier: \"" + bkuIdentifier + "\"");
- SignSignatureObject so = BKUHelper.parseCreateXMLResponse(response_string, new HotfixIdFormatter());
+ SignSignatureObject so = BKUHelper.parseCreateXMLResponse(response_string, new HotfixIdFormatter(), this.environment);
log.debug("analyzeSignResponse finished."); //$NON-NLS-1$
return so;