You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by bi...@apache.org on 2020/04/15 16:08:49 UTC

[axis-axis2-java-rampart] 06/18: * RAMPART-324: Merged r1178193 to the 1.5 branch. * Also merged r1075676 (addition of a test case) to avoid a merge conflict.

This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch 1_5_x
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-rampart.git

commit 51ed229fbfee75971e9af6c939b3492fa918025a
Author: Andreas Veithen <ve...@apache.org>
AuthorDate: Wed Oct 19 19:13:50 2011 +0000

    * RAMPART-324: Merged r1178193 to the 1.5 branch.
    * Also merged r1075676 (addition of a test case) to avoid a merge conflict.
---
 modules/rampart-integration/pom.xml                |   8 ++
 .../test/java/org/apache/rampart/RampartTest.java  |   9 +-
 .../src/test/resources/rampart/policy/32.xml       |  90 +++++++++++++
 .../src/test/resources/rampart/policy/33.xml       | 103 +++++++++++++++
 .../src/test/resources/rampart/services-32.xml     | 128 +++++++++++++++++++
 .../src/test/resources/rampart/services-33.xml     | 140 +++++++++++++++++++++
 .../builders/EncryptedElementsBuilder.java         |   2 +-
 .../builders/RequiredElementsBuilder.java          |   2 +-
 .../builders/SignedElementsBuilder.java            |   2 +-
 .../builders/ContentEncryptedElementsBuilder.java  |   2 +-
 .../builders/EncryptedElementsBuilder.java         |   2 +-
 .../builders/RequiredElementsBuilder.java          |   2 +-
 .../builders/SignedElementsBuilder.java            |   2 +-
 13 files changed, 479 insertions(+), 13 deletions(-)

diff --git a/modules/rampart-integration/pom.xml b/modules/rampart-integration/pom.xml
index 68b1e0d..dc3eeec 100644
--- a/modules/rampart-integration/pom.xml
+++ b/modules/rampart-integration/pom.xml
@@ -256,6 +256,14 @@
                                 <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService31.aar"
                                      basedir="target/temp-ramp"/>
 
+                                <!-- Service 32 -->
+                                <copy overwrite="yes" file="src/test/resources/rampart/services-32.xml" tofile="target/temp-ramp/META-INF/services.xml" />
+                                <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService32.aar" basedir="target/temp-ramp" />
+
+                                <!-- Service 33 -->
+                                <copy overwrite="yes" file="src/test/resources/rampart/services-33.xml" tofile="target/temp-ramp/META-INF/services.xml" />
+                                <jar jarfile="target/test-resources/rampart_service_repo/services/SecureService33.aar" basedir="target/temp-ramp" />
+
                                 <!-- Service SC-1 -->
                                 <copy overwrite="yes" file="src/test/resources/rampart/issuer.properties" tofile="target/temp-ramp/issuer.properties" />
                                 <copy overwrite="yes" file="src/test/resources/rampart/services-sc-1.xml" tofile="target/temp-ramp/META-INF/services.xml" />
diff --git a/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java b/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
index 34c8f2b..a06b31f 100644
--- a/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
+++ b/modules/rampart-integration/src/test/java/org/apache/rampart/RampartTest.java
@@ -16,6 +16,7 @@
 
 package org.apache.rampart;
 
+import junit.framework.TestCase;
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
@@ -23,21 +24,17 @@ import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.om.impl.builder.StAXOMBuilder;
 import org.apache.axiom.om.util.AXIOMUtil;
 import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axis2.Constants;
 import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
 import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.integration.UtilServer;
 import org.apache.neethi.Policy;
 import org.apache.neethi.PolicyEngine;
-import org.apache.ws.security.handler.WSHandlerConstants;
-
-import junit.framework.TestCase;
 
 
 public class RampartTest extends TestCase {
@@ -79,7 +76,7 @@ public class RampartTest extends TestCase {
                         "Unlimited Strength Jurisdiction Policy !!!");
             }
             
