You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2011/06/07 18:25:52 UTC

svn commit: r1133081 [38/50] - in /webservices/wss4j/site: ./ apidocs/ apidocs/org/apache/ws/security/ apidocs/org/apache/ws/security/action/ apidocs/org/apache/ws/security/action/class-use/ apidocs/org/apache/ws/security/class-use/ apidocs/org/apache/...

Modified: webservices/wss4j/site/xref/org/apache/ws/security/processor/EncryptedKeyProcessor.html
URL: http://svn.apache.org/viewvc/webservices/wss4j/site/xref/org/apache/ws/security/processor/EncryptedKeyProcessor.html?rev=1133081&r1=1133080&r2=1133081&view=diff
==============================================================================
--- webservices/wss4j/site/xref/org/apache/ws/security/processor/EncryptedKeyProcessor.html (original)
+++ webservices/wss4j/site/xref/org/apache/ws/security/processor/EncryptedKeyProcessor.html Tue Jun  7 16:25:20 2011
@@ -147,212 +147,213 @@
 <a name="137" href="#137">137</a>         );
 <a name="138" href="#138">138</a>         result.put(WSSecurityEngineResult.TAG_ID, elem.getAttribute(<span class="jxr_string">"Id"</span>));
 <a name="139" href="#139">139</a>         wsDocInfo.addResult(result);
