This is an automated email from the ASF dual-hosted git repository.
ffang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/main by this push:
new 354f09f05e [CXF-8981] Added unit tests for key agreement method
(#1715)
354f09f05e is described below
commit 354f09f05ef61722e9d62f5c6c4fb777d7ef9c97
Author: jrihtarsic <[email protected]>
AuthorDate: Tue Mar 5 14:55:06 2024 +0100
[CXF-8981] Added unit tests for key agreement method (#1715)
* [CXF-8981] Added unit tests for key agreement method with WSS4j
interceptors
* Add documentation to WSS4JInOutWithAttachmentsTest
* Ensure that added tests builds with JDK 11+
---------
Co-authored-by: RIHTARSIC Joze <[email protected]>
---
.../ws/security/wss4j/AbstractSecurityTest.java | 9 +
.../cxf/ws/security/wss4j/TestPwdCallback.java | 5 +
.../cxf/ws/security/wss4j/WSS4JInOutTest.java | 86 ++++++
.../wss4j/WSS4JInOutWithAttachmentsTest.java | 289 +++++++++++++++++++++
.../cxf/ws/security/wss4j/edeliver-as4-clean.xml | 62 +++++
rt/ws/security/src/test/resources/wss-ecdh.p12 | Bin 0 -> 8299 bytes
.../src/test/resources/wss-ecdh.properties | 4 +
7 files changed, 455 insertions(+)
diff --git
a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
index 3e06e36783..d62b314520 100644
---
a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
+++
b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/AbstractSecurityTest.java
@@ -171,4 +171,13 @@ public abstract class AbstractSecurityTest extends
AbstractCXFTest {
}
}
}
+
+ protected int getJDKVersion() {
+ try {
+ return Integer.getInteger("java.specification.version", 0);
+ } catch (NumberFormatException ex) {
+ // ignore
+ }
+ return 0;
+ }
}
diff --git
a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/TestPwdCallback.java
b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/TestPwdCallback.java
index eb233a9ab6..1ad166fcd8 100644
---
a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/TestPwdCallback.java
+++
b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/TestPwdCallback.java
@@ -36,6 +36,11 @@ public class TestPwdCallback implements CallbackHandler {
passwords.put("myalias", "myAliasPassword");
passwords.put("alice", "alicePassword");
passwords.put("username", "myAliasPassword");
+ passwords.put("x448", "security");
+ passwords.put("x25519", "security");
+ passwords.put("secp256r1", "security");
+ passwords.put("secp384r1", "security");
+ passwords.put("secp521r1", "security");
}
public void handle(Callback[] callbacks) throws IOException,
UnsupportedCallbackException {
diff --git
a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
index bd3488a6b3..9404bfd78f 100644
---
a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
+++
b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutTest.java
@@ -55,7 +55,10 @@ import org.apache.wss4j.dom.WSDataRef;
import org.apache.wss4j.dom.engine.WSSecurityEngineResult;
import org.apache.wss4j.dom.handler.WSHandlerConstants;
import org.apache.wss4j.dom.handler.WSHandlerResult;
+import org.apache.xml.security.utils.Constants;
+import org.apache.xml.security.utils.EncryptionConstants;
+import org.junit.Assume;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -70,6 +73,9 @@ import static org.junit.Assert.fail;
public class WSS4JInOutTest extends AbstractSecurityTest {
public WSS4JInOutTest() {
+ // add xenc11 and dsig11 namespaces
+ testUtilities.addNamespace("xenc11",
EncryptionConstants.EncryptionSpec11NS);
+ testUtilities.addNamespace("dsig11", Constants.SignatureSpec11NS);
}
@Test
@@ -191,6 +197,86 @@ public class WSS4JInOutTest extends AbstractSecurityTest {
);
}
+ @Test
+ public void testEncryptionWithAgreementMethodsX448() throws Exception {
+ Assume.assumeTrue(getJDKVersion() >= 16);
+ testEncryptionWithAgreementMethod("x448",
"//dsig11:DEREncodedKeyValue");
+ }
+
+ @Test
+ public void testEncryptionWithAgreementMethodsX25519() throws Exception {
+ Assume.assumeTrue(getJDKVersion() >= 16);
+ testEncryptionWithAgreementMethod("x25519",
"//dsig11:DEREncodedKeyValue");
+ }
+
+ @Test
+ public void testEncryptionWithAgreementMethodsECP256r1() throws Exception {
+ testEncryptionWithAgreementMethod("secp256r1", "//dsig11:ECKeyValue");
+ }
+
+ @Test
+ public void testEncryptionWithAgreementMethodsECP521r1() throws Exception {
+ testEncryptionWithAgreementMethod("secp521r1", "//dsig11:ECKeyValue");
+ }
+
+ /**
+ * Helper method to Test encryption using the specified agreement method
with various keys
+ */
+ public void testEncryptionWithAgreementMethod(String alias, String
keyElement) throws Exception {
+
+ Map<String, Object> outProperties = new HashMap<>();
+ outProperties.put(ConfigurationConstants.ACTION,
ConfigurationConstants.ENCRYPTION);
+ outProperties.put(ConfigurationConstants.ENC_PROP_FILE,
"wss-ecdh.properties");
+ outProperties.put(ConfigurationConstants.USER, alias);
+ outProperties.put(ConfigurationConstants.ENC_KEY_TRANSPORT,
WSS4JConstants.KEYWRAP_AES128);
+ outProperties.put(ConfigurationConstants.ENC_KEY_AGREEMENT_METHOD,
WSS4JConstants.AGREEMENT_METHOD_ECDH_ES);
+
+ Map<String, Object> inProperties = new HashMap<>();
+ inProperties.put(ConfigurationConstants.ACTION,
ConfigurationConstants.ENCRYPTION);
+ inProperties.put(ConfigurationConstants.DEC_PROP_FILE,
"wss-ecdh.properties");
+ inProperties.put(ConfigurationConstants.PW_CALLBACK_REF, new
TestPwdCallback());
+ // assertion of existence of elements
+ List<String> xpaths = new ArrayList<>();
+ xpaths.add(keyElement);
+ xpaths.add("//wsse:Security");
+ xpaths.add("//s:Body/xenc:EncryptedData");
+ xpaths.add("//xenc:AgreementMethod");
+ xpaths.add("//xenc11:KeyDerivationMethod");
+ xpaths.add("//xenc11:ConcatKDFParams");
+ xpaths.add("//xenc:OriginatorKeyInfo");
+ xpaths.add("//xenc:RecipientKeyInfo");
+
+ List<WSHandlerResult> handlerResults =
+ getResults(makeInvocation(outProperties, xpaths,
inProperties));
+
+ assertNotNull(handlerResults);
+ assertSame(handlerResults.size(), 1);
+ //
+ // This should contain exactly 1 protection result
+ //
+ final java.util.List<WSSecurityEngineResult> protectionResults =
+ handlerResults.get(0).getResults();
+ assertNotNull(protectionResults);
+ assertSame(protectionResults.size(), 1);
+ //
+ // This result should contain a reference to the decrypted element,
+ // which should contain the soap:Body Qname
+ //
+ final java.util.Map<String, Object> result =
+ protectionResults.get(0);
+ final java.util.List<WSDataRef> protectedElements =
+
CastUtils.cast((List<?>)result.get(WSSecurityEngineResult.TAG_DATA_REF_URIS));
+ assertNotNull(protectedElements);
+ assertSame(protectedElements.size(), 1);
+ assertEquals(
+ protectedElements.get(0).getName(),
+ new javax.xml.namespace.QName(
+ "http://schemas.xmlsoap.org/soap/envelope/",
+ "Body"
+ )
+ );
+ }
+
@Test
public void testEncryptedUsernameToken() throws Exception {
Map<String, Object> outProperties = new HashMap<>();
diff --git
a/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutWithAttachmentsTest.java
b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutWithAttachmentsTest.java
new file mode 100644
index 0000000000..5511dfc295
--- /dev/null
+++
b/rt/ws/security/src/test/java/org/apache/cxf/ws/security/wss4j/WSS4JInOutWithAttachmentsTest.java
@@ -0,0 +1,289 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.ws.security.wss4j;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.xml.crypto.dsig.DigestMethod;
+
+import org.w3c.dom.Document;
+
+import jakarta.activation.DataHandler;
+import jakarta.xml.soap.SOAPConstants;
+import jakarta.xml.soap.SOAPMessage;
+import org.apache.cxf.attachment.AttachmentImpl;
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.saaj.SAAJInInterceptor;
+import org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor;
+import org.apache.cxf.bus.managers.PhaseManagerImpl;
+import org.apache.cxf.interceptor.AttachmentInInterceptor;
+import org.apache.cxf.interceptor.AttachmentOutInterceptor;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.interceptor.StaxInInterceptor;
+import org.apache.cxf.interceptor.StaxOutInterceptor;
+import org.apache.cxf.message.Attachment;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.wss4j.common.ConfigurationConstants;
+import org.apache.wss4j.common.WSS4JConstants;
+import org.apache.wss4j.stax.ext.WSSConstants;
+import org.apache.xml.security.utils.Constants;
+import org.apache.xml.security.utils.EncryptionConstants;
+
+import org.junit.Assume;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Ensures that the WSS4J with attachment is working as expected.
+ */
+public class WSS4JInOutWithAttachmentsTest extends AbstractSecurityTest {
+
+ public WSS4JInOutWithAttachmentsTest() {
+ // add xenc11 and dsig11 namespaces
+ testUtilities.addNamespace("xenc11",
EncryptionConstants.EncryptionSpec11NS);
+ testUtilities.addNamespace("dsig11", Constants.SignatureSpec11NS);
+ }
+
+ /**
+ * Test security headers for signing, encryption with ED25519 and X25519
keys. The test
+ * assumes that the Java version is 17 or higher, because the ED25519 is
supported from Java 16+ and .
+ * and the X25519 PKCS8 -parsing error is fixed from Java 12+ by java
provided JCE.
+ *
+ * @throws Exception if something goes wrong
+ */
+ @Test
+ public void testEncryptWithAgreementMethodWithXECAndEDKeys() throws
Exception {
+ Assume.assumeTrue(getJDKVersion() >= 16);
+ testEncryptWithAgreementMethod("ed25519", "x25519");
+ }
+
+ @Test
+ public void testEncryptWithAgreementMethodWithECKeys() throws Exception {
+ testEncryptWithAgreementMethod("secp256r1", "secp256r1");
+ }
+
+ /**
+ * Generic method for testing security headers of the SOAP with Attachment
for signing and encryption with
+ * agreement method using various key types configured in the keystore:
wss-ecdh.properties.
+ *
+ * @param signAlias the alias of the signature key
+ * @param encAlias the alias of the encryption key
+ * @throws Exception if something goes wrong.
+ */
+ public void testEncryptWithAgreementMethod(String signAlias, String
encAlias) throws Exception {
+
+ Map<String, Object> outProperties = new HashMap<>();
+ // Signature configuration (sign before encrypt)
+ outProperties.put(ConfigurationConstants.ACTION,
+ ConfigurationConstants.SIGNATURE + " " +
ConfigurationConstants.ENCRYPTION);
+ outProperties.put(ConfigurationConstants.SIG_PROP_FILE,
"wss-ecdh.properties");
+ outProperties.put(ConfigurationConstants.USER, signAlias);
+ outProperties.put(ConfigurationConstants.DERIVED_TOKEN_REFERENCE,
signAlias);
+ outProperties.put(ConfigurationConstants.SIG_KEY_ID,
"DirectReference");
+ outProperties.put("password", "security");
+ outProperties.put(ConfigurationConstants.SIGNATURE_PARTS,
"{}cid:Attachments; "
+ + "{Element}{" + WSSConstants.NS_SOAP12 + "}Body;"
+ +
"{Element}{http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/}Messaging;"
+ );
+ outProperties.put(ConfigurationConstants.SIG_DIGEST_ALGO,
DigestMethod.SHA256);
+ // ------------------------------------------
+ // encryption configuration
+ outProperties.put(ConfigurationConstants.ENC_PROP_FILE,
"wss-ecdh.properties");
+ outProperties.put(ConfigurationConstants.ENCRYPTION_USER, encAlias);
+ outProperties.put(ConfigurationConstants.ENC_SYM_ALGO,
WSS4JConstants.AES_256_GCM);
+ outProperties.put(ConfigurationConstants.ENC_KEY_TRANSPORT,
WSS4JConstants.KEYWRAP_AES128);
+ outProperties.put(ConfigurationConstants.ENC_KEY_AGREEMENT_METHOD,
WSS4JConstants.AGREEMENT_METHOD_ECDH_ES);
+ outProperties.put(ConfigurationConstants.ENC_KEY_ID,
"DirectReference");
+ outProperties.put(ConfigurationConstants.ENCRYPTION_PARTS,
"{}cid:Attachments;");
+
+ Map<String, Object> inProperties = new HashMap<>();
+ inProperties.put(ConfigurationConstants.ACTION,
ConfigurationConstants.SIGNATURE
+ + " " + ConfigurationConstants.ENCRYPTION);
+ inProperties.put(ConfigurationConstants.SIG_VER_PROP_FILE,
"wss-ecdh.properties");
+ inProperties.put(ConfigurationConstants.USER, signAlias);
+
+ // ------------------------------------------
+ // encryption configuration
+ inProperties.put(ConfigurationConstants.DEC_PROP_FILE,
"wss-ecdh.properties");
+ inProperties.put(ConfigurationConstants.PW_CALLBACK_REF, new
TestPwdCallback());
+
+ List<String> xpaths = new ArrayList<>();
+ xpaths.add("//wsse:Security");
+ xpaths.add("//wsse:Security/xenc:EncryptedData");
+ xpaths.add("//xenc:AgreementMethod");
+ xpaths.add("//xenc11:KeyDerivationMethod");
+ xpaths.add("//xenc11:ConcatKDFParams");
+ xpaths.add("//wsse:Security/ds:Signature");
+
+ SoapMessage inSoapMessage =
makeInvocationWithAttachment(outProperties, xpaths, inProperties);
+ assertNotNull(inSoapMessage);
+ }
+
+ /**
+ * Method builds and configures the WSS4j output bus with interceptors:
AttachmentOutInterceptor,
+ * WSS4JOutInterceptor, StaxOutInterceptor, SAAJOutInterceptor and
serialize output message with two attachment
+ * to bytearray. Then it validates existence of the xpaths in the soap
header.
+ * Then it deserialize multipart message and decrypts attachments.
+ *
+ * @param outProperties - properties for out SoapMessage
+ * @param xpaths - list of xpaths to validate
+ * @param inProperties - properties for in WSS4JInInterceptor
+ * @return inMsg - deserialized input message
+ * @throws Exception - if something goes wrong
+ */
+ protected SoapMessage makeInvocationWithAttachment(
+ Map<String, Object> outProperties,
+ List<String> xpaths,
+ Map<String, Object> inProperties
+ ) throws Exception {
+ String attachmentContent1 = "Hello message: " + UUID.randomUUID();
+ String attachmentContent2 = "The second Hello message:" +
UUID.randomUUID();
+
+ Document doc = readDocument("edeliver-as4-clean.xml");
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ // Configure message
+ SoapMessage outMsg = getSoapMessageForDom(doc,
SOAPConstants.SOAP_1_2_PROTOCOL);
+ outMsg.put(Message.CONTENT_TYPE, "multipart/related");
+ // disable xop:Include where CipherData is serialized as payload in
multipart/related
+ outMsg.put(Message.MTOM_ENABLED, "false");
+ outMsg.put(Message.ENCODING, StandardCharsets.UTF_8.name());
+ outMsg.setContent(OutputStream.class, outputStream);
+
+ // add attachments
+ outMsg.setAttachments(new ArrayList<>());
+ DataHandler dataHandler = new DataHandler(attachmentContent1,
"text/plain");
+ AttachmentImpl attachment001 = new AttachmentImpl("attachment_id_001",
dataHandler);
+ outMsg.getAttachments().add(attachment001);
+ DataHandler dataHandler2 = new DataHandler(attachmentContent2,
"text/plain");
+ outMsg.getAttachments().add(new AttachmentImpl("attachment_id_002",
dataHandler2));
+
+ // add or overwrite properties
+ for (String key : outProperties.keySet()) {
+ outMsg.put(key, outProperties.get(key));
+ }
+
+ // Configure OUT message bus
+ PhaseInterceptorChain outPhaseInterceptorChain =
buildSimpleOutInterceptorChain();
+ outMsg.setInterceptorChain(outPhaseInterceptorChain);
+
+ // process message
+ outPhaseInterceptorChain.doIntercept(outMsg);
+ // xpath validation in output message (SOAPMessage)
+ SOAPMessage soapMessage = outMsg.getContent(SOAPMessage.class);
+ doc = soapMessage.getSOAPPart();
+ for (String xpath : xpaths) {
+ assertValid(xpath, doc);
+ }
+ // mime message bytes
+ byte [] mimeMessageBytes = outputStream.toByteArray();
+ // the output stream must not be empty
+ assertTrue(mimeMessageBytes.length > 0);
+
+ // build input message
+ MessageImpl inMessage = new MessageImpl();
+ SoapMessage inMsg = new SoapMessage(inMessage);
+ inMsg.put(Message.CONTENT_TYPE, "multipart/related");
+ Exchange ex = new ExchangeImpl();
+ ex.setInMessage(inMsg);
+ // set input multipart stream
+ inMsg.setContent(InputStream.class, new
ByteArrayInputStream(mimeMessageBytes));
+ inMsg.setExchange(ex);
+
+ // Configure IN message bus
+ PhaseInterceptorChain inPhaseInterceptorChain =
buildSimpleInInterceptorChain(inProperties);
+ inMsg.setInterceptorChain(inPhaseInterceptorChain);
+ // process message
+ inPhaseInterceptorChain.doIntercept(inMsg);
+
+ // validate in message
+ Exception exc = inMsg.getContent(Exception.class);
+ assertNull(exc);
+
+ SOAPMessage inSoapMessage = inMsg.getContent(SOAPMessage.class);
+ doc = inSoapMessage.getSOAPPart();
+ assertNotNull(doc);
+ // test attachments - processed in message must have 2 attachments
with decrypted content
+ assertNotNull(inSoapMessage.getAttachments());
+ Iterator<Attachment> iteAtt = inMsg.getAttachments().iterator();
+ assertEquals(2, inMsg.getAttachments().size());
+ assertEquals(attachmentContent1,
iteAtt.next().getDataHandler().getContent());
+ assertEquals(attachmentContent2,
iteAtt.next().getDataHandler().getContent());
+ assertNotNull(inSoapMessage.getSOAPHeader());
+
+ return inMsg;
+ }
+
+ /**
+ * Method builds and configures the OUT PhaseInterceptorChain with all
necessary interceptors to handle the
+ * security headers for soap with attachments: AttachmentOutInterceptor,
WSS4JOutInterceptor, StaxOutInterceptor,
+ * SAAJOutInterceptor.
+ * @return outPhaseInterceptorChain - configured out PhaseInterceptorChain
+ */
+ protected PhaseInterceptorChain buildSimpleOutInterceptorChain() {
+ List<Interceptor<? extends Message>> outInterceptorList = new
ArrayList<>();
+ outInterceptorList.add(new AttachmentOutInterceptor());
+ outInterceptorList.add(new WSS4JOutInterceptor());
+ outInterceptorList.add(new StaxOutInterceptor());
+ outInterceptorList.add(new SAAJOutInterceptor());
+ PhaseManagerImpl pmOut = new PhaseManagerImpl();
+ PhaseInterceptorChain outPhaseInterceptorChain = new
PhaseInterceptorChain(pmOut.getOutPhases());
+ outPhaseInterceptorChain.add(outInterceptorList);
+ return outPhaseInterceptorChain;
+ }
+
+ /**
+ * Method builds and configures the IN PhaseInterceptorChain with all
necessary interceptors to handle the
+ * security headers for soap with attachments: AttachmentInInterceptor,
StaxInInterceptor, SAAJInInterceptor,
+ * WSS4JInInterceptor.
+ * @param inProperties - properties for in WSS4JInInterceptor
+ * @return inPhaseInterceptorChain - configured in PhaseInterceptorChain
+ */
+ protected PhaseInterceptorChain buildSimpleInInterceptorChain(Map<String,
Object> inProperties) {
+ List<Interceptor<? extends Message>> inInterceptorList = new
ArrayList<>();
+ inInterceptorList.add(new AttachmentInInterceptor());
+ inInterceptorList.add(new StaxInInterceptor());
+ inInterceptorList.add(new SAAJInInterceptor());
+ inInterceptorList.add(new WSS4JInInterceptor(inProperties));
+
+ PhaseManagerImpl pmIn = new PhaseManagerImpl();
+ PhaseInterceptorChain inPhaseInterceptorChain = new
PhaseInterceptorChain(pmIn.getInPhases());
+ inPhaseInterceptorChain.add(inInterceptorList);
+ return inPhaseInterceptorChain;
+ }
+
+}
diff --git
a/rt/ws/security/src/test/resources/org/apache/cxf/ws/security/wss4j/edeliver-as4-clean.xml
b/rt/ws/security/src/test/resources/org/apache/cxf/ws/security/wss4j/edeliver-as4-clean.xml
new file mode 100644
index 0000000000..7277617557
--- /dev/null
+++
b/rt/ws/security/src/test/resources/org/apache/cxf/ws/security/wss4j/edeliver-as4-clean.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
+ <env:Header>
+ <eb:Messaging
xmlns:eb="http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/"
+
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ env:mustUnderstand="true"
wsu:Id="messaging_id_210bca51-e9b3-4ee1-81e7-226949ab6ff6">
+ <eb:UserMessage
+
mpc="http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/defaultMPC">
+ <eb:MessageInfo>
+ <eb:Timestamp>2017-10-24T09:07:36.000Z</eb:Timestamp>
+
<eb:MessageId>[email protected]</eb:MessageId>
+ </eb:MessageInfo>
+ <eb:PartyInfo>
+ <eb:From>
+ <eb:PartyId
type="urn:oasis:names:tc:ebcore:partyid-type:iso6523:0088"
+ >1234567890
+ </eb:PartyId>
+ <eb:Role>Seller</eb:Role>
+ </eb:From>
+ <eb:To>
+ <eb:PartyId
type="urn:oasis:names:tc:ebcore:partyid-type:iso6523:0088"
+ >0987654321
+ </eb:PartyId>
+ <eb:Role>Buyer</eb:Role>
+ </eb:To>
+ </eb:PartyInfo>
+ <eb:CollaborationInfo>
+
<eb:Service>http://edelivery.tech.ec.europa.eu/services/eprocurement/1.0</eb:Service>
+ <eb:Action>ConfirmOrder</eb:Action>
+
<eb:ConversationId>E5D7CFEE-E6A9-4855-A67E-6C24403E35E6</eb:ConversationId>
+ </eb:CollaborationInfo>
+ <eb:MessageProperties>
+ <eb:Property name="originalSender"
+
type="urn:oasis:names:tc:ebcore:partyid-type:iso6523:0088"
+ >5209999001264
+ </eb:Property>
+ <eb:Property name="finalRecipient"
+
type="urn:oasis:names:tc:ebcore:partyid-type:iso6523:0088"
+ >5209999001295
+ </eb:Property>
+ </eb:MessageProperties>
+ <eb:PayloadInfo>
+ <eb:PartInfo href="cid:attachment_id_001">
+ <eb:PartProperties>
+ <eb:Property
name="MimeType">text/plain</eb:Property>
+ <eb:Property
name="CompressionType">application/gzip</eb:Property>
+ </eb:PartProperties>
+ </eb:PartInfo>
+ <eb:PartInfo href="cid:attachment_id_002">
+ <eb:PartProperties>
+ <eb:Property
name="MimeType">text/plain</eb:Property>
+ <eb:Property
name="CompressionType">application/gzip</eb:Property>
+ </eb:PartProperties>
+ </eb:PartInfo>
+ </eb:PayloadInfo>
+ </eb:UserMessage>
+ </eb:Messaging>
+ </env:Header>
+ <env:Body
+
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
+ wsu:Id="body_id_840b593a-a40f-40d8-a8fd-89591478e5df"/>
+</env:Envelope>
diff --git a/rt/ws/security/src/test/resources/wss-ecdh.p12
b/rt/ws/security/src/test/resources/wss-ecdh.p12
new file mode 100644
index 0000000000..d09c516f45
Binary files /dev/null and b/rt/ws/security/src/test/resources/wss-ecdh.p12
differ
diff --git a/rt/ws/security/src/test/resources/wss-ecdh.properties
b/rt/ws/security/src/test/resources/wss-ecdh.properties
new file mode 100644
index 0000000000..ee89c3a5f9
--- /dev/null
+++ b/rt/ws/security/src/test/resources/wss-ecdh.properties
@@ -0,0 +1,4 @@
+org.apache.ws.security.crypto.provider=org.apache.ws.security.components.crypto.Merlin
+org.apache.ws.security.crypto.merlin.keystore.type=PKCS12
+org.apache.ws.security.crypto.merlin.keystore.password=security
+org.apache.ws.security.crypto.merlin.keystore.file=wss-ecdh.p12