-            for (int i = 1; i <= 31; i++) { //<-The number of tests we have
+            for (int i = 1; i <= 33; i++) { //<-The number of tests we have
                 if(!basic256Supported && (i == 3 || i == 4 || i == 5)) {
                     //Skip the Basic256 tests
                     continue;
diff --git a/modules/rampart-integration/src/test/resources/rampart/policy/32.xml b/modules/rampart-integration/src/test/resources/rampart/policy/32.xml
new file mode 100644
index 0000000..66e613a
--- /dev/null
+++ b/modules/rampart-integration/src/test/resources/rampart/policy/32.xml
@@ -0,0 +1,90 @@
+<wsp:Policy wsu:Id="EncrSigHeader"
+            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://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+                <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:Basic128/>
+                        </wsp:Policy>
+                    </sp:AlgorithmSuite>
+                    <sp:Layout>
+                        <wsp:Policy>
+                            <sp:Strict/>
+                        </wsp:Policy>
+                    </sp:Layout>
+                    <sp:IncludeTimestamp/>
+                    <sp:EncryptBeforeSigning/>
+                    <sp:OnlySignEntireHeadersAndBody/>
+                </wsp:Policy>
+            </sp:AsymmetricBinding>
+            <sp:Wss10 xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+                <wsp:Policy>
+                    <sp:MustSupportRefKeyIdentifier/>
+                    <sp:MustSupportRefIssuerSerial/>
+                </wsp:Policy>
+            </sp:Wss10>
+            <sp:ContentEncryptedElements
+                    xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
+                    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                    xmlns:example1="http://example1.org/example1">
+                <sp:XPath>soapenv:Body/example1:echo/example1:Text</sp:XPath>
+            </sp:ContentEncryptedElements>
+            <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.PWCallback
+                </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">JKS
+                        </ramp:property>
+                        <ramp:property name="org.apache.ws.security.crypto.merlin.file">
+                            rampart/store.jks
+                        </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">JKS
+                        </ramp:property>
+                        <ramp:property name="org.apache.ws.security.crypto.merlin.file">
+                            rampart/store.jks
+                        </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-integration/src/test/resources/rampart/policy/33.xml b/modules/rampart-integration/src/test/resources/rampart/policy/33.xml
new file mode 100644
index 0000000..f5c7da8
--- /dev/null
+++ b/modules/rampart-integration/src/test/resources/rampart/policy/33.xml
@@ -0,0 +1,103 @@
+<wsp:Policy wsu:Id="SignEncryptXPath"
+            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/Never">
+                                <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:TripleDesRsa15/>
+                        </wsp:Policy>
+                    </sp:AlgorithmSuite>
+                    <sp:Layout>
+                        <wsp:Policy>
+
+                            <sp:Strict/>
+                        </wsp:Policy>
+                    </sp:Layout>
+                    <sp:IncludeTimestamp/>
+                    <sp:OnlySignEntireHeadersAndBody/>
+                </wsp:Policy>
+            </sp:AsymmetricBinding>
+            <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                <wsp:Policy>
+
+                    <sp:MustSupportRefKeyIdentifier/>
+                    <sp:MustSupportRefIssuerSerial/>
+                </wsp:Policy>
+            </sp:Wss10>
+
+            <sp:EncryptedElements xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                                  xmlns:ser="http://example1.org/example1"
+                                  xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                <sp:XPath>/soapenv:Envelope/soapenv:Body/ser:example1</sp:XPath>
+            </sp:EncryptedElements>
+            <sp:SignedElements xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                               xmlns:test="http://example1.org/example1"
+                               xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                <sp:XPath>/soapenv:Envelope/soapenv:Body/test:example1</sp:XPath>
+            </sp:SignedElements>
+
+           <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.PWCallback
+                    </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">JKS
+                            </ramp:property>
+                            <ramp:property name="org.apache.ws.security.crypto.merlin.file">
+                                rampart/store.jks
+                            </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">JKS
+                            </ramp:property>
+                            <ramp:property name="org.apache.ws.security.crypto.merlin.file">
+                                rampart/store.jks
+                            </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-integration/src/test/resources/rampart/services-32.xml b/modules/rampart-integration/src/test/resources/rampart/services-32.xml
new file mode 100644
index 0000000..9d724ff
--- /dev/null
+++ b/modules/rampart-integration/src/test/resources/rampart/services-32.xml
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ !
+ ! Copyright 2006 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.
+ !-->
+<service name="SecureService32">
+
+    <module ref="addressing"/>
+    <module ref="rampart"/>
+
+    <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+    <operation name="echo">
+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <actionMapping>urn:echo</actionMapping>
+    </operation>
+
+    <operation name="returnError">
+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <actionMapping>urn:returnError</actionMapping>
+    </operation>
+
+    <wsp:Policy wsu:Id="EncrSigHeader"
+                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://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+                    <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:Basic128/>
+                            </wsp:Policy>
+                        </sp:AlgorithmSuite>
+                        <sp:Layout>
+                            <wsp:Policy>
+                                <sp:Strict/>
+                            </wsp:Policy>
+                        </sp:Layout>
+                        <sp:IncludeTimestamp/>
+                        <sp:EncryptBeforeSigning/>
+                        <sp:OnlySignEntireHeadersAndBody/>
+                    </wsp:Policy>
+                </sp:AsymmetricBinding>
+                <sp:Wss10 xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702">
+                    <wsp:Policy>
+                        <sp:MustSupportRefKeyIdentifier/>
+                        <sp:MustSupportRefIssuerSerial/>
+                    </wsp:Policy>
+                </sp:Wss10>
+                <sp:ContentEncryptedElements
+                        xmlns:sp="http://docs.oasis-open.org/ws-sx/ws-securitypolicy/200702"
+                        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                        xmlns:example1="http://example1.org/example1">
+                    <sp:XPath>soapenv:Body/example1:echo/example1:Text</sp:XPath>
+                </sp:ContentEncryptedElements>
+                <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.PWCallback
+                    </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">JKS
+                            </ramp:property>
+                            <ramp:property name="org.apache.ws.security.crypto.merlin.file">
+                                rampart/store.jks
+                            </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">JKS
+                            </ramp:property>
+                            <ramp:property name="org.apache.ws.security.crypto.merlin.file">
+                                rampart/store.jks
+                            </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>
+</service>
diff --git a/modules/rampart-integration/src/test/resources/rampart/services-33.xml b/modules/rampart-integration/src/test/resources/rampart/services-33.xml
new file mode 100644
index 0000000..fecafe4
--- /dev/null
+++ b/modules/rampart-integration/src/test/resources/rampart/services-33.xml
@@ -0,0 +1,140 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ !
+ ! Copyright 2006 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.
+ !-->
+<service name="SecureService33">
+
+    <module ref="addressing"/>
+    <module ref="rampart"/>
+
+    <parameter locked="false" name="ServiceClass">org.apache.rampart.Service</parameter>
+
+    <operation name="echo">
+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <actionMapping>urn:echo</actionMapping>
+    </operation>
+
+    <operation name="returnError">
+        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
+        <actionMapping>urn:returnError</actionMapping>
+    </operation>
+
+    <wsp:Policy wsu:Id="EncryptOnly"
+                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/Never">
+                                    <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:TripleDesRsa15/>
+                            </wsp:Policy>
+                        </sp:AlgorithmSuite>
+                        <sp:Layout>
+                            <wsp:Policy>
+
+                                <sp:Strict/>
+                            </wsp:Policy>
+                        </sp:Layout>
+                        <sp:IncludeTimestamp/>
+                        <sp:OnlySignEntireHeadersAndBody/>
+                    </wsp:Policy>
+                </sp:AsymmetricBinding>
+                <sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                    <wsp:Policy>
+
+                        <sp:MustSupportRefKeyIdentifier/>
+                        <sp:MustSupportRefIssuerSerial/>
+                    </wsp:Policy>
+                </sp:Wss10>
+
+                <sp:EncryptedElements xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                                      xmlns:ser="http://example1.org/example1"
+                                      xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                    <sp:XPath>/soapenv:Envelope/soapenv:Body/ser:example1</sp:XPath>
+                </sp:EncryptedElements>
+                <sp:SignedElements xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+                                   xmlns:test="http://example1.org/example1"
+                                   xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
+                    <sp:XPath>/soapenv:Envelope/soapenv:Body/test:example1</sp:XPath>
+                </sp:SignedElements>
+
+               <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.PWCallback
+                    </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">JKS
+                            </ramp:property>
+                            <ramp:property name="org.apache.ws.security.crypto.merlin.file">
+                                rampart/store.jks
+                            </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">JKS
+                            </ramp:property>
+                            <ramp:property name="org.apache.ws.security.crypto.merlin.file">
+                                rampart/store.jks
+                            </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>
+
+
+</service>
diff --git a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/EncryptedElementsBuilder.java b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/EncryptedElementsBuilder.java
index 1301a79..c40ac8e 100644
--- a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/EncryptedElementsBuilder.java
+++ b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/EncryptedElementsBuilder.java
@@ -64,7 +64,7 @@ public class EncryptedElementsBuilder implements AssertionBuilder {
     private void processElement(OMElement element, SignedEncryptedElements parent) {
         if (SP11Constants.XPATH.equals(element.getQName())) {
             parent.addXPathExpression(element.getText());   
-            Iterator namespaces = element.getAllDeclaredNamespaces();
+            Iterator namespaces = element.getNamespacesInScope();
             while (namespaces.hasNext()) {
                 OMNamespace nm = (OMNamespace) namespaces.next();
                 parent.addDeclaredNamespaces(nm.getNamespaceURI(), nm.getPrefix());
diff --git a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/RequiredElementsBuilder.java b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/RequiredElementsBuilder.java
index 8ff78f9..b6d783a 100644
--- a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/RequiredElementsBuilder.java
+++ b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/RequiredElementsBuilder.java
@@ -56,7 +56,7 @@ public class RequiredElementsBuilder implements AssertionBuilder {
         QName name = element.getQName();
         if (SP11Constants.XPATH.equals(name)) {
             parent.addXPathExpression(element.getText());
-            Iterator namespaces = element.getAllDeclaredNamespaces();
+            Iterator namespaces = element.getNamespacesInScope();
             while (namespaces.hasNext()) {
                 OMNamespace nm = (OMNamespace) namespaces.next();
                 parent.addDeclaredNamespaces(nm.getNamespaceURI(), nm.getPrefix());
diff --git a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/SignedElementsBuilder.java b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/SignedElementsBuilder.java
index 185c8d1..11a54a9 100644
--- a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/SignedElementsBuilder.java
+++ b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy11/builders/SignedElementsBuilder.java
@@ -62,7 +62,7 @@ public class SignedElementsBuilder implements AssertionBuilder {
         QName name = element.getQName();
         if (SP11Constants.XPATH.equals(name)) {
             parent.addXPathExpression(element.getText());
-            Iterator namespaces = element.getAllDeclaredNamespaces();
+            Iterator namespaces = element.getNamespacesInScope();
             while (namespaces.hasNext()) {
                 OMNamespace nm = (OMNamespace) namespaces.next();
                 parent.addDeclaredNamespaces(nm.getNamespaceURI(), nm.getPrefix());
diff --git a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/ContentEncryptedElementsBuilder.java b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/ContentEncryptedElementsBuilder.java
index 77e5c14..fa94274 100644
--- a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/ContentEncryptedElementsBuilder.java
+++ b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/ContentEncryptedElementsBuilder.java
@@ -56,7 +56,7 @@ public class ContentEncryptedElementsBuilder implements AssertionBuilder {
         QName name = element.getQName();
         if (SP12Constants.XPATH.equals(name)) {
             parent.addXPathExpression(element.getText());
-            Iterator namespaces = element.getAllDeclaredNamespaces();
+            Iterator namespaces = element.getNamespacesInScope();
             while (namespaces.hasNext()) {
                 OMNamespace nm = (OMNamespace) namespaces.next();
                 parent.addDeclaredNamespaces(nm.getNamespaceURI(), nm.getPrefix());
diff --git a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/EncryptedElementsBuilder.java b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/EncryptedElementsBuilder.java
index 3c9c8e7..e927f44 100755
--- a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/EncryptedElementsBuilder.java
+++ b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/EncryptedElementsBuilder.java
@@ -65,7 +65,7 @@ public class EncryptedElementsBuilder implements AssertionBuilder {
     private void processElement(OMElement element, SignedEncryptedElements parent) {
         if (SP12Constants.XPATH.equals(element.getQName())) {
             parent.addXPathExpression(element.getText());   
-            Iterator namespaces = element.getAllDeclaredNamespaces();
+            Iterator namespaces = element.getNamespacesInScope();
             while (namespaces.hasNext()) {
                 OMNamespace nm = (OMNamespace) namespaces.next();
                 parent.addDeclaredNamespaces(nm.getNamespaceURI(), nm.getPrefix());
diff --git a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/RequiredElementsBuilder.java b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/RequiredElementsBuilder.java
index 5c1dc6f..ece4b04 100644
--- a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/RequiredElementsBuilder.java
+++ b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/RequiredElementsBuilder.java
@@ -57,7 +57,7 @@ public class RequiredElementsBuilder implements AssertionBuilder {
         QName name = element.getQName();
         if (SP12Constants.XPATH.equals(name)) {
             parent.addXPathExpression(element.getText());
-            Iterator namespaces = element.getAllDeclaredNamespaces();
+            Iterator namespaces = element.getNamespacesInScope();
             while (namespaces.hasNext()) {
                 OMNamespace nm = (OMNamespace) namespaces.next();
                 parent.addDeclaredNamespaces(nm.getNamespaceURI(), nm.getPrefix());
diff --git a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/SignedElementsBuilder.java b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/SignedElementsBuilder.java
index f08d6b0..a34be11 100755
--- a/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/SignedElementsBuilder.java
+++ b/modules/rampart-policy/src/main/java/org/apache/ws/secpolicy12/builders/SignedElementsBuilder.java
@@ -63,7 +63,7 @@ public class SignedElementsBuilder implements AssertionBuilder {
         QName name = element.getQName();
         if (SP12Constants.XPATH.equals(name)) {
             parent.addXPathExpression(element.getText());
-            Iterator namespaces = element.getAllDeclaredNamespaces();
+            Iterator namespaces = element.getNamespacesInScope();
             while (namespaces.hasNext()) {
                 OMNamespace nm = (OMNamespace) namespaces.next();
                 parent.addDeclaredNamespaces(nm.getNamespaceURI(), nm.getPrefix());