Modified: webservices/wss4j/site/xref/org/apache/ws/security/message/WSSecEncryptedKey.html URL: http://svn.apache.org/viewvc/webservices/wss4j/site/xref/org/apache/ws/security/message/WSSecEncryptedKey.html?rev=1210847&r1=1210846&r2=1210847&view=diff ============================================================================== --- webservices/wss4j/site/xref/org/apache/ws/security/message/WSSecEncryptedKey.html (original) +++ webservices/wss4j/site/xref/org/apache/ws/security/message/WSSecEncryptedKey.html Tue Dec 6 10:23:54 2011 @@ -306,7 +306,7 @@ <a name="296" href="#296">296</a> <strong class="jxr_keyword">break</strong>; <a name="297" href="#297">297</a> <a name="298" href="#298">298</a> <strong class="jxr_keyword">case</strong> WSConstants.ISSUER_SERIAL: -<a name="299" href="#299">299</a> String issuer = remoteCert.getIssuerDN().getName(); +<a name="299" href="#299">299</a> String issuer = remoteCert.getIssuerX500Principal().getName(); <a name="300" href="#300">300</a> java.math.BigInteger serialNumber = remoteCert.getSerialNumber(); <a name="301" href="#301">301</a> DOMX509IssuerSerial domIssuerSerial = <a name="302" href="#302">302</a> <strong class="jxr_keyword">new</strong> DOMX509IssuerSerial( @@ -403,266 +403,268 @@ <a name="393" href="#393">393</a> keyAlgorithm = JCEMapper.translateURItoJCEID(symEncAlgo); <a name="394" href="#394">394</a> } <a name="395" href="#395">395</a> KeyGenerator keyGen = KeyGenerator.getInstance(keyAlgorithm); -<a name="396" href="#396">396</a> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_128)) { -<a name="397" href="#397">397</a> keyGen.init(128); -<a name="398" href="#398">398</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_192)) { -<a name="399" href="#399">399</a> keyGen.init(192); -<a name="400" href="#400">400</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_256)) { -<a name="401" href="#401">401</a> keyGen.init(256); -<a name="402" href="#402">402</a> } -<a name="403" href="#403">403</a> <strong class="jxr_keyword">return</strong> keyGen; -<a name="404" href="#404">404</a> } <strong class="jxr_keyword">catch</strong> (NoSuchAlgorithmException e) { -<a name="405" href="#405">405</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="406" href="#406">406</a> WSSecurityException.UNSUPPORTED_ALGORITHM, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, e -<a name="407" href="#407">407</a> ); -<a name="408" href="#408">408</a> } -<a name="409" href="#409">409</a> } -<a name="410" href="#410">410</a> -<a name="411" href="#411">411</a> <em class="jxr_javadoccomment">/**</em> -<a name="412" href="#412">412</a> <em class="jxr_javadoccomment"> * Create DOM subtree for <code>xenc:EncryptedKey</code></em> -<a name="413" href="#413">413</a> <em class="jxr_javadoccomment"> * </em> -<a name="414" href="#414">414</a> <em class="jxr_javadoccomment"> * @param doc the SOAP envelope parent document</em> -<a name="415" href="#415">415</a> <em class="jxr_javadoccomment"> * @param keyTransportAlgo specifies which algorithm to use to encrypt the symmetric key</em> -<a name="416" href="#416">416</a> <em class="jxr_javadoccomment"> * @return an <code>xenc:EncryptedKey</code> element</em> -<a name="417" href="#417">417</a> <em class="jxr_javadoccomment"> */</em> -<a name="418" href="#418">418</a> <strong class="jxr_keyword">protected</strong> Element createEncryptedKey(Document doc, String keyTransportAlgo) { -<a name="419" href="#419">419</a> Element encryptedKey = -<a name="420" href="#420">420</a> doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":EncryptedKey"</span>); -<a name="421" href="#421">421</a> -<a name="422" href="#422">422</a> WSSecurityUtil.setNamespace(encryptedKey, WSConstants.ENC_NS, WSConstants.ENC_PREFIX); -<a name="423" href="#423">423</a> Element encryptionMethod = -<a name="424" href="#424">424</a> doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":EncryptionMethod"</span>); -<a name="425" href="#425">425</a> encryptionMethod.setAttributeNS(<strong class="jxr_keyword">null</strong>, <span class="jxr_string">"Algorithm"</span>, keyTransportAlgo); -<a name="426" href="#426">426</a> encryptedKey.appendChild(encryptionMethod); -<a name="427" href="#427">427</a> <strong class="jxr_keyword">return</strong> encryptedKey; -<a name="428" href="#428">428</a> } -<a name="429" href="#429">429</a> -<a name="430" href="#430">430</a> <strong class="jxr_keyword">protected</strong> Element createCipherValue(Document doc, Element encryptedKey) { -<a name="431" href="#431">431</a> Element cipherData = -<a name="432" href="#432">432</a> doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":CipherData"</span>); -<a name="433" href="#433">433</a> Element cipherValue = -<a name="434" href="#434">434</a> doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":CipherValue"</span>); -<a name="435" href="#435">435</a> cipherData.appendChild(cipherValue); -<a name="436" href="#436">436</a> encryptedKey.appendChild(cipherData); -<a name="437" href="#437">437</a> <strong class="jxr_keyword">return</strong> cipherValue; -<a name="438" href="#438">438</a> } -<a name="439" href="#439">439</a> -<a name="440" href="#440">440</a> <em class="jxr_javadoccomment">/**</em> -<a name="441" href="#441">441</a> <em class="jxr_javadoccomment"> * Prepend the EncryptedKey element to the elements already in the Security</em> -<a name="442" href="#442">442</a> <em class="jxr_javadoccomment"> * header.</em> -<a name="443" href="#443">443</a> <em class="jxr_javadoccomment"> * </em> -<a name="444" href="#444">444</a> <em class="jxr_javadoccomment"> * The method can be called any time after <code>prepare()</code>. This</em> -<a name="445" href="#445">445</a> <em class="jxr_javadoccomment"> * allows to insert the EncryptedKey element at any position in the Security</em> -<a name="446" href="#446">446</a> <em class="jxr_javadoccomment"> * header.</em> -<a name="447" href="#447">447</a> <em class="jxr_javadoccomment"> * </em> -<a name="448" href="#448">448</a> <em class="jxr_javadoccomment"> * @param secHeader The security header that holds the Signature element.</em> -<a name="449" href="#449">449</a> <em class="jxr_javadoccomment"> */</em> -<a name="450" href="#450">450</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> prependToHeader(<a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) { -<a name="451" href="#451">451</a> WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), encryptedKeyElement); -<a name="452" href="#452">452</a> } -<a name="453" href="#453">453</a> -<a name="454" href="#454">454</a> <em class="jxr_javadoccomment">/**</em> -<a name="455" href="#455">455</a> <em class="jxr_javadoccomment"> * Append the EncryptedKey element to the elements already in the Security</em> -<a name="456" href="#456">456</a> <em class="jxr_javadoccomment"> * header.</em> -<a name="457" href="#457">457</a> <em class="jxr_javadoccomment"> * </em> -<a name="458" href="#458">458</a> <em class="jxr_javadoccomment"> * The method can be called any time after <code>prepare()</code>. This</em> -<a name="459" href="#459">459</a> <em class="jxr_javadoccomment"> * allows to insert the EncryptedKey element at any position in the Security</em> -<a name="460" href="#460">460</a> <em class="jxr_javadoccomment"> * header.</em> -<a name="461" href="#461">461</a> <em class="jxr_javadoccomment"> * </em> -<a name="462" href="#462">462</a> <em class="jxr_javadoccomment"> * @param secHeader The security header that holds the Signature element.</em> -<a name="463" href="#463">463</a> <em class="jxr_javadoccomment"> */</em> -<a name="464" href="#464">464</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> appendToHeader(<a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) { -<a name="465" href="#465">465</a> Element secHeaderElement = secHeader.getSecurityHeader(); -<a name="466" href="#466">466</a> secHeaderElement.appendChild(encryptedKeyElement); -<a name="467" href="#467">467</a> } -<a name="468" href="#468">468</a> -<a name="469" href="#469">469</a> <em class="jxr_javadoccomment">/**</em> -<a name="470" href="#470">470</a> <em class="jxr_javadoccomment"> * Prepend the BinarySecurityToken to the elements already in the Security</em> -<a name="471" href="#471">471</a> <em class="jxr_javadoccomment"> * header.</em> -<a name="472" href="#472">472</a> <em class="jxr_javadoccomment"> * </em> -<a name="473" href="#473">473</a> <em class="jxr_javadoccomment"> * The method can be called any time after <code>prepare()</code>. This</em> -<a name="474" href="#474">474</a> <em class="jxr_javadoccomment"> * allows to insert the BST element at any position in the Security header.</em> -<a name="475" href="#475">475</a> <em class="jxr_javadoccomment"> * </em> -<a name="476" href="#476">476</a> <em class="jxr_javadoccomment"> * @param secHeader The security header that holds the BST element.</em> -<a name="477" href="#477">477</a> <em class="jxr_javadoccomment"> */</em> -<a name="478" href="#478">478</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> prependBSTElementToHeader(<a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) { -<a name="479" href="#479">479</a> <strong class="jxr_keyword">if</strong> (bstToken != <strong class="jxr_keyword">null</strong>) { -<a name="480" href="#480">480</a> WSSecurityUtil.prependChildElement( -<a name="481" href="#481">481</a> secHeader.getSecurityHeader(), bstToken.getElement() -<a name="482" href="#482">482</a> ); -<a name="483" href="#483">483</a> } -<a name="484" href="#484">484</a> bstToken = <strong class="jxr_keyword">null</strong>; -<a name="485" href="#485">485</a> } -<a name="486" href="#486">486</a> -<a name="487" href="#487">487</a> <em class="jxr_javadoccomment">/**</em> -<a name="488" href="#488">488</a> <em class="jxr_javadoccomment"> * Append the BinarySecurityToken to the elements already in the Security</em> -<a name="489" href="#489">489</a> <em class="jxr_javadoccomment"> * header.</em> -<a name="490" href="#490">490</a> <em class="jxr_javadoccomment"> * </em> -<a name="491" href="#491">491</a> <em class="jxr_javadoccomment"> * The method can be called any time after <code>prepare()</code>. This</em> -<a name="492" href="#492">492</a> <em class="jxr_javadoccomment"> * allows to insert the BST element at any position in the Security header.</em> -<a name="493" href="#493">493</a> <em class="jxr_javadoccomment"> * </em> -<a name="494" href="#494">494</a> <em class="jxr_javadoccomment"> * @param secHeader The security header that holds the BST element.</em> -<a name="495" href="#495">495</a> <em class="jxr_javadoccomment"> */</em> -<a name="496" href="#496">496</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> appendBSTElementToHeader(<a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) { -<a name="497" href="#497">497</a> <strong class="jxr_keyword">if</strong> (bstToken != <strong class="jxr_keyword">null</strong>) { -<a name="498" href="#498">498</a> Element secHeaderElement = secHeader.getSecurityHeader(); -<a name="499" href="#499">499</a> secHeaderElement.appendChild(bstToken.getElement()); -<a name="500" href="#500">500</a> } -<a name="501" href="#501">501</a> bstToken = <strong class="jxr_keyword">null</strong>; -<a name="502" href="#502">502</a> } -<a name="503" href="#503">503</a> -<a name="504" href="#504">504</a> <em class="jxr_javadoccomment">/**</em> -<a name="505" href="#505">505</a> <em class="jxr_javadoccomment"> * @return Returns the ephemeralKey.</em> -<a name="506" href="#506">506</a> <em class="jxr_javadoccomment"> */</em> -<a name="507" href="#507">507</a> <strong class="jxr_keyword">public</strong> byte[] getEphemeralKey() { -<a name="508" href="#508">508</a> <strong class="jxr_keyword">return</strong> ephemeralKey; -<a name="509" href="#509">509</a> } -<a name="510" href="#510">510</a> -<a name="511" href="#511">511</a> <em class="jxr_javadoccomment">/**</em> -<a name="512" href="#512">512</a> <em class="jxr_javadoccomment"> * Set the X509 Certificate to use for encryption.</em> -<a name="513" href="#513">513</a> <em class="jxr_javadoccomment"> * </em> -<a name="514" href="#514">514</a> <em class="jxr_javadoccomment"> * If this is set <b>and</b> the key identifier is set to</em> -<a name="515" href="#515">515</a> <em class="jxr_javadoccomment"> * <code>DirectReference</code> then use this certificate to get the</em> -<a name="516" href="#516">516</a> <em class="jxr_javadoccomment"> * public key for encryption.</em> -<a name="517" href="#517">517</a> <em class="jxr_javadoccomment"> * </em> -<a name="518" href="#518">518</a> <em class="jxr_javadoccomment"> * @param cert is the X509 certificate to use for encryption</em> -<a name="519" href="#519">519</a> <em class="jxr_javadoccomment"> */</em> -<a name="520" href="#520">520</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setUseThisCert(X509Certificate cert) { -<a name="521" href="#521">521</a> useThisCert = cert; -<a name="522" href="#522">522</a> } -<a name="523" href="#523">523</a> -<a name="524" href="#524">524</a> <em class="jxr_javadoccomment">/**</em> -<a name="525" href="#525">525</a> <em class="jxr_javadoccomment"> * @return Returns the encryptedKeyElement.</em> -<a name="526" href="#526">526</a> <em class="jxr_javadoccomment"> */</em> -<a name="527" href="#527">527</a> <strong class="jxr_keyword">public</strong> Element getEncryptedKeyElement() { -<a name="528" href="#528">528</a> <strong class="jxr_keyword">return</strong> encryptedKeyElement; -<a name="529" href="#529">529</a> } -<a name="530" href="#530">530</a> -<a name="531" href="#531">531</a> <em class="jxr_javadoccomment">/**</em> -<a name="532" href="#532">532</a> <em class="jxr_javadoccomment"> * Set the encrypted key element when a pre prepared encrypted key is used</em> -<a name="533" href="#533">533</a> <em class="jxr_javadoccomment"> * @param encryptedKeyElement EncryptedKey element of the encrypted key used</em> -<a name="534" href="#534">534</a> <em class="jxr_javadoccomment"> */</em> -<a name="535" href="#535">535</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncryptedKeyElement(Element encryptedKeyElement) { -<a name="536" href="#536">536</a> <strong class="jxr_keyword">this</strong>.encryptedKeyElement = encryptedKeyElement; -<a name="537" href="#537">537</a> } -<a name="538" href="#538">538</a> -<a name="539" href="#539">539</a> <em class="jxr_javadoccomment">/**</em> -<a name="540" href="#540">540</a> <em class="jxr_javadoccomment"> * @return Returns the BinarySecurityToken element.</em> -<a name="541" href="#541">541</a> <em class="jxr_javadoccomment"> */</em> -<a name="542" href="#542">542</a> <strong class="jxr_keyword">public</strong> Element getBinarySecurityTokenElement() { -<a name="543" href="#543">543</a> <strong class="jxr_keyword">if</strong> (bstToken != <strong class="jxr_keyword">null</strong>) { -<a name="544" href="#544">544</a> <strong class="jxr_keyword">return</strong> bstToken.getElement(); -<a name="545" href="#545">545</a> } -<a name="546" href="#546">546</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>; -<a name="547" href="#547">547</a> } -<a name="548" href="#548">548</a> -<a name="549" href="#549">549</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setKeyEncAlgo(String keyEncAlgo) { -<a name="550" href="#550">550</a> <strong class="jxr_keyword">this</strong>.keyEncAlgo = keyEncAlgo; -<a name="551" href="#551">551</a> } -<a name="552" href="#552">552</a> -<a name="553" href="#553">553</a> <em class="jxr_javadoccomment">/**</em> -<a name="554" href="#554">554</a> <em class="jxr_javadoccomment"> * @param ephemeralKey The ephemeralKey to set.</em> -<a name="555" href="#555">555</a> <em class="jxr_javadoccomment"> */</em> -<a name="556" href="#556">556</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEphemeralKey(byte[] ephemeralKey) { -<a name="557" href="#557">557</a> <strong class="jxr_keyword">this</strong>.ephemeralKey = ephemeralKey; -<a name="558" href="#558">558</a> } -<a name="559" href="#559">559</a> -<a name="560" href="#560">560</a> <em class="jxr_javadoccomment">/**</em> -<a name="561" href="#561">561</a> <em class="jxr_javadoccomment"> * Get the id of the BSt generated during <code>prepare()</code>.</em> -<a name="562" href="#562">562</a> <em class="jxr_javadoccomment"> * </em> -<a name="563" href="#563">563</a> <em class="jxr_javadoccomment"> * @return Returns the the value of wsu:Id attribute of the </em> -<a name="564" href="#564">564</a> <em class="jxr_javadoccomment"> * BinaruSecurityToken element.</em> -<a name="565" href="#565">565</a> <em class="jxr_javadoccomment"> */</em> -<a name="566" href="#566">566</a> <strong class="jxr_keyword">public</strong> String getBSTTokenId() { -<a name="567" href="#567">567</a> <strong class="jxr_keyword">if</strong> (bstToken == <strong class="jxr_keyword">null</strong>) { -<a name="568" href="#568">568</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>; -<a name="569" href="#569">569</a> } -<a name="570" href="#570">570</a> -<a name="571" href="#571">571</a> <strong class="jxr_keyword">return</strong> bstToken.getID(); -<a name="572" href="#572">572</a> } -<a name="573" href="#573">573</a> -<a name="574" href="#574">574</a> <em class="jxr_javadoccomment">/**</em> -<a name="575" href="#575">575</a> <em class="jxr_javadoccomment"> * @param document The document to set.</em> -<a name="576" href="#576">576</a> <em class="jxr_javadoccomment"> */</em> -<a name="577" href="#577">577</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setDocument(Document document) { -<a name="578" href="#578">578</a> <strong class="jxr_keyword">this</strong>.document = document; -<a name="579" href="#579">579</a> } -<a name="580" href="#580">580</a> -<a name="581" href="#581">581</a> <em class="jxr_javadoccomment">/**</em> -<a name="582" href="#582">582</a> <em class="jxr_javadoccomment"> * @param encKeyId The encKeyId to set.</em> -<a name="583" href="#583">583</a> <em class="jxr_javadoccomment"> */</em> -<a name="584" href="#584">584</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncKeyId(String encKeyId) { -<a name="585" href="#585">585</a> <strong class="jxr_keyword">this</strong>.encKeyId = encKeyId; -<a name="586" href="#586">586</a> } -<a name="587" href="#587">587</a> -<a name="588" href="#588">588</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isCertSet() { -<a name="589" href="#589">589</a> <strong class="jxr_keyword">return</strong> (useThisCert == <strong class="jxr_keyword">null</strong> ? <strong class="jxr_keyword">true</strong> : false) ; -<a name="590" href="#590">590</a> } -<a name="591" href="#591">591</a> -<a name="592" href="#592">592</a> <strong class="jxr_keyword">public</strong> byte[] getEncryptedEphemeralKey() { -<a name="593" href="#593">593</a> <strong class="jxr_keyword">return</strong> encryptedEphemeralKey; -<a name="594" href="#594">594</a> } -<a name="595" href="#595">595</a> -<a name="596" href="#596">596</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setCustomEKTokenValueType(String customEKTokenValueType) { -<a name="597" href="#597">597</a> <strong class="jxr_keyword">this</strong>.customEKTokenValueType = customEKTokenValueType; -<a name="598" href="#598">598</a> } -<a name="599" href="#599">599</a> -<a name="600" href="#600">600</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setCustomEKTokenId(String customEKTokenId) { -<a name="601" href="#601">601</a> <strong class="jxr_keyword">this</strong>.customEKTokenId = customEKTokenId; -<a name="602" href="#602">602</a> } -<a name="603" href="#603">603</a> -<a name="604" href="#604">604</a> <em class="jxr_javadoccomment">/**</em> -<a name="605" href="#605">605</a> <em class="jxr_javadoccomment"> * Set the name of the symmetric encryption algorithm to use.</em> -<a name="606" href="#606">606</a> <em class="jxr_javadoccomment"> * </em> -<a name="607" href="#607">607</a> <em class="jxr_javadoccomment"> * This encryption algorithm is used to encrypt the data. If the algorithm</em> -<a name="608" href="#608">608</a> <em class="jxr_javadoccomment"> * is not set then AES128 is used. Refer to WSConstants which algorithms are</em> -<a name="609" href="#609">609</a> <em class="jxr_javadoccomment"> * supported.</em> -<a name="610" href="#610">610</a> <em class="jxr_javadoccomment"> * </em> -<a name="611" href="#611">611</a> <em class="jxr_javadoccomment"> * @param algo Is the name of the encryption algorithm</em> -<a name="612" href="#612">612</a> <em class="jxr_javadoccomment"> * @see WSConstants#TRIPLE_DES</em> -<a name="613" href="#613">613</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_128</em> -<a name="614" href="#614">614</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_192</em> -<a name="615" href="#615">615</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_256</em> -<a name="616" href="#616">616</a> <em class="jxr_javadoccomment"> */</em> -<a name="617" href="#617">617</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSymmetricEncAlgorithm(String algo) { -<a name="618" href="#618">618</a> symEncAlgo = algo; -<a name="619" href="#619">619</a> } -<a name="620" href="#620">620</a> -<a name="621" href="#621">621</a> -<a name="622" href="#622">622</a> <em class="jxr_javadoccomment">/**</em> -<a name="623" href="#623">623</a> <em class="jxr_javadoccomment"> * Get the name of symmetric encryption algorithm to use.</em> -<a name="624" href="#624">624</a> <em class="jxr_javadoccomment"> * </em> -<a name="625" href="#625">625</a> <em class="jxr_javadoccomment"> * The name of the encryption algorithm to encrypt the data, i.e. the SOAP</em> -<a name="626" href="#626">626</a> <em class="jxr_javadoccomment"> * Body. Refer to WSConstants which algorithms are supported.</em> -<a name="627" href="#627">627</a> <em class="jxr_javadoccomment"> * </em> -<a name="628" href="#628">628</a> <em class="jxr_javadoccomment"> * @return the name of the currently selected symmetric encryption algorithm</em> -<a name="629" href="#629">629</a> <em class="jxr_javadoccomment"> * @see WSConstants#TRIPLE_DES</em> -<a name="630" href="#630">630</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_128</em> -<a name="631" href="#631">631</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_192</em> -<a name="632" href="#632">632</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_256</em> -<a name="633" href="#633">633</a> <em class="jxr_javadoccomment"> */</em> -<a name="634" href="#634">634</a> <strong class="jxr_keyword">public</strong> String getSymmetricEncAlgorithm() { -<a name="635" href="#635">635</a> <strong class="jxr_keyword">return</strong> symEncAlgo; -<a name="636" href="#636">636</a> } -<a name="637" href="#637">637</a> -<a name="638" href="#638">638</a> <em class="jxr_javadoccomment">/**</em> -<a name="639" href="#639">639</a> <em class="jxr_javadoccomment"> * @return The symmetric key</em> -<a name="640" href="#640">640</a> <em class="jxr_javadoccomment"> */</em> -<a name="641" href="#641">641</a> <strong class="jxr_keyword">public</strong> SecretKey getSymmetricKey() { -<a name="642" href="#642">642</a> <strong class="jxr_keyword">return</strong> symmetricKey; -<a name="643" href="#643">643</a> } -<a name="644" href="#644">644</a> -<a name="645" href="#645">645</a> <em class="jxr_javadoccomment">/**</em> -<a name="646" href="#646">646</a> <em class="jxr_javadoccomment"> * Set the symmetric key to be used for encryption</em> -<a name="647" href="#647">647</a> <em class="jxr_javadoccomment"> * </em> -<a name="648" href="#648">648</a> <em class="jxr_javadoccomment"> * @param key</em> -<a name="649" href="#649">649</a> <em class="jxr_javadoccomment"> */</em> -<a name="650" href="#650">650</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSymmetricKey(SecretKey key) { -<a name="651" href="#651">651</a> <strong class="jxr_keyword">this</strong>.symmetricKey = key; -<a name="652" href="#652">652</a> } -<a name="653" href="#653">653</a> -<a name="654" href="#654">654</a> -<a name="655" href="#655">655</a> } +<a name="396" href="#396">396</a> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_128) +<a name="397" href="#397">397</a> || symEncAlgo.equalsIgnoreCase(WSConstants.AES_128_GCM)) { +<a name="398" href="#398">398</a> keyGen.init(128); +<a name="399" href="#399">399</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_192)) { +<a name="400" href="#400">400</a> keyGen.init(192); +<a name="401" href="#401">401</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (symEncAlgo.equalsIgnoreCase(WSConstants.AES_256) +<a name="402" href="#402">402</a> || symEncAlgo.equalsIgnoreCase(WSConstants.AES_256_GCM)) { +<a name="403" href="#403">403</a> keyGen.init(256); +<a name="404" href="#404">404</a> } +<a name="405" href="#405">405</a> <strong class="jxr_keyword">return</strong> keyGen; +<a name="406" href="#406">406</a> } <strong class="jxr_keyword">catch</strong> (NoSuchAlgorithmException e) { +<a name="407" href="#407">407</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="408" href="#408">408</a> WSSecurityException.UNSUPPORTED_ALGORITHM, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, e +<a name="409" href="#409">409</a> ); +<a name="410" href="#410">410</a> } +<a name="411" href="#411">411</a> } +<a name="412" href="#412">412</a> +<a name="413" href="#413">413</a> <em class="jxr_javadoccomment">/**</em> +<a name="414" href="#414">414</a> <em class="jxr_javadoccomment"> * Create DOM subtree for <code>xenc:EncryptedKey</code></em> +<a name="415" href="#415">415</a> <em class="jxr_javadoccomment"> * </em> +<a name="416" href="#416">416</a> <em class="jxr_javadoccomment"> * @param doc the SOAP envelope parent document</em> +<a name="417" href="#417">417</a> <em class="jxr_javadoccomment"> * @param keyTransportAlgo specifies which algorithm to use to encrypt the symmetric key</em> +<a name="418" href="#418">418</a> <em class="jxr_javadoccomment"> * @return an <code>xenc:EncryptedKey</code> element</em> +<a name="419" href="#419">419</a> <em class="jxr_javadoccomment"> */</em> +<a name="420" href="#420">420</a> <strong class="jxr_keyword">protected</strong> Element createEncryptedKey(Document doc, String keyTransportAlgo) { +<a name="421" href="#421">421</a> Element encryptedKey = +<a name="422" href="#422">422</a> doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":EncryptedKey"</span>); +<a name="423" href="#423">423</a> +<a name="424" href="#424">424</a> WSSecurityUtil.setNamespace(encryptedKey, WSConstants.ENC_NS, WSConstants.ENC_PREFIX); +<a name="425" href="#425">425</a> Element encryptionMethod = +<a name="426" href="#426">426</a> doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":EncryptionMethod"</span>); +<a name="427" href="#427">427</a> encryptionMethod.setAttributeNS(<strong class="jxr_keyword">null</strong>, <span class="jxr_string">"Algorithm"</span>, keyTransportAlgo); +<a name="428" href="#428">428</a> encryptedKey.appendChild(encryptionMethod); +<a name="429" href="#429">429</a> <strong class="jxr_keyword">return</strong> encryptedKey; +<a name="430" href="#430">430</a> } +<a name="431" href="#431">431</a> +<a name="432" href="#432">432</a> <strong class="jxr_keyword">protected</strong> Element createCipherValue(Document doc, Element encryptedKey) { +<a name="433" href="#433">433</a> Element cipherData = +<a name="434" href="#434">434</a> doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":CipherData"</span>); +<a name="435" href="#435">435</a> Element cipherValue = +<a name="436" href="#436">436</a> doc.createElementNS(WSConstants.ENC_NS, WSConstants.ENC_PREFIX + <span class="jxr_string">":CipherValue"</span>); +<a name="437" href="#437">437</a> cipherData.appendChild(cipherValue); +<a name="438" href="#438">438</a> encryptedKey.appendChild(cipherData); +<a name="439" href="#439">439</a> <strong class="jxr_keyword">return</strong> cipherValue; +<a name="440" href="#440">440</a> } +<a name="441" href="#441">441</a> +<a name="442" href="#442">442</a> <em class="jxr_javadoccomment">/**</em> +<a name="443" href="#443">443</a> <em class="jxr_javadoccomment"> * Prepend the EncryptedKey element to the elements already in the Security</em> +<a name="444" href="#444">444</a> <em class="jxr_javadoccomment"> * header.</em> +<a name="445" href="#445">445</a> <em class="jxr_javadoccomment"> * </em> +<a name="446" href="#446">446</a> <em class="jxr_javadoccomment"> * The method can be called any time after <code>prepare()</code>. This</em> +<a name="447" href="#447">447</a> <em class="jxr_javadoccomment"> * allows to insert the EncryptedKey element at any position in the Security</em> +<a name="448" href="#448">448</a> <em class="jxr_javadoccomment"> * header.</em> +<a name="449" href="#449">449</a> <em class="jxr_javadoccomment"> * </em> +<a name="450" href="#450">450</a> <em class="jxr_javadoccomment"> * @param secHeader The security header that holds the Signature element.</em> +<a name="451" href="#451">451</a> <em class="jxr_javadoccomment"> */</em> +<a name="452" href="#452">452</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> prependToHeader(<a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) { +<a name="453" href="#453">453</a> WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), encryptedKeyElement); +<a name="454" href="#454">454</a> } +<a name="455" href="#455">455</a> +<a name="456" href="#456">456</a> <em class="jxr_javadoccomment">/**</em> +<a name="457" href="#457">457</a> <em class="jxr_javadoccomment"> * Append the EncryptedKey element to the elements already in the Security</em> +<a name="458" href="#458">458</a> <em class="jxr_javadoccomment"> * header.</em> +<a name="459" href="#459">459</a> <em class="jxr_javadoccomment"> * </em> +<a name="460" href="#460">460</a> <em class="jxr_javadoccomment"> * The method can be called any time after <code>prepare()</code>. This</em> +<a name="461" href="#461">461</a> <em class="jxr_javadoccomment"> * allows to insert the EncryptedKey element at any position in the Security</em> +<a name="462" href="#462">462</a> <em class="jxr_javadoccomment"> * header.</em> +<a name="463" href="#463">463</a> <em class="jxr_javadoccomment"> * </em> +<a name="464" href="#464">464</a> <em class="jxr_javadoccomment"> * @param secHeader The security header that holds the Signature element.</em> +<a name="465" href="#465">465</a> <em class="jxr_javadoccomment"> */</em> +<a name="466" href="#466">466</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> appendToHeader(<a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) { +<a name="467" href="#467">467</a> Element secHeaderElement = secHeader.getSecurityHeader(); +<a name="468" href="#468">468</a> secHeaderElement.appendChild(encryptedKeyElement); +<a name="469" href="#469">469</a> } +<a name="470" href="#470">470</a> +<a name="471" href="#471">471</a> <em class="jxr_javadoccomment">/**</em> +<a name="472" href="#472">472</a> <em class="jxr_javadoccomment"> * Prepend the BinarySecurityToken to the elements already in the Security</em> +<a name="473" href="#473">473</a> <em class="jxr_javadoccomment"> * header.</em> +<a name="474" href="#474">474</a> <em class="jxr_javadoccomment"> * </em> +<a name="475" href="#475">475</a> <em class="jxr_javadoccomment"> * The method can be called any time after <code>prepare()</code>. This</em> +<a name="476" href="#476">476</a> <em class="jxr_javadoccomment"> * allows to insert the BST element at any position in the Security header.</em> +<a name="477" href="#477">477</a> <em class="jxr_javadoccomment"> * </em> +<a name="478" href="#478">478</a> <em class="jxr_javadoccomment"> * @param secHeader The security header that holds the BST element.</em> +<a name="479" href="#479">479</a> <em class="jxr_javadoccomment"> */</em> +<a name="480" href="#480">480</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> prependBSTElementToHeader(<a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) { +<a name="481" href="#481">481</a> <strong class="jxr_keyword">if</strong> (bstToken != <strong class="jxr_keyword">null</strong>) { +<a name="482" href="#482">482</a> WSSecurityUtil.prependChildElement( +<a name="483" href="#483">483</a> secHeader.getSecurityHeader(), bstToken.getElement() +<a name="484" href="#484">484</a> ); +<a name="485" href="#485">485</a> } +<a name="486" href="#486">486</a> bstToken = <strong class="jxr_keyword">null</strong>; +<a name="487" href="#487">487</a> } +<a name="488" href="#488">488</a> +<a name="489" href="#489">489</a> <em class="jxr_javadoccomment">/**</em> +<a name="490" href="#490">490</a> <em class="jxr_javadoccomment"> * Append the BinarySecurityToken to the elements already in the Security</em> +<a name="491" href="#491">491</a> <em class="jxr_javadoccomment"> * header.</em> +<a name="492" href="#492">492</a> <em class="jxr_javadoccomment"> * </em> +<a name="493" href="#493">493</a> <em class="jxr_javadoccomment"> * The method can be called any time after <code>prepare()</code>. This</em> +<a name="494" href="#494">494</a> <em class="jxr_javadoccomment"> * allows to insert the BST element at any position in the Security header.</em> +<a name="495" href="#495">495</a> <em class="jxr_javadoccomment"> * </em> +<a name="496" href="#496">496</a> <em class="jxr_javadoccomment"> * @param secHeader The security header that holds the BST element.</em> +<a name="497" href="#497">497</a> <em class="jxr_javadoccomment"> */</em> +<a name="498" href="#498">498</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> appendBSTElementToHeader(<a href="../../../../../org/apache/ws/security/message/WSSecHeader.html">WSSecHeader</a> secHeader) { +<a name="499" href="#499">499</a> <strong class="jxr_keyword">if</strong> (bstToken != <strong class="jxr_keyword">null</strong>) { +<a name="500" href="#500">500</a> Element secHeaderElement = secHeader.getSecurityHeader(); +<a name="501" href="#501">501</a> secHeaderElement.appendChild(bstToken.getElement()); +<a name="502" href="#502">502</a> } +<a name="503" href="#503">503</a> bstToken = <strong class="jxr_keyword">null</strong>; +<a name="504" href="#504">504</a> } +<a name="505" href="#505">505</a> +<a name="506" href="#506">506</a> <em class="jxr_javadoccomment">/**</em> +<a name="507" href="#507">507</a> <em class="jxr_javadoccomment"> * @return Returns the ephemeralKey.</em> +<a name="508" href="#508">508</a> <em class="jxr_javadoccomment"> */</em> +<a name="509" href="#509">509</a> <strong class="jxr_keyword">public</strong> byte[] getEphemeralKey() { +<a name="510" href="#510">510</a> <strong class="jxr_keyword">return</strong> ephemeralKey; +<a name="511" href="#511">511</a> } +<a name="512" href="#512">512</a> +<a name="513" href="#513">513</a> <em class="jxr_javadoccomment">/**</em> +<a name="514" href="#514">514</a> <em class="jxr_javadoccomment"> * Set the X509 Certificate to use for encryption.</em> +<a name="515" href="#515">515</a> <em class="jxr_javadoccomment"> * </em> +<a name="516" href="#516">516</a> <em class="jxr_javadoccomment"> * If this is set <b>and</b> the key identifier is set to</em> +<a name="517" href="#517">517</a> <em class="jxr_javadoccomment"> * <code>DirectReference</code> then use this certificate to get the</em> +<a name="518" href="#518">518</a> <em class="jxr_javadoccomment"> * public key for encryption.</em> +<a name="519" href="#519">519</a> <em class="jxr_javadoccomment"> * </em> +<a name="520" href="#520">520</a> <em class="jxr_javadoccomment"> * @param cert is the X509 certificate to use for encryption</em> +<a name="521" href="#521">521</a> <em class="jxr_javadoccomment"> */</em> +<a name="522" href="#522">522</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setUseThisCert(X509Certificate cert) { +<a name="523" href="#523">523</a> useThisCert = cert; +<a name="524" href="#524">524</a> } +<a name="525" href="#525">525</a> +<a name="526" href="#526">526</a> <em class="jxr_javadoccomment">/**</em> +<a name="527" href="#527">527</a> <em class="jxr_javadoccomment"> * @return Returns the encryptedKeyElement.</em> +<a name="528" href="#528">528</a> <em class="jxr_javadoccomment"> */</em> +<a name="529" href="#529">529</a> <strong class="jxr_keyword">public</strong> Element getEncryptedKeyElement() { +<a name="530" href="#530">530</a> <strong class="jxr_keyword">return</strong> encryptedKeyElement; +<a name="531" href="#531">531</a> } +<a name="532" href="#532">532</a> +<a name="533" href="#533">533</a> <em class="jxr_javadoccomment">/**</em> +<a name="534" href="#534">534</a> <em class="jxr_javadoccomment"> * Set the encrypted key element when a pre prepared encrypted key is used</em> +<a name="535" href="#535">535</a> <em class="jxr_javadoccomment"> * @param encryptedKeyElement EncryptedKey element of the encrypted key used</em> +<a name="536" href="#536">536</a> <em class="jxr_javadoccomment"> */</em> +<a name="537" href="#537">537</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncryptedKeyElement(Element encryptedKeyElement) { +<a name="538" href="#538">538</a> <strong class="jxr_keyword">this</strong>.encryptedKeyElement = encryptedKeyElement; +<a name="539" href="#539">539</a> } +<a name="540" href="#540">540</a> +<a name="541" href="#541">541</a> <em class="jxr_javadoccomment">/**</em> +<a name="542" href="#542">542</a> <em class="jxr_javadoccomment"> * @return Returns the BinarySecurityToken element.</em> +<a name="543" href="#543">543</a> <em class="jxr_javadoccomment"> */</em> +<a name="544" href="#544">544</a> <strong class="jxr_keyword">public</strong> Element getBinarySecurityTokenElement() { +<a name="545" href="#545">545</a> <strong class="jxr_keyword">if</strong> (bstToken != <strong class="jxr_keyword">null</strong>) { +<a name="546" href="#546">546</a> <strong class="jxr_keyword">return</strong> bstToken.getElement(); +<a name="547" href="#547">547</a> } +<a name="548" href="#548">548</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>; +<a name="549" href="#549">549</a> } +<a name="550" href="#550">550</a> +<a name="551" href="#551">551</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setKeyEncAlgo(String keyEncAlgo) { +<a name="552" href="#552">552</a> <strong class="jxr_keyword">this</strong>.keyEncAlgo = keyEncAlgo; +<a name="553" href="#553">553</a> } +<a name="554" href="#554">554</a> +<a name="555" href="#555">555</a> <em class="jxr_javadoccomment">/**</em> +<a name="556" href="#556">556</a> <em class="jxr_javadoccomment"> * @param ephemeralKey The ephemeralKey to set.</em> +<a name="557" href="#557">557</a> <em class="jxr_javadoccomment"> */</em> +<a name="558" href="#558">558</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEphemeralKey(byte[] ephemeralKey) { +<a name="559" href="#559">559</a> <strong class="jxr_keyword">this</strong>.ephemeralKey = ephemeralKey; +<a name="560" href="#560">560</a> } +<a name="561" href="#561">561</a> +<a name="562" href="#562">562</a> <em class="jxr_javadoccomment">/**</em> +<a name="563" href="#563">563</a> <em class="jxr_javadoccomment"> * Get the id of the BSt generated during <code>prepare()</code>.</em> +<a name="564" href="#564">564</a> <em class="jxr_javadoccomment"> * </em> +<a name="565" href="#565">565</a> <em class="jxr_javadoccomment"> * @return Returns the the value of wsu:Id attribute of the </em> +<a name="566" href="#566">566</a> <em class="jxr_javadoccomment"> * BinaruSecurityToken element.</em> +<a name="567" href="#567">567</a> <em class="jxr_javadoccomment"> */</em> +<a name="568" href="#568">568</a> <strong class="jxr_keyword">public</strong> String getBSTTokenId() { +<a name="569" href="#569">569</a> <strong class="jxr_keyword">if</strong> (bstToken == <strong class="jxr_keyword">null</strong>) { +<a name="570" href="#570">570</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>; +<a name="571" href="#571">571</a> } +<a name="572" href="#572">572</a> +<a name="573" href="#573">573</a> <strong class="jxr_keyword">return</strong> bstToken.getID(); +<a name="574" href="#574">574</a> } +<a name="575" href="#575">575</a> +<a name="576" href="#576">576</a> <em class="jxr_javadoccomment">/**</em> +<a name="577" href="#577">577</a> <em class="jxr_javadoccomment"> * @param document The document to set.</em> +<a name="578" href="#578">578</a> <em class="jxr_javadoccomment"> */</em> +<a name="579" href="#579">579</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setDocument(Document document) { +<a name="580" href="#580">580</a> <strong class="jxr_keyword">this</strong>.document = document; +<a name="581" href="#581">581</a> } +<a name="582" href="#582">582</a> +<a name="583" href="#583">583</a> <em class="jxr_javadoccomment">/**</em> +<a name="584" href="#584">584</a> <em class="jxr_javadoccomment"> * @param encKeyId The encKeyId to set.</em> +<a name="585" href="#585">585</a> <em class="jxr_javadoccomment"> */</em> +<a name="586" href="#586">586</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setEncKeyId(String encKeyId) { +<a name="587" href="#587">587</a> <strong class="jxr_keyword">this</strong>.encKeyId = encKeyId; +<a name="588" href="#588">588</a> } +<a name="589" href="#589">589</a> +<a name="590" href="#590">590</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isCertSet() { +<a name="591" href="#591">591</a> <strong class="jxr_keyword">return</strong> (useThisCert == <strong class="jxr_keyword">null</strong> ? <strong class="jxr_keyword">true</strong> : false) ; +<a name="592" href="#592">592</a> } +<a name="593" href="#593">593</a> +<a name="594" href="#594">594</a> <strong class="jxr_keyword">public</strong> byte[] getEncryptedEphemeralKey() { +<a name="595" href="#595">595</a> <strong class="jxr_keyword">return</strong> encryptedEphemeralKey; +<a name="596" href="#596">596</a> } +<a name="597" href="#597">597</a> +<a name="598" href="#598">598</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setCustomEKTokenValueType(String customEKTokenValueType) { +<a name="599" href="#599">599</a> <strong class="jxr_keyword">this</strong>.customEKTokenValueType = customEKTokenValueType; +<a name="600" href="#600">600</a> } +<a name="601" href="#601">601</a> +<a name="602" href="#602">602</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setCustomEKTokenId(String customEKTokenId) { +<a name="603" href="#603">603</a> <strong class="jxr_keyword">this</strong>.customEKTokenId = customEKTokenId; +<a name="604" href="#604">604</a> } +<a name="605" href="#605">605</a> +<a name="606" href="#606">606</a> <em class="jxr_javadoccomment">/**</em> +<a name="607" href="#607">607</a> <em class="jxr_javadoccomment"> * Set the name of the symmetric encryption algorithm to use.</em> +<a name="608" href="#608">608</a> <em class="jxr_javadoccomment"> * </em> +<a name="609" href="#609">609</a> <em class="jxr_javadoccomment"> * This encryption algorithm is used to encrypt the data. If the algorithm</em> +<a name="610" href="#610">610</a> <em class="jxr_javadoccomment"> * is not set then AES128 is used. Refer to WSConstants which algorithms are</em> +<a name="611" href="#611">611</a> <em class="jxr_javadoccomment"> * supported.</em> +<a name="612" href="#612">612</a> <em class="jxr_javadoccomment"> * </em> +<a name="613" href="#613">613</a> <em class="jxr_javadoccomment"> * @param algo Is the name of the encryption algorithm</em> +<a name="614" href="#614">614</a> <em class="jxr_javadoccomment"> * @see WSConstants#TRIPLE_DES</em> +<a name="615" href="#615">615</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_128</em> +<a name="616" href="#616">616</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_192</em> +<a name="617" href="#617">617</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_256</em> +<a name="618" href="#618">618</a> <em class="jxr_javadoccomment"> */</em> +<a name="619" href="#619">619</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSymmetricEncAlgorithm(String algo) { +<a name="620" href="#620">620</a> symEncAlgo = algo; +<a name="621" href="#621">621</a> } +<a name="622" href="#622">622</a> +<a name="623" href="#623">623</a> +<a name="624" href="#624">624</a> <em class="jxr_javadoccomment">/**</em> +<a name="625" href="#625">625</a> <em class="jxr_javadoccomment"> * Get the name of symmetric encryption algorithm to use.</em> +<a name="626" href="#626">626</a> <em class="jxr_javadoccomment"> * </em> +<a name="627" href="#627">627</a> <em class="jxr_javadoccomment"> * The name of the encryption algorithm to encrypt the data, i.e. the SOAP</em> +<a name="628" href="#628">628</a> <em class="jxr_javadoccomment"> * Body. Refer to WSConstants which algorithms are supported.</em> +<a name="629" href="#629">629</a> <em class="jxr_javadoccomment"> * </em> +<a name="630" href="#630">630</a> <em class="jxr_javadoccomment"> * @return the name of the currently selected symmetric encryption algorithm</em> +<a name="631" href="#631">631</a> <em class="jxr_javadoccomment"> * @see WSConstants#TRIPLE_DES</em> +<a name="632" href="#632">632</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_128</em> +<a name="633" href="#633">633</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_192</em> +<a name="634" href="#634">634</a> <em class="jxr_javadoccomment"> * @see WSConstants#AES_256</em> +<a name="635" href="#635">635</a> <em class="jxr_javadoccomment"> */</em> +<a name="636" href="#636">636</a> <strong class="jxr_keyword">public</strong> String getSymmetricEncAlgorithm() { +<a name="637" href="#637">637</a> <strong class="jxr_keyword">return</strong> symEncAlgo; +<a name="638" href="#638">638</a> } +<a name="639" href="#639">639</a> +<a name="640" href="#640">640</a> <em class="jxr_javadoccomment">/**</em> +<a name="641" href="#641">641</a> <em class="jxr_javadoccomment"> * @return The symmetric key</em> +<a name="642" href="#642">642</a> <em class="jxr_javadoccomment"> */</em> +<a name="643" href="#643">643</a> <strong class="jxr_keyword">public</strong> SecretKey getSymmetricKey() { +<a name="644" href="#644">644</a> <strong class="jxr_keyword">return</strong> symmetricKey; +<a name="645" href="#645">645</a> } +<a name="646" href="#646">646</a> +<a name="647" href="#647">647</a> <em class="jxr_javadoccomment">/**</em> +<a name="648" href="#648">648</a> <em class="jxr_javadoccomment"> * Set the symmetric key to be used for encryption</em> +<a name="649" href="#649">649</a> <em class="jxr_javadoccomment"> * </em> +<a name="650" href="#650">650</a> <em class="jxr_javadoccomment"> * @param key</em> +<a name="651" href="#651">651</a> <em class="jxr_javadoccomment"> */</em> +<a name="652" href="#652">652</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setSymmetricKey(SecretKey key) { +<a name="653" href="#653">653</a> <strong class="jxr_keyword">this</strong>.symmetricKey = key; +<a name="654" href="#654">654</a> } +<a name="655" href="#655">655</a> +<a name="656" href="#656">656</a> +<a name="657" href="#657">657</a> } </pre> <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body> </html>
