[jboss-remoting-commits] JBoss Remoting SVN: r5625 - remoting2/branches/2.2/src/main/org/jboss/remoting/security.
jboss-remoting-commits at lists.jboss.org
jboss-remoting-commits at lists.jboss.org
Thu Dec 24 21:13:13 EST 2009
Author: ron.sigal at jboss.com
Date: 2009-12-24 21:13:13 -0500 (Thu, 24 Dec 2009)
New Revision: 5625
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/security/SSLSocketBuilder.java
Log:
JBREM-1172: Can handle keystore / truststore URL set to "NONE".
Modified: remoting2/branches/2.2/src/main/org/jboss/remoting/security/SSLSocketBuilder.java
===================================================================
--- remoting2/branches/2.2/src/main/org/jboss/remoting/security/SSLSocketBuilder.java 2009-12-25 02:08:55 UTC (rev 5624)
+++ remoting2/branches/2.2/src/main/org/jboss/remoting/security/SSLSocketBuilder.java 2009-12-25 02:13:13 UTC (rev 5625)
@@ -229,6 +229,8 @@
* when not using custom config.
*/
public static final String REMOTING_DEFAULT_SOCKET_FACTORY_CLASS = "org.jboss.remoting.defaultSocketFactory";
+
+ public static final String NONE_STORE = "NONE";
private SSLContext sslContextServerSocketFactory = null; // context that builds the server socket factories
private SSLContext sslContextSocketFactory = null; // context that builds the socket factories
@@ -262,6 +264,19 @@
private boolean useSSLSocketFactory = true;
private static final Logger log = Logger.getLogger(SSLSocketBuilder.class);
+
+ private static URL NONE_STORE_URL;
+
+ static
+ {
+ try
+ {
+ NONE_STORE_URL = new URL("file:NONE");
+ } catch (MalformedURLException e)
+ {
+ log.info("unexpected URL exception", e);
+ }
+ }
/**
* Constructor for {@link SSLSocketBuilder} that does not have
@@ -1536,13 +1551,18 @@
throw new NullStoreURLException("Can not find store file for url because store url is null.");
}
+ URL url = storePathURL == NONE_STORE_URL ? null : storePathURL;
+
// now that keystore instance created, need to load data from file
InputStream keyStoreInputStream = null;
try
{
- keyStoreInputStream = storePathURL.openStream();
-
+ if (url != null)
+ {
+ keyStoreInputStream = url.openStream();
+ }
+
// is ok for password to be null, as will just be used to check integrity of store
char[] password = storePassword != null ? storePassword.toCharArray() : null;
keyStore.load(keyStoreInputStream, password);
@@ -1582,6 +1602,11 @@
*/
protected URL validateStoreURL(String storePath) throws IOException
{
+ if (storePath == NONE_STORE)
+ {
+ return NONE_STORE_URL;
+ }
+
URL url = null;
// First see if this is a URL
More information about the jboss-remoting-commits
mailing list