ws-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject svn commit: r1040461 [20/28] - in /webservices/wss4j/site: ./ apidocs/ apidocs/org/apache/ws/axis/security/ apidocs/org/apache/ws/axis/security/class-use/ apidocs/org/apache/ws/axis/security/handler/ apidocs/org/apache/ws/axis/security/handler/class-us...
Date Tue, 30 Nov 2010 11:10:41 GMT
Modified: webservices/wss4j/site/xref/org/apache/ws/security/message/WSSecEncrypt.html
URL: http://svn.apache.org/viewvc/webservices/wss4j/site/xref/org/apache/ws/security/message/WSSecEncrypt.html?rev=1040461&r1=1040460&r2=1040461&view=diff
==============================================================================
--- webservices/wss4j/site/xref/org/apache/ws/security/message/WSSecEncrypt.html (original)
+++ webservices/wss4j/site/xref/org/apache/ws/security/message/WSSecEncrypt.html Tue Nov 30 11:10:26 2010
@@ -99,7 +99,7 @@
 <a name="89" href="#89">89</a>  <em class="jxr_javadoccomment">     * Custom reference value</em>
 <a name="90" href="#90">90</a>  <em class="jxr_javadoccomment">     */</em>
 <a name="91" href="#91">91</a>      <strong class="jxr_keyword">private</strong> String customReferenceValue;
-<a name="92" href="#92">92</a>      
+<a name="92" href="#92">92</a>  
 <a name="93" href="#93">93</a>      <em class="jxr_javadoccomment">/**</em>
 <a name="94" href="#94">94</a>  <em class="jxr_javadoccomment">     * ValueType for the encrypted key reference</em>
 <a name="95" href="#95">95</a>  <em class="jxr_javadoccomment">     */</em>
