From dd521f966cb23b6ff46d1b36ad946246d174b1ee Mon Sep 17 00:00:00 2001 From: FrodeBjerkholt Date: Wed, 5 Feb 2020 13:13:00 +0100 Subject: [PATCH 1/2] Issue #76 Mismatch of the digest of the attachment in the signature --- .../inbound/AbstractSetPolicyInterceptor.java | 5 ++++- .../as4/inbound/SetPolicyOutInterceptor.java | 20 ------------------- .../oxalis/as4/outbound/As4MessageSender.java | 2 ++ 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/main/java/no/difi/oxalis/as4/inbound/AbstractSetPolicyInterceptor.java b/src/main/java/no/difi/oxalis/as4/inbound/AbstractSetPolicyInterceptor.java index 4471c6c..d568c8f 100644 --- a/src/main/java/no/difi/oxalis/as4/inbound/AbstractSetPolicyInterceptor.java +++ b/src/main/java/no/difi/oxalis/as4/inbound/AbstractSetPolicyInterceptor.java @@ -10,7 +10,6 @@ import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.ws.policy.PolicyConstants; -import org.apache.cxf.ws.policy.PolicyInInterceptor; import org.apache.neethi.Policy; import org.oasis_open.docs.ebxml_msg.ebms.v3_0.ns.core._200704.Messaging; import org.oasis_open.docs.ebxml_msg.ebms.v3_0.ns.core._200704.UserMessage; @@ -23,6 +22,8 @@ import java.util.Optional; import java.util.stream.Stream; +import static org.apache.cxf.ws.security.SecurityConstants.USE_ATTACHMENT_ENCRYPTION_CONTENT_ONLY_TRANSFORM; + @Slf4j abstract class AbstractSetPolicyInterceptor extends AbstractSoapInterceptor { @@ -36,6 +37,8 @@ public AbstractSetPolicyInterceptor(String phase, PolicyService policyService) { @Override public void handleMessage(SoapMessage message) throws Fault { + message.put(USE_ATTACHMENT_ENCRYPTION_CONTENT_ONLY_TRANSFORM, true); + Optional userMessage = getMessaging(message) .map(Messaging::getUserMessage) .map(Collection::stream).orElseGet(Stream::empty) diff --git a/src/main/java/no/difi/oxalis/as4/inbound/SetPolicyOutInterceptor.java b/src/main/java/no/difi/oxalis/as4/inbound/SetPolicyOutInterceptor.java index f8fae4f..0ca16a4 100644 --- a/src/main/java/no/difi/oxalis/as4/inbound/SetPolicyOutInterceptor.java +++ b/src/main/java/no/difi/oxalis/as4/inbound/SetPolicyOutInterceptor.java @@ -3,29 +3,9 @@ import com.google.inject.Inject; import com.google.inject.Singleton; import lombok.extern.slf4j.Slf4j; -import no.difi.oxalis.as4.util.Constants; -import no.difi.oxalis.as4.util.Marshalling; import no.difi.oxalis.as4.util.PolicyService; -import org.apache.cxf.binding.soap.SoapMessage; -import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; -import org.apache.cxf.headers.Header; -import org.apache.cxf.interceptor.Fault; -import org.apache.cxf.message.Message; import org.apache.cxf.phase.Phase; -import org.apache.cxf.ws.policy.PolicyConstants; -import org.apache.cxf.ws.policy.PolicyInInterceptor; import org.apache.cxf.ws.policy.PolicyOutInterceptor; -import org.apache.neethi.Policy; -import org.oasis_open.docs.ebxml_msg.ebms.v3_0.ns.core._200704.Messaging; -import org.oasis_open.docs.ebxml_msg.ebms.v3_0.ns.core._200704.UserMessage; -import org.w3c.dom.Node; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import java.util.Collection; -import java.util.Optional; -import java.util.stream.Stream; @Slf4j @Singleton diff --git a/src/main/java/no/difi/oxalis/as4/outbound/As4MessageSender.java b/src/main/java/no/difi/oxalis/as4/outbound/As4MessageSender.java index dbc00b2..4aa84ff 100644 --- a/src/main/java/no/difi/oxalis/as4/outbound/As4MessageSender.java +++ b/src/main/java/no/difi/oxalis/as4/outbound/As4MessageSender.java @@ -41,6 +41,7 @@ import static no.difi.oxalis.as4.common.AS4Constants.CEF_CONFORMANCE; import static org.apache.cxf.rt.security.SecurityConstants.*; +import static org.apache.cxf.ws.security.SecurityConstants.USE_ATTACHMENT_ENCRYPTION_CONTENT_ONLY_TRANSFORM; @Slf4j public class As4MessageSender { @@ -117,6 +118,7 @@ private void configureSecurity(TransmissionRequest request, Dispatch prepareAttachments(TransmissionRequest request) throws OxalisAs4TransmissionException { From d31dc6c94049a43192f5ea67b959eb8355aec9cb Mon Sep 17 00:00:00 2001 From: FrodeBjerkholt Date: Wed, 5 Feb 2020 13:14:15 +0100 Subject: [PATCH 2/2] Setting 4.1.3 release version --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5c10238..dad4180 100755 --- a/pom.xml +++ b/pom.xml @@ -32,7 +32,7 @@ oxalis-as4 - 4.1.2 + 4.1.3 jar