You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ws.apache.org by co...@apache.org on 2011/10/03 17:16:11 UTC
svn commit: r1178426 [24/40] - in /webservices/wss4j/site: ./ apidocs/
apidocs/org/apache/ws/security/ apidocs/org/apache/ws/security/action/
apidocs/org/apache/ws/security/action/class-use/
apidocs/org/apache/ws/security/class-use/ apidocs/org/apache/...
Modified: webservices/wss4j/site/xref/org/apache/ws/security/components/crypto/Merlin.html
URL: http://svn.apache.org/viewvc/webservices/wss4j/site/xref/org/apache/ws/security/components/crypto/Merlin.html?rev=1178426&r1=1178425&r2=1178426&view=diff
==============================================================================
--- webservices/wss4j/site/xref/org/apache/ws/security/components/crypto/Merlin.html (original)
+++ webservices/wss4j/site/xref/org/apache/ws/security/components/crypto/Merlin.html Mon Oct 3 15:15:52 2011
@@ -103,683 +103,683 @@
<a name="93" href="#93">93</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.keystore.type"</span>;
<a name="94" href="#94">94</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String KEYSTORE_ALIAS =
<a name="95" href="#95">95</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.keystore.alias"</span>;
-<a name="96" href="#96">96</a>
-<a name="97" href="#97">97</a> <em class="jxr_comment">/*</em>
-<a name="98" href="#98">98</a> <em class="jxr_comment"> * TrustStore configuration types</em>
-<a name="99" href="#99">99</a> <em class="jxr_comment"> */</em>
-<a name="100" href="#100">100</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String LOAD_CA_CERTS =
-<a name="101" href="#101">101</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.load.cacerts"</span>;
-<a name="102" href="#102">102</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String TRUSTSTORE_FILE =
-<a name="103" href="#103">103</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.truststore.file"</span>;
-<a name="104" href="#104">104</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String TRUSTSTORE_PASSWORD =
-<a name="105" href="#105">105</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.truststore.password"</span>;
-<a name="106" href="#106">106</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String TRUSTSTORE_TYPE =
-<a name="107" href="#107">107</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.truststore.type"</span>;
-<a name="108" href="#108">108</a>
-<a name="109" href="#109">109</a> <em class="jxr_comment">/*</em>
-<a name="110" href="#110">110</a> <em class="jxr_comment"> * CRL configuration</em>
-<a name="111" href="#111">111</a> <em class="jxr_comment"> */</em>
-<a name="112" href="#112">112</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String X509_CRL_FILE =
-<a name="113" href="#113">113</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.x509crl.file"</span>;
-<a name="114" href="#114">114</a>
-<a name="115" href="#115">115</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> org.apache.commons.logging.Log log =
-<a name="116" href="#116">116</a> org.apache.commons.logging.LogFactory.getLog(Merlin.<strong class="jxr_keyword">class</strong>);
-<a name="117" href="#117">117</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">boolean</strong> doDebug = log.isDebugEnabled();
-<a name="118" href="#118">118</a>
-<a name="119" href="#119">119</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">static</strong> CertificateFactory certFact;
-<a name="120" href="#120">120</a> <strong class="jxr_keyword">protected</strong> Properties properties = <strong class="jxr_keyword">null</strong>;
-<a name="121" href="#121">121</a> <strong class="jxr_keyword">protected</strong> KeyStore keystore = <strong class="jxr_keyword">null</strong>;
-<a name="122" href="#122">122</a> <strong class="jxr_keyword">protected</strong> KeyStore truststore = <strong class="jxr_keyword">null</strong>;
-<a name="123" href="#123">123</a> <strong class="jxr_keyword">protected</strong> CertStore crlCertStore = <strong class="jxr_keyword">null</strong>;
-<a name="124" href="#124">124</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">boolean</strong> loadCACerts = false;
-<a name="125" href="#125">125</a>
-<a name="126" href="#126">126</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/Merlin.html">Merlin</a>() {
-<a name="127" href="#127">127</a> <em class="jxr_comment">// default constructor</em>
-<a name="128" href="#128">128</a> }
-<a name="129" href="#129">129</a>
-<a name="130" href="#130">130</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/Merlin.html">Merlin</a>(Properties properties)
-<a name="131" href="#131">131</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
-<a name="132" href="#132">132</a> <strong class="jxr_keyword">this</strong>(properties, Loader.getClassLoader(Merlin.<strong class="jxr_keyword">class</strong>));
-<a name="133" href="#133">133</a> }
-<a name="134" href="#134">134</a>
-<a name="135" href="#135">135</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/Merlin.html">Merlin</a>(Properties properties, ClassLoader loader)
-<a name="136" href="#136">136</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
-<a name="137" href="#137">137</a> loadProperties(properties, loader);
-<a name="138" href="#138">138</a> }
-<a name="139" href="#139">139</a>
-<a name="140" href="#140">140</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> loadProperties(Properties properties)
-<a name="141" href="#141">141</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
-<a name="142" href="#142">142</a> loadProperties(properties, Loader.getClassLoader(Merlin.<strong class="jxr_keyword">class</strong>));
-<a name="143" href="#143">143</a> }
-<a name="144" href="#144">144</a>
-<a name="145" href="#145">145</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> loadProperties(Properties properties, ClassLoader loader)
-<a name="146" href="#146">146</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
-<a name="147" href="#147">147</a> <strong class="jxr_keyword">if</strong> (properties == <strong class="jxr_keyword">null</strong>) {
-<a name="148" href="#148">148</a> <strong class="jxr_keyword">return</strong>;
-<a name="149" href="#149">149</a> }
-<a name="150" href="#150">150</a> <strong class="jxr_keyword">this</strong>.properties = properties;
-<a name="151" href="#151">151</a> <em class="jxr_comment">//</em>
-<a name="152" href="#152">152</a> <em class="jxr_comment">// Load the provider(s)</em>
-<a name="153" href="#153">153</a> <em class="jxr_comment">//</em>
-<a name="154" href="#154">154</a> String provider = properties.getProperty(CRYPTO_KEYSTORE_PROVIDER);
-<a name="155" href="#155">155</a> <strong class="jxr_keyword">if</strong> (provider != <strong class="jxr_keyword">null</strong>) {
-<a name="156" href="#156">156</a> provider = provider.trim();
-<a name="157" href="#157">157</a> }
-<a name="158" href="#158">158</a> String certProvider = properties.getProperty(CRYPTO_CERT_PROVIDER);
-<a name="159" href="#159">159</a> <strong class="jxr_keyword">if</strong> (certProvider != <strong class="jxr_keyword">null</strong>) {
-<a name="160" href="#160">160</a> setCryptoProvider(certProvider);
-<a name="161" href="#161">161</a> }
-<a name="162" href="#162">162</a> <em class="jxr_comment">//</em>
-<a name="163" href="#163">163</a> <em class="jxr_comment">// Load the KeyStore</em>
-<a name="164" href="#164">164</a> <em class="jxr_comment">//</em>
-<a name="165" href="#165">165</a> String alias = properties.getProperty(KEYSTORE_ALIAS);
-<a name="166" href="#166">166</a> <strong class="jxr_keyword">if</strong> (alias != <strong class="jxr_keyword">null</strong>) {
-<a name="167" href="#167">167</a> alias = alias.trim();
-<a name="168" href="#168">168</a> defaultAlias = alias;
-<a name="169" href="#169">169</a> }
-<a name="170" href="#170">170</a> String keyStoreLocation = properties.getProperty(KEYSTORE_FILE);
-<a name="171" href="#171">171</a> <strong class="jxr_keyword">if</strong> (keyStoreLocation == <strong class="jxr_keyword">null</strong>) {
-<a name="172" href="#172">172</a> keyStoreLocation = properties.getProperty(OLD_KEYSTORE_FILE);
-<a name="173" href="#173">173</a> }
-<a name="174" href="#174">174</a> <strong class="jxr_keyword">if</strong> (keyStoreLocation != <strong class="jxr_keyword">null</strong>) {
-<a name="175" href="#175">175</a> keyStoreLocation = keyStoreLocation.trim();
-<a name="176" href="#176">176</a> InputStream is = loadInputStream(loader, keyStoreLocation);
-<a name="177" href="#177">177</a>
-<a name="178" href="#178">178</a> <strong class="jxr_keyword">try</strong> {
-<a name="179" href="#179">179</a> String passwd = properties.getProperty(KEYSTORE_PASSWORD, <span class="jxr_string">"security"</span>);
-<a name="180" href="#180">180</a> <strong class="jxr_keyword">if</strong> (passwd != <strong class="jxr_keyword">null</strong>) {
-<a name="181" href="#181">181</a> passwd = passwd.trim();
-<a name="182" href="#182">182</a> }
-<a name="183" href="#183">183</a> String type = properties.getProperty(KEYSTORE_TYPE, KeyStore.getDefaultType());
-<a name="184" href="#184">184</a> <strong class="jxr_keyword">if</strong> (type != <strong class="jxr_keyword">null</strong>) {
-<a name="185" href="#185">185</a> type = type.trim();
-<a name="186" href="#186">186</a> }
-<a name="187" href="#187">187</a> keystore = load(is, passwd, provider, type);
-<a name="188" href="#188">188</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="189" href="#189">189</a> log.debug(
-<a name="190" href="#190">190</a> <span class="jxr_string">"The KeyStore "</span> + keyStoreLocation + <span class="jxr_string">" of type "</span> + type
-<a name="191" href="#191">191</a> + <span class="jxr_string">" has been loaded"</span>
-<a name="192" href="#192">192</a> );
-<a name="193" href="#193">193</a> }
-<a name="194" href="#194">194</a> } <strong class="jxr_keyword">finally</strong> {
-<a name="195" href="#195">195</a> <strong class="jxr_keyword">if</strong> (is != <strong class="jxr_keyword">null</strong>) {
-<a name="196" href="#196">196</a> is.close();
-<a name="197" href="#197">197</a> }
-<a name="198" href="#198">198</a> }
-<a name="199" href="#199">199</a> } <strong class="jxr_keyword">else</strong> {
-<a name="200" href="#200">200</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="201" href="#201">201</a> log.debug(<span class="jxr_string">"The KeyStore is not loaded as KEYSTORE_FILE is null"</span>);
-<a name="202" href="#202">202</a> }
-<a name="203" href="#203">203</a> }
-<a name="204" href="#204">204</a>
-<a name="205" href="#205">205</a> <em class="jxr_comment">//</em>
-<a name="206" href="#206">206</a> <em class="jxr_comment">// Load the TrustStore</em>
-<a name="207" href="#207">207</a> <em class="jxr_comment">//</em>
-<a name="208" href="#208">208</a> String trustStoreLocation = properties.getProperty(TRUSTSTORE_FILE);
-<a name="209" href="#209">209</a> <strong class="jxr_keyword">if</strong> (trustStoreLocation != <strong class="jxr_keyword">null</strong>) {
-<a name="210" href="#210">210</a> trustStoreLocation = trustStoreLocation.trim();
-<a name="211" href="#211">211</a> InputStream is = loadInputStream(loader, trustStoreLocation);
-<a name="212" href="#212">212</a>
-<a name="213" href="#213">213</a> <strong class="jxr_keyword">try</strong> {
-<a name="214" href="#214">214</a> String passwd = properties.getProperty(TRUSTSTORE_PASSWORD, <span class="jxr_string">"changeit"</span>);
-<a name="215" href="#215">215</a> <strong class="jxr_keyword">if</strong> (passwd != <strong class="jxr_keyword">null</strong>) {
-<a name="216" href="#216">216</a> passwd = passwd.trim();
-<a name="217" href="#217">217</a> }
-<a name="218" href="#218">218</a> String type = properties.getProperty(TRUSTSTORE_TYPE, KeyStore.getDefaultType());
-<a name="219" href="#219">219</a> <strong class="jxr_keyword">if</strong> (type != <strong class="jxr_keyword">null</strong>) {
-<a name="220" href="#220">220</a> type = type.trim();
-<a name="221" href="#221">221</a> }
-<a name="222" href="#222">222</a> truststore = load(is, passwd, provider, type);
-<a name="223" href="#223">223</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="224" href="#224">224</a> log.debug(
-<a name="225" href="#225">225</a> <span class="jxr_string">"The TrustStore "</span> + trustStoreLocation + <span class="jxr_string">" of type "</span> + type
-<a name="226" href="#226">226</a> + <span class="jxr_string">" has been loaded"</span>
-<a name="227" href="#227">227</a> );
+<a name="96" href="#96">96</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String KEYSTORE_PRIVATE_PASSWORD =
+<a name="97" href="#97">97</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.keystore.private.password"</span>;
+<a name="98" href="#98">98</a>
+<a name="99" href="#99">99</a> <em class="jxr_comment">/*</em>
+<a name="100" href="#100">100</a> <em class="jxr_comment"> * TrustStore configuration types</em>
+<a name="101" href="#101">101</a> <em class="jxr_comment"> */</em>
+<a name="102" href="#102">102</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String LOAD_CA_CERTS =
+<a name="103" href="#103">103</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.load.cacerts"</span>;
+<a name="104" href="#104">104</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String TRUSTSTORE_FILE =
+<a name="105" href="#105">105</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.truststore.file"</span>;
+<a name="106" href="#106">106</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String TRUSTSTORE_PASSWORD =
+<a name="107" href="#107">107</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.truststore.password"</span>;
+<a name="108" href="#108">108</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String TRUSTSTORE_TYPE =
+<a name="109" href="#109">109</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.truststore.type"</span>;
+<a name="110" href="#110">110</a>
+<a name="111" href="#111">111</a> <em class="jxr_comment">/*</em>
+<a name="112" href="#112">112</a> <em class="jxr_comment"> * CRL configuration</em>
+<a name="113" href="#113">113</a> <em class="jxr_comment"> */</em>
+<a name="114" href="#114">114</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String X509_CRL_FILE =
+<a name="115" href="#115">115</a> <span class="jxr_string">"org.apache.ws.security.crypto.merlin.x509crl.file"</span>;
+<a name="116" href="#116">116</a>
+<a name="117" href="#117">117</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> org.apache.commons.logging.Log log =
+<a name="118" href="#118">118</a> org.apache.commons.logging.LogFactory.getLog(Merlin.<strong class="jxr_keyword">class</strong>);
+<a name="119" href="#119">119</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">boolean</strong> doDebug = log.isDebugEnabled();
+<a name="120" href="#120">120</a>
+<a name="121" href="#121">121</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">static</strong> CertificateFactory certFact;
+<a name="122" href="#122">122</a> <strong class="jxr_keyword">protected</strong> Properties properties = <strong class="jxr_keyword">null</strong>;
+<a name="123" href="#123">123</a> <strong class="jxr_keyword">protected</strong> KeyStore keystore = <strong class="jxr_keyword">null</strong>;
+<a name="124" href="#124">124</a> <strong class="jxr_keyword">protected</strong> KeyStore truststore = <strong class="jxr_keyword">null</strong>;
+<a name="125" href="#125">125</a> <strong class="jxr_keyword">protected</strong> CertStore crlCertStore = <strong class="jxr_keyword">null</strong>;
+<a name="126" href="#126">126</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">boolean</strong> loadCACerts = false;
+<a name="127" href="#127">127</a> <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">boolean</strong> privatePasswordSet = false;
+<a name="128" href="#128">128</a>
+<a name="129" href="#129">129</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/Merlin.html">Merlin</a>() {
+<a name="130" href="#130">130</a> <em class="jxr_comment">// default constructor</em>
+<a name="131" href="#131">131</a> }
+<a name="132" href="#132">132</a>
+<a name="133" href="#133">133</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/Merlin.html">Merlin</a>(Properties properties)
+<a name="134" href="#134">134</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
+<a name="135" href="#135">135</a> <strong class="jxr_keyword">this</strong>(properties, Loader.getClassLoader(Merlin.<strong class="jxr_keyword">class</strong>));
+<a name="136" href="#136">136</a> }
+<a name="137" href="#137">137</a>
+<a name="138" href="#138">138</a> <strong class="jxr_keyword">public</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/Merlin.html">Merlin</a>(Properties properties, ClassLoader loader)
+<a name="139" href="#139">139</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
+<a name="140" href="#140">140</a> loadProperties(properties, loader);
+<a name="141" href="#141">141</a> }
+<a name="142" href="#142">142</a>
+<a name="143" href="#143">143</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> loadProperties(Properties properties)
+<a name="144" href="#144">144</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
+<a name="145" href="#145">145</a> loadProperties(properties, Loader.getClassLoader(Merlin.<strong class="jxr_keyword">class</strong>));
+<a name="146" href="#146">146</a> }
+<a name="147" href="#147">147</a>
+<a name="148" href="#148">148</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> loadProperties(Properties properties, ClassLoader loader)
+<a name="149" href="#149">149</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
+<a name="150" href="#150">150</a> <strong class="jxr_keyword">if</strong> (properties == <strong class="jxr_keyword">null</strong>) {
+<a name="151" href="#151">151</a> <strong class="jxr_keyword">return</strong>;
+<a name="152" href="#152">152</a> }
+<a name="153" href="#153">153</a> <strong class="jxr_keyword">this</strong>.properties = properties;
+<a name="154" href="#154">154</a> <em class="jxr_comment">//</em>
+<a name="155" href="#155">155</a> <em class="jxr_comment">// Load the provider(s)</em>
+<a name="156" href="#156">156</a> <em class="jxr_comment">//</em>
+<a name="157" href="#157">157</a> String provider = properties.getProperty(CRYPTO_KEYSTORE_PROVIDER);
+<a name="158" href="#158">158</a> <strong class="jxr_keyword">if</strong> (provider != <strong class="jxr_keyword">null</strong>) {
+<a name="159" href="#159">159</a> provider = provider.trim();
+<a name="160" href="#160">160</a> }
+<a name="161" href="#161">161</a> String certProvider = properties.getProperty(CRYPTO_CERT_PROVIDER);
+<a name="162" href="#162">162</a> <strong class="jxr_keyword">if</strong> (certProvider != <strong class="jxr_keyword">null</strong>) {
+<a name="163" href="#163">163</a> setCryptoProvider(certProvider);
+<a name="164" href="#164">164</a> }
+<a name="165" href="#165">165</a> <em class="jxr_comment">//</em>
+<a name="166" href="#166">166</a> <em class="jxr_comment">// Load the KeyStore</em>
+<a name="167" href="#167">167</a> <em class="jxr_comment">//</em>
+<a name="168" href="#168">168</a> String alias = properties.getProperty(KEYSTORE_ALIAS);
+<a name="169" href="#169">169</a> <strong class="jxr_keyword">if</strong> (alias != <strong class="jxr_keyword">null</strong>) {
+<a name="170" href="#170">170</a> alias = alias.trim();
+<a name="171" href="#171">171</a> defaultAlias = alias;
+<a name="172" href="#172">172</a> }
+<a name="173" href="#173">173</a> String keyStoreLocation = properties.getProperty(KEYSTORE_FILE);
+<a name="174" href="#174">174</a> <strong class="jxr_keyword">if</strong> (keyStoreLocation == <strong class="jxr_keyword">null</strong>) {
+<a name="175" href="#175">175</a> keyStoreLocation = properties.getProperty(OLD_KEYSTORE_FILE);
+<a name="176" href="#176">176</a> }
+<a name="177" href="#177">177</a> <strong class="jxr_keyword">if</strong> (keyStoreLocation != <strong class="jxr_keyword">null</strong>) {
+<a name="178" href="#178">178</a> keyStoreLocation = keyStoreLocation.trim();
+<a name="179" href="#179">179</a> InputStream is = loadInputStream(loader, keyStoreLocation);
+<a name="180" href="#180">180</a>
+<a name="181" href="#181">181</a> <strong class="jxr_keyword">try</strong> {
+<a name="182" href="#182">182</a> String passwd = properties.getProperty(KEYSTORE_PASSWORD, <span class="jxr_string">"security"</span>);
+<a name="183" href="#183">183</a> <strong class="jxr_keyword">if</strong> (passwd != <strong class="jxr_keyword">null</strong>) {
+<a name="184" href="#184">184</a> passwd = passwd.trim();
+<a name="185" href="#185">185</a> }
+<a name="186" href="#186">186</a> String type = properties.getProperty(KEYSTORE_TYPE, KeyStore.getDefaultType());
+<a name="187" href="#187">187</a> <strong class="jxr_keyword">if</strong> (type != <strong class="jxr_keyword">null</strong>) {
+<a name="188" href="#188">188</a> type = type.trim();
+<a name="189" href="#189">189</a> }
+<a name="190" href="#190">190</a> keystore = load(is, passwd, provider, type);
+<a name="191" href="#191">191</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="192" href="#192">192</a> log.debug(
+<a name="193" href="#193">193</a> <span class="jxr_string">"The KeyStore "</span> + keyStoreLocation + <span class="jxr_string">" of type "</span> + type
+<a name="194" href="#194">194</a> + <span class="jxr_string">" has been loaded"</span>
+<a name="195" href="#195">195</a> );
+<a name="196" href="#196">196</a> }
+<a name="197" href="#197">197</a> String privatePasswd = properties.getProperty(KEYSTORE_PRIVATE_PASSWORD);
+<a name="198" href="#198">198</a> <strong class="jxr_keyword">if</strong> (privatePasswd != <strong class="jxr_keyword">null</strong>) {
+<a name="199" href="#199">199</a> privatePasswordSet = <strong class="jxr_keyword">true</strong>;
+<a name="200" href="#200">200</a> }
+<a name="201" href="#201">201</a> } <strong class="jxr_keyword">finally</strong> {
+<a name="202" href="#202">202</a> <strong class="jxr_keyword">if</strong> (is != <strong class="jxr_keyword">null</strong>) {
+<a name="203" href="#203">203</a> is.close();
+<a name="204" href="#204">204</a> }
+<a name="205" href="#205">205</a> }
+<a name="206" href="#206">206</a> } <strong class="jxr_keyword">else</strong> {
+<a name="207" href="#207">207</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="208" href="#208">208</a> log.debug(<span class="jxr_string">"The KeyStore is not loaded as KEYSTORE_FILE is null"</span>);
+<a name="209" href="#209">209</a> }
+<a name="210" href="#210">210</a> }
+<a name="211" href="#211">211</a>
+<a name="212" href="#212">212</a> <em class="jxr_comment">//</em>
+<a name="213" href="#213">213</a> <em class="jxr_comment">// Load the TrustStore</em>
+<a name="214" href="#214">214</a> <em class="jxr_comment">//</em>
+<a name="215" href="#215">215</a> String trustStoreLocation = properties.getProperty(TRUSTSTORE_FILE);
+<a name="216" href="#216">216</a> <strong class="jxr_keyword">if</strong> (trustStoreLocation != <strong class="jxr_keyword">null</strong>) {
+<a name="217" href="#217">217</a> trustStoreLocation = trustStoreLocation.trim();
+<a name="218" href="#218">218</a> InputStream is = loadInputStream(loader, trustStoreLocation);
+<a name="219" href="#219">219</a>
+<a name="220" href="#220">220</a> <strong class="jxr_keyword">try</strong> {
+<a name="221" href="#221">221</a> String passwd = properties.getProperty(TRUSTSTORE_PASSWORD, <span class="jxr_string">"changeit"</span>);
+<a name="222" href="#222">222</a> <strong class="jxr_keyword">if</strong> (passwd != <strong class="jxr_keyword">null</strong>) {
+<a name="223" href="#223">223</a> passwd = passwd.trim();
+<a name="224" href="#224">224</a> }
+<a name="225" href="#225">225</a> String type = properties.getProperty(TRUSTSTORE_TYPE, KeyStore.getDefaultType());
+<a name="226" href="#226">226</a> <strong class="jxr_keyword">if</strong> (type != <strong class="jxr_keyword">null</strong>) {
+<a name="227" href="#227">227</a> type = type.trim();
<a name="228" href="#228">228</a> }
-<a name="229" href="#229">229</a> loadCACerts = false;
-<a name="230" href="#230">230</a> } <strong class="jxr_keyword">finally</strong> {
-<a name="231" href="#231">231</a> <strong class="jxr_keyword">if</strong> (is != <strong class="jxr_keyword">null</strong>) {
-<a name="232" href="#232">232</a> is.close();
-<a name="233" href="#233">233</a> }
-<a name="234" href="#234">234</a> }
-<a name="235" href="#235">235</a> } <strong class="jxr_keyword">else</strong> {
-<a name="236" href="#236">236</a> String loadCacerts = properties.getProperty(LOAD_CA_CERTS, <span class="jxr_string">"false"</span>);
-<a name="237" href="#237">237</a> <strong class="jxr_keyword">if</strong> (loadCacerts != <strong class="jxr_keyword">null</strong>) {
-<a name="238" href="#238">238</a> loadCacerts = loadCacerts.trim();
-<a name="239" href="#239">239</a> }
-<a name="240" href="#240">240</a> <strong class="jxr_keyword">if</strong> (Boolean.valueOf(loadCacerts).booleanValue()) {
-<a name="241" href="#241">241</a> String cacertsPath = System.getProperty(<span class="jxr_string">"java.home"</span>) + <span class="jxr_string">"/lib/security/cacerts"</span>;
-<a name="242" href="#242">242</a> <strong class="jxr_keyword">if</strong> (cacertsPath != <strong class="jxr_keyword">null</strong>) {
-<a name="243" href="#243">243</a> cacertsPath = cacertsPath.trim();
-<a name="244" href="#244">244</a> }
-<a name="245" href="#245">245</a> InputStream is = <strong class="jxr_keyword">new</strong> FileInputStream(cacertsPath);
-<a name="246" href="#246">246</a> <strong class="jxr_keyword">try</strong> {
-<a name="247" href="#247">247</a> String cacertsPasswd = properties.getProperty(TRUSTSTORE_PASSWORD, <span class="jxr_string">"changeit"</span>);
-<a name="248" href="#248">248</a> <strong class="jxr_keyword">if</strong> (cacertsPasswd != <strong class="jxr_keyword">null</strong>) {
-<a name="249" href="#249">249</a> cacertsPasswd = cacertsPasswd.trim();
-<a name="250" href="#250">250</a> }
-<a name="251" href="#251">251</a> truststore = load(is, cacertsPasswd, <strong class="jxr_keyword">null</strong>, KeyStore.getDefaultType());
-<a name="252" href="#252">252</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="253" href="#253">253</a> log.debug(<span class="jxr_string">"CA certs have been loaded"</span>);
-<a name="254" href="#254">254</a> }
-<a name="255" href="#255">255</a> loadCACerts = <strong class="jxr_keyword">true</strong>;
-<a name="256" href="#256">256</a> } <strong class="jxr_keyword">finally</strong> {
-<a name="257" href="#257">257</a> <strong class="jxr_keyword">if</strong> (is != <strong class="jxr_keyword">null</strong>) {
-<a name="258" href="#258">258</a> is.close();
-<a name="259" href="#259">259</a> }
-<a name="260" href="#260">260</a> }
-<a name="261" href="#261">261</a> }
-<a name="262" href="#262">262</a> }
-<a name="263" href="#263">263</a> <em class="jxr_comment">//</em>
-<a name="264" href="#264">264</a> <em class="jxr_comment">// Load the CRL file</em>
-<a name="265" href="#265">265</a> <em class="jxr_comment">//</em>
-<a name="266" href="#266">266</a> String crlLocation = properties.getProperty(X509_CRL_FILE);
-<a name="267" href="#267">267</a> <strong class="jxr_keyword">if</strong> (crlLocation != <strong class="jxr_keyword">null</strong>) {
-<a name="268" href="#268">268</a> crlLocation = crlLocation.trim();
-<a name="269" href="#269">269</a> InputStream is = loadInputStream(loader, crlLocation);
-<a name="270" href="#270">270</a>
-<a name="271" href="#271">271</a> <strong class="jxr_keyword">try</strong> {
-<a name="272" href="#272">272</a> CertificateFactory cf = getCertificateFactory();
-<a name="273" href="#273">273</a> X509CRL crl = (X509CRL)cf.generateCRL(is);
-<a name="274" href="#274">274</a>
-<a name="275" href="#275">275</a> <strong class="jxr_keyword">if</strong> (provider == <strong class="jxr_keyword">null</strong> || provider.length() == 0) {
-<a name="276" href="#276">276</a> crlCertStore =
-<a name="277" href="#277">277</a> CertStore.getInstance(
-<a name="278" href="#278">278</a> <span class="jxr_string">"Collection"</span>,
-<a name="279" href="#279">279</a> <strong class="jxr_keyword">new</strong> CollectionCertStoreParameters(Collections.singletonList(crl))
-<a name="280" href="#280">280</a> );
-<a name="281" href="#281">281</a> } <strong class="jxr_keyword">else</strong> {
-<a name="282" href="#282">282</a> crlCertStore =
-<a name="283" href="#283">283</a> CertStore.getInstance(
-<a name="284" href="#284">284</a> <span class="jxr_string">"Collection"</span>,
-<a name="285" href="#285">285</a> <strong class="jxr_keyword">new</strong> CollectionCertStoreParameters(Collections.singletonList(crl)),
-<a name="286" href="#286">286</a> provider
+<a name="229" href="#229">229</a> truststore = load(is, passwd, provider, type);
+<a name="230" href="#230">230</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="231" href="#231">231</a> log.debug(
+<a name="232" href="#232">232</a> <span class="jxr_string">"The TrustStore "</span> + trustStoreLocation + <span class="jxr_string">" of type "</span> + type
+<a name="233" href="#233">233</a> + <span class="jxr_string">" has been loaded"</span>
+<a name="234" href="#234">234</a> );
+<a name="235" href="#235">235</a> }
+<a name="236" href="#236">236</a> loadCACerts = false;
+<a name="237" href="#237">237</a> } <strong class="jxr_keyword">finally</strong> {
+<a name="238" href="#238">238</a> <strong class="jxr_keyword">if</strong> (is != <strong class="jxr_keyword">null</strong>) {
+<a name="239" href="#239">239</a> is.close();
+<a name="240" href="#240">240</a> }
+<a name="241" href="#241">241</a> }
+<a name="242" href="#242">242</a> } <strong class="jxr_keyword">else</strong> {
+<a name="243" href="#243">243</a> String loadCacerts = properties.getProperty(LOAD_CA_CERTS, <span class="jxr_string">"false"</span>);
+<a name="244" href="#244">244</a> <strong class="jxr_keyword">if</strong> (loadCacerts != <strong class="jxr_keyword">null</strong>) {
+<a name="245" href="#245">245</a> loadCacerts = loadCacerts.trim();
+<a name="246" href="#246">246</a> }
+<a name="247" href="#247">247</a> <strong class="jxr_keyword">if</strong> (Boolean.valueOf(loadCacerts).booleanValue()) {
+<a name="248" href="#248">248</a> String cacertsPath = System.getProperty(<span class="jxr_string">"java.home"</span>) + <span class="jxr_string">"/lib/security/cacerts"</span>;
+<a name="249" href="#249">249</a> <strong class="jxr_keyword">if</strong> (cacertsPath != <strong class="jxr_keyword">null</strong>) {
+<a name="250" href="#250">250</a> cacertsPath = cacertsPath.trim();
+<a name="251" href="#251">251</a> }
+<a name="252" href="#252">252</a> InputStream is = <strong class="jxr_keyword">new</strong> FileInputStream(cacertsPath);
+<a name="253" href="#253">253</a> <strong class="jxr_keyword">try</strong> {
+<a name="254" href="#254">254</a> String cacertsPasswd = properties.getProperty(TRUSTSTORE_PASSWORD, <span class="jxr_string">"changeit"</span>);
+<a name="255" href="#255">255</a> <strong class="jxr_keyword">if</strong> (cacertsPasswd != <strong class="jxr_keyword">null</strong>) {
+<a name="256" href="#256">256</a> cacertsPasswd = cacertsPasswd.trim();
+<a name="257" href="#257">257</a> }
+<a name="258" href="#258">258</a> truststore = load(is, cacertsPasswd, <strong class="jxr_keyword">null</strong>, KeyStore.getDefaultType());
+<a name="259" href="#259">259</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="260" href="#260">260</a> log.debug(<span class="jxr_string">"CA certs have been loaded"</span>);
+<a name="261" href="#261">261</a> }
+<a name="262" href="#262">262</a> loadCACerts = <strong class="jxr_keyword">true</strong>;
+<a name="263" href="#263">263</a> } <strong class="jxr_keyword">finally</strong> {
+<a name="264" href="#264">264</a> <strong class="jxr_keyword">if</strong> (is != <strong class="jxr_keyword">null</strong>) {
+<a name="265" href="#265">265</a> is.close();
+<a name="266" href="#266">266</a> }
+<a name="267" href="#267">267</a> }
+<a name="268" href="#268">268</a> }
+<a name="269" href="#269">269</a> }
+<a name="270" href="#270">270</a> <em class="jxr_comment">//</em>
+<a name="271" href="#271">271</a> <em class="jxr_comment">// Load the CRL file</em>
+<a name="272" href="#272">272</a> <em class="jxr_comment">//</em>
+<a name="273" href="#273">273</a> String crlLocation = properties.getProperty(X509_CRL_FILE);
+<a name="274" href="#274">274</a> <strong class="jxr_keyword">if</strong> (crlLocation != <strong class="jxr_keyword">null</strong>) {
+<a name="275" href="#275">275</a> crlLocation = crlLocation.trim();
+<a name="276" href="#276">276</a> InputStream is = loadInputStream(loader, crlLocation);
+<a name="277" href="#277">277</a>
+<a name="278" href="#278">278</a> <strong class="jxr_keyword">try</strong> {
+<a name="279" href="#279">279</a> CertificateFactory cf = getCertificateFactory();
+<a name="280" href="#280">280</a> X509CRL crl = (X509CRL)cf.generateCRL(is);
+<a name="281" href="#281">281</a>
+<a name="282" href="#282">282</a> <strong class="jxr_keyword">if</strong> (provider == <strong class="jxr_keyword">null</strong> || provider.length() == 0) {
+<a name="283" href="#283">283</a> crlCertStore =
+<a name="284" href="#284">284</a> CertStore.getInstance(
+<a name="285" href="#285">285</a> <span class="jxr_string">"Collection"</span>,
+<a name="286" href="#286">286</a> <strong class="jxr_keyword">new</strong> CollectionCertStoreParameters(Collections.singletonList(crl))
<a name="287" href="#287">287</a> );
-<a name="288" href="#288">288</a> }
-<a name="289" href="#289">289</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="290" href="#290">290</a> log.debug(
-<a name="291" href="#291">291</a> <span class="jxr_string">"The CRL "</span> + crlLocation + <span class="jxr_string">" has been loaded"</span>
-<a name="292" href="#292">292</a> );
-<a name="293" href="#293">293</a> }
-<a name="294" href="#294">294</a> } <strong class="jxr_keyword">catch</strong> (Exception e) {
-<a name="295" href="#295">295</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="296" href="#296">296</a> log.debug(e.getMessage(), e);
-<a name="297" href="#297">297</a> }
-<a name="298" href="#298">298</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(CredentialException.IO_ERROR, <span class="jxr_string">"ioError00"</span>, e);
-<a name="299" href="#299">299</a> } <strong class="jxr_keyword">finally</strong> {
-<a name="300" href="#300">300</a> <strong class="jxr_keyword">if</strong> (is != <strong class="jxr_keyword">null</strong>) {
-<a name="301" href="#301">301</a> is.close();
-<a name="302" href="#302">302</a> }
-<a name="303" href="#303">303</a> }
-<a name="304" href="#304">304</a> }
-<a name="305" href="#305">305</a> }
-<a name="306" href="#306">306</a>
-<a name="307" href="#307">307</a>
-<a name="308" href="#308">308</a> <em class="jxr_javadoccomment">/**</em>
-<a name="309" href="#309">309</a> <em class="jxr_javadoccomment"> * Load a KeyStore object as an InputStream, using the ClassLoader and location arguments</em>
-<a name="310" href="#310">310</a> <em class="jxr_javadoccomment"> */</em>
-<a name="311" href="#311">311</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> InputStream loadInputStream(ClassLoader loader, String location)
-<a name="312" href="#312">312</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
-<a name="313" href="#313">313</a> InputStream is = <strong class="jxr_keyword">null</strong>;
-<a name="314" href="#314">314</a> <strong class="jxr_keyword">if</strong> (location != <strong class="jxr_keyword">null</strong>) {
-<a name="315" href="#315">315</a> java.net.URL url = Loader.getResource(loader, location);
-<a name="316" href="#316">316</a> <strong class="jxr_keyword">if</strong> (url != <strong class="jxr_keyword">null</strong>) {
-<a name="317" href="#317">317</a> is = url.openStream();
-<a name="318" href="#318">318</a> }
-<a name="319" href="#319">319</a>
-<a name="320" href="#320">320</a> <em class="jxr_comment">//</em>
-<a name="321" href="#321">321</a> <em class="jxr_comment">// If we don't find it, then look on the file system.</em>
-<a name="322" href="#322">322</a> <em class="jxr_comment">//</em>
-<a name="323" href="#323">323</a> <strong class="jxr_keyword">if</strong> (is == <strong class="jxr_keyword">null</strong>) {
-<a name="324" href="#324">324</a> <strong class="jxr_keyword">try</strong> {
-<a name="325" href="#325">325</a> is = <strong class="jxr_keyword">new</strong> FileInputStream(location);
-<a name="326" href="#326">326</a> } <strong class="jxr_keyword">catch</strong> (Exception e) {
-<a name="327" href="#327">327</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="328" href="#328">328</a> log.debug(e.getMessage(), e);
-<a name="329" href="#329">329</a> }
-<a name="330" href="#330">330</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(
-<a name="331" href="#331">331</a> CredentialException.IO_ERROR, <span class="jxr_string">"proxyNotFound"</span>, <strong class="jxr_keyword">new</strong> Object[]{location}, e
-<a name="332" href="#332">332</a> );
-<a name="333" href="#333">333</a> }
-<a name="334" href="#334">334</a> }
-<a name="335" href="#335">335</a> }
-<a name="336" href="#336">336</a> <strong class="jxr_keyword">return</strong> is;
-<a name="337" href="#337">337</a> }
-<a name="338" href="#338">338</a>
-<a name="339" href="#339">339</a>
-<a name="340" href="#340">340</a> <em class="jxr_javadoccomment">/**</em>
-<a name="341" href="#341">341</a> <em class="jxr_javadoccomment"> * Loads the keystore from an <code>InputStream </code>.</em>
-<a name="342" href="#342">342</a> <em class="jxr_javadoccomment"> * <p/></em>
-<a name="343" href="#343">343</a> <em class="jxr_javadoccomment"> *</em>
-<a name="344" href="#344">344</a> <em class="jxr_javadoccomment"> * @param input <code>InputStream</code> to read from</em>
-<a name="345" href="#345">345</a> <em class="jxr_javadoccomment"> * @throws CredentialException</em>
-<a name="346" href="#346">346</a> <em class="jxr_javadoccomment"> */</em>
-<a name="347" href="#347">347</a> <strong class="jxr_keyword">public</strong> KeyStore load(InputStream input, String storepass, String provider, String type)
-<a name="348" href="#348">348</a> <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a> {
-<a name="349" href="#349">349</a> KeyStore ks = <strong class="jxr_keyword">null</strong>;
-<a name="350" href="#350">350</a>
-<a name="351" href="#351">351</a> <strong class="jxr_keyword">try</strong> {
-<a name="352" href="#352">352</a> <strong class="jxr_keyword">if</strong> (provider == <strong class="jxr_keyword">null</strong> || provider.length() == 0) {
-<a name="353" href="#353">353</a> ks = KeyStore.getInstance(type);
-<a name="354" href="#354">354</a> } <strong class="jxr_keyword">else</strong> {
-<a name="355" href="#355">355</a> ks = KeyStore.getInstance(type, provider);
-<a name="356" href="#356">356</a> }
-<a name="357" href="#357">357</a>
-<a name="358" href="#358">358</a> ks.load(input, (storepass == <strong class="jxr_keyword">null</strong> || storepass.length() == 0)
-<a name="359" href="#359">359</a> ? <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">char</strong>[0] : storepass.toCharArray());
-<a name="360" href="#360">360</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
-<a name="361" href="#361">361</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="362" href="#362">362</a> log.debug(e.getMessage(), e);
+<a name="288" href="#288">288</a> } <strong class="jxr_keyword">else</strong> {
+<a name="289" href="#289">289</a> crlCertStore =
+<a name="290" href="#290">290</a> CertStore.getInstance(
+<a name="291" href="#291">291</a> <span class="jxr_string">"Collection"</span>,
+<a name="292" href="#292">292</a> <strong class="jxr_keyword">new</strong> CollectionCertStoreParameters(Collections.singletonList(crl)),
+<a name="293" href="#293">293</a> provider
+<a name="294" href="#294">294</a> );
+<a name="295" href="#295">295</a> }
+<a name="296" href="#296">296</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="297" href="#297">297</a> log.debug(
+<a name="298" href="#298">298</a> <span class="jxr_string">"The CRL "</span> + crlLocation + <span class="jxr_string">" has been loaded"</span>
+<a name="299" href="#299">299</a> );
+<a name="300" href="#300">300</a> }
+<a name="301" href="#301">301</a> } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="302" href="#302">302</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="303" href="#303">303</a> log.debug(e.getMessage(), e);
+<a name="304" href="#304">304</a> }
+<a name="305" href="#305">305</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(CredentialException.IO_ERROR, <span class="jxr_string">"ioError00"</span>, e);
+<a name="306" href="#306">306</a> } <strong class="jxr_keyword">finally</strong> {
+<a name="307" href="#307">307</a> <strong class="jxr_keyword">if</strong> (is != <strong class="jxr_keyword">null</strong>) {
+<a name="308" href="#308">308</a> is.close();
+<a name="309" href="#309">309</a> }
+<a name="310" href="#310">310</a> }
+<a name="311" href="#311">311</a> }
+<a name="312" href="#312">312</a> }
+<a name="313" href="#313">313</a>
+<a name="314" href="#314">314</a>
+<a name="315" href="#315">315</a> <em class="jxr_javadoccomment">/**</em>
+<a name="316" href="#316">316</a> <em class="jxr_javadoccomment"> * Load a KeyStore object as an InputStream, using the ClassLoader and location arguments</em>
+<a name="317" href="#317">317</a> <em class="jxr_javadoccomment"> */</em>
+<a name="318" href="#318">318</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> InputStream loadInputStream(ClassLoader loader, String location)
+<a name="319" href="#319">319</a> <strong class="jxr_keyword">throws</strong> CredentialException, IOException {
+<a name="320" href="#320">320</a> InputStream is = <strong class="jxr_keyword">null</strong>;
+<a name="321" href="#321">321</a> <strong class="jxr_keyword">if</strong> (location != <strong class="jxr_keyword">null</strong>) {
+<a name="322" href="#322">322</a> java.net.URL url = Loader.getResource(loader, location);
+<a name="323" href="#323">323</a> <strong class="jxr_keyword">if</strong> (url != <strong class="jxr_keyword">null</strong>) {
+<a name="324" href="#324">324</a> is = url.openStream();
+<a name="325" href="#325">325</a> }
+<a name="326" href="#326">326</a>
+<a name="327" href="#327">327</a> <em class="jxr_comment">//</em>
+<a name="328" href="#328">328</a> <em class="jxr_comment">// If we don't find it, then look on the file system.</em>
+<a name="329" href="#329">329</a> <em class="jxr_comment">//</em>
+<a name="330" href="#330">330</a> <strong class="jxr_keyword">if</strong> (is == <strong class="jxr_keyword">null</strong>) {
+<a name="331" href="#331">331</a> <strong class="jxr_keyword">try</strong> {
+<a name="332" href="#332">332</a> is = <strong class="jxr_keyword">new</strong> FileInputStream(location);
+<a name="333" href="#333">333</a> } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="334" href="#334">334</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="335" href="#335">335</a> log.debug(e.getMessage(), e);
+<a name="336" href="#336">336</a> }
+<a name="337" href="#337">337</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(
+<a name="338" href="#338">338</a> CredentialException.IO_ERROR, <span class="jxr_string">"proxyNotFound"</span>, <strong class="jxr_keyword">new</strong> Object[]{location}, e
+<a name="339" href="#339">339</a> );
+<a name="340" href="#340">340</a> }
+<a name="341" href="#341">341</a> }
+<a name="342" href="#342">342</a> }
+<a name="343" href="#343">343</a> <strong class="jxr_keyword">return</strong> is;
+<a name="344" href="#344">344</a> }
+<a name="345" href="#345">345</a>
+<a name="346" href="#346">346</a>
+<a name="347" href="#347">347</a> <em class="jxr_javadoccomment">/**</em>
+<a name="348" href="#348">348</a> <em class="jxr_javadoccomment"> * Loads the keystore from an <code>InputStream </code>.</em>
+<a name="349" href="#349">349</a> <em class="jxr_javadoccomment"> * <p/></em>
+<a name="350" href="#350">350</a> <em class="jxr_javadoccomment"> *</em>
+<a name="351" href="#351">351</a> <em class="jxr_javadoccomment"> * @param input <code>InputStream</code> to read from</em>
+<a name="352" href="#352">352</a> <em class="jxr_javadoccomment"> * @throws CredentialException</em>
+<a name="353" href="#353">353</a> <em class="jxr_javadoccomment"> */</em>
+<a name="354" href="#354">354</a> <strong class="jxr_keyword">public</strong> KeyStore load(InputStream input, String storepass, String provider, String type)
+<a name="355" href="#355">355</a> <strong class="jxr_keyword">throws</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a> {
+<a name="356" href="#356">356</a> KeyStore ks = <strong class="jxr_keyword">null</strong>;
+<a name="357" href="#357">357</a>
+<a name="358" href="#358">358</a> <strong class="jxr_keyword">try</strong> {
+<a name="359" href="#359">359</a> <strong class="jxr_keyword">if</strong> (provider == <strong class="jxr_keyword">null</strong> || provider.length() == 0) {
+<a name="360" href="#360">360</a> ks = KeyStore.getInstance(type);
+<a name="361" href="#361">361</a> } <strong class="jxr_keyword">else</strong> {
+<a name="362" href="#362">362</a> ks = KeyStore.getInstance(type, provider);
<a name="363" href="#363">363</a> }
-<a name="364" href="#364">364</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(CredentialException.IO_ERROR, <span class="jxr_string">"ioError00"</span>, e);
-<a name="365" href="#365">365</a> } <strong class="jxr_keyword">catch</strong> (GeneralSecurityException e) {
-<a name="366" href="#366">366</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="367" href="#367">367</a> log.debug(e.getMessage(), e);
-<a name="368" href="#368">368</a> }
-<a name="369" href="#369">369</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(CredentialException.SEC_ERROR, <span class="jxr_string">"secError00"</span>, e);
-<a name="370" href="#370">370</a> } <strong class="jxr_keyword">catch</strong> (Exception e) {
-<a name="371" href="#371">371</a> <strong class="jxr_keyword">if</strong> (doDebug) {
-<a name="372" href="#372">372</a> log.debug(e.getMessage(), e);
-<a name="373" href="#373">373</a> }
-<a name="374" href="#374">374</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(CredentialException.FAILURE, <span class="jxr_string">"error00"</span>, e);
-<a name="375" href="#375">375</a> }
-<a name="376" href="#376">376</a> <strong class="jxr_keyword">return</strong> ks;
-<a name="377" href="#377">377</a> }
-<a name="378" href="#378">378</a>
-<a name="379" href="#379">379</a> <em class="jxr_comment">//</em>
-<a name="380" href="#380">380</a> <em class="jxr_comment">// Accessor methods</em>
-<a name="381" href="#381">381</a> <em class="jxr_comment">//</em>
-<a name="382" href="#382">382</a>
-<a name="383" href="#383">383</a> <em class="jxr_javadoccomment">/**</em>
-<a name="384" href="#384">384</a> <em class="jxr_javadoccomment"> * Gets the Keystore that was loaded</em>
-<a name="385" href="#385">385</a> <em class="jxr_javadoccomment"> *</em>
-<a name="386" href="#386">386</a> <em class="jxr_javadoccomment"> * @return the Keystore</em>
-<a name="387" href="#387">387</a> <em class="jxr_javadoccomment"> */</em>
-<a name="388" href="#388">388</a> <strong class="jxr_keyword">public</strong> KeyStore getKeyStore() {
-<a name="389" href="#389">389</a> <strong class="jxr_keyword">return</strong> keystore;
-<a name="390" href="#390">390</a> }
-<a name="391" href="#391">391</a>
-<a name="392" href="#392">392</a> <em class="jxr_javadoccomment">/**</em>
-<a name="393" href="#393">393</a> <em class="jxr_javadoccomment"> * Set the Keystore on this Crypto instance</em>
-<a name="394" href="#394">394</a> <em class="jxr_javadoccomment"> *</em>
-<a name="395" href="#395">395</a> <em class="jxr_javadoccomment"> * @param keyStore the Keystore to set</em>
-<a name="396" href="#396">396</a> <em class="jxr_javadoccomment"> */</em>
-<a name="397" href="#397">397</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setKeyStore(KeyStore keyStore) {
-<a name="398" href="#398">398</a> keystore = keyStore;
-<a name="399" href="#399">399</a> }
-<a name="400" href="#400">400</a>
-<a name="401" href="#401">401</a> <em class="jxr_javadoccomment">/**</em>
-<a name="402" href="#402">402</a> <em class="jxr_javadoccomment"> * Gets the trust store that was loaded by the underlying implementation</em>
-<a name="403" href="#403">403</a> <em class="jxr_javadoccomment"> *</em>
-<a name="404" href="#404">404</a> <em class="jxr_javadoccomment"> * @return the trust store</em>
-<a name="405" href="#405">405</a> <em class="jxr_javadoccomment"> */</em>
-<a name="406" href="#406">406</a> <strong class="jxr_keyword">public</strong> KeyStore getTrustStore() {
-<a name="407" href="#407">407</a> <strong class="jxr_keyword">return</strong> truststore;
-<a name="408" href="#408">408</a> }
-<a name="409" href="#409">409</a>
-<a name="410" href="#410">410</a> <em class="jxr_javadoccomment">/**</em>
-<a name="411" href="#411">411</a> <em class="jxr_javadoccomment"> * Set the trust store on this Crypto instance</em>
-<a name="412" href="#412">412</a> <em class="jxr_javadoccomment"> *</em>
-<a name="413" href="#413">413</a> <em class="jxr_javadoccomment"> * @param trustStore the trust store to set</em>
-<a name="414" href="#414">414</a> <em class="jxr_javadoccomment"> */</em>
-<a name="415" href="#415">415</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setTrustStore(KeyStore trustStore) {
-<a name="416" href="#416">416</a> truststore = trustStore;
-<a name="417" href="#417">417</a> }
-<a name="418" href="#418">418</a>
-<a name="419" href="#419">419</a> <em class="jxr_javadoccomment">/**</em>
-<a name="420" href="#420">420</a> <em class="jxr_javadoccomment"> * Set the CertStore from which to obtain a list of CRLs for Certificate Revocation</em>
-<a name="421" href="#421">421</a> <em class="jxr_javadoccomment"> * checking.</em>
-<a name="422" href="#422">422</a> <em class="jxr_javadoccomment"> * @param crlCertStore the CertStore from which to obtain a list of CRLs for Certificate </em>
-<a name="423" href="#423">423</a> <em class="jxr_javadoccomment"> * Revocation checking.</em>
-<a name="424" href="#424">424</a> <em class="jxr_javadoccomment"> */</em>
-<a name="425" href="#425">425</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setCRLCertStore(CertStore crlCertStore) {
-<a name="426" href="#426">426</a> <strong class="jxr_keyword">this</strong>.crlCertStore = crlCertStore;
-<a name="427" href="#427">427</a> }
-<a name="428" href="#428">428</a>
-<a name="429" href="#429">429</a> <em class="jxr_javadoccomment">/**</em>
-<a name="430" href="#430">430</a> <em class="jxr_javadoccomment"> * Get the CertStore from which to obtain a list of CRLs for Certificate Revocation</em>
-<a name="431" href="#431">431</a> <em class="jxr_javadoccomment"> * checking.</em>
-<a name="432" href="#432">432</a> <em class="jxr_javadoccomment"> * @return the CertStore from which to obtain a list of CRLs for Certificate </em>
-<a name="433" href="#433">433</a> <em class="jxr_javadoccomment"> * Revocation checking.</em>
-<a name="434" href="#434">434</a> <em class="jxr_javadoccomment"> */</em>
-<a name="435" href="#435">435</a> <strong class="jxr_keyword">public</strong> CertStore getCRLCertStore() {
-<a name="436" href="#436">436</a> <strong class="jxr_keyword">return</strong> crlCertStore;
-<a name="437" href="#437">437</a> }
-<a name="438" href="#438">438</a>
-<a name="439" href="#439">439</a> <em class="jxr_javadoccomment">/**</em>
-<a name="440" href="#440">440</a> <em class="jxr_javadoccomment"> * Singleton certificate factory for this Crypto instance.</em>
-<a name="441" href="#441">441</a> <em class="jxr_javadoccomment"> * <p/></em>
-<a name="442" href="#442">442</a> <em class="jxr_javadoccomment"> *</em>
-<a name="443" href="#443">443</a> <em class="jxr_javadoccomment"> * @return Returns a <code>CertificateFactory</code> to construct</em>
-<a name="444" href="#444">444</a> <em class="jxr_javadoccomment"> * X509 certificates</em>
-<a name="445" href="#445">445</a> <em class="jxr_javadoccomment"> * @throws org.apache.ws.security.WSSecurityException</em>
-<a name="446" href="#446">446</a> <em class="jxr_javadoccomment"> */</em>
-<a name="447" href="#447">447</a> @Override
-<a name="448" href="#448">448</a> <strong class="jxr_keyword">public</strong> CertificateFactory getCertificateFactory() <strong class="jxr_keyword">throws</strong> WSSecurityException {
-<a name="449" href="#449">449</a> String provider = getCryptoProvider();
-<a name="450" href="#450">450</a> String keyStoreProvider = <strong class="jxr_keyword">null</strong>;
-<a name="451" href="#451">451</a> <strong class="jxr_keyword">if</strong> (keystore != <strong class="jxr_keyword">null</strong>) {
-<a name="452" href="#452">452</a> keyStoreProvider = keystore.getProvider().getName();
-<a name="453" href="#453">453</a> }
-<a name="454" href="#454">454</a>
-<a name="455" href="#455">455</a> <em class="jxr_comment">//Try to find a CertificateFactory that generates certs that are fully</em>
-<a name="456" href="#456">456</a> <em class="jxr_comment">//compatible with the certs in the KeyStore (Sun -> Sun, BC -> BC, etc...)</em>
-<a name="457" href="#457">457</a> CertificateFactory factory = <strong class="jxr_keyword">null</strong>;
-<a name="458" href="#458">458</a> <strong class="jxr_keyword">if</strong> (provider != <strong class="jxr_keyword">null</strong>) {
-<a name="459" href="#459">459</a> factory = certFactMap.get(provider);
-<a name="460" href="#460">460</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (keyStoreProvider != <strong class="jxr_keyword">null</strong>) {
-<a name="461" href="#461">461</a> factory =
-<a name="462" href="#462">462</a> certFactMap.get(mapKeystoreProviderToCertProvider(keyStoreProvider));
-<a name="463" href="#463">463</a> <strong class="jxr_keyword">if</strong> (factory == <strong class="jxr_keyword">null</strong>) {
-<a name="464" href="#464">464</a> factory = certFactMap.get(keyStoreProvider);
-<a name="465" href="#465">465</a> }
-<a name="466" href="#466">466</a> } <strong class="jxr_keyword">else</strong> {
-<a name="467" href="#467">467</a> factory = certFactMap.get(<span class="jxr_string">"DEFAULT"</span>);
-<a name="468" href="#468">468</a> }
-<a name="469" href="#469">469</a> <strong class="jxr_keyword">if</strong> (factory == <strong class="jxr_keyword">null</strong>) {
-<a name="470" href="#470">470</a> <strong class="jxr_keyword">try</strong> {
-<a name="471" href="#471">471</a> <strong class="jxr_keyword">if</strong> (provider == <strong class="jxr_keyword">null</strong> || provider.length() == 0) {
-<a name="472" href="#472">472</a> <strong class="jxr_keyword">if</strong> (keyStoreProvider != <strong class="jxr_keyword">null</strong> && keyStoreProvider.length() != 0) {
-<a name="473" href="#473">473</a> <strong class="jxr_keyword">try</strong> {
-<a name="474" href="#474">474</a> factory =
-<a name="475" href="#475">475</a> CertificateFactory.getInstance(
-<a name="476" href="#476">476</a> <span class="jxr_string">"X.509"</span>, mapKeystoreProviderToCertProvider(keyStoreProvider)
-<a name="477" href="#477">477</a> );
-<a name="478" href="#478">478</a> certFactMap.put(keyStoreProvider, factory);
-<a name="479" href="#479">479</a> certFactMap.put(
-<a name="480" href="#480">480</a> mapKeystoreProviderToCertProvider(keyStoreProvider), factory
-<a name="481" href="#481">481</a> );
-<a name="482" href="#482">482</a> } <strong class="jxr_keyword">catch</strong> (Exception ex) {
-<a name="483" href="#483">483</a> log.debug(ex);
-<a name="484" href="#484">484</a> <em class="jxr_comment">//Ignore, we'll just use the default since they didn't specify one.</em>
-<a name="485" href="#485">485</a> <em class="jxr_comment">//Hopefully that will work for them.</em>
-<a name="486" href="#486">486</a> }
-<a name="487" href="#487">487</a> }
-<a name="488" href="#488">488</a> <strong class="jxr_keyword">if</strong> (factory == <strong class="jxr_keyword">null</strong>) {
-<a name="489" href="#489">489</a> factory = CertificateFactory.getInstance(<span class="jxr_string">"X.509"</span>);
-<a name="490" href="#490">490</a> certFactMap.put(<span class="jxr_string">"DEFAULT"</span>, factory);
-<a name="491" href="#491">491</a> }
-<a name="492" href="#492">492</a> } <strong class="jxr_keyword">else</strong> {
-<a name="493" href="#493">493</a> factory = CertificateFactory.getInstance(<span class="jxr_string">"X.509"</span>, provider);
-<a name="494" href="#494">494</a> certFactMap.put(provider, factory);
-<a name="495" href="#495">495</a> }
-<a name="496" href="#496">496</a> certFactMap.put(factory.getProvider().getName(), factory);
-<a name="497" href="#497">497</a> } <strong class="jxr_keyword">catch</strong> (CertificateException e) {
-<a name="498" href="#498">498</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="499" href="#499">499</a> WSSecurityException.SECURITY_TOKEN_UNAVAILABLE, <span class="jxr_string">"unsupportedCertType"</span>,
-<a name="500" href="#500">500</a> <strong class="jxr_keyword">null</strong>, e
-<a name="501" href="#501">501</a> );
-<a name="502" href="#502">502</a> } <strong class="jxr_keyword">catch</strong> (NoSuchProviderException e) {
-<a name="503" href="#503">503</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="504" href="#504">504</a> WSSecurityException.SECURITY_TOKEN_UNAVAILABLE, <span class="jxr_string">"noSecProvider"</span>,
-<a name="505" href="#505">505</a> <strong class="jxr_keyword">null</strong>, e
-<a name="506" href="#506">506</a> );
-<a name="507" href="#507">507</a> }
-<a name="508" href="#508">508</a> }
-<a name="509" href="#509">509</a> <strong class="jxr_keyword">return</strong> factory;
-<a name="510" href="#510">510</a> }
-<a name="511" href="#511">511</a>
-<a name="512" href="#512">512</a> <strong class="jxr_keyword">private</strong> String mapKeystoreProviderToCertProvider(String s) {
-<a name="513" href="#513">513</a> <strong class="jxr_keyword">if</strong> (<span class="jxr_string">"SunJSSE"</span>.equals(s)) {
-<a name="514" href="#514">514</a> <strong class="jxr_keyword">return</strong> <span class="jxr_string">"SUN"</span>;
+<a name="364" href="#364">364</a>
+<a name="365" href="#365">365</a> ks.load(input, (storepass == <strong class="jxr_keyword">null</strong> || storepass.length() == 0)
+<a name="366" href="#366">366</a> ? <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">char</strong>[0] : storepass.toCharArray());
+<a name="367" href="#367">367</a> } <strong class="jxr_keyword">catch</strong> (IOException e) {
+<a name="368" href="#368">368</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="369" href="#369">369</a> log.debug(e.getMessage(), e);
+<a name="370" href="#370">370</a> }
+<a name="371" href="#371">371</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(CredentialException.IO_ERROR, <span class="jxr_string">"ioError00"</span>, e);
+<a name="372" href="#372">372</a> } <strong class="jxr_keyword">catch</strong> (GeneralSecurityException e) {
+<a name="373" href="#373">373</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="374" href="#374">374</a> log.debug(e.getMessage(), e);
+<a name="375" href="#375">375</a> }
+<a name="376" href="#376">376</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(CredentialException.SEC_ERROR, <span class="jxr_string">"secError00"</span>, e);
+<a name="377" href="#377">377</a> } <strong class="jxr_keyword">catch</strong> (Exception e) {
+<a name="378" href="#378">378</a> <strong class="jxr_keyword">if</strong> (doDebug) {
+<a name="379" href="#379">379</a> log.debug(e.getMessage(), e);
+<a name="380" href="#380">380</a> }
+<a name="381" href="#381">381</a> <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/ws/security/components/crypto/CredentialException.html">CredentialException</a>(CredentialException.FAILURE, <span class="jxr_string">"error00"</span>, e);
+<a name="382" href="#382">382</a> }
+<a name="383" href="#383">383</a> <strong class="jxr_keyword">return</strong> ks;
+<a name="384" href="#384">384</a> }
+<a name="385" href="#385">385</a>
+<a name="386" href="#386">386</a> <em class="jxr_comment">//</em>
+<a name="387" href="#387">387</a> <em class="jxr_comment">// Accessor methods</em>
+<a name="388" href="#388">388</a> <em class="jxr_comment">//</em>
+<a name="389" href="#389">389</a>
+<a name="390" href="#390">390</a> <em class="jxr_javadoccomment">/**</em>
+<a name="391" href="#391">391</a> <em class="jxr_javadoccomment"> * Gets the Keystore that was loaded</em>
+<a name="392" href="#392">392</a> <em class="jxr_javadoccomment"> *</em>
+<a name="393" href="#393">393</a> <em class="jxr_javadoccomment"> * @return the Keystore</em>
+<a name="394" href="#394">394</a> <em class="jxr_javadoccomment"> */</em>
+<a name="395" href="#395">395</a> <strong class="jxr_keyword">public</strong> KeyStore getKeyStore() {
+<a name="396" href="#396">396</a> <strong class="jxr_keyword">return</strong> keystore;
+<a name="397" href="#397">397</a> }
+<a name="398" href="#398">398</a>
+<a name="399" href="#399">399</a> <em class="jxr_javadoccomment">/**</em>
+<a name="400" href="#400">400</a> <em class="jxr_javadoccomment"> * Set the Keystore on this Crypto instance</em>
+<a name="401" href="#401">401</a> <em class="jxr_javadoccomment"> *</em>
+<a name="402" href="#402">402</a> <em class="jxr_javadoccomment"> * @param keyStore the Keystore to set</em>
+<a name="403" href="#403">403</a> <em class="jxr_javadoccomment"> */</em>
+<a name="404" href="#404">404</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setKeyStore(KeyStore keyStore) {
+<a name="405" href="#405">405</a> keystore = keyStore;
+<a name="406" href="#406">406</a> }
+<a name="407" href="#407">407</a>
+<a name="408" href="#408">408</a> <em class="jxr_javadoccomment">/**</em>
+<a name="409" href="#409">409</a> <em class="jxr_javadoccomment"> * Gets the trust store that was loaded by the underlying implementation</em>
+<a name="410" href="#410">410</a> <em class="jxr_javadoccomment"> *</em>
+<a name="411" href="#411">411</a> <em class="jxr_javadoccomment"> * @return the trust store</em>
+<a name="412" href="#412">412</a> <em class="jxr_javadoccomment"> */</em>
+<a name="413" href="#413">413</a> <strong class="jxr_keyword">public</strong> KeyStore getTrustStore() {
+<a name="414" href="#414">414</a> <strong class="jxr_keyword">return</strong> truststore;
+<a name="415" href="#415">415</a> }
+<a name="416" href="#416">416</a>
+<a name="417" href="#417">417</a> <em class="jxr_javadoccomment">/**</em>
+<a name="418" href="#418">418</a> <em class="jxr_javadoccomment"> * Set the trust store on this Crypto instance</em>
+<a name="419" href="#419">419</a> <em class="jxr_javadoccomment"> *</em>
+<a name="420" href="#420">420</a> <em class="jxr_javadoccomment"> * @param trustStore the trust store to set</em>
+<a name="421" href="#421">421</a> <em class="jxr_javadoccomment"> */</em>
+<a name="422" href="#422">422</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setTrustStore(KeyStore trustStore) {
+<a name="423" href="#423">423</a> truststore = trustStore;
+<a name="424" href="#424">424</a> }
+<a name="425" href="#425">425</a>
+<a name="426" href="#426">426</a> <em class="jxr_javadoccomment">/**</em>
+<a name="427" href="#427">427</a> <em class="jxr_javadoccomment"> * Set the CertStore from which to obtain a list of CRLs for Certificate Revocation</em>
+<a name="428" href="#428">428</a> <em class="jxr_javadoccomment"> * checking.</em>
+<a name="429" href="#429">429</a> <em class="jxr_javadoccomment"> * @param crlCertStore the CertStore from which to obtain a list of CRLs for Certificate </em>
+<a name="430" href="#430">430</a> <em class="jxr_javadoccomment"> * Revocation checking.</em>
+<a name="431" href="#431">431</a> <em class="jxr_javadoccomment"> */</em>
+<a name="432" href="#432">432</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setCRLCertStore(CertStore crlCertStore) {
+<a name="433" href="#433">433</a> <strong class="jxr_keyword">this</strong>.crlCertStore = crlCertStore;
+<a name="434" href="#434">434</a> }
+<a name="435" href="#435">435</a>
+<a name="436" href="#436">436</a> <em class="jxr_javadoccomment">/**</em>
+<a name="437" href="#437">437</a> <em class="jxr_javadoccomment"> * Get the CertStore from which to obtain a list of CRLs for Certificate Revocation</em>
+<a name="438" href="#438">438</a> <em class="jxr_javadoccomment"> * checking.</em>
+<a name="439" href="#439">439</a> <em class="jxr_javadoccomment"> * @return the CertStore from which to obtain a list of CRLs for Certificate </em>
+<a name="440" href="#440">440</a> <em class="jxr_javadoccomment"> * Revocation checking.</em>
+<a name="441" href="#441">441</a> <em class="jxr_javadoccomment"> */</em>
+<a name="442" href="#442">442</a> <strong class="jxr_keyword">public</strong> CertStore getCRLCertStore() {
+<a name="443" href="#443">443</a> <strong class="jxr_keyword">return</strong> crlCertStore;
+<a name="444" href="#444">444</a> }
+<a name="445" href="#445">445</a>
+<a name="446" href="#446">446</a> <em class="jxr_javadoccomment">/**</em>
+<a name="447" href="#447">447</a> <em class="jxr_javadoccomment"> * Singleton certificate factory for this Crypto instance.</em>
+<a name="448" href="#448">448</a> <em class="jxr_javadoccomment"> * <p/></em>
+<a name="449" href="#449">449</a> <em class="jxr_javadoccomment"> *</em>
+<a name="450" href="#450">450</a> <em class="jxr_javadoccomment"> * @return Returns a <code>CertificateFactory</code> to construct</em>
+<a name="451" href="#451">451</a> <em class="jxr_javadoccomment"> * X509 certificates</em>
+<a name="452" href="#452">452</a> <em class="jxr_javadoccomment"> * @throws org.apache.ws.security.WSSecurityException</em>
+<a name="453" href="#453">453</a> <em class="jxr_javadoccomment"> */</em>
+<a name="454" href="#454">454</a> @Override
+<a name="455" href="#455">455</a> <strong class="jxr_keyword">public</strong> CertificateFactory getCertificateFactory() <strong class="jxr_keyword">throws</strong> WSSecurityException {
+<a name="456" href="#456">456</a> String provider = getCryptoProvider();
+<a name="457" href="#457">457</a> String keyStoreProvider = <strong class="jxr_keyword">null</strong>;
+<a name="458" href="#458">458</a> <strong class="jxr_keyword">if</strong> (keystore != <strong class="jxr_keyword">null</strong>) {
+<a name="459" href="#459">459</a> keyStoreProvider = keystore.getProvider().getName();
+<a name="460" href="#460">460</a> }
+<a name="461" href="#461">461</a>
+<a name="462" href="#462">462</a> <em class="jxr_comment">//Try to find a CertificateFactory that generates certs that are fully</em>
+<a name="463" href="#463">463</a> <em class="jxr_comment">//compatible with the certs in the KeyStore (Sun -> Sun, BC -> BC, etc...)</em>
+<a name="464" href="#464">464</a> CertificateFactory factory = <strong class="jxr_keyword">null</strong>;
+<a name="465" href="#465">465</a> <strong class="jxr_keyword">if</strong> (provider != <strong class="jxr_keyword">null</strong>) {
+<a name="466" href="#466">466</a> factory = certFactMap.get(provider);
+<a name="467" href="#467">467</a> } <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (keyStoreProvider != <strong class="jxr_keyword">null</strong>) {
+<a name="468" href="#468">468</a> factory =
+<a name="469" href="#469">469</a> certFactMap.get(mapKeystoreProviderToCertProvider(keyStoreProvider));
+<a name="470" href="#470">470</a> <strong class="jxr_keyword">if</strong> (factory == <strong class="jxr_keyword">null</strong>) {
+<a name="471" href="#471">471</a> factory = certFactMap.get(keyStoreProvider);
+<a name="472" href="#472">472</a> }
+<a name="473" href="#473">473</a> } <strong class="jxr_keyword">else</strong> {
+<a name="474" href="#474">474</a> factory = certFactMap.get(<span class="jxr_string">"DEFAULT"</span>);
+<a name="475" href="#475">475</a> }
+<a name="476" href="#476">476</a> <strong class="jxr_keyword">if</strong> (factory == <strong class="jxr_keyword">null</strong>) {
+<a name="477" href="#477">477</a> <strong class="jxr_keyword">try</strong> {
+<a name="478" href="#478">478</a> <strong class="jxr_keyword">if</strong> (provider == <strong class="jxr_keyword">null</strong> || provider.length() == 0) {
+<a name="479" href="#479">479</a> <strong class="jxr_keyword">if</strong> (keyStoreProvider != <strong class="jxr_keyword">null</strong> && keyStoreProvider.length() != 0) {
+<a name="480" href="#480">480</a> <strong class="jxr_keyword">try</strong> {
+<a name="481" href="#481">481</a> factory =
+<a name="482" href="#482">482</a> CertificateFactory.getInstance(
+<a name="483" href="#483">483</a> <span class="jxr_string">"X.509"</span>, mapKeystoreProviderToCertProvider(keyStoreProvider)
+<a name="484" href="#484">484</a> );
+<a name="485" href="#485">485</a> certFactMap.put(keyStoreProvider, factory);
+<a name="486" href="#486">486</a> certFactMap.put(
+<a name="487" href="#487">487</a> mapKeystoreProviderToCertProvider(keyStoreProvider), factory
+<a name="488" href="#488">488</a> );
+<a name="489" href="#489">489</a> } <strong class="jxr_keyword">catch</strong> (Exception ex) {
+<a name="490" href="#490">490</a> log.debug(ex);
+<a name="491" href="#491">491</a> <em class="jxr_comment">//Ignore, we'll just use the default since they didn't specify one.</em>
+<a name="492" href="#492">492</a> <em class="jxr_comment">//Hopefully that will work for them.</em>
+<a name="493" href="#493">493</a> }
+<a name="494" href="#494">494</a> }
+<a name="495" href="#495">495</a> <strong class="jxr_keyword">if</strong> (factory == <strong class="jxr_keyword">null</strong>) {
+<a name="496" href="#496">496</a> factory = CertificateFactory.getInstance(<span class="jxr_string">"X.509"</span>);
+<a name="497" href="#497">497</a> certFactMap.put(<span class="jxr_string">"DEFAULT"</span>, factory);
+<a name="498" href="#498">498</a> }
+<a name="499" href="#499">499</a> } <strong class="jxr_keyword">else</strong> {
+<a name="500" href="#500">500</a> factory = CertificateFactory.getInstance(<span class="jxr_string">"X.509"</span>, provider);
+<a name="501" href="#501">501</a> certFactMap.put(provider, factory);
+<a name="502" href="#502">502</a> }
+<a name="503" href="#503">503</a> certFactMap.put(factory.getProvider().getName(), factory);
+<a name="504" href="#504">504</a> } <strong class="jxr_keyword">catch</strong> (CertificateException e) {
+<a name="505" href="#505">505</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="506" href="#506">506</a> WSSecurityException.SECURITY_TOKEN_UNAVAILABLE, <span class="jxr_string">"unsupportedCertType"</span>,
+<a name="507" href="#507">507</a> <strong class="jxr_keyword">null</strong>, e
+<a name="508" href="#508">508</a> );
+<a name="509" href="#509">509</a> } <strong class="jxr_keyword">catch</strong> (NoSuchProviderException e) {
+<a name="510" href="#510">510</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="511" href="#511">511</a> WSSecurityException.SECURITY_TOKEN_UNAVAILABLE, <span class="jxr_string">"noSecProvider"</span>,
+<a name="512" href="#512">512</a> <strong class="jxr_keyword">null</strong>, e
+<a name="513" href="#513">513</a> );
+<a name="514" href="#514">514</a> }
<a name="515" href="#515">515</a> }
-<a name="516" href="#516">516</a> <strong class="jxr_keyword">return</strong> s;
+<a name="516" href="#516">516</a> <strong class="jxr_keyword">return</strong> factory;
<a name="517" href="#517">517</a> }
<a name="518" href="#518">518</a>
-<a name="519" href="#519">519</a> <em class="jxr_javadoccomment">/**</em>
-<a name="520" href="#520">520</a> <em class="jxr_javadoccomment"> * Retrieves the identifier name of the default certificate. This should be the certificate </em>
-<a name="521" href="#521">521</a> <em class="jxr_javadoccomment"> * that is used for signature and encryption. This identifier corresponds to the certificate </em>
-<a name="522" href="#522">522</a> <em class="jxr_javadoccomment"> * that should be used whenever KeyInfo is not present in a signed or an encrypted </em>
-<a name="523" href="#523">523</a> <em class="jxr_javadoccomment"> * message. May return null. The identifier is implementation specific, e.g. it could be the</em>
-<a name="524" href="#524">524</a> <em class="jxr_javadoccomment"> * KeyStore alias.</em>
-<a name="525" href="#525">525</a> <em class="jxr_javadoccomment"> *</em>
-<a name="526" href="#526">526</a> <em class="jxr_javadoccomment"> * @return name of the default X509 certificate.</em>
-<a name="527" href="#527">527</a> <em class="jxr_javadoccomment"> */</em>
-<a name="528" href="#528">528</a> @Override
-<a name="529" href="#529">529</a> <strong class="jxr_keyword">public</strong> String getDefaultX509Identifier() <strong class="jxr_keyword">throws</strong> WSSecurityException {
-<a name="530" href="#530">530</a> <strong class="jxr_keyword">if</strong> (defaultAlias != <strong class="jxr_keyword">null</strong>) {
-<a name="531" href="#531">531</a> <strong class="jxr_keyword">return</strong> defaultAlias;
-<a name="532" href="#532">532</a> }
-<a name="533" href="#533">533</a>
-<a name="534" href="#534">534</a> <strong class="jxr_keyword">if</strong> (keystore != <strong class="jxr_keyword">null</strong>) {
-<a name="535" href="#535">535</a> <strong class="jxr_keyword">try</strong> {
-<a name="536" href="#536">536</a> Enumeration<String> as = keystore.aliases();
-<a name="537" href="#537">537</a> <strong class="jxr_keyword">if</strong> (as.hasMoreElements()) {
-<a name="538" href="#538">538</a> String alias = as.nextElement();
-<a name="539" href="#539">539</a> <strong class="jxr_keyword">if</strong> (!as.hasMoreElements()) {
-<a name="540" href="#540">540</a> defaultAlias = alias;
-<a name="541" href="#541">541</a> <strong class="jxr_keyword">return</strong> alias;
-<a name="542" href="#542">542</a> }
-<a name="543" href="#543">543</a> }
-<a name="544" href="#544">544</a> } <strong class="jxr_keyword">catch</strong> (KeyStoreException ex) {
-<a name="545" href="#545">545</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="546" href="#546">546</a> WSSecurityException.FAILURE, <span class="jxr_string">"keystore"</span>, <strong class="jxr_keyword">null</strong>, ex
-<a name="547" href="#547">547</a> );
-<a name="548" href="#548">548</a> }
-<a name="549" href="#549">549</a> }
-<a name="550" href="#550">550</a> <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">null</strong>;
-<a name="551" href="#551">551</a> }
-<a name="552" href="#552">552</a>
-<a name="553" href="#553">553</a> <em class="jxr_comment">//</em>
[... 1684 lines stripped ...]