@@ -530,293 +530,300 @@
 <a name="520" href="#520">520</a>             <strong class="jxr_keyword">if</strong> (keyInfo == <strong class="jxr_keyword">null</strong>) {
 <a name="521" href="#521">521</a>                 keyInfo = <strong class="jxr_keyword">new</strong> KeyInfo(document);
 <a name="522" href="#522">522</a>                 <a href="../../../../../org/apache/ws/security/message/token/SecurityTokenReference.html">SecurityTokenReference</a> secToken = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/message/token/SecurityTokenReference.html">SecurityTokenReference</a>(document);
-<a name="523" href="#523">523</a>                 <a href="../../../../../org/apache/ws/security/message/token/Reference.html">Reference</a> ref = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/message/token/Reference.html">Reference</a>(document);
-<a name="524" href="#524">524</a>                 <strong class="jxr_keyword">if</strong> (encKeyIdDirectId) {
-<a name="525" href="#525">525</a>                     ref.setURI(encKeyId);
-<a name="526" href="#526">526</a>                 } <strong class="jxr_keyword">else</strong> {
-<a name="527" href="#527">527</a>                     ref.setURI(<span class="jxr_string">"#"</span> + encKeyId);                    
-<a name="528" href="#528">528</a>                 }
-<a name="529" href="#529">529</a>                 <strong class="jxr_keyword">if</strong> (encKeyValueType != <strong class="jxr_keyword">null</strong>) {
-<a name="530" href="#530">530</a>                     ref.setValueType(encKeyValueType);
-<a name="531" href="#531">531</a>                 }
-<a name="532" href="#532">532</a>                 secToken.setReference(ref);
-<a name="533" href="#533">533</a>                 keyInfo.addUnknownElement(secToken.getElement());
-<a name="534" href="#534">534</a>                 Element keyInfoElement = keyInfo.getElement();
-<a name="535" href="#535">535</a>                 keyInfoElement.setAttributeNS(
-<a name="536" href="#536">536</a>                     WSConstants.XMLNS_NS, <span class="jxr_string">"xmlns:"</span> + WSConstants.SIG_PREFIX, WSConstants.SIG_NS
-<a name="537" href="#537">537</a>                 );
-<a name="538" href="#538">538</a>             }
-<a name="539" href="#539">539</a>             <em class="jxr_comment">//</em>
-<a name="540" href="#540">540</a>             <em class="jxr_comment">// Fourth step: encrypt data, and set necessary attributes in</em>
-<a name="541" href="#541">541</a>             <em class="jxr_comment">// xenc:EncryptedData</em>
-<a name="542" href="#542">542</a>             <em class="jxr_comment">//</em>
-<a name="543" href="#543">543</a>             <strong class="jxr_keyword">try</strong> {
-<a name="544" href="#544">544</a>                 <strong class="jxr_keyword">if</strong> (modifier.equals(<span class="jxr_string">"Header"</span>)) {
-<a name="545" href="#545">545</a>                     
-<a name="546" href="#546">546</a>                     Element elem = 
-<a name="547" href="#547">547</a>                         doc.createElementNS(
-<a name="548" href="#548">548</a>                             WSConstants.WSSE11_NS, <span class="jxr_string">"wsse11:"</span> + WSConstants.ENCRYPTED_HEADER
-<a name="549" href="#549">549</a>                         );
-<a name="550" href="#550">550</a>                     WSSecurityUtil.setNamespace(elem, WSConstants.WSSE11_NS, WSConstants.WSSE11_PREFIX);
-<a name="551" href="#551">551</a>                     String wsuPrefix = 
-<a name="552" href="#552">552</a>                         WSSecurityUtil.setNamespace(elem, WSConstants.WSU_NS, WSConstants.WSU_PREFIX);
-<a name="553" href="#553">553</a>                     elem.setAttributeNS(
-<a name="554" href="#554">554</a>                         WSConstants.WSU_NS, wsuPrefix + <span class="jxr_string">":Id"</span>, 
-<a name="555" href="#555">555</a>                         wssConfig.getIdAllocator().createId(<span class="jxr_string">"EncHeader-"</span>, body)
-<a name="556" href="#556">556</a>                     );
-<a name="557" href="#557">557</a>                     
-<a name="558" href="#558">558</a>                     NamedNodeMap map = body.getAttributes();
-<a name="559" href="#559">559</a>                     
-<a name="560" href="#560">560</a>                     <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0 ; i &lt; map.getLength() ; i++) {
-<a name="561" href="#561">561</a>                         Attr attr = (Attr)map.item(i);
-<a name="562" href="#562">562</a>                         <strong class="jxr_keyword">if</strong> (attr.getNamespaceURI().equals(WSConstants.URI_SOAP11_ENV)
-<a name="563" href="#563">563</a>                             || attr.getNamespaceURI().equals(WSConstants.URI_SOAP12_ENV)) {                         
-<a name="564" href="#564">564</a>                             String soapEnvPrefix = 
-<a name="565" href="#565">565</a>                                 WSSecurityUtil.setNamespace(
-<a name="566" href="#566">566</a>                                     elem, attr.getNamespaceURI(), WSConstants.DEFAULT_SOAP_PREFIX
-<a name="567" href="#567">567</a>                                 );
-<a name="568" href="#568">568</a>                             elem.setAttributeNS(
-<a name="569" href="#569">569</a>                                 attr.getNamespaceURI(), 
-<a name="570" href="#570">570</a>                                 soapEnvPrefix + <span class="jxr_string">":"</span> + attr.getLocalName(), 
-<a name="571" href="#571">571</a>                                 attr.getValue()
-<a name="572" href="#572">572</a>                             );
-<a name="573" href="#573">573</a>                         }
-<a name="574" href="#574">574</a>                     }
-<a name="575" href="#575">575</a>                     
-<a name="576" href="#576">576</a>                     xmlCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
-<a name="577" href="#577">577</a>                     EncryptedData encData = xmlCipher.getEncryptedData();
-<a name="578" href="#578">578</a>                     encData.setId(xencEncryptedDataId);
-<a name="579" href="#579">579</a>                     encData.setKeyInfo(keyInfo);
-<a name="580" href="#580">580</a>                     xmlCipher.doFinal(doc, body, content);
-<a name="581" href="#581">581</a>                     
-<a name="582" href="#582">582</a>                     Element encDataElem = 
-<a name="583" href="#583">583</a>                         WSSecurityUtil.findElementById(
-<a name="584" href="#584">584</a>                             document.getDocumentElement(), xencEncryptedDataId, <strong class="jxr_keyword">null</strong>
-<a name="585" href="#585">585</a>                         );
-<a name="586" href="#586">586</a>                     Node clone = encDataElem.cloneNode(<strong class="jxr_keyword">true</strong>);
-<a name="587" href="#587">587</a>                     elem.appendChild(clone);
-<a name="588" href="#588">588</a>                     encDataElem.getParentNode().appendChild(elem);
-<a name="589" href="#589">589</a>                     encDataElem.getParentNode().removeChild(encDataElem); 
-<a name="590" href="#590">590</a>                 } <strong class="jxr_keyword">else</strong> {
-<a name="591" href="#591">591</a>                     xmlCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
-<a name="592" href="#592">592</a>                     EncryptedData encData = xmlCipher.getEncryptedData();
-<a name="593" href="#593">593</a>                     encData.setId(xencEncryptedDataId);
-<a name="594" href="#594">594</a>                     encData.setKeyInfo(keyInfo);
-<a name="595" href="#595">595</a>                     xmlCipher.doFinal(doc, body, content);          
-<a name="596" href="#596">596</a>                 }
-<a name="597" href="#597">597</a>                 <strong class="jxr_keyword">if</strong> (cloneKeyInfo) {
-<a name="598" href="#598">598</a>                     keyInfo = <strong class="jxr_keyword">new</strong> KeyInfo((Element) keyInfo.getElement().cloneNode(<strong class="jxr_keyword">true</strong>), <strong class="jxr_keyword">null</strong>);
-<a name="599" href="#599">599</a>                 }
-<a name="600" href="#600">600</a>             } <strong class="jxr_keyword">catch</strong> (Exception e2) {
-<a name="601" href="#601">601</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="602" href="#602">602</a>                     WSSecurityException.FAILED_ENCRYPTION, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, e2
-<a name="603" href="#603">603</a>                 );
-<a name="604" href="#604">604</a>             }
-<a name="605" href="#605">605</a>             encDataRef.add(<span class="jxr_string">"#"</span> + xencEncryptedDataId);
-<a name="606" href="#606">606</a>         }
-<a name="607" href="#607">607</a>         <strong class="jxr_keyword">return</strong> encDataRef;
-<a name="608" href="#608">608</a>     }
-<a name="609" href="#609">609</a> 
-<a name="610" href="#610">610</a>     <strong class="jxr_keyword">private</strong> Document buildEmbedded(Document doc, <a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) 
-<a name="611" href="#611">611</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
-<a name="612" href="#612">612</a>         doDebug = log.isDebugEnabled();
-<a name="613" href="#613">613</a> 
-<a name="614" href="#614">614</a>         <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="615" href="#615">615</a>             log.debug(<span class="jxr_string">"Beginning Encryption embedded..."</span>);
-<a name="616" href="#616">616</a>         }
-<a name="617" href="#617">617</a>         envelope = doc.getDocumentElement();
-<a name="618" href="#618">618</a>         envelope.setAttributeNS(
-<a name="619" href="#619">619</a>             WSConstants.XMLNS_NS, <span class="jxr_string">"xmlns:"</span> + WSConstants.ENC_PREFIX, WSConstants.ENC_NS
-<a name="620" href="#620">620</a>         );
-<a name="621" href="#621">621</a> 
-<a name="622" href="#622">622</a>         <em class="jxr_comment">//</em>
-<a name="623" href="#623">623</a>         <em class="jxr_comment">// Second step: generate a symmetric key from the specified key</em>
-<a name="624" href="#624">624</a>         <em class="jxr_comment">// (password) for this algorithm, and set the cipher into encryption</em>
-<a name="625" href="#625">625</a>         <em class="jxr_comment">// mode.</em>
-<a name="626" href="#626">626</a>         <em class="jxr_comment">//</em>
-<a name="627" href="#627">627</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.symmetricKey == <strong class="jxr_keyword">null</strong>) {
-<a name="628" href="#628">628</a>             <strong class="jxr_keyword">if</strong> (embeddedKey == <strong class="jxr_keyword">null</strong>) {
-<a name="629" href="#629">629</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.FAILURE, <span class="jxr_string">"noKeySupplied"</span>);
-<a name="630" href="#630">630</a>             }
-<a name="631" href="#631">631</a>             <strong class="jxr_keyword">this</strong>.symmetricKey = WSSecurityUtil.prepareSecretKey(symEncAlgo, embeddedKey);
-<a name="632" href="#632">632</a>         }
-<a name="633" href="#633">633</a> 
-<a name="634" href="#634">634</a>         KeyInfo keyInfo = <strong class="jxr_keyword">null</strong>;
-<a name="635" href="#635">635</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.keyIdentifierType == WSConstants.EMBEDDED_KEYNAME) {
-<a name="636" href="#636">636</a>             keyInfo = <strong class="jxr_keyword">new</strong> KeyInfo(doc);
-<a name="637" href="#637">637</a>             keyInfo.addKeyName(embeddedKeyName == <strong class="jxr_keyword">null</strong> ? user : embeddedKeyName);
-<a name="638" href="#638">638</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.keyIdentifierType == WSConstants.EMBED_SECURITY_TOKEN_REF) {
-<a name="639" href="#639">639</a>             <em class="jxr_comment">//</em>
-<a name="640" href="#640">640</a>             <em class="jxr_comment">// This means that we want to embed a &lt;wsse:SecurityTokenReference&gt;</em>
-<a name="641" href="#641">641</a>             <em class="jxr_comment">// into keyInfo element. If we need this functionality, this.secRef</em>
-<a name="642" href="#642">642</a>             <em class="jxr_comment">// MUST be set before calling the build(doc, crypto) method. So if</em>
-<a name="643" href="#643">643</a>             <em class="jxr_comment">// secRef is null then throw an exception.</em>
-<a name="644" href="#644">644</a>             <em class="jxr_comment">//</em>
-<a name="645" href="#645">645</a>             <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.securityTokenReference == <strong class="jxr_keyword">null</strong>) {
-<a name="646" href="#646">646</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="647" href="#647">647</a>                     WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
-<a name="648" href="#648">648</a>                     <span class="jxr_string">"You must set keyInfo element, if the keyIdentifier == EMBED_SECURITY_TOKEN_REF"</span>
-<a name="649" href="#649">649</a>                  );
-<a name="650" href="#650">650</a>             } <strong class="jxr_keyword">else</strong> {
-<a name="651" href="#651">651</a>                 keyInfo = <strong class="jxr_keyword">new</strong> KeyInfo(doc);
-<a name="652" href="#652">652</a>                 Element tmpE = securityTokenReference.getElement();
-<a name="653" href="#653">653</a>                 tmpE.setAttributeNS(
-<a name="654" href="#654">654</a>                     WSConstants.XMLNS_NS, <span class="jxr_string">"xmlns:"</span> + tmpE.getPrefix(), tmpE.getNamespaceURI()
-<a name="655" href="#655">655</a>                 );
-<a name="656" href="#656">656</a>                 keyInfo.addUnknownElement(securityTokenReference.getElement());
-<a name="657" href="#657">657</a>             }
-<a name="658" href="#658">658</a>         }
-<a name="659" href="#659">659</a>         Element keyInfoElement = keyInfo.getElement();
-<a name="660" href="#660">660</a>         keyInfoElement.setAttributeNS(
-<a name="661" href="#661">661</a>             WSConstants.XMLNS_NS, <span class="jxr_string">"xmlns:"</span> + WSConstants.SIG_PREFIX, WSConstants.SIG_NS
-<a name="662" href="#662">662</a>         );
-<a name="663" href="#663">663</a> 
-<a name="664" href="#664">664</a>         <a href="../../../../../org/apache/ws/security/SOAPConstants.html">SOAPConstants</a> soapConstants = WSSecurityUtil.getSOAPConstants(envelope);
-<a name="665" href="#665">665</a>         <strong class="jxr_keyword">if</strong> (parts == <strong class="jxr_keyword">null</strong>) {
-<a name="666" href="#666">666</a>             parts = <strong class="jxr_keyword">new</strong> Vector();
-<a name="667" href="#667">667</a>             <a href="../../../../../org/apache/ws/security/WSEncryptionPart.html">WSEncryptionPart</a> encP = 
-<a name="668" href="#668">668</a>                 <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSEncryptionPart.html">WSEncryptionPart</a>(
-<a name="669" href="#669">669</a>                     soapConstants.getBodyQName().getLocalPart(), 
-<a name="670" href="#670">670</a>                     soapConstants.getEnvelopeURI(), 
-<a name="671" href="#671">671</a>                     <span class="jxr_string">"Content"</span>
-<a name="672" href="#672">672</a>                 );
-<a name="673" href="#673">673</a>             parts.add(encP);
-<a name="674" href="#674">674</a>         }
-<a name="675" href="#675">675</a>         Vector encDataRefs = doEncryption(doc, <strong class="jxr_keyword">this</strong>.symmetricKey, keyInfo, parts);
-<a name="676" href="#676">676</a> 
-<a name="677" href="#677">677</a>         <em class="jxr_comment">//</em>
-<a name="678" href="#678">678</a>         <em class="jxr_comment">// At this point data is encrypted with the symmetric key and can be</em>
-<a name="679" href="#679">679</a>         <em class="jxr_comment">// referenced via the above Id</em>
-<a name="680" href="#680">680</a>         <em class="jxr_comment">//</em>
-<a name="681" href="#681">681</a> 
-<a name="682" href="#682">682</a>         <em class="jxr_comment">//</em>
-<a name="683" href="#683">683</a>         <em class="jxr_comment">// Now we need to setup the wsse:Security header block 1) get (or</em>
-<a name="684" href="#684">684</a>         <em class="jxr_comment">// create) the wsse:Security header block 2) The last step sets up the</em>
-<a name="685" href="#685">685</a>         <em class="jxr_comment">// reference list that pints to the encrypted data</em>
-<a name="686" href="#686">686</a>         <em class="jxr_comment">//</em>
-<a name="687" href="#687">687</a>         Element wsseSecurity = secHeader.getSecurityHeader();
+<a name="523" href="#523">523</a>                 
+<a name="524" href="#524">524</a>                 <strong class="jxr_keyword">if</strong> (useKeyIdentifier &amp;&amp; 
+<a name="525" href="#525">525</a>                         SecurityTokenReference.SAML_ID_URI.equals(customReferenceValue)) {
+<a name="526" href="#526">526</a>                     secToken.setSAMLKeyIdentifier((encKeyIdDirectId ? <span class="jxr_string">""</span>:<span class="jxr_string">"#"</span>) + encKeyId);
+<a name="527" href="#527">527</a>                 } <strong class="jxr_keyword">else</strong> {
+<a name="528" href="#528">528</a>                    <a href="../../../../../org/apache/ws/security/message/token/Reference.html">Reference</a> ref = <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/message/token/Reference.html">Reference</a>(document);
+<a name="529" href="#529">529</a>                    <strong class="jxr_keyword">if</strong> (encKeyIdDirectId) {
+<a name="530" href="#530">530</a>                        ref.setURI(encKeyId);
+<a name="531" href="#531">531</a>                    } <strong class="jxr_keyword">else</strong> {
+<a name="532" href="#532">532</a>                        ref.setURI(<span class="jxr_string">"#"</span> + encKeyId);                    
+<a name="533" href="#533">533</a>                    }
+<a name="534" href="#534">534</a>                    <strong class="jxr_keyword">if</strong> (encKeyValueType != <strong class="jxr_keyword">null</strong>) {
+<a name="535" href="#535">535</a>                        ref.setValueType(encKeyValueType);
+<a name="536" href="#536">536</a>                    }
+<a name="537" href="#537">537</a>                    secToken.setReference(ref);
+<a name="538" href="#538">538</a>                 }
+<a name="539" href="#539">539</a>                 
+<a name="540" href="#540">540</a>                 keyInfo.addUnknownElement(secToken.getElement());
+<a name="541" href="#541">541</a>                 Element keyInfoElement = keyInfo.getElement();
+<a name="542" href="#542">542</a>                 keyInfoElement.setAttributeNS(
+<a name="543" href="#543">543</a>                     WSConstants.XMLNS_NS, <span class="jxr_string">"xmlns:"</span> + WSConstants.SIG_PREFIX, WSConstants.SIG_NS
+<a name="544" href="#544">544</a>                 );
+<a name="545" href="#545">545</a>             }
+<a name="546" href="#546">546</a>             <em class="jxr_comment">//</em>
+<a name="547" href="#547">547</a>             <em class="jxr_comment">// Fourth step: encrypt data, and set necessary attributes in</em>
+<a name="548" href="#548">548</a>             <em class="jxr_comment">// xenc:EncryptedData</em>
+<a name="549" href="#549">549</a>             <em class="jxr_comment">//</em>
+<a name="550" href="#550">550</a>             <strong class="jxr_keyword">try</strong> {
+<a name="551" href="#551">551</a>                 <strong class="jxr_keyword">if</strong> (modifier.equals(<span class="jxr_string">"Header"</span>)) {
+<a name="552" href="#552">552</a>                     
+<a name="553" href="#553">553</a>                     Element elem = 
+<a name="554" href="#554">554</a>                         doc.createElementNS(
+<a name="555" href="#555">555</a>                             WSConstants.WSSE11_NS, <span class="jxr_string">"wsse11:"</span> + WSConstants.ENCRYPTED_HEADER
+<a name="556" href="#556">556</a>                         );
+<a name="557" href="#557">557</a>                     WSSecurityUtil.setNamespace(elem, WSConstants.WSSE11_NS, WSConstants.WSSE11_PREFIX);
+<a name="558" href="#558">558</a>                     String wsuPrefix = 
+<a name="559" href="#559">559</a>                         WSSecurityUtil.setNamespace(elem, WSConstants.WSU_NS, WSConstants.WSU_PREFIX);
+<a name="560" href="#560">560</a>                     elem.setAttributeNS(
+<a name="561" href="#561">561</a>                         WSConstants.WSU_NS, wsuPrefix + <span class="jxr_string">":Id"</span>, 
+<a name="562" href="#562">562</a>                         wssConfig.getIdAllocator().createId(<span class="jxr_string">"EncHeader-"</span>, body)
+<a name="563" href="#563">563</a>                     );
+<a name="564" href="#564">564</a>                     
+<a name="565" href="#565">565</a>                     NamedNodeMap map = body.getAttributes();
+<a name="566" href="#566">566</a>                     
+<a name="567" href="#567">567</a>                     <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0 ; i &lt; map.getLength() ; i++) {
+<a name="568" href="#568">568</a>                         Attr attr = (Attr)map.item(i);
+<a name="569" href="#569">569</a>                         <strong class="jxr_keyword">if</strong> (attr.getNamespaceURI().equals(WSConstants.URI_SOAP11_ENV)
+<a name="570" href="#570">570</a>                             || attr.getNamespaceURI().equals(WSConstants.URI_SOAP12_ENV)) {                         
+<a name="571" href="#571">571</a>                             String soapEnvPrefix = 
+<a name="572" href="#572">572</a>                                 WSSecurityUtil.setNamespace(
+<a name="573" href="#573">573</a>                                     elem, attr.getNamespaceURI(), WSConstants.DEFAULT_SOAP_PREFIX
+<a name="574" href="#574">574</a>                                 );
+<a name="575" href="#575">575</a>                             elem.setAttributeNS(
+<a name="576" href="#576">576</a>                                 attr.getNamespaceURI(), 
+<a name="577" href="#577">577</a>                                 soapEnvPrefix + <span class="jxr_string">":"</span> + attr.getLocalName(), 
+<a name="578" href="#578">578</a>                                 attr.getValue()
+<a name="579" href="#579">579</a>                             );
+<a name="580" href="#580">580</a>                         }
+<a name="581" href="#581">581</a>                     }
+<a name="582" href="#582">582</a>                     
+<a name="583" href="#583">583</a>                     xmlCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
+<a name="584" href="#584">584</a>                     EncryptedData encData = xmlCipher.getEncryptedData();
+<a name="585" href="#585">585</a>                     encData.setId(xencEncryptedDataId);
+<a name="586" href="#586">586</a>                     encData.setKeyInfo(keyInfo);
+<a name="587" href="#587">587</a>                     xmlCipher.doFinal(doc, body, content);
+<a name="588" href="#588">588</a>                     
+<a name="589" href="#589">589</a>                     Element encDataElem = 
+<a name="590" href="#590">590</a>                         WSSecurityUtil.findElementById(
+<a name="591" href="#591">591</a>                             document.getDocumentElement(), xencEncryptedDataId, <strong class="jxr_keyword">null</strong>
+<a name="592" href="#592">592</a>                         );
+<a name="593" href="#593">593</a>                     Node clone = encDataElem.cloneNode(<strong class="jxr_keyword">true</strong>);
+<a name="594" href="#594">594</a>                     elem.appendChild(clone);
+<a name="595" href="#595">595</a>                     encDataElem.getParentNode().appendChild(elem);
+<a name="596" href="#596">596</a>                     encDataElem.getParentNode().removeChild(encDataElem); 
+<a name="597" href="#597">597</a>                 } <strong class="jxr_keyword">else</strong> {
+<a name="598" href="#598">598</a>                     xmlCipher.init(XMLCipher.ENCRYPT_MODE, secretKey);
+<a name="599" href="#599">599</a>                     EncryptedData encData = xmlCipher.getEncryptedData();
+<a name="600" href="#600">600</a>                     encData.setId(xencEncryptedDataId);
+<a name="601" href="#601">601</a>                     encData.setKeyInfo(keyInfo);
+<a name="602" href="#602">602</a>                     xmlCipher.doFinal(doc, body, content);          
+<a name="603" href="#603">603</a>                 }
+<a name="604" href="#604">604</a>                 <strong class="jxr_keyword">if</strong> (cloneKeyInfo) {
+<a name="605" href="#605">605</a>                     keyInfo = <strong class="jxr_keyword">new</strong> KeyInfo((Element) keyInfo.getElement().cloneNode(<strong class="jxr_keyword">true</strong>), <strong class="jxr_keyword">null</strong>);
+<a name="606" href="#606">606</a>                 }
+<a name="607" href="#607">607</a>             } <strong class="jxr_keyword">catch</strong> (Exception e2) {
+<a name="608" href="#608">608</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="609" href="#609">609</a>                     WSSecurityException.FAILED_ENCRYPTION, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, e2
+<a name="610" href="#610">610</a>                 );
+<a name="611" href="#611">611</a>             }
+<a name="612" href="#612">612</a>             encDataRef.add(<span class="jxr_string">"#"</span> + xencEncryptedDataId);
+<a name="613" href="#613">613</a>         }
+<a name="614" href="#614">614</a>         <strong class="jxr_keyword">return</strong> encDataRef;
+<a name="615" href="#615">615</a>     }
+<a name="616" href="#616">616</a> 
+<a name="617" href="#617">617</a>     <strong class="jxr_keyword">private</strong> Document buildEmbedded(Document doc, <a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) 
+<a name="618" href="#618">618</a>         <strong class="jxr_keyword">throws</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a> {
+<a name="619" href="#619">619</a>         doDebug = log.isDebugEnabled();
+<a name="620" href="#620">620</a> 
+<a name="621" href="#621">621</a>         <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="622" href="#622">622</a>             log.debug(<span class="jxr_string">"Beginning Encryption embedded..."</span>);
+<a name="623" href="#623">623</a>         }
+<a name="624" href="#624">624</a>         envelope = doc.getDocumentElement();
+<a name="625" href="#625">625</a>         envelope.setAttributeNS(
+<a name="626" href="#626">626</a>             WSConstants.XMLNS_NS, <span class="jxr_string">"xmlns:"</span> + WSConstants.ENC_PREFIX, WSConstants.ENC_NS
+<a name="627" href="#627">627</a>         );
+<a name="628" href="#628">628</a> 
+<a name="629" href="#629">629</a>         <em class="jxr_comment">//</em>
+<a name="630" href="#630">630</a>         <em class="jxr_comment">// Second step: generate a symmetric key from the specified key</em>
+<a name="631" href="#631">631</a>         <em class="jxr_comment">// (password) for this algorithm, and set the cipher into encryption</em>
+<a name="632" href="#632">632</a>         <em class="jxr_comment">// mode.</em>
+<a name="633" href="#633">633</a>         <em class="jxr_comment">//</em>
+<a name="634" href="#634">634</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.symmetricKey == <strong class="jxr_keyword">null</strong>) {
+<a name="635" href="#635">635</a>             <strong class="jxr_keyword">if</strong> (embeddedKey == <strong class="jxr_keyword">null</strong>) {
+<a name="636" href="#636">636</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSSecurityException.html">WSSecurityException</a>(WSSecurityException.FAILURE, <span class="jxr_string">"noKeySupplied"</span>);
+<a name="637" href="#637">637</a>             }
+<a name="638" href="#638">638</a>             <strong class="jxr_keyword">this</strong>.symmetricKey = WSSecurityUtil.prepareSecretKey(symEncAlgo, embeddedKey);
+<a name="639" href="#639">639</a>         }
+<a name="640" href="#640">640</a> 
+<a name="641" href="#641">641</a>         KeyInfo keyInfo = <strong class="jxr_keyword">null</strong>;
+<a name="642" href="#642">642</a>         <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.keyIdentifierType == WSConstants.EMBEDDED_KEYNAME) {
+<a name="643" href="#643">643</a>             keyInfo = <strong class="jxr_keyword">new</strong> KeyInfo(doc);
+<a name="644" href="#644">644</a>             keyInfo.addKeyName(embeddedKeyName == <strong class="jxr_keyword">null</strong> ? user : embeddedKeyName);
+<a name="645" href="#645">645</a>         } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.keyIdentifierType == WSConstants.EMBED_SECURITY_TOKEN_REF) {
+<a name="646" href="#646">646</a>             <em class="jxr_comment">//</em>
+<a name="647" href="#647">647</a>             <em class="jxr_comment">// This means that we want to embed a &lt;wsse:SecurityTokenReference&gt;</em>
+<a name="648" href="#648">648</a>             <em class="jxr_comment">// into keyInfo element. If we need this functionality, this.secRef</em>
+<a name="649" href="#649">649</a>             <em class="jxr_comment">// MUST be set before calling the build(doc, crypto) method. So if</em>
+<a name="650" href="#650">650</a>             <em class="jxr_comment">// secRef is null then throw an exception.</em>
+<a name="651" href="#651">651</a>             <em class="jxr_comment">//</em>
+<a name="652" href="#652">652</a>             <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.securityTokenReference == <strong class="jxr_keyword">null</strong>) {
+<a name="653" href="#653">653</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="654" href="#654">654</a>                     WSSecurityException.SECURITY_TOKEN_UNAVAILABLE,
+<a name="655" href="#655">655</a>                     <span class="jxr_string">"You must set keyInfo element, if the keyIdentifier == EMBED_SECURITY_TOKEN_REF"</span>
+<a name="656" href="#656">656</a>                  );
+<a name="657" href="#657">657</a>             } <strong class="jxr_keyword">else</strong> {
+<a name="658" href="#658">658</a>                 keyInfo = <strong class="jxr_keyword">new</strong> KeyInfo(doc);
+<a name="659" href="#659">659</a>                 Element tmpE = securityTokenReference.getElement();
+<a name="660" href="#660">660</a>                 tmpE.setAttributeNS(
+<a name="661" href="#661">661</a>                     WSConstants.XMLNS_NS, <span class="jxr_string">"xmlns:"</span> + tmpE.getPrefix(), tmpE.getNamespaceURI()
+<a name="662" href="#662">662</a>                 );
+<a name="663" href="#663">663</a>                 keyInfo.addUnknownElement(securityTokenReference.getElement());
+<a name="664" href="#664">664</a>             }
+<a name="665" href="#665">665</a>         }
+<a name="666" href="#666">666</a>         Element keyInfoElement = keyInfo.getElement();
+<a name="667" href="#667">667</a>         keyInfoElement.setAttributeNS(
+<a name="668" href="#668">668</a>             WSConstants.XMLNS_NS, <span class="jxr_string">"xmlns:"</span> + WSConstants.SIG_PREFIX, WSConstants.SIG_NS
+<a name="669" href="#669">669</a>         );
+<a name="670" href="#670">670</a> 
+<a name="671" href="#671">671</a>         <a href="../../../../../org/apache/ws/security/SOAPConstants.html">SOAPConstants</a> soapConstants = WSSecurityUtil.getSOAPConstants(envelope);
+<a name="672" href="#672">672</a>         <strong class="jxr_keyword">if</strong> (parts == <strong class="jxr_keyword">null</strong>) {
+<a name="673" href="#673">673</a>             parts = <strong class="jxr_keyword">new</strong> Vector();
+<a name="674" href="#674">674</a>             <a href="../../../../../org/apache/ws/security/WSEncryptionPart.html">WSEncryptionPart</a> encP = 
+<a name="675" href="#675">675</a>                 <strong class="jxr_keyword">new</strong> <a href="../../../../../org/apache/ws/security/WSEncryptionPart.html">WSEncryptionPart</a>(
+<a name="676" href="#676">676</a>                     soapConstants.getBodyQName().getLocalPart(), 
+<a name="677" href="#677">677</a>                     soapConstants.getEnvelopeURI(), 
+<a name="678" href="#678">678</a>                     <span class="jxr_string">"Content"</span>
+<a name="679" href="#679">679</a>                 );
+<a name="680" href="#680">680</a>             parts.add(encP);
+<a name="681" href="#681">681</a>         }
+<a name="682" href="#682">682</a>         Vector encDataRefs = doEncryption(doc, <strong class="jxr_keyword">this</strong>.symmetricKey, keyInfo, parts);
+<a name="683" href="#683">683</a> 
+<a name="684" href="#684">684</a>         <em class="jxr_comment">//</em>
+<a name="685" href="#685">685</a>         <em class="jxr_comment">// At this point data is encrypted with the symmetric key and can be</em>
+<a name="686" href="#686">686</a>         <em class="jxr_comment">// referenced via the above Id</em>
+<a name="687" href="#687">687</a>         <em class="jxr_comment">//</em>
 <a name="688" href="#688">688</a> 
