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 318a6555cf488f20ec1298b6b3bad3c0c9e924b7 Author: Robert Lazarski <[email protected]> AuthorDate: Wed Nov 18 12:32:03 2026 -1000 RAMPART-289: encrypt and validate encrypted supporting tokens Under sp:EncryptBeforeSigning the asymmetric builder only ran the second encryption when the signature was protected, and the symmetric builder passed it the body parts instead of the token list, so Encrypted* SupportingTokens went out in the clear. The validator never checked the four encrypted kinds, so neither a missing nor a clear-text token was refused; it now requires them, checks that each arrived encrypted, and accepts a password-less token under its own WSS4J action. EncryptBeforeSigningSupportingTokensTest covers both orders and bindings. Co-Authored-By: Claude Fable 5.1 <[email protected]> --- .../rampart/PolicyBasedResultsValidator.java | 87 +++++++++--- .../rampart/builder/AsymmetricBindingBuilder.java | 16 ++- .../rampart/builder/SymmetricBindingBuilder.java | 8 +- .../EncryptBeforeSigningSupportingTokensTest.java | 158 +++++++++++++++++++++ .../policy/rampart-asymm-binding-ebs-encr-sig.xml | 76 ++++++++++ ...symm-binding-ebs-encr-sup-tokens-nopassword.xml | 85 +++++++++++ .../rampart-asymm-binding-ebs-encr-sup-tokens.xml | 80 +++++++++++ .../rampart-asymm-binding-ebs-plain-sup-tokens.xml | 80 +++++++++++ ...rt-asymm-binding-ebs-signed-encr-sup-tokens.xml | 80 +++++++++++ .../policy/rampart-asymm-binding-ebs.xml | 75 ++++++++++ .../rampart-asymm-binding-sbe-encr-sup-tokens.xml | 79 +++++++++++ ...rt-asymm-binding-sbe-signed-encr-sup-tokens.xml | 79 +++++++++++ ...rt-asymm-binding-signed-encr-sup-token-only.xml | 75 ++++++++++ .../rampart-symm-binding-ebs-encr-sup-tokens.xml | 74 ++++++++++ .../rampart-symm-binding-sbe-encr-sup-tokens.xml | 73 ++++++++++ 15 files changed, 1097 insertions(+), 28 deletions(-) diff --git a/modules/rampart-core/src/main/java/org/apache/rampart/PolicyBasedResultsValidator.java b/modules/rampart-core/src/main/java/org/apache/rampart/PolicyBasedResultsValidator.java index bd872de2..82489f2f 100644 --- a/modules/rampart-core/src/main/java/org/apache/rampart/PolicyBasedResultsValidator.java +++ b/modules/rampart-core/src/main/java/org/apache/rampart/PolicyBasedResultsValidator.java @@ -249,12 +249,13 @@ public class PolicyBasedResultsValidator implements ExtendedPolicyValidatorCallb RampartPolicyData rpd = data.getRampartMessageData().getPolicyData(); - SupportingToken sgndSupTokens = rpd.getSignedSupportingTokens(); - SupportingToken sgndEndorSupTokens = rpd.getSignedEndorsingSupportingTokens(); - + // RAMPART-289: a signature over nothing but signed (encrypted) supporting + // tokens is expected, not an unexpected signature. if(sig && signatureParts.size() == 0 - && (sgndSupTokens == null || sgndSupTokens.getTokens().size() == 0) - && (sgndEndorSupTokens == null || sgndEndorSupTokens.getTokens().size() == 0)) { + && !hasTokens(rpd.getSignedSupportingTokens()) + && !hasTokens(rpd.getSignedEndorsingSupportingTokens()) + && !hasTokens(rpd.getSignedEncryptedSupportingTokens()) + && !hasTokens(rpd.getSignedEndorsingEncryptedSupportingTokens())) { //Unexpected signature throw new RampartException("unexprectedSignature"); @@ -291,6 +292,31 @@ public class PolicyBasedResultsValidator implements ExtendedPolicyValidatorCallb } } + private static boolean hasTokens(SupportingToken supportingToken) { + return supportingToken != null && supportingToken.getTokens().size() > 0; + } + + /** + * Whether the element with the given wsu:Id was revealed by decryption. The + * data reference's own wsu:Id is that of the EncryptedData, so the decrypted + * element itself is compared. + */ + private boolean isElementDecrypted(List<WSSecurityEngineResult> results, String wsuId) { + if (wsuId == null) { + return false; + } + for (Object ref : getEncryptedReferences(results)) { + WSDataRef dataRef = (WSDataRef) ref; + if (dataRef == null || dataRef.getProtectedElement() == null) { + continue; + } + if (wsuId.equals(dataRef.getProtectedElement().getAttributeNS(WSConstants.WSU_NS, "Id"))) { + return true; + } + } + return false; + } + /** * @param data contains RampartMessageData * @param results Used to handle SupportingTokens @@ -298,7 +324,7 @@ public class PolicyBasedResultsValidator implements ExtendedPolicyValidatorCallb */ protected void validateSupportingTokens(ValidatorData data, List<WSSecurityEngineResult> results) throws RampartException { - + //Check for UsernameToken RampartPolicyData rpd = data.getRampartMessageData().getPolicyData(); RampartMessageData rmd = data.getRampartMessageData(); @@ -312,6 +338,12 @@ public class PolicyBasedResultsValidator implements ExtendedPolicyValidatorCallb handleSupportingTokens(rmd, results, signedEndSuppToken); SupportingToken endSuppToken = rpd.getEndorsingSupportingTokens(); handleSupportingTokens(rmd, results, endSuppToken); + // RAMPART-289: the encrypted kinds were never validated, so a missing or + // clear-text token went unnoticed. + handleSupportingTokens(rmd, results, rpd.getEncryptedSupportingTokens()); + handleSupportingTokens(rmd, results, rpd.getSignedEncryptedSupportingTokens()); + handleSupportingTokens(rmd, results, rpd.getEndorsingEncryptedSupportingTokens()); + handleSupportingTokens(rmd, results, rpd.getSignedEndorsingEncryptedSupportingTokens()); } /** @@ -333,7 +365,11 @@ public class PolicyBasedResultsValidator implements ExtendedPolicyValidatorCallb UsernameToken ut = (UsernameToken) token; //Check presence of a UsernameToken WSSecurityEngineResult utResult = fetchActionResult(results, WSConstants.UT); - + if (utResult == null && ut.isNoPassword()) { + // WSS4J files a UsernameToken without a password under its own action. + utResult = fetchActionResult(results, WSConstants.UT_NOPASSWORD); + } + if (utResult == null) { if (ut.isOptional()) { // RAMPART-286: the policy allows the token to be absent. @@ -343,19 +379,26 @@ public class PolicyBasedResultsValidator implements ExtendedPolicyValidatorCallb } org.apache.wss4j.dom.message.token.UsernameToken wssUt = (org.apache.wss4j.dom.message.token.UsernameToken) utResult.get(WSSecurityEngineResult.TAG_USERNAME_TOKEN); - - if(ut.isNoPassword() && wssUt.getPassword() != null) { - throw new RampartException("invalidUsernameTokenType"); + + if (ut.isNoPassword()) { + if (wssUt.getPassword() != null) { + throw new RampartException("invalidUsernameTokenType"); + } + } else if (ut.isHashPassword()) { + if (!wssUt.isHashed()) { + throw new RampartException("invalidUsernameTokenType"); + } + } else if (wssUt.getPassword() == null || + !WSConstants.PASSWORD_TEXT.equals(wssUt.getPasswordType())) { + throw new RampartException("invalidUsernameTokenType"); } - - if(ut.isHashPassword() && !wssUt.isHashed()) { - throw new RampartException("invalidUsernameTokenType"); - } else if (!ut.isHashPassword() && (wssUt.getPassword() == null || - !wssUt.getPasswordType().equals(WSConstants.PASSWORD_TEXT))) { - throw new RampartException("invalidUsernameTokenType"); + + // An encrypted supporting token must have arrived encrypted: the + // decrypted references carry the wsu:Id of the token they revealed. + if (suppTok.isEncryptedToken() && !isElementDecrypted(results, wssUt.getID())) { + throw new RampartException("encryptedPartMissing", + new String[]{WSConstants.WSSE_NS + ":" + WSConstants.USERNAME_TOKEN_LN}); } - - } else if (token instanceof IssuedToken) { WSSecurityEngineResult samlResult = fetchActionResult(results, WSConstants.ST_SIGNED); @@ -1021,9 +1064,11 @@ public class PolicyBasedResultsValidator implements ExtendedPolicyValidatorCallb } SupportingToken endSuppToken = rpd.getEndorsingSupportingTokens(); - return isUsernameTokenPresent(endSuppToken); - - + return isUsernameTokenPresent(endSuppToken) + || isUsernameTokenPresent(rpd.getEncryptedSupportingTokens()) + || isUsernameTokenPresent(rpd.getSignedEncryptedSupportingTokens()) + || isUsernameTokenPresent(rpd.getEndorsingEncryptedSupportingTokens()) + || isUsernameTokenPresent(rpd.getSignedEndorsingEncryptedSupportingTokens()); } protected boolean isUsernameTokenPresent(SupportingToken suppTok) { 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 29bd4ccb..38babf6e 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 @@ -296,8 +296,12 @@ public class AsymmetricBindingBuilder extends BindingBuilder { +", Signature tool :" + (t2 - t1) ); } - // Check for signature protection - if (rpd.isSignatureProtection() && this.mainSigId != null) { + // Check for signature protection and encryption of supporting tokens. + // RAMPART-289: the encrypted supporting tokens are added after the + // signature, so they need this second encryption even when the + // signature itself stays in the clear. + boolean protectSignature = rpd.isSignatureProtection() && this.mainSigId != null; + if (protectSignature || (rmd.isInitiator() && encryptedTokensIdList.size() > 0)) { long t3 = 0, t4 = 0; if(tlog.isDebugEnabled()){ t3 = System.currentTimeMillis(); @@ -306,9 +310,11 @@ public class AsymmetricBindingBuilder extends BindingBuilder { List<WSEncryptionPart> secondEncrParts = new ArrayList<WSEncryptionPart>(); // Now encrypt the signature using the above token - secondEncrParts.add(new WSEncryptionPart(this.mainSigId, - "Element")); - addSignatureConfirmationsToEncrypt(secondEncrParts); + if (protectSignature) { + secondEncrParts.add(new WSEncryptionPart(this.mainSigId, + "Element")); + addSignatureConfirmationsToEncrypt(secondEncrParts); + } if(rmd.isInitiator()) { for (String anEncryptedTokensIdList : encryptedTokensIdList) { 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 927cf987..e7e5081c 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 @@ -455,9 +455,13 @@ public class SymmetricBindingBuilder extends BindingBuilder { encr.prepare(RampartUtil.getEncryptionCrypto(rpd .getRampartConfig(), rmd.getCustomClassLoader()), key); - secondRefList = encr.encryptForRef(null, encrParts, key); + // RAMPART-289: encrypt the signature and the encrypted supporting + // tokens, not the body parts again. encrParts belongs to the first + // encryption; passing it here wrapped the body a second time and + // left the tokens in the clear. + secondRefList = encr.encryptForRef(null, secondEncrParts, key); RampartUtil.insertSiblingAfter( - rmd, + rmd, encrTokenElement, secondRefList); } catch (WSSecurityException e) { diff --git a/modules/rampart-tests/src/test/java/org/apache/rampart/EncryptBeforeSigningSupportingTokensTest.java b/modules/rampart-tests/src/test/java/org/apache/rampart/EncryptBeforeSigningSupportingTokensTest.java new file mode 100644 index 00000000..f6340091 --- /dev/null +++ b/modules/rampart-tests/src/test/java/org/apache/rampart/EncryptBeforeSigningSupportingTokensTest.java @@ -0,0 +1,158 @@ +/* + * 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.rampart; + +import org.apache.axiom.om.OMElement; +import org.apache.axiom.soap.SOAPEnvelope; +import org.apache.axis2.builder.SOAPBuilder; +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 javax.xml.namespace.QName; +import java.io.ByteArrayInputStream; +import java.util.List; + +/** + * RAMPART-289: a request built with sp:EncryptBeforeSigning must validate when the + * encryption covers a supporting token or the signature as well as the body. + * Each policy is built as the client and then processed as the service. + */ +public class EncryptBeforeSigningSupportingTokensTest extends MessageBuilderTestBase { + + public void testAsymmetricEncryptedSupportingToken() throws Exception { + roundTrip("test-resources/policy/rampart-asymm-binding-ebs-encr-sup-tokens.xml"); + } + + public void testAsymmetricSignedEncryptedSupportingToken() throws Exception { + roundTrip("test-resources/policy/rampart-asymm-binding-ebs-signed-encr-sup-tokens.xml"); + } + + public void testSymmetricEncryptedSupportingToken() throws Exception { + roundTrip("test-resources/policy/rampart-symm-binding-ebs-encr-sup-tokens.xml"); + } + + public void testAsymmetricEncryptedSignature() throws Exception { + roundTrip("test-resources/policy/rampart-asymm-binding-ebs-encr-sig.xml"); + } + + public void testAsymmetricSignBeforeEncryptEncryptedSupportingToken() throws Exception { + roundTrip("test-resources/policy/rampart-asymm-binding-sbe-encr-sup-tokens.xml"); + } + + public void testAsymmetricSignBeforeEncryptSignedEncryptedSupportingToken() throws Exception { + roundTrip("test-resources/policy/rampart-asymm-binding-sbe-signed-encr-sup-tokens.xml"); + } + + public void testSymmetricSignBeforeEncryptEncryptedSupportingToken() throws Exception { + roundTrip("test-resources/policy/rampart-symm-binding-sbe-encr-sup-tokens.xml"); + } + + /** A password-less token (sp:NoPassword) is reported by WSS4J under its own action. */ + public void testEncryptedSupportingTokenWithoutPassword() throws Exception { + roundTrip("test-resources/policy/rampart-asymm-binding-ebs-encr-sup-tokens-nopassword.xml"); + } + + /** A token the policy wants encrypted but which arrives in the clear must be refused. */ + public void testClearTextSupportingTokenIsRefusedWhenEncryptionIsRequired() throws Exception { + assertRefused("test-resources/policy/rampart-asymm-binding-ebs-plain-sup-tokens.xml", + "test-resources/policy/rampart-asymm-binding-ebs-encr-sup-tokens.xml"); + } + + /** The signature covers nothing but the signed-encrypted token; that is not an unexpected signature. */ + public void testSignatureOverTheSignedEncryptedTokenAlone() throws Exception { + roundTrip("test-resources/policy/rampart-asymm-binding-signed-encr-sup-token-only.xml"); + } + + /** A request without the encrypted supporting token must still be refused. */ + public void testMissingEncryptedSupportingTokenIsRefused() throws Exception { + assertRefused("test-resources/policy/rampart-asymm-binding-ebs.xml", + "test-resources/policy/rampart-asymm-binding-ebs-encr-sup-tokens.xml"); + } + + public void testMissingSignedEncryptedSupportingTokenIsRefused() throws Exception { + assertRefused("test-resources/policy/rampart-asymm-binding-ebs.xml", + "test-resources/policy/rampart-asymm-binding-ebs-signed-encr-sup-tokens.xml"); + } + + private void assertRefused(String clientPolicyPath, String servicePolicyPath) throws Exception { + MessageContext ctx = getMsgCtx(); + ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, loadPolicy(clientPolicyPath)); + new MessageBuilder().build(ctx); + try { + processAsService(ctx, loadPolicy(servicePolicyPath)); + fail("the request has no supporting token and must be refused"); + } catch (RampartException expected) { + // usernameTokenMissing + } + } + + private void roundTrip(String policyPath) throws Exception { + MessageContext ctx = getMsgCtx(); + Policy policy = loadPolicy(policyPath); + ctx.setProperty(RampartMessageData.KEY_RAMPART_POLICY, policy); + new MessageBuilder().build(ctx); + assertFalse("the supporting token must not be sent in the clear", + hasClearTextUsernameToken(ctx.getEnvelope())); + + List<WSSecurityEngineResult> results = processAsService(ctx, policy); + + boolean signed = false; + boolean encrypted = false; + for (WSSecurityEngineResult result : results) { + Integer action = (Integer) result.get(WSSecurityEngineResult.TAG_ACTION); + signed |= action == WSConstants.SIGN; + encrypted |= action == WSConstants.ENCR; + } + assertTrue("signature not processed", signed); + assertTrue("encryption not processed", encrypted); + } + + private static boolean hasClearTextUsernameToken(SOAPEnvelope env) { + OMElement security = env.getHeader().getFirstChildWithName( + new QName(WSConstants.WSSE_NS, WSConstants.WSSE_LN)); + return security.getFirstChildWithName( + new QName(WSConstants.WSSE_NS, WSConstants.USERNAME_TOKEN_LN)) != null; + } + + /** Re-parses the built envelope and runs it through the engine as the service. */ + private static List<WSSecurityEngineResult> processAsService(MessageContext ctx, Policy policy) + throws Exception { + SOAPEnvelope env = ctx.getEnvelope(); + ByteArrayInputStream in = new ByteArrayInputStream(env.toString().getBytes("UTF-8")); + env = (SOAPEnvelope) new SOAPBuilder().processDocument(in, "text/xml", ctx); + ctx.setEnvelope(env); + + 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, policy); + ctx.setProperty(WSHandlerConstants.PW_CALLBACK_REF, new TestCBHandler()); + + return new RampartEngine().process(ctx); + } +} diff --git a/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-encr-sig.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-encr-sig.xml new file mode 100644 index 00000000..43b64dd9 --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-encr-sig.xml @@ -0,0 +1,76 @@ +<wsp:Policy wsu:Id="AsymmEbsEncrSig" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128Rsa15/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:EncryptSignature/> + <sp:EncryptBeforeSigning/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss10> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <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> diff --git a/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-encr-sup-tokens-nopassword.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-encr-sup-tokens-nopassword.xml new file mode 100644 index 00000000..097fe285 --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-encr-sup-tokens-nopassword.xml @@ -0,0 +1,85 @@ +<wsp:Policy wsu:Id="AsymmEbsEncrSupTokensNoPassword" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128Rsa15/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:EncryptBeforeSigning/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss10> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:EncryptedSupportingTokens> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssUsernameToken11/> + <sp:NoPassword/> + </wsp:Policy> + </sp:UsernameToken> + </wsp:Policy> + </sp:EncryptedSupportingTokens> + <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-ebs-encr-sup-tokens.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-encr-sup-tokens.xml new file mode 100644 index 00000000..437de4a6 --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-encr-sup-tokens.xml @@ -0,0 +1,80 @@ +<wsp:Policy wsu:Id="AsymmEbsEncrSupTokens" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128Rsa15/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:EncryptBeforeSigning/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss10> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:EncryptedSupportingTokens> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> + </wsp:Policy> + </sp:EncryptedSupportingTokens> + <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-ebs-plain-sup-tokens.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-plain-sup-tokens.xml new file mode 100644 index 00000000..ca311fca --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-plain-sup-tokens.xml @@ -0,0 +1,80 @@ +<wsp:Policy wsu:Id="AsymmEbsPlainSupTokens" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128Rsa15/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:EncryptBeforeSigning/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss10> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:SupportingTokens> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> + </wsp:Policy> + </sp:SupportingTokens> + <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-ebs-signed-encr-sup-tokens.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-signed-encr-sup-tokens.xml new file mode 100644 index 00000000..02452bce --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs-signed-encr-sup-tokens.xml @@ -0,0 +1,80 @@ +<wsp:Policy wsu:Id="AsymmEbsSignedEncrSupTokens" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128Rsa15/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:EncryptBeforeSigning/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss10> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:SignedEncryptedSupportingTokens> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> + </wsp:Policy> + </sp:SignedEncryptedSupportingTokens> + <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-ebs.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs.xml new file mode 100644 index 00000000..57872abc --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-ebs.xml @@ -0,0 +1,75 @@ +<wsp:Policy wsu:Id="AsymmEbs" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128Rsa15/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:EncryptBeforeSigning/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss10> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <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> diff --git a/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sbe-encr-sup-tokens.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sbe-encr-sup-tokens.xml new file mode 100644 index 00000000..4c258bf8 --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sbe-encr-sup-tokens.xml @@ -0,0 +1,79 @@ +<wsp:Policy wsu:Id="AsymmSbeEncrSupTokens" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128Rsa15/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss10> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:EncryptedSupportingTokens> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> + </wsp:Policy> + </sp:EncryptedSupportingTokens> + <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-sbe-signed-encr-sup-tokens.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sbe-signed-encr-sup-tokens.xml new file mode 100644 index 00000000..9d7501ee --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-sbe-signed-encr-sup-tokens.xml @@ -0,0 +1,79 @@ +<wsp:Policy wsu:Id="AsymmSbeSignedEncrSupTokens" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128Rsa15/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss10> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:SignedEncryptedSupportingTokens> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> + </wsp:Policy> + </sp:SignedEncryptedSupportingTokens> + <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-signed-encr-sup-token-only.xml b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-signed-encr-sup-token-only.xml new file mode 100644 index 00000000..80ac3f8f --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-asymm-binding-signed-encr-sup-token-only.xml @@ -0,0 +1,75 @@ +<wsp:Policy wsu:Id="AsymmSignedEncrSupTokenOnly" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:AsymmetricBinding> + <wsp:Policy> + <sp:InitiatorToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:InitiatorToken> + <sp:RecipientToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/Never"> + <wsp:Policy> + <sp:WssX509V3Token10/> + </wsp:Policy> + </sp:X509Token> + </wsp:Policy> + </sp:RecipientToken> + <sp:AlgorithmSuite> + <wsp:Policy> + <sp:Basic128Rsa15/> + </wsp:Policy> + </sp:AlgorithmSuite> + <sp:Layout> + <wsp:Policy> + <sp:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:AsymmetricBinding> + <sp:Wss10> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + </wsp:Policy> + </sp:Wss10> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:SignedEncryptedSupportingTokens> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> + </wsp:Policy> + </sp:SignedEncryptedSupportingTokens> + <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-ebs-encr-sup-tokens.xml b/modules/rampart-tests/test-resources/policy/rampart-symm-binding-ebs-encr-sup-tokens.xml new file mode 100644 index 00000000..b872e788 --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-symm-binding-ebs-encr-sup-tokens.xml @@ -0,0 +1,74 @@ +<wsp:Policy wsu:Id="SymmEbsEncrSupTokens" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:SymmetricBinding> + <wsp:Policy> + <sp:ProtectionToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/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:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:EncryptBeforeSigning/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:SymmetricBinding> + <sp:Wss11> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + <sp:MustSupportRefThumbprint/> + <sp:MustSupportRefEncryptedKey/> + </wsp:Policy> + </sp:Wss11> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:EncryptedSupportingTokens> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> + </wsp:Policy> + </sp:EncryptedSupportingTokens> + <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-sbe-encr-sup-tokens.xml b/modules/rampart-tests/test-resources/policy/rampart-symm-binding-sbe-encr-sup-tokens.xml new file mode 100644 index 00000000..dd47ac3f --- /dev/null +++ b/modules/rampart-tests/test-resources/policy/rampart-symm-binding-sbe-encr-sup-tokens.xml @@ -0,0 +1,73 @@ +<wsp:Policy wsu:Id="SymmSbeEncrSupTokens" + 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:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"> + <wsp:ExactlyOne> + <wsp:All> + <sp:SymmetricBinding> + <wsp:Policy> + <sp:ProtectionToken> + <wsp:Policy> + <sp:X509Token sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/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:Lax/> + </wsp:Policy> + </sp:Layout> + <sp:IncludeTimestamp/> + <sp:OnlySignEntireHeadersAndBody/> + </wsp:Policy> + </sp:SymmetricBinding> + <sp:Wss11> + <wsp:Policy> + <sp:MustSupportRefKeyIdentifier/> + <sp:MustSupportRefIssuerSerial/> + <sp:MustSupportRefThumbprint/> + <sp:MustSupportRefEncryptedKey/> + </wsp:Policy> + </sp:Wss11> + <sp:SignedParts> + <sp:Body/> + </sp:SignedParts> + <sp:EncryptedParts> + <sp:Body/> + </sp:EncryptedParts> + <sp:EncryptedSupportingTokens> + <wsp:Policy> + <sp:UsernameToken sp:IncludeToken="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702/IncludeToken/AlwaysToRecipient"/> + </wsp:Policy> + </sp:EncryptedSupportingTokens> + <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>