-<a name="140" href="#140">140</a>         <strong class="jxr_keyword">return</strong> java.util.Collections.singletonList(result);
-<a name="141" href="#141">141</a>     }
-<a name="142" href="#142">142</a>     
-<a name="143" href="#143">143</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="144" href="#144">144</a> <em class="jxr_javadoccomment">     * Method getDecodedBase64EncodedData</em>
-<a name="145" href="#145">145</a> <em class="jxr_javadoccomment">     *</em>
-<a name="146" href="#146">146</a> <em class="jxr_javadoccomment">     * @param element</em>
-<a name="147" href="#147">147</a> <em class="jxr_javadoccomment">     * @return a byte array containing the decoded data</em>
-<a name="148" href="#148">148</a> <em class="jxr_javadoccomment">     * @throws WSSecurityException</em>
-<a name="149" href="#149">149</a> <em class="jxr_javadoccomment">     */</em>
-<a name="150" href="#150">150</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> byte[] getDecodedBase64EncodedData(Element element) <strong class="jxr_keyword">throws</strong> WSSecurityException {
-<a name="151" href="#151">151</a>         StringBuilder sb = <strong class="jxr_keyword">new</strong> StringBuilder();
-<a name="152" href="#152">152</a>         Node node = element.getFirstChild();
-<a name="153" href="#153">153</a>         <strong class="jxr_keyword">while</strong> (node != <strong class="jxr_keyword">null</strong>) {
-<a name="154" href="#154">154</a>             <strong class="jxr_keyword">if</strong> (Node.TEXT_NODE == node.getNodeType()) {
-<a name="155" href="#155">155</a>                 sb.append(((Text) node).getData());
-<a name="156" href="#156">156</a>             }
-<a name="157" href="#157">157</a>             node = node.getNextSibling();
-<a name="158" href="#158">158</a>         }
-<a name="159" href="#159">159</a>         String encodedData = sb.toString();
-<a name="160" href="#160">160</a>         <strong class="jxr_keyword">return</strong> Base64.decode(encodedData);
-<a name="161" href="#161">161</a>     }
-<a name="162" href="#162">162</a>     
-<a name="163" href="#163">163</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="164" href="#164">164</a> <em class="jxr_javadoccomment">     * @return the Certificate(s) corresponding to the public key reference in the </em>
-<a name="165" href="#165">165</a> <em class="jxr_javadoccomment">     * EncryptedKey Element</em>
-<a name="166" href="#166">166</a> <em class="jxr_javadoccomment">     */</em>
-<a name="167" href="#167">167</a>     <strong class="jxr_keyword">private</strong> X509Certificate[] getCertificatesFromEncryptedKey(
-<a name="168" href="#168">168</a>         Element xencEncryptedKey,
-<a name="169" href="#169">169</a>         <a href="../../../../../org/apache/ws/security/handler/RequestData.html">RequestData</a> data,
-<a name="170" href="#170">170</a>         <a href="../../../../../org/apache/ws/security/components/crypto/Crypto.html">Crypto</a> crypto,
-<a name="171" href="#171">171</a>         <a href="../../../../../org/apache/ws/security/WSDocInfo.html">WSDocInfo</a> wsDocInfo
-<a name="172" href="#172">172</a>     ) <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
-<a name="173" href="#173">173</a>         Element keyInfo = 
-<a name="174" href="#174">174</a>             WSSecurityUtil.getDirectChildElement(
-<a name="175" href="#175">175</a>                 xencEncryptedKey, <span class="jxr_string">"KeyInfo"</span>, WSConstants.SIG_NS
-<a name="176" href="#176">176</a>             );
-<a name="177" href="#177">177</a>         <strong class="jxr_keyword">if</strong> (keyInfo != <strong class="jxr_keyword">null</strong>) {
-<a name="178" href="#178">178</a>             Element strElement = <strong class="jxr_keyword">null</strong>;
-<a name="179" href="#179">179</a>             <strong class="jxr_keyword">if</strong> (data.getWssConfig().isWsiBSPCompliant()) {
-<a name="180" href="#180">180</a>                 <strong class="jxr_keyword">int</strong> result = 0;
-<a name="181" href="#181">181</a>                 Node node = keyInfo.getFirstChild();
-<a name="182" href="#182">182</a>                 <strong class="jxr_keyword">while</strong> (node != <strong class="jxr_keyword">null</strong>) {
-<a name="183" href="#183">183</a>                     <strong class="jxr_keyword">if</strong> (Node.ELEMENT_NODE == node.getNodeType()) {
-<a name="184" href="#184">184</a>                         result++;
-<a name="185" href="#185">185</a>                         strElement = (Element)node;
-<a name="186" href="#186">186</a>                     }
-<a name="187" href="#187">187</a>                     node = node.getNextSibling();
-<a name="188" href="#188">188</a>                 }
-<a name="189" href="#189">189</a>                 <strong class="jxr_keyword">if</strong> (result != 1) {
-<a name="190" href="#190">190</a>                     <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="191" href="#191">191</a>                         WSSecurityException.INVALID_SECURITY, <span class="jxr_string">"invalidDataRef"</span>
-<a name="192" href="#192">192</a>                     );
-<a name="193" href="#193">193</a>                 }
-<a name="194" href="#194">194</a>             } <strong class="jxr_keyword">else</strong> {
-<a name="195" href="#195">195</a>                  strElement = 
-<a name="196" href="#196">196</a>                     WSSecurityUtil.getDirectChildElement(
-<a name="197" href="#197">197</a>                         keyInfo,
-<a name="198" href="#198">198</a>                         SecurityTokenReference.SECURITY_TOKEN_REFERENCE,
-<a name="199" href="#199">199</a>                         WSConstants.WSSE_NS
-<a name="200" href="#200">200</a>                     );
-<a name="201" href="#201">201</a>             }
-<a name="202" href="#202">202</a>             <strong class="jxr_keyword">if</strong> (strElement == <strong class="jxr_keyword">null</strong>) {
-<a name="203" href="#203">203</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="204" href="#204">204</a>                     WSSecurityException.INVALID_SECURITY, <span class="jxr_string">"noSecTokRef"</span>
-<a name="205" href="#205">205</a>                 );
-<a name="206" href="#206">206</a>             }
-<a name="207" href="#207">207</a>             <a href="../../../../../org/apache/ws/security/str/STRParser.html">STRParser</a> strParser = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/str/EncryptedKeySTRParser.html">EncryptedKeySTRParser</a>();
-<a name="208" href="#208">208</a>             strParser.parseSecurityTokenReference(strElement, data, wsDocInfo, <strong class="jxr_keyword">null</strong>);
-<a name="209" href="#209">209</a>             
-<a name="210" href="#210">210</a>             X509Certificate[] certs = strParser.getCertificates();
-<a name="211" href="#211">211</a>             <strong class="jxr_keyword">if</strong> (certs == <strong class="jxr_keyword">null</strong> || certs.length &lt; 1 || certs[0] == <strong class="jxr_keyword">null</strong>) {
-<a name="212" href="#212">212</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="213" href="#213">213</a>                     WSSecurityException.FAILURE,
-<a name="214" href="#214">214</a>                     <span class="jxr_string">"noCertsFound"</span>, 
-<a name="215" href="#215">215</a>                     <strong class="jxr_keyword">new</strong> Object[] {<span class="jxr_string">"decryption (KeyId)"</span>}
-<a name="216" href="#216">216</a>                 );
-<a name="217" href="#217">217</a>             }
-<a name="218" href="#218">218</a>             <strong class="jxr_keyword">return</strong> certs;
-<a name="219" href="#219">219</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (!data.getWssConfig().isWsiBSPCompliant() 
-<a name="220" href="#220">220</a>             &amp;&amp; crypto.getDefaultX509Identifier() != <strong class="jxr_keyword">null</strong>) {
-<a name="221" href="#221">221</a>             String alias = crypto.getDefaultX509Identifier();
-<a name="222" href="#222">222</a>             <a href="../../../../../org/apache/ws/security/components/crypto/CryptoType.html">CryptoType</a> cryptoType = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/components/crypto/CryptoType.html">CryptoType</a>(CryptoType.TYPE.ALIAS);
-<a name="223" href="#223">223</a>             cryptoType.setAlias(alias);
-<a name="224" href="#224">224</a>             X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
-<a name="225" href="#225">225</a>             <strong class="jxr_keyword">if</strong> (certs == <strong class="jxr_keyword">null</strong> || certs.length &lt; 1 || certs[0] == <strong class="jxr_keyword">null</strong>) {
-<a name="226" href="#226">226</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="227" href="#227">227</a>                     WSSecurityException.FAILURE,
-<a name="228" href="#228">228</a>                     <span class="jxr_string">"noCertsFound"</span>, 
-<a name="229" href="#229">229</a>                     <strong class="jxr_keyword">new</strong> Object[] {<span class="jxr_string">"decryption (KeyId)"</span>}
-<a name="230" href="#230">230</a>                 );
-<a name="231" href="#231">231</a>             }
-<a name="232" href="#232">232</a>             <strong class="jxr_keyword">return</strong> certs;
-<a name="233" href="#233">233</a>         } <strong class="jxr_keyword">else</strong> {
-<a name="234" href="#234">234</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.INVALID_SECURITY, <span class="jxr_string">"noKeyinfo"</span>);
-<a name="235" href="#235">235</a>         }
-<a name="236" href="#236">236</a>     }
-<a name="237" href="#237">237</a>     
-<a name="238" href="#238">238</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="239" href="#239">239</a> <em class="jxr_javadoccomment">     * Decrypt all data references</em>
-<a name="240" href="#240">240</a> <em class="jxr_javadoccomment">     */</em>
-<a name="241" href="#241">241</a>     <strong class="jxr_keyword">private</strong> List&lt;WSDataRef&gt; decryptDataRefs(
-<a name="242" href="#242">242</a>         Document doc, Element xencEncryptedKey, <a href="../../../../../org/apache/ws/security/WSDocInfo.html">WSDocInfo</a> docInfo, byte[] decryptedBytes
-<a name="243" href="#243">243</a>     ) <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
-<a name="244" href="#244">244</a>         <em class="jxr_comment">//</em>
-<a name="245" href="#245">245</a>         <em class="jxr_comment">// At this point we have the decrypted session (symmetric) key. According</em>
-<a name="246" href="#246">246</a>         <em class="jxr_comment">// to W3C XML-Enc this key is used to decrypt _any_ references contained in</em>
-<a name="247" href="#247">247</a>         <em class="jxr_comment">// the reference list</em>
-<a name="248" href="#248">248</a>         <em class="jxr_comment">// Now lookup the references that are encrypted with this key</em>
-<a name="249" href="#249">249</a>         <em class="jxr_comment">//</em>
-<a name="250" href="#250">250</a>         Element refList = 
-<a name="251" href="#251">251</a>             WSSecurityUtil.getDirectChildElement(
-<a name="252" href="#252">252</a>                     xencEncryptedKey, <span class="jxr_string">"ReferenceList"</span>, WSConstants.ENC_NS
-<a name="253" href="#253">253</a>             );
-<a name="254" href="#254">254</a>         List&lt;WSDataRef&gt; dataRefs = <strong class="jxr_keyword">new</strong> ArrayList&lt;WSDataRef&gt;();
-<a name="255" href="#255">255</a>         <strong class="jxr_keyword">if</strong> (refList != <strong class="jxr_keyword">null</strong>) {
-<a name="256" href="#256">256</a>             <strong class="jxr_keyword">for</strong> (Node node = refList.getFirstChild();
-<a name="257" href="#257">257</a>             node != <strong class="jxr_keyword">null</strong>; 
-<a name="258" href="#258">258</a>             node = node.getNextSibling()
-<a name="259" href="#259">259</a>             ) {
-<a name="260" href="#260">260</a>                 <strong class="jxr_keyword">if</strong> (Node.ELEMENT_NODE == node.getNodeType()
-<a name="261" href="#261">261</a>                         &amp;&amp; WSConstants.ENC_NS.equals(node.getNamespaceURI())
-<a name="262" href="#262">262</a>                         &amp;&amp; <span class="jxr_string">"DataReference"</span>.equals(node.getLocalName())) {
-<a name="263" href="#263">263</a>                     String dataRefURI = ((Element) node).getAttribute(<span class="jxr_string">"URI"</span>);
-<a name="264" href="#264">264</a>                     <strong class="jxr_keyword">if</strong> (dataRefURI.charAt(0) == '#') {
-<a name="265" href="#265">265</a>                         dataRefURI = dataRefURI.substring(1);
-<a name="266" href="#266">266</a>                     }
-<a name="267" href="#267">267</a>                     <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a> dataRef = decryptDataRef(doc, dataRefURI, docInfo, decryptedBytes);
-<a name="268" href="#268">268</a>                     dataRefs.add(dataRef);
-<a name="269" href="#269">269</a>                 }
-<a name="270" href="#270">270</a>             }
-<a name="271" href="#271">271</a>             <strong class="jxr_keyword">return</strong> dataRefs;
-<a name="272" href="#272">272</a>         }
-<a name="273" href="#273">273</a> 
-<a name="274" href="#274">274</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a name="275" href="#275">275</a>     }
-<a name="276" href="#276">276</a> 
-<a name="277" href="#277">277</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="278" href="#278">278</a> <em class="jxr_javadoccomment">     * Decrypt an EncryptedData element referenced by dataRefURI</em>
-<a name="279" href="#279">279</a> <em class="jxr_javadoccomment">     */</em>
-<a name="280" href="#280">280</a>     <strong class="jxr_keyword">private</strong> <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a> decryptDataRef(
-<a name="281" href="#281">281</a>         Document doc, 
-<a name="282" href="#282">282</a>         String dataRefURI, 
-<a name="283" href="#283">283</a>         <a href="../../../../../org/apache/ws/security/WSDocInfo.html">WSDocInfo</a> docInfo,
-<a name="284" href="#284">284</a>         byte[] decryptedData
-<a name="285" href="#285">285</a>     ) <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
-<a name="286" href="#286">286</a>         <strong class="jxr_keyword">if</strong> (log.isDebugEnabled()) {
-<a name="287" href="#287">287</a>             log.debug(<span class="jxr_string">"found data reference: "</span> + dataRefURI);
-<a name="288" href="#288">288</a>         }
-<a name="289" href="#289">289</a>         <em class="jxr_comment">//</em>
-<a name="290" href="#290">290</a>         <em class="jxr_comment">// Find the encrypted data element referenced by dataRefURI</em>
-<a name="291" href="#291">291</a>         <em class="jxr_comment">//</em>
-<a name="292" href="#292">292</a>         Element encryptedDataElement = 
-<a name="293" href="#293">293</a>             ReferenceListProcessor.findEncryptedDataElement(doc, docInfo, dataRefURI);
-<a name="294" href="#294">294</a>         <em class="jxr_comment">//</em>
-<a name="295" href="#295">295</a>         <em class="jxr_comment">// Prepare the SecretKey object to decrypt EncryptedData</em>
-<a name="296" href="#296">296</a>         <em class="jxr_comment">//</em>
-<a name="297" href="#297">297</a>         String symEncAlgo = X509Util.getEncAlgo(encryptedDataElement);
-<a name="298" href="#298">298</a>         SecretKey symmetricKey = 
-<a name="299" href="#299">299</a>             WSSecurityUtil.prepareSecretKey(symEncAlgo, decryptedData);
-<a name="300" href="#300">300</a> 
-<a name="301" href="#301">301</a>         <strong class="jxr_keyword">return</strong> ReferenceListProcessor.decryptEncryptedData(
-<a name="302" href="#302">302</a>             doc, dataRefURI, encryptedDataElement, symmetricKey, symEncAlgo
-<a name="303" href="#303">303</a>         );
-<a name="304" href="#304">304</a>     }
-<a name="305" href="#305">305</a>     
-<a name="306" href="#306">306</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="307" href="#307">307</a> <em class="jxr_javadoccomment">     * A method to check that the EncryptedKey is compliant with the BSP spec.</em>
-<a name="308" href="#308">308</a> <em class="jxr_javadoccomment">     * @throws WSSecurityException</em>
-<a name="309" href="#309">309</a> <em class="jxr_javadoccomment">     */</em>
-<a name="310" href="#310">310</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> checkBSPCompliance(Element elem, String encAlgo) <strong class="jxr_keyword">throws</strong> WSSecurityException {
-<a name="311" href="#311">311</a>         String attribute = elem.getAttribute(<span class="jxr_string">"Type"</span>);
-<a name="312" href="#312">312</a>         <strong class="jxr_keyword">if</strong> (attribute != <strong class="jxr_keyword">null</strong> &amp;&amp; !<span class="jxr_string">""</span>.equals(attribute)) {
-<a name="313" href="#313">313</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="314" href="#314">314</a>                 WSSecurityException.FAILED_CHECK, <span class="jxr_string">"badAttribute"</span>, <strong class="jxr_keyword">new</strong> Object[]{attribute}
-<a name="315" href="#315">315</a>             );
-<a name="316" href="#316">316</a>         }
-<a name="317" href="#317">317</a>         attribute = elem.getAttribute(<span class="jxr_string">"MimeType"</span>);
-<a name="318" href="#318">318</a>         <strong class="jxr_keyword">if</strong> (attribute != <strong class="jxr_keyword">null</strong> &amp;&amp; !<span class="jxr_string">""</span>.equals(attribute)) {
-<a name="319" href="#319">319</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="320" href="#320">320</a>                 WSSecurityException.FAILED_CHECK, <span class="jxr_string">"badAttribute"</span>, <strong class="jxr_keyword">new</strong> Object[]{attribute}
-<a name="321" href="#321">321</a>             );
-<a name="322" href="#322">322</a>         }
-<a name="323" href="#323">323</a>         attribute = elem.getAttribute(<span class="jxr_string">"Encoding"</span>);
-<a name="324" href="#324">324</a>         <strong class="jxr_keyword">if</strong> (attribute != <strong class="jxr_keyword">null</strong> &amp;&amp; !<span class="jxr_string">""</span>.equals(attribute)) {
-<a name="325" href="#325">325</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="326" href="#326">326</a>                 WSSecurityException.FAILED_CHECK, <span class="jxr_string">"badAttribute"</span>, <strong class="jxr_keyword">new</strong> Object[]{attribute}
-<a name="327" href="#327">327</a>             );
-<a name="328" href="#328">328</a>         }
-<a name="329" href="#329">329</a>         attribute = elem.getAttribute(<span class="jxr_string">"Recipient"</span>);
-<a name="330" href="#330">330</a>         <strong class="jxr_keyword">if</strong> (attribute != <strong class="jxr_keyword">null</strong> &amp;&amp; !<span class="jxr_string">""</span>.equals(attribute)) {
-<a name="331" href="#331">331</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="332" href="#332">332</a>                 WSSecurityException.FAILED_CHECK, <span class="jxr_string">"badAttribute"</span>, <strong class="jxr_keyword">new</strong> Object[]{attribute}
-<a name="333" href="#333">333</a>             );
-<a name="334" href="#334">334</a>         }
-<a name="335" href="#335">335</a>         
-<a name="336" href="#336">336</a>         <em class="jxr_comment">// EncryptionAlgorithm must be RSA15, or RSAOEP.</em>
-<a name="337" href="#337">337</a>         <strong class="jxr_keyword">if</strong> (!WSConstants.KEYTRANSPORT_RSA15.equals(encAlgo)
-<a name="338" href="#338">338</a>             &amp;&amp; !WSConstants.KEYTRANSPORT_RSAOEP.equals(encAlgo)) {
-<a name="339" href="#339">339</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="340" href="#340">340</a>                 WSSecurityException.INVALID_SECURITY, <span class="jxr_string">"badEncAlgo"</span>, <strong class="jxr_keyword">new</strong> Object[]{encAlgo}
-<a name="341" href="#341">341</a>             );
-<a name="342" href="#342">342</a>         }
-<a name="343" href="#343">343</a>     }
-<a name="344" href="#344">344</a>   
-<a name="345" href="#345">345</a> }
+<a name="140" href="#140">140</a>         wsDocInfo.addTokenElement(elem);
+<a name="141" href="#141">141</a>         <strong class="jxr_keyword">return</strong> java.util.Collections.singletonList(result);
+<a name="142" href="#142">142</a>     }
+<a name="143" href="#143">143</a>     
+<a name="144" href="#144">144</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="145" href="#145">145</a> <em class="jxr_javadoccomment">     * Method getDecodedBase64EncodedData</em>
+<a name="146" href="#146">146</a> <em class="jxr_javadoccomment">     *</em>
+<a name="147" href="#147">147</a> <em class="jxr_javadoccomment">     * @param element</em>
+<a name="148" href="#148">148</a> <em class="jxr_javadoccomment">     * @return a byte array containing the decoded data</em>
+<a name="149" href="#149">149</a> <em class="jxr_javadoccomment">     * @throws WSSecurityException</em>
+<a name="150" href="#150">150</a> <em class="jxr_javadoccomment">     */</em>
+<a name="151" href="#151">151</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> byte[] getDecodedBase64EncodedData(Element element) <strong class="jxr_keyword">throws</strong> WSSecurityException {
+<a name="152" href="#152">152</a>         StringBuilder sb = <strong class="jxr_keyword">new</strong> StringBuilder();
+<a name="153" href="#153">153</a>         Node node = element.getFirstChild();
+<a name="154" href="#154">154</a>         <strong class="jxr_keyword">while</strong> (node != <strong class="jxr_keyword">null</strong>) {
+<a name="155" href="#155">155</a>             <strong class="jxr_keyword">if</strong> (Node.TEXT_NODE == node.getNodeType()) {
+<a name="156" href="#156">156</a>                 sb.append(((Text) node).getData());
+<a name="157" href="#157">157</a>             }
+<a name="158" href="#158">158</a>             node = node.getNextSibling();
+<a name="159" href="#159">159</a>         }
+<a name="160" href="#160">160</a>         String encodedData = sb.toString();
+<a name="161" href="#161">161</a>         <strong class="jxr_keyword">return</strong> Base64.decode(encodedData);
+<a name="162" href="#162">162</a>     }
+<a name="163" href="#163">163</a>     
+<a name="164" href="#164">164</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="165" href="#165">165</a> <em class="jxr_javadoccomment">     * @return the Certificate(s) corresponding to the public key reference in the </em>
+<a name="166" href="#166">166</a> <em class="jxr_javadoccomment">     * EncryptedKey Element</em>
+<a name="167" href="#167">167</a> <em class="jxr_javadoccomment">     */</em>
+<a name="168" href="#168">168</a>     <strong class="jxr_keyword">private</strong> X509Certificate[] getCertificatesFromEncryptedKey(
+<a name="169" href="#169">169</a>         Element xencEncryptedKey,
+<a name="170" href="#170">170</a>         <a href="../../../../../org/apache/ws/security/handler/RequestData.html">RequestData</a> data,
+<a name="171" href="#171">171</a>         <a href="../../../../../org/apache/ws/security/components/crypto/Crypto.html">Crypto</a> crypto,
+<a name="172" href="#172">172</a>         <a href="../../../../../org/apache/ws/security/WSDocInfo.html">WSDocInfo</a> wsDocInfo
+<a name="173" href="#173">173</a>     ) <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
+<a name="174" href="#174">174</a>         Element keyInfo = 
+<a name="175" href="#175">175</a>             WSSecurityUtil.getDirectChildElement(
+<a name="176" href="#176">176</a>                 xencEncryptedKey, <span class="jxr_string">"KeyInfo"</span>, WSConstants.SIG_NS
+<a name="177" href="#177">177</a>             );
+<a name="178" href="#178">178</a>         <strong class="jxr_keyword">if</strong> (keyInfo != <strong class="jxr_keyword">null</strong>) {
+<a name="179" href="#179">179</a>             Element strElement = <strong class="jxr_keyword">null</strong>;
+<a name="180" href="#180">180</a>             <strong class="jxr_keyword">if</strong> (data.getWssConfig().isWsiBSPCompliant()) {
+<a name="181" href="#181">181</a>                 <strong class="jxr_keyword">int</strong> result = 0;
+<a name="182" href="#182">182</a>                 Node node = keyInfo.getFirstChild();
+<a name="183" href="#183">183</a>                 <strong class="jxr_keyword">while</strong> (node != <strong class="jxr_keyword">null</strong>) {
+<a name="184" href="#184">184</a>                     <strong class="jxr_keyword">if</strong> (Node.ELEMENT_NODE == node.getNodeType()) {
+<a name="185" href="#185">185</a>                         result++;
+<a name="186" href="#186">186</a>                         strElement = (Element)node;
+<a name="187" href="#187">187</a>                     }
+<a name="188" href="#188">188</a>                     node = node.getNextSibling();
+<a name="189" href="#189">189</a>                 }
+<a name="190" href="#190">190</a>                 <strong class="jxr_keyword">if</strong> (result != 1) {
+<a name="191" href="#191">191</a>                     <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="192" href="#192">192</a>                         WSSecurityException.INVALID_SECURITY, <span class="jxr_string">"invalidDataRef"</span>
+<a name="193" href="#193">193</a>                     );
+<a name="194" href="#194">194</a>                 }
+<a name="195" href="#195">195</a>             } <strong class="jxr_keyword">else</strong> {
+<a name="196" href="#196">196</a>                  strElement = 
+<a name="197" href="#197">197</a>                     WSSecurityUtil.getDirectChildElement(
+<a name="198" href="#198">198</a>                         keyInfo,
+<a name="199" href="#199">199</a>                         SecurityTokenReference.SECURITY_TOKEN_REFERENCE,
+<a name="200" href="#200">200</a>                         WSConstants.WSSE_NS
+<a name="201" href="#201">201</a>                     );
+<a name="202" href="#202">202</a>             }
+<a name="203" href="#203">203</a>             <strong class="jxr_keyword">if</strong> (strElement == <strong class="jxr_keyword">null</strong>) {
+<a name="204" href="#204">204</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="205" href="#205">205</a>                     WSSecurityException.INVALID_SECURITY, <span class="jxr_string">"noSecTokRef"</span>
+<a name="206" href="#206">206</a>                 );
+<a name="207" href="#207">207</a>             }
+<a name="208" href="#208">208</a>             <a href="../../../../../org/apache/ws/security/str/STRParser.html">STRParser</a> strParser = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/str/EncryptedKeySTRParser.html">EncryptedKeySTRParser</a>();
+<a name="209" href="#209">209</a>             strParser.parseSecurityTokenReference(strElement, data, wsDocInfo, <strong class="jxr_keyword">null</strong>);
+<a name="210" href="#210">210</a>             
+<a name="211" href="#211">211</a>             X509Certificate[] certs = strParser.getCertificates();
+<a name="212" href="#212">212</a>             <strong class="jxr_keyword">if</strong> (certs == <strong class="jxr_keyword">null</strong> || certs.length &lt; 1 || certs[0] == <strong class="jxr_keyword">null</strong>) {
+<a name="213" href="#213">213</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="214" href="#214">214</a>                     WSSecurityException.FAILURE,
+<a name="215" href="#215">215</a>                     <span class="jxr_string">"noCertsFound"</span>, 
+<a name="216" href="#216">216</a>                     <strong class="jxr_keyword">new</strong> Object[] {<span class="jxr_string">"decryption (KeyId)"</span>}
+<a name="217" href="#217">217</a>                 );
+<a name="218" href="#218">218</a>             }
+<a name="219" href="#219">219</a>             <strong class="jxr_keyword">return</strong> certs;
+<a name="220" href="#220">220</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (!data.getWssConfig().isWsiBSPCompliant() 
+<a name="221" href="#221">221</a>             &amp;&amp; crypto.getDefaultX509Identifier() != <strong class="jxr_keyword">null</strong>) {
+<a name="222" href="#222">222</a>             String alias = crypto.getDefaultX509Identifier();
+<a name="223" href="#223">223</a>             <a href="../../../../../org/apache/ws/security/components/crypto/CryptoType.html">CryptoType</a> cryptoType = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/components/crypto/CryptoType.html">CryptoType</a>(CryptoType.TYPE.ALIAS);
+<a name="224" href="#224">224</a>             cryptoType.setAlias(alias);
+<a name="225" href="#225">225</a>             X509Certificate[] certs = crypto.getX509Certificates(cryptoType);
+<a name="226" href="#226">226</a>             <strong class="jxr_keyword">if</strong> (certs == <strong class="jxr_keyword">null</strong> || certs.length &lt; 1 || certs[0] == <strong class="jxr_keyword">null</strong>) {
+<a name="227" href="#227">227</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="228" href="#228">228</a>                     WSSecurityException.FAILURE,
+<a name="229" href="#229">229</a>                     <span class="jxr_string">"noCertsFound"</span>, 
+<a name="230" href="#230">230</a>                     <strong class="jxr_keyword">new</strong> Object[] {<span class="jxr_string">"decryption (KeyId)"</span>}
+<a name="231" href="#231">231</a>                 );
+<a name="232" href="#232">232</a>             }
+<a name="233" href="#233">233</a>             <strong class="jxr_keyword">return</strong> certs;
+<a name="234" href="#234">234</a>         } <strong class="jxr_keyword">else</strong> {
+<a name="235" href="#235">235</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.INVALID_SECURITY, <span class="jxr_string">"noKeyinfo"</span>);
+<a name="236" href="#236">236</a>         }
+<a name="237" href="#237">237</a>     }
+<a name="238" href="#238">238</a>     
+<a name="239" href="#239">239</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="240" href="#240">240</a> <em class="jxr_javadoccomment">     * Decrypt all data references</em>
+<a name="241" href="#241">241</a> <em class="jxr_javadoccomment">     */</em>
+<a name="242" href="#242">242</a>     <strong class="jxr_keyword">private</strong> List&lt;WSDataRef&gt; decryptDataRefs(
+<a name="243" href="#243">243</a>         Document doc, Element xencEncryptedKey, <a href="../../../../../org/apache/ws/security/WSDocInfo.html">WSDocInfo</a> docInfo, byte[] decryptedBytes
+<a name="244" href="#244">244</a>     ) <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
+<a name="245" href="#245">245</a>         <em class="jxr_comment">//</em>
+<a name="246" href="#246">246</a>         <em class="jxr_comment">// At this point we have the decrypted session (symmetric) key. According</em>
+<a name="247" href="#247">247</a>         <em class="jxr_comment">// to W3C XML-Enc this key is used to decrypt _any_ references contained in</em>
+<a name="248" href="#248">248</a>         <em class="jxr_comment">// the reference list</em>
+<a name="249" href="#249">249</a>         <em class="jxr_comment">// Now lookup the references that are encrypted with this key</em>
+<a name="250" href="#250">250</a>         <em class="jxr_comment">//</em>
+<a name="251" href="#251">251</a>         Element refList = 
+<a name="252" href="#252">252</a>             WSSecurityUtil.getDirectChildElement(
+<a name="253" href="#253">253</a>                     xencEncryptedKey, <span class="jxr_string">"ReferenceList"</span>, WSConstants.ENC_NS
+<a name="254" href="#254">254</a>             );
+<a name="255" href="#255">255</a>         List&lt;WSDataRef&gt; dataRefs = <strong class="jxr_keyword">new</strong> ArrayList&lt;WSDataRef&gt;();
+<a name="256" href="#256">256</a>         <strong class="jxr_keyword">if</strong> (refList != <strong class="jxr_keyword">null</strong>) {
+<a name="257" href="#257">257</a>             <strong class="jxr_keyword">for</strong> (Node node = refList.getFirstChild();
+<a name="258" href="#258">258</a>             node != <strong class="jxr_keyword">null</strong>; 
+<a name="259" href="#259">259</a>             node = node.getNextSibling()
+<a name="260" href="#260">260</a>             ) {
+<a name="261" href="#261">261</a>                 <strong class="jxr_keyword">if</strong> (Node.ELEMENT_NODE == node.getNodeType()
+<a name="262" href="#262">262</a>                         &amp;&amp; WSConstants.ENC_NS.equals(node.getNamespaceURI())
+<a name="263" href="#263">263</a>                         &amp;&amp; <span class="jxr_string">"DataReference"</span>.equals(node.getLocalName())) {
+<a name="264" href="#264">264</a>                     String dataRefURI = ((Element) node).getAttribute(<span class="jxr_string">"URI"</span>);
+<a name="265" href="#265">265</a>                     <strong class="jxr_keyword">if</strong> (dataRefURI.charAt(0) == '#') {
+<a name="266" href="#266">266</a>                         dataRefURI = dataRefURI.substring(1);
+<a name="267" href="#267">267</a>                     }
+<a name="268" href="#268">268</a>                     <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a> dataRef = decryptDataRef(doc, dataRefURI, docInfo, decryptedBytes);
+<a name="269" href="#269">269</a>                     dataRefs.add(dataRef);
+<a name="270" href="#270">270</a>                 }
+<a name="271" href="#271">271</a>             }
+<a name="272" href="#272">272</a>             <strong class="jxr_keyword">return</strong> dataRefs;
+<a name="273" href="#273">273</a>         }
+<a name="274" href="#274">274</a> 
+<a name="275" href="#275">275</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a name="276" href="#276">276</a>     }
+<a name="277" href="#277">277</a> 
+<a name="278" href="#278">278</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="279" href="#279">279</a> <em class="jxr_javadoccomment">     * Decrypt an EncryptedData element referenced by dataRefURI</em>
+<a name="280" href="#280">280</a> <em class="jxr_javadoccomment">     */</em>
+<a name="281" href="#281">281</a>     <strong class="jxr_keyword">private</strong> <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a> decryptDataRef(
+<a name="282" href="#282">282</a>         Document doc, 
+<a name="283" href="#283">283</a>         String dataRefURI, 
+<a name="284" href="#284">284</a>         <a href="../../../../../org/apache/ws/security/WSDocInfo.html">WSDocInfo</a> docInfo,
+<a name="285" href="#285">285</a>         byte[] decryptedData
+<a name="286" href="#286">286</a>     ) <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
+<a name="287" href="#287">287</a>         <strong class="jxr_keyword">if</strong> (log.isDebugEnabled()) {
+<a name="288" href="#288">288</a>             log.debug(<span class="jxr_string">"found data reference: "</span> + dataRefURI);
+<a name="289" href="#289">289</a>         }
+<a name="290" href="#290">290</a>         <em class="jxr_comment">//</em>
+<a name="291" href="#291">291</a>         <em class="jxr_comment">// Find the encrypted data element referenced by dataRefURI</em>
+<a name="292" href="#292">292</a>         <em class="jxr_comment">//</em>
+<a name="293" href="#293">293</a>         Element encryptedDataElement = 
+<a name="294" href="#294">294</a>             ReferenceListProcessor.findEncryptedDataElement(doc, docInfo, dataRefURI);
+<a name="295" href="#295">295</a>         <em class="jxr_comment">//</em>
+<a name="296" href="#296">296</a>         <em class="jxr_comment">// Prepare the SecretKey object to decrypt EncryptedData</em>
+<a name="297" href="#297">297</a>         <em class="jxr_comment">//</em>
+<a name="298" href="#298">298</a>         String symEncAlgo = X509Util.getEncAlgo(encryptedDataElement);
+<a name="299" href="#299">299</a>         SecretKey symmetricKey = 
+<a name="300" href="#300">300</a>             WSSecurityUtil.prepareSecretKey(symEncAlgo, decryptedData);
+<a name="301" href="#301">301</a> 
+<a name="302" href="#302">302</a>         <strong class="jxr_keyword">return</strong> ReferenceListProcessor.decryptEncryptedData(
+<a name="303" href="#303">303</a>             doc, dataRefURI, encryptedDataElement, symmetricKey, symEncAlgo
+<a name="304" href="#304">304</a>         );
+<a name="305" href="#305">305</a>     }
+<a name="306" href="#306">306</a>     
+<a name="307" href="#307">307</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="308" href="#308">308</a> <em class="jxr_javadoccomment">     * A method to check that the EncryptedKey is compliant with the BSP spec.</em>
+<a name="309" href="#309">309</a> <em class="jxr_javadoccomment">     * @throws WSSecurityException</em>
+<a name="310" href="#310">310</a> <em class="jxr_javadoccomment">     */</em>
+<a name="311" href="#311">311</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> checkBSPCompliance(Element elem, String encAlgo) <strong class="jxr_keyword">throws</strong> WSSecurityException {
+<a name="312" href="#312">312</a>         String attribute = elem.getAttribute(<span class="jxr_string">"Type"</span>);
+<a name="313" href="#313">313</a>         <strong class="jxr_keyword">if</strong> (attribute != <strong class="jxr_keyword">null</strong> &amp;&amp; !<span class="jxr_string">""</span>.equals(attribute)) {
+<a name="314" href="#314">314</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="315" href="#315">315</a>                 WSSecurityException.FAILED_CHECK, <span class="jxr_string">"badAttribute"</span>, <strong class="jxr_keyword">new</strong> Object[]{attribute}
+<a name="316" href="#316">316</a>             );
+<a name="317" href="#317">317</a>         }
+<a name="318" href="#318">318</a>         attribute = elem.getAttribute(<span class="jxr_string">"MimeType"</span>);
+<a name="319" href="#319">319</a>         <strong class="jxr_keyword">if</strong> (attribute != <strong class="jxr_keyword">null</strong> &amp;&amp; !<span class="jxr_string">""</span>.equals(attribute)) {
+<a name="320" href="#320">320</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="321" href="#321">321</a>                 WSSecurityException.FAILED_CHECK, <span class="jxr_string">"badAttribute"</span>, <strong class="jxr_keyword">new</strong> Object[]{attribute}
+<a name="322" href="#322">322</a>             );
+<a name="323" href="#323">323</a>         }
+<a name="324" href="#324">324</a>         attribute = elem.getAttribute(<span class="jxr_string">"Encoding"</span>);
+<a name="325" href="#325">325</a>         <strong class="jxr_keyword">if</strong> (attribute != <strong class="jxr_keyword">null</strong> &amp;&amp; !<span class="jxr_string">""</span>.equals(attribute)) {
+<a name="326" href="#326">326</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="327" href="#327">327</a>                 WSSecurityException.FAILED_CHECK, <span class="jxr_string">"badAttribute"</span>, <strong class="jxr_keyword">new</strong> Object[]{attribute}
+<a name="328" href="#328">328</a>             );
+<a name="329" href="#329">329</a>         }
+<a name="330" href="#330">330</a>         attribute = elem.getAttribute(<span class="jxr_string">"Recipient"</span>);
+<a name="331" href="#331">331</a>         <strong class="jxr_keyword">if</strong> (attribute != <strong class="jxr_keyword">null</strong> &amp;&amp; !<span class="jxr_string">""</span>.equals(attribute)) {
+<a name="332" href="#332">332</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="333" href="#333">333</a>                 WSSecurityException.FAILED_CHECK, <span class="jxr_string">"badAttribute"</span>, <strong class="jxr_keyword">new</strong> Object[]{attribute}
+<a name="334" href="#334">334</a>             );
+<a name="335" href="#335">335</a>         }
+<a name="336" href="#336">336</a>         
+<a name="337" href="#337">337</a>         <em class="jxr_comment">// EncryptionAlgorithm must be RSA15, or RSAOEP.</em>
+<a name="338" href="#338">338</a>         <strong class="jxr_keyword">if</strong> (!WSConstants.KEYTRANSPORT_RSA15.equals(encAlgo)
+<a name="339" href="#339">339</a>             &amp;&amp; !WSConstants.KEYTRANSPORT_RSAOEP.equals(encAlgo)) {
+<a name="340" href="#340">340</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="341" href="#341">341</a>                 WSSecurityException.INVALID_SECURITY, <span class="jxr_string">"badEncAlgo"</span>, <strong class="jxr_keyword">new</strong> Object[]{encAlgo}
+<a name="342" href="#342">342</a>             );
+<a name="343" href="#343">343</a>         }
+<a name="344" href="#344">344</a>     }
+<a name="345" href="#345">345</a>   
+<a name="346" href="#346">346</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: webservices/wss4j/site/xref/org/apache/ws/security/processor/ReferenceListProcessor.html
URL: http://svn.apache.org/viewvc/webservices/wss4j/site/xref/org/apache/ws/security/processor/ReferenceListProcessor.html?rev=1133081&r1=1133080&r2=1133081&view=diff
==============================================================================
--- webservices/wss4j/site/xref/org/apache/ws/security/processor/ReferenceListProcessor.html (original)
+++ webservices/wss4j/site/xref/org/apache/ws/security/processor/ReferenceListProcessor.html Tue Jun  7 16:25:20 2011
@@ -253,139 +253,147 @@
 <a name="243" href="#243">243</a>                 WSSecurityException.INVALID_SECURITY, <span class="jxr_string">"dataRef"</span>, <strong class="jxr_keyword">new</strong> Object[] {dataRefURI}
 <a name="244" href="#244">244</a>             );
 <a name="245" href="#245">245</a>         }