-<a name="689" href="#689">689</a>         Element referenceList = 
-<a name="690" href="#690">690</a>             doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":ReferenceList"</span>);
-<a name="691" href="#691">691</a>         referenceList = createDataRefList(doc, referenceList, encDataRefs);
-<a name="692" href="#692">692</a>         WSSecurityUtil.prependChildElement(wsseSecurity, referenceList);
-<a name="693" href="#693">693</a> 
-<a name="694" href="#694">694</a>         <strong class="jxr_keyword">return</strong> doc;
-<a name="695" href="#695">695</a>     }
-<a name="696" href="#696">696</a> 
-<a name="697" href="#697">697</a>     <strong class="jxr_keyword">private</strong> KeyGenerator getKeyGenerator() <strong class="jxr_keyword">throws</strong> WSSecurityException {
-<a name="698" href="#698">698</a>         <strong class="jxr_keyword">try</strong> {
-<a name="699" href="#699">699</a>             <em class="jxr_comment">//</em>
-<a name="700" href="#700">700</a>             <em class="jxr_comment">// Assume AES as default, so initialize it</em>
-<a name="701" href="#701">701</a>             <em class="jxr_comment">//</em>
-<a name="702" href="#702">702</a>             String keyAlgorithm = JCEMapper.getJCEKeyAlgorithmFromURI(symEncAlgo);
-<a name="703" href="#703">703</a>             KeyGenerator keyGen = KeyGenerator.getInstance(keyAlgorithm);
-<a name="704" href="#704">704</a>             <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_128)) {
-<a name="705" href="#705">705</a>                 keyGen.init(128);
-<a name="706" href="#706">706</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_192)) {
-<a name="707" href="#707">707</a>                 keyGen.init(192);
-<a name="708" href="#708">708</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_256)) {
-<a name="709" href="#709">709</a>                 keyGen.init(256);
-<a name="710" href="#710">710</a>             }
-<a name="711" href="#711">711</a>             <strong class="jxr_keyword">return</strong> keyGen;
-<a name="712" href="#712">712</a>         } <strong class="jxr_keyword">catch</strong> (NoSuchAlgorithmException e) {
-<a name="713" href="#713">713</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="714" href="#714">714</a>                 WSSecurityException.UNSUPPORTED_ALGORITHM, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, e
-<a name="715" href="#715">715</a>             );
-<a name="716" href="#716">716</a>         }
-<a name="717" href="#717">717</a>     }
-<a name="718" href="#718">718</a> 
-<a name="719" href="#719">719</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="720" href="#720">720</a> <em class="jxr_javadoccomment">     * Create DOM subtree for &lt;code&gt;xenc:EncryptedKey&lt;/code&gt;</em>
-<a name="721" href="#721">721</a> <em class="jxr_javadoccomment">     * </em>
-<a name="722" href="#722">722</a> <em class="jxr_javadoccomment">     * @param doc the SOAP envelope parent document</em>
-<a name="723" href="#723">723</a> <em class="jxr_javadoccomment">     * @param referenceList</em>
-<a name="724" href="#724">724</a> <em class="jxr_javadoccomment">     * @param encDataRefs</em>
-<a name="725" href="#725">725</a> <em class="jxr_javadoccomment">     * @return an &lt;code&gt;xenc:EncryptedKey&lt;/code&gt; element</em>
-<a name="726" href="#726">726</a> <em class="jxr_javadoccomment">     */</em>
-<a name="727" href="#727">727</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Element createDataRefList(
-<a name="728" href="#728">728</a>         Document doc,
-<a name="729" href="#729">729</a>         Element referenceList, 
-<a name="730" href="#730">730</a>         Vector encDataRefs
-<a name="731" href="#731">731</a>     ) {
-<a name="732" href="#732">732</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; encDataRefs.size(); i++) {
-<a name="733" href="#733">733</a>             String dataReferenceUri = (String) encDataRefs.get(i);
-<a name="734" href="#734">734</a>             Element dataReference = 
-<a name="735" href="#735">735</a>                 doc.createElementNS(
-<a name="736" href="#736">736</a>                     WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":DataReference"</span>
-<a name="737" href="#737">737</a>                 );
-<a name="738" href="#738">738</a>             dataReference.setAttributeNS(<strong class="jxr_keyword">null</strong>, <span class="jxr_string">"URI"</span>, dataReferenceUri);
-<a name="739" href="#739">739</a>             referenceList.appendChild(dataReference);
-<a name="740" href="#740">740</a>         }
-<a name="741" href="#741">741</a>         <strong class="jxr_keyword">return</strong> referenceList;
-<a name="742" href="#742">742</a>     }
-<a name="743" href="#743">743</a> 
-<a name="744" href="#744">744</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="745" href="#745">745</a> <em class="jxr_javadoccomment">     * @return The symmetric key</em>
-<a name="746" href="#746">746</a> <em class="jxr_javadoccomment">     */</em>
-<a name="747" href="#747">747</a>     <strong class="jxr_keyword">public</strong> SecretKey getSymmetricKey() {
-<a name="748" href="#748">748</a>         <strong class="jxr_keyword">return</strong> symmetricKey;
+<a name="689" href="#689">689</a>         <em class="jxr_comment">//</em>
+<a name="690" href="#690">690</a>         <em class="jxr_comment">// Now we need to setup the wsse:Security header block 1) get (or</em>
+<a name="691" href="#691">691</a>         <em class="jxr_comment">// create) the wsse:Security header block 2) The last step sets up the</em>
+<a name="692" href="#692">692</a>         <em class="jxr_comment">// reference list that pints to the encrypted data</em>
+<a name="693" href="#693">693</a>         <em class="jxr_comment">//</em>
+<a name="694" href="#694">694</a>         Element wsseSecurity = secHeader.getSecurityHeader();
+<a name="695" href="#695">695</a> 
+<a name="696" href="#696">696</a>         Element referenceList = 
+<a name="697" href="#697">697</a>             doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":ReferenceList"</span>);
+<a name="698" href="#698">698</a>         referenceList = createDataRefList(doc, referenceList, encDataRefs);
+<a name="699" href="#699">699</a>         WSSecurityUtil.prependChildElement(wsseSecurity, referenceList);
+<a name="700" href="#700">700</a> 
+<a name="701" href="#701">701</a>         <strong class="jxr_keyword">return</strong> doc;
+<a name="702" href="#702">702</a>     }
+<a name="703" href="#703">703</a> 
+<a name="704" href="#704">704</a>     <strong class="jxr_keyword">private</strong> KeyGenerator getKeyGenerator() <strong class="jxr_keyword">throws</strong> WSSecurityException {
+<a name="705" href="#705">705</a>         <strong class="jxr_keyword">try</strong> {
+<a name="706" href="#706">706</a>             <em class="jxr_comment">//</em>
+<a name="707" href="#707">707</a>             <em class="jxr_comment">// Assume AES as default, so initialize it</em>
+<a name="708" href="#708">708</a>             <em class="jxr_comment">//</em>
+<a name="709" href="#709">709</a>             String keyAlgorithm = JCEMapper.getJCEKeyAlgorithmFromURI(symEncAlgo);
+<a name="710" href="#710">710</a>             KeyGenerator keyGen = KeyGenerator.getInstance(keyAlgorithm);
+<a name="711" href="#711">711</a>             <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_128)) {
+<a name="712" href="#712">712</a>                 keyGen.init(128);
+<a name="713" href="#713">713</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_192)) {
+<a name="714" href="#714">714</a>                 keyGen.init(192);
+<a name="715" href="#715">715</a>             } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_256)) {
+<a name="716" href="#716">716</a>                 keyGen.init(256);
+<a name="717" href="#717">717</a>             }
+<a name="718" href="#718">718</a>             <strong class="jxr_keyword">return</strong> keyGen;
+<a name="719" href="#719">719</a>         } <strong class="jxr_keyword">catch</strong> (NoSuchAlgorithmException e) {
+<a name="720" href="#720">720</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="721" href="#721">721</a>                 WSSecurityException.UNSUPPORTED_ALGORITHM, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, e
+<a name="722" href="#722">722</a>             );
+<a name="723" href="#723">723</a>         }
+<a name="724" href="#724">724</a>     }
+<a name="725" href="#725">725</a> 
+<a name="726" href="#726">726</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="727" href="#727">727</a> <em class="jxr_javadoccomment">     * Create DOM subtree for &lt;code&gt;xenc:EncryptedKey&lt;/code&gt;</em>
+<a name="728" href="#728">728</a> <em class="jxr_javadoccomment">     * </em>
+<a name="729" href="#729">729</a> <em class="jxr_javadoccomment">     * @param doc the SOAP envelope parent document</em>
+<a name="730" href="#730">730</a> <em class="jxr_javadoccomment">     * @param referenceList</em>
+<a name="731" href="#731">731</a> <em class="jxr_javadoccomment">     * @param encDataRefs</em>
+<a name="732" href="#732">732</a> <em class="jxr_javadoccomment">     * @return an &lt;code&gt;xenc:EncryptedKey&lt;/code&gt; element</em>
+<a name="733" href="#733">733</a> <em class="jxr_javadoccomment">     */</em>
+<a name="734" href="#734">734</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> Element createDataRefList(
+<a name="735" href="#735">735</a>         Document doc,
+<a name="736" href="#736">736</a>         Element referenceList, 
+<a name="737" href="#737">737</a>         Vector encDataRefs
+<a name="738" href="#738">738</a>     ) {
+<a name="739" href="#739">739</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; encDataRefs.size(); i++) {
+<a name="740" href="#740">740</a>             String dataReferenceUri = (String) encDataRefs.get(i);
+<a name="741" href="#741">741</a>             Element dataReference = 
+<a name="742" href="#742">742</a>                 doc.createElementNS(
+<a name="743" href="#743">743</a>                     WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":DataReference"</span>
+<a name="744" href="#744">744</a>                 );
+<a name="745" href="#745">745</a>             dataReference.setAttributeNS(<strong class="jxr_keyword">null</strong>, <span class="jxr_string">"URI"</span>, dataReferenceUri);
+<a name="746" href="#746">746</a>             referenceList.appendChild(dataReference);
+<a name="747" href="#747">747</a>         }
+<a name="748" href="#748">748</a>         <strong class="jxr_keyword">return</strong> referenceList;
 <a name="749" href="#749">749</a>     }
 <a name="750" href="#750">750</a> 
 <a name="751" href="#751">751</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="752" href="#752">752</a> <em class="jxr_javadoccomment">     * Set the symmetric key to be used for encryption</em>
