This is an automated email from the ASF dual-hosted git repository. robertlazarski pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-rampart.git
commit a1334796a66db2542f3c355aa85f9f1d34e84966 Author: Robert Lazarski <[email protected]> AuthorDate: Wed Nov 18 04:10:08 2026 -1000 RAMPART-330: encrypt SignatureConfirmation when the signature is encrypted WS-SecurityPolicy 6.4 [Signature Protection] requires the signature confirmation elements to be encrypted along with the primary signature when sp:EncryptSignature is set. Rampart only signed them, so a WSIT client rejected the response. The binding builders now record the wsu:Ids of the confirmations they add and encrypt them at every point where the signature is encrypted, in both protection orders. Co-Authored-By: Claude Fable 5.1 <[email protected]> --- .../rampart/builder/AsymmetricBindingBuilder.java | 4 +- .../org/apache/rampart/builder/BindingBuilder.java | 18 ++- .../rampart/builder/SymmetricBindingBuilder.java | 2 + .../SignatureConfirmationEncryptionTest.java | 135 +++++++++++++++++++++ .../rampart-asymm-binding-sigconf-es-ebs.xml | 84 +++++++++++++ .../policy/rampart-asymm-binding-sigconf-es.xml | 83 +++++++++++++ .../policy/rampart-asymm-binding-sigconf.xml | 82 +++++++++++++ .../policy/rampart-symm-binding-sigconf-es.xml | 78 ++++++++++++ 8 files changed, 484 insertions(+), 2 deletions(-) diff --git a/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java b/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java index 8378423f..29bd4ccb 100644 --- a/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java +++ b/modules/rampart-core/src/main/java/org/apache/rampart/builder/AsymmetricBindingBuilder.java @@ -308,7 +308,8 @@ public class AsymmetricBindingBuilder extends BindingBuilder { // Now encrypt the signature using the above token secondEncrParts.add(new WSEncryptionPart(this.mainSigId, "Element")); - + addSignatureConfirmationsToEncrypt(secondEncrParts); + if(rmd.isInitiator()) { for (String anEncryptedTokensIdList : encryptedTokensIdList) { secondEncrParts.add(new WSEncryptionPart(anEncryptedTokensIdList, "Element")); @@ -480,6 +481,7 @@ public class AsymmetricBindingBuilder extends BindingBuilder { //Check for signature protection if(rpd.isSignatureProtection() && this.mainSigId != null) { encrParts.add(new WSEncryptionPart(RampartUtil.addWsuIdToElement((OMElement)this.signatureElement), "Element")); + addSignatureConfirmationsToEncrypt(encrParts); } if(rmd.isInitiator()) { diff --git a/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java b/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java index 83281aa5..f3307df9 100644 --- a/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java +++ b/modules/rampart-core/src/main/java/org/apache/rampart/builder/BindingBuilder.java @@ -83,7 +83,10 @@ public abstract class BindingBuilder { protected String mainSigId = null; protected ArrayList<String> encryptedTokensIdList = new ArrayList<String>(); - + + /** wsu:Ids of the wsse11:SignatureConfirmation elements added to this message. */ + protected List<String> signatureConfirmationIds = new ArrayList<String>(); + protected Element timestampElement; protected Element mainRefListElement; @@ -845,6 +848,7 @@ public abstract class BindingBuilder { wsc.setSignatureValue(sigVal); wsc.prepare(); RampartUtil.appendChildToSecHeader(rmd, wsc.getSignatureConfirmationElement()); + signatureConfirmationIds.add(wsc.getId()); if (sigParts != null) { sigParts.add(new WSEncryptionPart(wsc.getId())); } @@ -853,11 +857,23 @@ public abstract class BindingBuilder { //No Sig value wsc.prepare(); RampartUtil.appendChildToSecHeader(rmd, wsc.getSignatureConfirmationElement()); + signatureConfirmationIds.add(wsc.getId()); if(sigParts != null) { sigParts.add(new WSEncryptionPart(wsc.getId())); } } } + + /** + * RAMPART-330: WS-SecurityPolicy 6.4 [Signature Protection] requires the signature + * confirmation elements to be encrypted whenever the primary signature is. Call this + * wherever the signature is added to the parts to encrypt. + */ + protected void addSignatureConfirmationsToEncrypt(List<WSEncryptionPart> encrParts) { + for (String id : signatureConfirmationIds) { + encrParts.add(new WSEncryptionPart(id, "Element")); + } + } private void checkForX509PkiPath(WSSecSignature sig, Token token){ if (token instanceof X509Token) { X509Token x509Token = (X509Token) token; diff --git a/modules/rampart-core/src/main/java/org/apache/rampart/builder/SymmetricBindingBuilder.java b/modules/rampart-core/src/main/java/org/apache/rampart/builder/SymmetricBindingBuilder.java index 6e071725..927cf987 100644 --- a/modules/rampart-core/src/main/java/org/apache/rampart/builder/SymmetricBindingBuilder.java +++ b/modules/rampart-core/src/main/java/org/apache/rampart/builder/SymmetricBindingBuilder.java @@ -426,6 +426,7 @@ public class SymmetricBindingBuilder extends BindingBuilder { //Now encrypt the signature using the above token if(rpd.isSignatureProtection()) { secondEncrParts.add(new WSEncryptionPart(this.mainSigId, "Element")); + addSignatureConfirmationsToEncrypt(secondEncrParts); } if(rmd.isInitiator()) { @@ -647,6 +648,7 @@ public class SymmetricBindingBuilder extends BindingBuilder { if(rpd.isSignatureProtection() && this.mainSigId != null) { //Now encrypt the signature using the above token encrParts.add(new WSEncryptionPart(this.mainSigId, "Element")); + addSignatureConfirmationsToEncrypt(encrParts); } if(rmd.isInitiator()) { diff --git a/modules/rampart-tests/src/test/java/org/apache/rampart/SignatureConfirmationEncryptionTest.java b/modules/rampart-tests/src/test/java/org/apache/rampart/SignatureConfirmationEncryptionTest.java new file mode 100644 index 00000000..110a8496 --- /dev/null +++ b/modules/rampart-tests/src/test/java/org/apache/rampart/SignatureConfirmationEncryptionTest.java @@ -0,0 +1,135 @@ +/* + * Copyright 2004,2005 The Apache Software Foundation. + * + * Licensed 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.rampart; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.apache.axiom.om.OMElement; +import org.apache.axis2.context.MessageContext; +import org.apache.axis2.description.AxisService; +import org.apache.axis2.description.Parameter; +import org.apache.neethi.Policy; +import org.apache.wss4j.dom.WSConstants; +import org.apache.wss4j.dom.engine.WSSecurityEngineResult; +import org.apache.wss4j.dom.handler.WSHandlerConstants; +import org.apache.wss4j.dom.handler.WSHandlerResult; + +/** + * RAMPART-330: WS-SecurityPolicy 6.4 [Signature Protection]. When sp:EncryptSignature + * is set, the wsse11:SignatureConfirmation elements of a response must be encrypted + * along with the primary signature; when it is not set, they must stay in the clear. + */ +public class SignatureConfirmationEncryptionTest extends MessageBuilderTestBase { + + private static final QName SIG_CONF = + new QName(WSConstants.WSSE11_NS, WSConstants.SIGNATURE_CONFIRMATION_LN); + private static final QName ENC_DATA = new QName(WSConstants.ENC_NS, WSConstants.ENC_DATA_LN); + + /** The inbound results of a request that carried two signatures and an EncryptedKey. */ + private static List<WSHandlerResult> receivedResults(boolean withEncryptedKey) { + List<WSSecurityEngineResult> results = new ArrayList<WSSecurityEngineResult>(); + Map<Integer, List<WSSecurityEngineResult>> actions = + new HashMap<Integer, List<WSSecurityEngineResult>>(); + + List<WSSecurityEngineResult> signatures = new ArrayList<WSSecurityEngineResult>(); + for (int i = 1; i <= 2; i++) { + WSSecurityEngineResult sig = new WSSecurityEngineResult(WSConstants.SIGN); + byte[] value = new byte[20]; + Arrays.fill(value, (byte) i); + sig.put(WSSecurityEngineResult.TAG_SIGNATURE_VALUE, value); + signatures.add(sig); + } + results.addAll(signatures); + actions.put(WSConstants.SIGN, signatures); + + if (withEncryptedKey) { + byte[] secret = new byte[16]; + WSSecurityEngineResult encr = new WSSecurityEngineResult(WSConstants.ENCR); + encr.put(WSSecurityEngineResult.TAG_ID, "_ek"); + encr.put(WSSecurityEngineResult.TAG_SECRET, secret); + encr.put(WSSecurityEngineResult.TAG_ENCRYPTED_EPHEMERAL_KEY, secret); + results.add(encr); + actions.put(WSConstants.ENCR, Collections.singletonList(encr)); + } + return Collections.singletonList(new WSHandlerResult("", results, actions)); + } + + private OMElement buildResponse(String policyPath, boolean withEncryptedKey) throws Exception { + MessageContext ctx = getMsgCtx(); + ctx.setServerSide(true); + AxisService axisService = ctx.getAxisService(); + Parameter clientSide = axisService.getParameter(RampartMessageData.PARAM_CLIENT_SIDE); + if (clientSide != null) { + axisService.removeParameter(clientSide); + } + ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(policyPath)); + ctx.setProperty(WSHandlerConstants.RECV_RESULTS, receivedResults(withEncryptedKey)); + + new MessageBuilder().build(ctx); + + return ctx.getEnvelope().getHeader().getFirstChildWithName( + new QName(WSConstants.WSSE_NS, WSConstants.WSSE_LN)); + } + + private static int count(OMElement parent, QName name) { + int n = 0; + for (Iterator<OMElement> it = parent.getChildrenWithName(name); it.hasNext(); it.next()) { + n++; + } + return n; + } + + private static void assertConfirmationsEncrypted(OMElement secHeader) { + assertEquals("SignatureConfirmation must not be left in the clear", + 0, count(secHeader, SIG_CONF)); + assertEquals("the Signature must be encrypted", + 0, count(secHeader, new QName(WSConstants.SIG_NS, WSConstants.SIG_LN))); + assertEquals("expected EncryptedData for the Signature and both confirmations", + 3, count(secHeader, ENC_DATA)); + } + + public void testAsymmetricBindingEncryptsSignatureConfirmations() throws Exception { + assertConfirmationsEncrypted( + buildResponse("test-resources/policy/rampart-asymm-binding-sigconf-es.xml", false)); + } + + public void testEncryptBeforeSigningEncryptsSignatureConfirmations() throws Exception { + assertConfirmationsEncrypted( + buildResponse("test-resources/policy/rampart-asymm-binding-sigconf-es-ebs.xml", false)); + } + + public void testSymmetricBindingEncryptsSignatureConfirmations() throws Exception { + assertConfirmationsEncrypted( + buildResponse("test-resources/policy/rampart-symm-binding-sigconf-es.xml", true)); + } + + public void testWithoutEncryptSignatureConfirmationsStayInTheClear() throws Exception { + OMElement secHeader = + buildResponse("test-resources/policy/rampart-asymm-binding-sigconf.xml", false); + assertEquals(2, count(secHeader, SIG_CONF)); + assertEquals(1, count(secHeader, new QName(WSConstants.SIG_NS, WSConstants.SIG_LN))); + assertEquals(0, count(secHeader, ENC_DATA)); + } +} diff --git a/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sigconf-es-ebs.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sigconf-es-ebs.xml new file mode 100644 index 00000000..068ed01c --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sigconf-es-ebs.xml @@ -0,0 +1,84 @@ +<wsp:Policy wsu:Id="sigconfEsEbs" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:OnlySignEntireHeadersAndBody/> + <sp:EncryptSignature/> + <sp:EncryptBeforeSigning/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + <sp:RequireSignatureConfirmation/> + </wsp:Policy> + </sp:Wss11> + <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + </sp:EncryptedParts> + <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:MustSupportIssuedTokens/> + <sp:RequireClientEntropy/> + <sp:RequireServerEntropy/> + </wsp:Policy> + </sp:Trust10> + + <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy"> + <ramp:user>alice</ramp:user> + <ramp:encryptionUser>bob</ramp:encryptionUser> + <ramp:passwordCallbackClass>org.apache.rampart.TestCBHandler</ramp:passwordCallbackClass> + + <ramp:signatureCrypto> + <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin"> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.file">test-resources/keys/interop2024.pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property> + </ramp:crypto> + </ramp:signatureCrypto> + <ramp:encryptionCypto> + <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin"> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.file">test-resources/keys/interop2024.pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property> + </ramp:crypto> + </ramp:encryptionCypto> + </ramp:RampartConfig> + + </wsp:All> + </wsp:ExactlyOne> +</wsp:Policy> diff --git a/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sigconf-es.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sigconf-es.xml new file mode 100644 index 00000000..809286eb --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sigconf-es.xml @@ -0,0 +1,83 @@ +<wsp:Policy wsu:Id="sigconfEs" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:OnlySignEntireHeadersAndBody/> + <sp:EncryptSignature/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + <sp:RequireSignatureConfirmation/> + </wsp:Policy> + </sp:Wss11> + <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + </sp:EncryptedParts> + <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:MustSupportIssuedTokens/> + <sp:RequireClientEntropy/> + <sp:RequireServerEntropy/> + </wsp:Policy> + </sp:Trust10> + + <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy"> + <ramp:user>alice</ramp:user> + <ramp:encryptionUser>bob</ramp:encryptionUser> + <ramp:passwordCallbackClass>org.apache.rampart.TestCBHandler</ramp:passwordCallbackClass> + + <ramp:signatureCrypto> + <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin"> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.file">test-resources/keys/interop2024.pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property> + </ramp:crypto> + </ramp:signatureCrypto> + <ramp:encryptionCypto> + <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin"> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.file">test-resources/keys/interop2024.pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property> + </ramp:crypto> + </ramp:encryptionCypto> + </ramp:RampartConfig> + + </wsp:All> + </wsp:ExactlyOne> +</wsp:Policy> diff --git a/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sigconf.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sigconf.xml new file mode 100644 index 00000000..907df427 --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sigconf.xml @@ -0,0 +1,82 @@ +<wsp:Policy wsu:Id="sigconf" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + <sp:RequireSignatureConfirmation/> + </wsp:Policy> + </sp:Wss11> + <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + </sp:EncryptedParts> + <sp:Trust10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:MustSupportIssuedTokens/> + <sp:RequireClientEntropy/> + <sp:RequireServerEntropy/> + </wsp:Policy> + </sp:Trust10> + + <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy"> + <ramp:user>alice</ramp:user> + <ramp:encryptionUser>bob</ramp:encryptionUser> + <ramp:passwordCallbackClass>org.apache.rampart.TestCBHandler</ramp:passwordCallbackClass> + + <ramp:signatureCrypto> + <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin"> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.file">test-resources/keys/interop2024.pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property> + </ramp:crypto> + </ramp:signatureCrypto> + <ramp:encryptionCypto> + <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin"> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.file">test-resources/keys/interop2024.pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property> + </ramp:crypto> + </ramp:encryptionCypto> + </ramp:RampartConfig> + + </wsp:All> + </wsp:ExactlyOne> +</wsp:Policy> diff --git a/modules/rampart-tests/test-resources/policy/rampart-symm-binding-sigconf-es.xml b/modules/rampart-tests/test-resources/policy/rampart-symm-binding-sigconf-es.xml new file mode 100644 index 00000000..47253520 --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-symm-binding-sigconf-es.xml @@ -0,0 +1,78 @@ +<wsp:Policy wsu:Id="symmSigconfEs" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"> + <wsp:ExactlyOne> + <wsp:All> + <sp:SymmetricBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:ProtectionToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/Never"> + <wsp:Policy> + <sp:RequireThumbprintReference/> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:ProtectionToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Strict/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:OnlySignEntireHeadersAndBody/> + <sp:EncryptSignature/> + </wsp:Policy> + </sp:SymmetricBinding> + <sp:Wss11 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + <sp:MustSupportRefThumbprint/> + <sp:MustSupportRefEncryptedKey/> + <sp:RequireSignatureConfirmation/> + </wsp:Policy> + </sp:Wss11> + <sp:SignedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + <sp:Header Name="To" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/> + <sp:Header Name="From" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/> + <sp:Header Name="FaultTo" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/> + <sp:Header Name="ReplyTo" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/> + <sp:Header Name="MessageID" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/> + <sp:Header Name="RelatesTo" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/> + <sp:Header Name="Action" Namespace="http://schemas.xmlsoap.org/ws/2004/08/addressing"/> + </sp:SignedParts> + <sp:EncryptedParts xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"> + <sp:Body/> + </sp:EncryptedParts> + + <ramp:RampartConfig xmlns:ramp="http://ws.apache.org/rampart/policy"> + <ramp:user>alice</ramp:user> + <ramp:encryptionUser>bob</ramp:encryptionUser> + <ramp:passwordCallbackClass>org.apache.rampart.TestCBHandler</ramp:passwordCallbackClass> + + <ramp:signatureCrypto> + <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin"> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.file">test-resources/keys/interop2024.pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property> + </ramp:crypto> + </ramp:signatureCrypto> + <ramp:encryptionCypto> + <ramp:crypto provider="org.apache.ws.security.components.crypto.Merlin"> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.type">pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.file">test-resources/keys/interop2024.pkcs12</ramp:property> + <ramp:property name="org.apache.ws.security.crypto.merlin.keystore.password">password</ramp:property> + </ramp:crypto> + </ramp:encryptionCypto> + </ramp:RampartConfig> + + + </wsp:All> + </wsp:ExactlyOne> +</wsp:Policy>