-<a name="246" href="#246">246</a>         <strong class="jxr_keyword">return</strong> encryptedDataElement;
-<a name="247" href="#247">247</a>     }
-<a name="248" href="#248">248</a> 
-<a name="249" href="#249">249</a>     
-<a name="250" href="#250">250</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="251" href="#251">251</a> <em class="jxr_javadoccomment">     * Decrypt the EncryptedData argument using a SecretKey.</em>
-<a name="252" href="#252">252</a> <em class="jxr_javadoccomment">     * @param doc The (document) owner of EncryptedData</em>
-<a name="253" href="#253">253</a> <em class="jxr_javadoccomment">     * @param dataRefURI The URI of EncryptedData</em>
-<a name="254" href="#254">254</a> <em class="jxr_javadoccomment">     * @param encData The EncryptedData element</em>
-<a name="255" href="#255">255</a> <em class="jxr_javadoccomment">     * @param symmetricKey The SecretKey with which to decrypt EncryptedData</em>
-<a name="256" href="#256">256</a> <em class="jxr_javadoccomment">     * @param symEncAlgo The symmetric encryption algorithm to use</em>
-<a name="257" href="#257">257</a> <em class="jxr_javadoccomment">     * @throws WSSecurityException</em>
-<a name="258" href="#258">258</a> <em class="jxr_javadoccomment">     */</em>
-<a name="259" href="#259">259</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a>
-<a name="260" href="#260">260</a>     decryptEncryptedData(
-<a name="261" href="#261">261</a>         Document doc,
-<a name="262" href="#262">262</a>         String dataRefURI,
-<a name="263" href="#263">263</a>         Element encData,
-<a name="264" href="#264">264</a>         SecretKey symmetricKey,
-<a name="265" href="#265">265</a>         String symEncAlgo
-<a name="266" href="#266">266</a>     ) <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
-<a name="267" href="#267">267</a>         XMLCipher xmlCipher = <strong class="jxr_keyword">null</strong>;
-<a name="268" href="#268">268</a>         <strong class="jxr_keyword">try</strong> {
-<a name="269" href="#269">269</a>             xmlCipher = XMLCipher.getInstance(symEncAlgo);
-<a name="270" href="#270">270</a>             xmlCipher.init(XMLCipher.DECRYPT_MODE, symmetricKey);
-<a name="271" href="#271">271</a>         } <strong class="jxr_keyword">catch</strong> (XMLEncryptionException ex) {
-<a name="272" href="#272">272</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
-<a name="273" href="#273">273</a>                 WSSecurityException.UNSUPPORTED_ALGORITHM, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, ex
-<a name="274" href="#274">274</a>             );
-<a name="275" href="#275">275</a>         }
-<a name="276" href="#276">276</a> 
-<a name="277" href="#277">277</a>         <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a> dataRef = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a>();
-<a name="278" href="#278">278</a>         dataRef.setWsuId(dataRefURI);
-<a name="279" href="#279">279</a>         dataRef.setAlgorithm(symEncAlgo);
-<a name="280" href="#280">280</a>         <strong class="jxr_keyword">boolean</strong> content = X509Util.isContent(encData);
-<a name="281" href="#281">281</a>         dataRef.setContent(content);
-<a name="282" href="#282">282</a>         
-<a name="283" href="#283">283</a>         Node parent = encData.getParentNode();
-<a name="284" href="#284">284</a>         Node previousSibling = encData.getPreviousSibling();
-<a name="285" href="#285">285</a>         <strong class="jxr_keyword">if</strong> (content) {
-<a name="286" href="#286">286</a>             encData = (Element) encData.getParentNode();
-<a name="287" href="#287">287</a>             parent = encData.getParentNode();
-<a name="288" href="#288">288</a>         }
-<a name="289" href="#289">289</a>         
-<a name="290" href="#290">290</a>         <strong class="jxr_keyword">try</strong> {
-<a name="291" href="#291">291</a>             xmlCipher.doFinal(doc, encData, content);
-<a name="292" href="#292">292</a>         } <strong class="jxr_keyword">catch</strong> (Exception ex) {
-<a name="293" href="#293">293</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.FAILED_CHECK, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, ex);
-<a name="294" href="#294">294</a>         }
-<a name="295" href="#295">295</a>         
-<a name="296" href="#296">296</a>         <strong class="jxr_keyword">if</strong> (parent.getLocalName().equals(WSConstants.ENCRYPTED_HEADER)
-<a name="297" href="#297">297</a>             &amp;&amp; parent.getNamespaceURI().equals(WSConstants.WSSE11_NS)) {
-<a name="298" href="#298">298</a>                 
-<a name="299" href="#299">299</a>             Node decryptedHeader = parent.getFirstChild();
-<a name="300" href="#300">300</a>             Element decryptedHeaderClone = (Element)decryptedHeader.cloneNode(<strong class="jxr_keyword">true</strong>);            
-<a name="301" href="#301">301</a>             parent.getParentNode().appendChild(decryptedHeaderClone);
-<a name="302" href="#302">302</a>             parent.getParentNode().removeChild(parent);
-<a name="303" href="#303">303</a>             dataRef.setProtectedElement(decryptedHeaderClone);
-<a name="304" href="#304">304</a>             dataRef.setXpath(getXPath(decryptedHeaderClone));
-<a name="305" href="#305">305</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (content) {
-<a name="306" href="#306">306</a>             dataRef.setProtectedElement(encData);
-<a name="307" href="#307">307</a>             dataRef.setXpath(getXPath(encData));
-<a name="308" href="#308">308</a>         } <strong class="jxr_keyword">else</strong> {
-<a name="309" href="#309">309</a>             Node decryptedNode;
-<a name="310" href="#310">310</a>             <strong class="jxr_keyword">if</strong> (previousSibling == <strong class="jxr_keyword">null</strong>) {
-<a name="311" href="#311">311</a>                 decryptedNode = parent.getFirstChild();
-<a name="312" href="#312">312</a>             } <strong class="jxr_keyword">else</strong> {
-<a name="313" href="#313">313</a>                 decryptedNode = previousSibling.getNextSibling();
-<a name="314" href="#314">314</a>             }
-<a name="315" href="#315">315</a>             <strong class="jxr_keyword">if</strong> (decryptedNode != <strong class="jxr_keyword">null</strong> &amp;&amp; Node.ELEMENT_NODE == decryptedNode.getNodeType()) {
-<a name="316" href="#316">316</a>                 dataRef.setProtectedElement((Element)decryptedNode);
-<a name="317" href="#317">317</a>             }
-<a name="318" href="#318">318</a>             dataRef.setXpath(getXPath(decryptedNode));
-<a name="319" href="#319">319</a>         }
-<a name="320" href="#320">320</a>         
-<a name="321" href="#321">321</a>         <strong class="jxr_keyword">return</strong> dataRef;
-<a name="322" href="#322">322</a>     }
-<a name="323" href="#323">323</a>     
-<a name="324" href="#324">324</a>     
-<a name="325" href="#325">325</a>     <strong class="jxr_keyword">public</strong> String getId() {
-<a name="326" href="#326">326</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a name="327" href="#327">327</a>     }
-<a name="328" href="#328">328</a> 
-<a name="329" href="#329">329</a>     
-<a name="330" href="#330">330</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="331" href="#331">331</a> <em class="jxr_javadoccomment">     * @param decryptedNode the decrypted node</em>
-<a name="332" href="#332">332</a> <em class="jxr_javadoccomment">     * @return a fully built xpath </em>
-<a name="333" href="#333">333</a> <em class="jxr_javadoccomment">     *        (eg. &amp;quot;/soapenv:Envelope/soapenv:Body/ns:decryptedElement&amp;quot;)</em>
-<a name="334" href="#334">334</a> <em class="jxr_javadoccomment">     *        if the decryptedNode is an Element or an Attr node and is not detached</em>
-<a name="335" href="#335">335</a> <em class="jxr_javadoccomment">     *        from the document. &lt;code&gt;null&lt;/code&gt; otherwise</em>
-<a name="336" href="#336">336</a> <em class="jxr_javadoccomment">     */</em>
-<a name="337" href="#337">337</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String getXPath(Node decryptedNode) {
-<a name="338" href="#338">338</a>         <strong class="jxr_keyword">if</strong> (decryptedNode == <strong class="jxr_keyword">null</strong>) {
-<a name="339" href="#339">339</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a name="340" href="#340">340</a>         }
-<a name="341" href="#341">341</a>         
-<a name="342" href="#342">342</a>         String result = <span class="jxr_string">""</span>;
-<a name="343" href="#343">343</a>         <strong class="jxr_keyword">if</strong> (Node.ELEMENT_NODE == decryptedNode.getNodeType()) {
-<a name="344" href="#344">344</a>             result = decryptedNode.getNodeName();
-<a name="345" href="#345">345</a>             result = prependFullPath(result, decryptedNode.getParentNode());
-<a name="346" href="#346">346</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (Node.ATTRIBUTE_NODE == decryptedNode.getNodeType()) {
-<a name="347" href="#347">347</a>             result = <span class="jxr_string">"@"</span> + decryptedNode.getNodeName();
-<a name="348" href="#348">348</a>             result = prependFullPath(result, ((Attr)decryptedNode).getOwnerElement());
-<a name="349" href="#349">349</a>         } <strong class="jxr_keyword">else</strong> {
-<a name="350" href="#350">350</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a name="351" href="#351">351</a>         }
-<a name="352" href="#352">352</a>         
-<a name="353" href="#353">353</a>         <strong class="jxr_keyword">return</strong> result;
-<a name="354" href="#354">354</a>     }
-<a name="355" href="#355">355</a> 
-<a name="356" href="#356">356</a> 
-<a name="357" href="#357">357</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="358" href="#358">358</a> <em class="jxr_javadoccomment">     * Recursively build an absolute xpath (starting with the root &amp;quot;/&amp;quot;)</em>
-<a name="359" href="#359">359</a> <em class="jxr_javadoccomment">     * </em>
-<a name="360" href="#360">360</a> <em class="jxr_javadoccomment">     * @param xpath the xpath expression built so far</em>
-<a name="361" href="#361">361</a> <em class="jxr_javadoccomment">     * @param node the current node whose name is to be prepended</em>
-<a name="362" href="#362">362</a> <em class="jxr_javadoccomment">     * @return a fully built xpath</em>
-<a name="363" href="#363">363</a> <em class="jxr_javadoccomment">     */</em>
-<a name="364" href="#364">364</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String prependFullPath(String xpath, Node node) {
-<a name="365" href="#365">365</a>         <strong class="jxr_keyword">if</strong> (node == <strong class="jxr_keyword">null</strong>) {
-<a name="366" href="#366">366</a>             <em class="jxr_comment">// probably a detached node... not really useful</em>
-<a name="367" href="#367">367</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a name="368" href="#368">368</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (Node.ELEMENT_NODE == node.getNodeType()) {
-<a name="369" href="#369">369</a>             xpath = node.getNodeName() + <span class="jxr_string">"/"</span> + xpath;
-<a name="370" href="#370">370</a>             <strong class="jxr_keyword">return</strong> prependFullPath(xpath, node.getParentNode());
-<a name="371" href="#371">371</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (Node.DOCUMENT_NODE == node.getNodeType()) {
-<a name="372" href="#372">372</a>             <strong class="jxr_keyword">return</strong> <span class="jxr_string">"/"</span> + xpath;
-<a name="373" href="#373">373</a>         } <strong class="jxr_keyword">else</strong> {
-<a name="374" href="#374">374</a>             <strong class="jxr_keyword">return</strong> prependFullPath(xpath, node.getParentNode());
-<a name="375" href="#375">375</a>         }
-<a name="376" href="#376">376</a>     }
-<a name="377" href="#377">377</a> 
-<a name="378" href="#378">378</a> }
+<a name="246" href="#246">246</a>         <strong class="jxr_keyword">if</strong> (encryptedDataElement.getLocalName().equals(WSConstants.ENCRYPTED_HEADER)
+<a name="247" href="#247">247</a>             &amp;&amp; encryptedDataElement.getNamespaceURI().equals(WSConstants.WSSE11_NS)) {
+<a name="248" href="#248">248</a>             Node child = encryptedDataElement.getFirstChild();
+<a name="249" href="#249">249</a>             <strong class="jxr_keyword">while</strong> (child != <strong class="jxr_keyword">null</strong> &amp;&amp; child.getNodeType() != Node.ELEMENT_NODE) {
+<a name="250" href="#250">250</a>                 child = child.getNextSibling();
+<a name="251" href="#251">251</a>             }
+<a name="252" href="#252">252</a>             <strong class="jxr_keyword">return</strong> (Element)child;
+<a name="253" href="#253">253</a>         }
+<a name="254" href="#254">254</a>         <strong class="jxr_keyword">return</strong> encryptedDataElement;
+<a name="255" href="#255">255</a>     }
+<a name="256" href="#256">256</a> 
+<a name="257" href="#257">257</a>     
+<a name="258" href="#258">258</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="259" href="#259">259</a> <em class="jxr_javadoccomment">     * Decrypt the EncryptedData argument using a SecretKey.</em>
+<a name="260" href="#260">260</a> <em class="jxr_javadoccomment">     * @param doc The (document) owner of EncryptedData</em>
+<a name="261" href="#261">261</a> <em class="jxr_javadoccomment">     * @param dataRefURI The URI of EncryptedData</em>
+<a name="262" href="#262">262</a> <em class="jxr_javadoccomment">     * @param encData The EncryptedData element</em>
+<a name="263" href="#263">263</a> <em class="jxr_javadoccomment">     * @param symmetricKey The SecretKey with which to decrypt EncryptedData</em>
+<a name="264" href="#264">264</a> <em class="jxr_javadoccomment">     * @param symEncAlgo The symmetric encryption algorithm to use</em>
+<a name="265" href="#265">265</a> <em class="jxr_javadoccomment">     * @throws WSSecurityException</em>
+<a name="266" href="#266">266</a> <em class="jxr_javadoccomment">     */</em>
+<a name="267" href="#267">267</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a>
+<a name="268" href="#268">268</a>     decryptEncryptedData(
+<a name="269" href="#269">269</a>         Document doc,
+<a name="270" href="#270">270</a>         String dataRefURI,
+<a name="271" href="#271">271</a>         Element encData,
+<a name="272" href="#272">272</a>         SecretKey symmetricKey,
+<a name="273" href="#273">273</a>         String symEncAlgo
+<a name="274" href="#274">274</a>     ) <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
+<a name="275" href="#275">275</a>         XMLCipher xmlCipher = <strong class="jxr_keyword">null</strong>;
+<a name="276" href="#276">276</a>         <strong class="jxr_keyword">try</strong> {
+<a name="277" href="#277">277</a>             xmlCipher = XMLCipher.getInstance(symEncAlgo);
+<a name="278" href="#278">278</a>             xmlCipher.init(XMLCipher.DECRYPT_MODE, symmetricKey);
+<a name="279" href="#279">279</a>         } <strong class="jxr_keyword">catch</strong> (XMLEncryptionException ex) {
+<a name="280" href="#280">280</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(
+<a name="281" href="#281">281</a>                 WSSecurityException.UNSUPPORTED_ALGORITHM, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, ex
+<a name="282" href="#282">282</a>             );
+<a name="283" href="#283">283</a>         }
+<a name="284" href="#284">284</a> 
+<a name="285" href="#285">285</a>         <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a> dataRef = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSDataRef.html">WSDataRef</a>();
+<a name="286" href="#286">286</a>         dataRef.setWsuId(dataRefURI);
+<a name="287" href="#287">287</a>         dataRef.setAlgorithm(symEncAlgo);
+<a name="288" href="#288">288</a>         <strong class="jxr_keyword">boolean</strong> content = X509Util.isContent(encData);
+<a name="289" href="#289">289</a>         dataRef.setContent(content);
+<a name="290" href="#290">290</a>         
+<a name="291" href="#291">291</a>         Node parent = encData.getParentNode();
+<a name="292" href="#292">292</a>         Node previousSibling = encData.getPreviousSibling();
+<a name="293" href="#293">293</a>         <strong class="jxr_keyword">if</strong> (content) {
+<a name="294" href="#294">294</a>             encData = (Element) encData.getParentNode();
+<a name="295" href="#295">295</a>             parent = encData.getParentNode();
+<a name="296" href="#296">296</a>         }
+<a name="297" href="#297">297</a>         
+<a name="298" href="#298">298</a>         <strong class="jxr_keyword">try</strong> {
+<a name="299" href="#299">299</a>             xmlCipher.doFinal(doc, encData, content);
+<a name="300" href="#300">300</a>         } <strong class="jxr_keyword">catch</strong> (Exception ex) {
+<a name="301" href="#301">301</a>             <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.FAILED_CHECK, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, ex);
+<a name="302" href="#302">302</a>         }
+<a name="303" href="#303">303</a>         
+<a name="304" href="#304">304</a>         <strong class="jxr_keyword">if</strong> (parent.getLocalName().equals(WSConstants.ENCRYPTED_HEADER)
+<a name="305" href="#305">305</a>             &amp;&amp; parent.getNamespaceURI().equals(WSConstants.WSSE11_NS)) {
+<a name="306" href="#306">306</a>                 
+<a name="307" href="#307">307</a>             Node decryptedHeader = parent.getFirstChild();
+<a name="308" href="#308">308</a>             Node soapHeader = parent.getParentNode();
+<a name="309" href="#309">309</a>             soapHeader.replaceChild(decryptedHeader, parent);
+<a name="310" href="#310">310</a> 
+<a name="311" href="#311">311</a>             dataRef.setProtectedElement((Element)decryptedHeader);
+<a name="312" href="#312">312</a>             dataRef.setXpath(getXPath(decryptedHeader));
+<a name="313" href="#313">313</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (content) {
+<a name="314" href="#314">314</a>             dataRef.setProtectedElement(encData);
+<a name="315" href="#315">315</a>             dataRef.setXpath(getXPath(encData));
+<a name="316" href="#316">316</a>         } <strong class="jxr_keyword">else</strong> {
+<a name="317" href="#317">317</a>             Node decryptedNode;
+<a name="318" href="#318">318</a>             <strong class="jxr_keyword">if</strong> (previousSibling == <strong class="jxr_keyword">null</strong>) {
+<a name="319" href="#319">319</a>                 decryptedNode = parent.getFirstChild();
+<a name="320" href="#320">320</a>             } <strong class="jxr_keyword">else</strong> {
+<a name="321" href="#321">321</a>                 decryptedNode = previousSibling.getNextSibling();
+<a name="322" href="#322">322</a>             }
+<a name="323" href="#323">323</a>             <strong class="jxr_keyword">if</strong> (decryptedNode != <strong class="jxr_keyword">null</strong> &amp;&amp; Node.ELEMENT_NODE == decryptedNode.getNodeType()) {
+<a name="324" href="#324">324</a>                 dataRef.setProtectedElement((Element)decryptedNode);
+<a name="325" href="#325">325</a>             }
+<a name="326" href="#326">326</a>             dataRef.setXpath(getXPath(decryptedNode));
+<a name="327" href="#327">327</a>         }
+<a name="328" href="#328">328</a>         
+<a name="329" href="#329">329</a>         <strong class="jxr_keyword">return</strong> dataRef;
+<a name="330" href="#330">330</a>     }
+<a name="331" href="#331">331</a>     
+<a name="332" href="#332">332</a>     
+<a name="333" href="#333">333</a>     <strong class="jxr_keyword">public</strong> String getId() {
+<a name="334" href="#334">334</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a name="335" href="#335">335</a>     }
+<a name="336" href="#336">336</a> 
+<a name="337" href="#337">337</a>     
+<a name="338" href="#338">338</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="339" href="#339">339</a> <em class="jxr_javadoccomment">     * @param decryptedNode the decrypted node</em>
+<a name="340" href="#340">340</a> <em class="jxr_javadoccomment">     * @return a fully built xpath </em>
+<a name="341" href="#341">341</a> <em class="jxr_javadoccomment">     *        (eg. &amp;quot;/soapenv:Envelope/soapenv:Body/ns:decryptedElement&amp;quot;)</em>
+<a name="342" href="#342">342</a> <em class="jxr_javadoccomment">     *        if the decryptedNode is an Element or an Attr node and is not detached</em>
+<a name="343" href="#343">343</a> <em class="jxr_javadoccomment">     *        from the document. &lt;code&gt;null&lt;/code&gt; otherwise</em>
+<a name="344" href="#344">344</a> <em class="jxr_javadoccomment">     */</em>
+<a name="345" href="#345">345</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> String getXPath(Node decryptedNode) {
+<a name="346" href="#346">346</a>         <strong class="jxr_keyword">if</strong> (decryptedNode == <strong class="jxr_keyword">null</strong>) {
+<a name="347" href="#347">347</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a name="348" href="#348">348</a>         }
+<a name="349" href="#349">349</a>         
+<a name="350" href="#350">350</a>         String result = <span class="jxr_string">""</span>;
+<a name="351" href="#351">351</a>         <strong class="jxr_keyword">if</strong> (Node.ELEMENT_NODE == decryptedNode.getNodeType()) {
+<a name="352" href="#352">352</a>             result = decryptedNode.getNodeName();
+<a name="353" href="#353">353</a>             result = prependFullPath(result, decryptedNode.getParentNode());
+<a name="354" href="#354">354</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (Node.ATTRIBUTE_NODE == decryptedNode.getNodeType()) {
+<a name="355" href="#355">355</a>             result = <span class="jxr_string">"@"</span> + decryptedNode.getNodeName();
+<a name="356" href="#356">356</a>             result = prependFullPath(result, ((Attr)decryptedNode).getOwnerElement());
+<a name="357" href="#357">357</a>         } <strong class="jxr_keyword">else</strong> {
+<a name="358" href="#358">358</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a name="359" href="#359">359</a>         }
+<a name="360" href="#360">360</a>         
+<a name="361" href="#361">361</a>         <strong class="jxr_keyword">return</strong> result;
+<a name="362" href="#362">362</a>     }
+<a name="363" href="#363">363</a> 
+<a name="364" href="#364">364</a> 
+<a name="365" href="#365">365</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="366" href="#366">366</a> <em class="jxr_javadoccomment">     * Recursively build an absolute xpath (starting with the root &amp;quot;/&amp;quot;)</em>
+<a name="367" href="#367">367</a> <em class="jxr_javadoccomment">     * </em>
+<a name="368" href="#368">368</a> <em class="jxr_javadoccomment">     * @param xpath the xpath expression built so far</em>
+<a name="369" href="#369">369</a> <em class="jxr_javadoccomment">     * @param node the current node whose name is to be prepended</em>
+<a name="370" href="#370">370</a> <em class="jxr_javadoccomment">     * @return a fully built xpath</em>
+<a name="371" href="#371">371</a> <em class="jxr_javadoccomment">     */</em>
+<a name="372" href="#372">372</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String prependFullPath(String xpath, Node node) {
+<a name="373" href="#373">373</a>         <strong class="jxr_keyword">if</strong> (node == <strong class="jxr_keyword">null</strong>) {
+<a name="374" href="#374">374</a>             <em class="jxr_comment">// probably a detached node... not really useful</em>
+<a name="375" href="#375">375</a>             <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
+<a name="376" href="#376">376</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (Node.ELEMENT_NODE == node.getNodeType()) {
+<a name="377" href="#377">377</a>             xpath = node.getNodeName() + <span class="jxr_string">"/"</span> + xpath;
+<a name="378" href="#378">378</a>             <strong class="jxr_keyword">return</strong> prependFullPath(xpath, node.getParentNode());
+<a name="379" href="#379">379</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (Node.DOCUMENT_NODE == node.getNodeType()) {
+<a name="380" href="#380">380</a>             <strong class="jxr_keyword">return</strong> <span class="jxr_string">"/"</span> + xpath;
+<a name="381" href="#381">381</a>         } <strong class="jxr_keyword">else</strong> {
+<a name="382" href="#382">382</a>             <strong class="jxr_keyword">return</strong> prependFullPath(xpath, node.getParentNode());
+<a name="383" href="#383">383</a>         }
+<a name="384" href="#384">384</a>     }
+<a name="385" href="#385">385</a> 
+<a name="386" href="#386">386</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>