-<a name="753" href="#753">753</a> <em class="jxr_javadoccomment">     * </em>
-<a name="754" href="#754">754</a> <em class="jxr_javadoccomment">     * @param key</em>
-<a name="755" href="#755">755</a> <em class="jxr_javadoccomment">     */</em>
-<a name="756" href="#756">756</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSymmetricKey(SecretKey key) {
-<a name="757" href="#757">757</a>         <strong class="jxr_keyword">this</strong>.symmetricKey = key;
-<a name="758" href="#758">758</a>     }
-<a name="759" href="#759">759</a> 
-<a name="760" href="#760">760</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="761" href="#761">761</a> <em class="jxr_javadoccomment">     * @return Return the SecurityTokenRefernce</em>
+<a name="752" href="#752">752</a> <em class="jxr_javadoccomment">     * @return The symmetric key</em>
+<a name="753" href="#753">753</a> <em class="jxr_javadoccomment">     */</em>
+<a name="754" href="#754">754</a>     <strong class="jxr_keyword">public</strong> SecretKey getSymmetricKey() {
+<a name="755" href="#755">755</a>         <strong class="jxr_keyword">return</strong> symmetricKey;
+<a name="756" href="#756">756</a>     }
+<a name="757" href="#757">757</a> 
+<a name="758" href="#758">758</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="759" href="#759">759</a> <em class="jxr_javadoccomment">     * Set the symmetric key to be used for encryption</em>
+<a name="760" href="#760">760</a> <em class="jxr_javadoccomment">     * </em>
+<a name="761" href="#761">761</a> <em class="jxr_javadoccomment">     * @param key</em>
 <a name="762" href="#762">762</a> <em class="jxr_javadoccomment">     */</em>
