From 706da250618d8ac75364388718edff77cd59e3df Mon Sep 17 00:00:00 2001 From: pdanner Date: Mon, 29 Nov 2010 14:32:32 +0000 Subject: improved prepareVerifyRequest to disable "default verify" git-svn-id: https://joinup.ec.europa.eu/svn/pdf-as/trunk@642 7b5415b0-85f9-ee4d-85bd-d5d0c3b42d1c --- .../moa/MOASoapWithAttachmentConnector.java | 57 ++++++++++++---------- 1 file changed, 30 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java index 1d310cf..a111ca5 100644 --- a/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java +++ b/src/main/java/at/knowcenter/wag/egov/egiz/sig/connectors/moa/MOASoapWithAttachmentConnector.java @@ -214,36 +214,39 @@ public class MOASoapWithAttachmentConnector implements Connector return verify_request_xml; } - private String chooseAndCreateXMLDsig(SignatureData data, SignSignatureObject so) throws ConnectorException { + private String chooseAndCreateXMLDsig(SignatureData data, SignSignatureObject so) throws ConnectorException { // MOA - if (SigKZIDHelper.isMOASigned(so)) { - log.debug("MOA signature detected."); - return 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("A-Trust signature detected."); - this.environment.reInitVerifyTemplate(ATRUST_VERIFY_TEMPLATE_KEY); - return prepareXMLContent(data, so); - - // TD - } else { - log.debug("TD signature signature detected."); - DetachedBKUConnector bku_connector = new DetachedBKUConnector(this.params, "not needed here"); - return bku_connector.prepareXMLContent(data, so); - } + if (SigKZIDHelper.isMOASigned(so)) { + log.debug("MOA signature detected."); + return 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("A-Trust signature detected."); + this.environment.reInitVerifyTemplate(ATRUST_VERIFY_TEMPLATE_KEY); + return prepareXMLContent(data, so); + + // TD bku + } else if (SigKZIDHelper.isBKUSigned(so)) { + log.debug("TD bku signature detected."); + DetachedBKUConnector bku_connector = new DetachedBKUConnector(this.params, "not needed here"); + return bku_connector.prepareXMLContent(data, so); + } else { + throw new ConnectorException(ErrorCode.UNSUPPORTED_SIGNATURE_METHOD, "unsupported signature, get a new pdf-as version. " + so.id + ", " +so.kz); + + } } - -/** + + /** * Analyzes the verify response string. * * @param response_properties -- cgit v1.2.3