diff options
author | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-11-29 14:32:04 +0000 |
---|---|---|
committer | pdanner <pdanner@7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c> | 2010-11-29 14:32:04 +0000 |
commit | 56f8680bd81892ec7cfe4e346f98ecfe23651caf (patch) | |
tree | 95aa7b5c2d3306faf113081ac7811df381e4da1f | |
parent | 690218d811d7915d636703c27428515aaa6a5c56 (diff) | |
download | pdf-as-3-56f8680bd81892ec7cfe4e346f98ecfe23651caf.tar.gz pdf-as-3-56f8680bd81892ec7cfe4e346f98ecfe23651caf.tar.bz2 pdf-as-3-56f8680bd81892ec7cfe4e346f98ecfe23651caf.zip |
improved prepareVerifyRequest to disable "default verify"
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@640 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c
-rw-r--r-- | src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/bku/DetachedBKUConnector.java | 51 |
1 files changed, 29 insertions, 22 deletions
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 c55e727..dcb758d 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 @@ -324,7 +324,7 @@ public class DetachedBKUConnector implements Connector, LocalConnector String verify_request_template = this.environment.getVerifyRequestTemplate();
String xml_content = null;
-
+
if (dsigData != null && dsigData.getXmlDsig() != null)
{
xml_content = dsigData.getXmlDsig();
@@ -333,6 +333,8 @@ public class DetachedBKUConnector implements Connector, LocalConnector {
xml_content = chooseAndCreateXMLDsig(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());
@@ -340,37 +342,42 @@ public class DetachedBKUConnector implements Connector, LocalConnector return verify_request_xml;
}
-
- private String chooseAndCreateXMLDsig(SignatureData data, SignSignatureObject so) throws ConnectorException {
- // MOA
+
+ private String chooseAndCreateXMLDsig(SignatureData data, SignSignatureObject so) throws ConnectorException {
+ // MOA
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");
return moa_conn.prepareXMLContent(data, so);
- // MOCCA
- } else if (SigKZIDHelper.isMOCCASigned(so)) {
- log.debug("MOCCA signature detected.");
- String algorithmId = SigKZIDHelper.parseAlgorithmId(so.id);
- log.debug("Algorithm = " + algorithmId);
- LocRefDetachedMOCCAConnector mocca_connector = new LocRefDetachedMOCCAConnector(this.params, "not needed here", algorithmId);
- return mocca_connector.prepareXMLContent(data, so);
- // ATRUST
- } else if (SigKZIDHelper.isATrustSigned(so)) {
- log.debug("ATrust signature detected");
- MOASoapWithAttachmentConnector moaConn = new MOASoapWithAttachmentConnector(this.params);
- moaConn.reInitVerifyTemplate(MOASoapWithAttachmentConnector.ATRUST_VERIFY_TEMPLATE_KEY);
- return moaConn.prepareXMLContent(data, so);
- }
+
+ // MOCCA
+ } else if (SigKZIDHelper.isMOCCASigned(so)) {
+ log.debug("MOCCA signature detected.");
+ String algorithmId = SigKZIDHelper.parseAlgorithmId(so.id);
+ log.debug("Algorithm = " + algorithmId);
+ LocRefDetachedMOCCAConnector mocca_connector = new LocRefDetachedMOCCAConnector(this.params, "not needed here", algorithmId);
+ return mocca_connector.prepareXMLContent(data, so);
+
+ // ATRUST
+ } else if (SigKZIDHelper.isATrustSigned(so)) {
+ log.debug("ATrust signature detected");
+ MOASoapWithAttachmentConnector moaConn = new MOASoapWithAttachmentConnector(this.params);
+ moaConn.reInitVerifyTemplate(MOASoapWithAttachmentConnector.ATRUST_VERIFY_TEMPLATE_KEY);
+ return moaConn.prepareXMLContent(data, so);
+ }
// TD
- else
- {
+ else if (SigKZIDHelper.isBKUSigned(so)) {
log.debug("TD signature signature detected.");
return prepareXMLContent(data, so);
+ }
+ // unknown
+ else {
+ throw new ConnectorException(ErrorCode.UNSUPPORTED_SIGNATURE_METHOD, "unsupported signature, get a new pdf-as version. " + so.id + ", " +so.kz);
}
- }
+ }
-/**
+ /**
* Prepares the XML content the holds the actual signature data.
*
* <p>
|