-<a name="763" href="#763">763</a>     <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/ws/security/message/token/SecurityTokenReference.html">SecurityTokenReference</a> getSecurityTokenReference() {
-<a name="764" href="#764">764</a>         <strong class="jxr_keyword">return</strong> securityTokenReference;
+<a name="763" href="#763">763</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSymmetricKey(SecretKey key) {
+<a name="764" href="#764">764</a>         <strong class="jxr_keyword">this</strong>.symmetricKey = key;
 <a name="765" href="#765">765</a>     }
 <a name="766" href="#766">766</a> 
 <a name="767" href="#767">767</a>     <em class="jxr_javadoccomment">/**</em>
-<a name="768" href="#768">768</a> <em class="jxr_javadoccomment">     * @param reference</em>
+<a name="768" href="#768">768</a> <em class="jxr_javadoccomment">     * @return Return the SecurityTokenRefernce</em>
 <a name="769" href="#769">769</a> <em class="jxr_javadoccomment">     */</em>
-<a name="770" href="#770">770</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSecurityTokenReference(<a href="../../../../../org/apache/ws/security/message/token/SecurityTokenReference.html">SecurityTokenReference</a> reference) {
-<a name="771" href="#771">771</a>         securityTokenReference = reference;
+<a name="770" href="#770">770</a>     <strong class="jxr_keyword">public</strong> <a href="../../../../../org/apache/ws/security/message/token/SecurityTokenReference.html">SecurityTokenReference</a> getSecurityTokenReference() {
+<a name="771" href="#771">771</a>         <strong class="jxr_keyword">return</strong> securityTokenReference;
 <a name="772" href="#772">772</a>     }
 <a name="773" href="#773">773</a> 
-<a name="774" href="#774">774</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isEncryptSymmKey() {
-<a name="775" href="#775">775</a>         <strong class="jxr_keyword">return</strong> encryptSymmKey;
-<a name="776" href="#776">776</a>     }
-<a name="777" href="#777">777</a> 
-<a name="778" href="#778">778</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncryptSymmKey(<strong class="jxr_keyword">boolean</strong> encryptSymmKey) {
-<a name="779" href="#779">779</a>         <strong class="jxr_keyword">this</strong>.encryptSymmKey = encryptSymmKey;
-<a name="780" href="#780">780</a>     }
-<a name="781" href="#781">781</a> 
-<a name="782" href="#782">782</a>     <strong class="jxr_keyword">private</strong> String getSHA1(byte[] input) <strong class="jxr_keyword">throws</strong> WSSecurityException {
-<a name="783" href="#783">783</a>         <strong class="jxr_keyword">try</strong> {
-<a name="784" href="#784">784</a>             MessageDigest sha = <strong class="jxr_keyword">null</strong>;
-<a name="785" href="#785">785</a>             sha = MessageDigest.getInstance(<span class="jxr_string">"SHA-1"</span>);
-<a name="786" href="#786">786</a>             sha.reset();
-<a name="787" href="#787">787</a>             sha.update(input);
-<a name="788" href="#788">788</a>             byte[] data = sha.digest();
-<a name="789" href="#789">789</a>             
-<a name="790" href="#790">790</a>             <strong class="jxr_keyword">return</strong> Base64.encode(data);
-<a name="791" href="#791">791</a>         } <strong class="jxr_keyword">catch</strong> (NoSuchAlgorithmException e) {
-<a name="792" href="#792">792</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="793" href="#793">793</a>                 WSSecurityException.UNSUPPORTED_ALGORITHM, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, e
-<a name="794" href="#794">794</a>             );
-<a name="795" href="#795">795</a>         }
-<a name="796" href="#796">796</a>     }
-<a name="797" href="#797">797</a> 
-<a name="798" href="#798">798</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setCustomReferenceValue(String customReferenceValue) {
-<a name="799" href="#799">799</a>         <strong class="jxr_keyword">this</strong>.customReferenceValue = customReferenceValue;
-<a name="800" href="#800">800</a>     }
-<a name="801" href="#801">801</a>     
-<a name="802" href="#802">802</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncKeyValueType(String e) {
-<a name="803" href="#803">803</a>         encKeyValueType = e;
-<a name="804" href="#804">804</a>     }
-<a name="805" href="#805">805</a>     
-<a name="806" href="#806">806</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncKeyIdDirectId(<strong class="jxr_keyword">boolean</strong> b) {
-<a name="807" href="#807">807</a>         encKeyIdDirectId = b;
-<a name="808" href="#808">808</a>     }
-<a name="809" href="#809">809</a> }
+<a name="774" href="#774">774</a>     <em class="jxr_javadoccomment">/**</em>
+<a name="775" href="#775">775</a> <em class="jxr_javadoccomment">     * @param reference</em>
+<a name="776" href="#776">776</a> <em class="jxr_javadoccomment">     */</em>
+<a name="777" href="#777">777</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSecurityTokenReference(<a href="../../../../../org/apache/ws/security/message/token/SecurityTokenReference.html">SecurityTokenReference</a> reference) {
+<a name="778" href="#778">778</a>         securityTokenReference = reference;
+<a name="779" href="#779">779</a>     }
+<a name="780" href="#780">780</a> 
+<a name="781" href="#781">781</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isEncryptSymmKey() {
+<a name="782" href="#782">782</a>         <strong class="jxr_keyword">return</strong> encryptSymmKey;
+<a name="783" href="#783">783</a>     }
+<a name="784" href="#784">784</a>     
+<a name="785" href="#785">785</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncryptSymmKey(<strong class="jxr_keyword">boolean</strong> encryptSymmKey) {
+<a name="786" href="#786">786</a>         <strong class="jxr_keyword">this</strong>.encryptSymmKey = encryptSymmKey;
+<a name="787" href="#787">787</a>     }
+<a name="788" href="#788">788</a>     
+<a name="789" href="#789">789</a>     <strong class="jxr_keyword">private</strong> String getSHA1(byte[] input) <strong class="jxr_keyword">throws</strong> WSSecurityException {
+<a name="790" href="#790">790</a>         <strong class="jxr_keyword">try</strong> {
+<a name="791" href="#791">791</a>             MessageDigest sha = <strong class="jxr_keyword">null</strong>;
+<a name="792" href="#792">792</a>             sha = MessageDigest.getInstance(<span class="jxr_string">"SHA-1"</span>);
+<a name="793" href="#793">793</a>             sha.reset();
+<a name="794" href="#794">794</a>             sha.update(input);
+<a name="795" href="#795">795</a>             byte[] data = sha.digest();
+<a name="796" href="#796">796</a>             
+<a name="797" href="#797">797</a>             <strong class="jxr_keyword">return</strong> Base64.encode(data);
+<a name="798" href="#798">798</a>         } <strong class="jxr_keyword">catch</strong> (NoSuchAlgorithmException e) {
+<a name="799" href="#799">799</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="800" href="#800">800</a>                 WSSecurityException.UNSUPPORTED_ALGORITHM, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, e
+<a name="801" href="#801">801</a>             );
+<a name="802" href="#802">802</a>         }
+<a name="803" href="#803">803</a>     }
+<a name="804" href="#804">804</a>     
+<a name="805" href="#805">805</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setCustomReferenceValue(String customReferenceValue) {
+<a name="806" href="#806">806</a>         <strong class="jxr_keyword">this</strong>.customReferenceValue = customReferenceValue;
+<a name="807" href="#807">807</a>     }
+<a name="808" href="#808">808</a>     
+<a name="809" href="#809">809</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncKeyValueType(String e) {
+<a name="810" href="#810">810</a>         encKeyValueType = e;
+<a name="811" href="#811">811</a>     }
+<a name="812" href="#812">812</a>     
+<a name="813" href="#813">813</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncKeyIdDirectId(<strong class="jxr_keyword">boolean</strong> b) {
+<a name="814" href="#814">814</a>         encKeyIdDirectId = b;
+<a name="815" href="#815">815</a>     }
+<a name="816" href="#816">816</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>



Mime
View raw message