-
1. Re: Secure Socket Connection Example question
ataylor Sep 24, 2007 7:01 AM (in response to kadlecp)For more info on how to configure JSSE take a look at the reference guide via http://java.sun.com/j2se/1.5.0/docs/guide/security/jsse/JSSERefGuide.html . Alternatively just set the System Properties using System.setProperty(prop,val);
-
2. Re: Secure Socket Connection Example question
kadlecp Sep 27, 2007 7:10 AM (in response to kadlecp)I have been trying to solve the problem and my solution is:
public class SecureSocketExample extends ExampleSupport {
...
public static void main(String[] args) {
System.setProperty(SSLSocketBuilder.REMOTING_DEFAULT_SOCKET_FACTORY_CLASS, "org.jboss.example.jms.common.MySSLSocketFactory");
new SecureSocketExample().run();
}
}
public class MySSLSocketFactory {
static {
HashMap<String, String> config = new HashMap<String, String>();
config.put(SSLSocketBuilder.REMOTING_KEY_STORE_FILE_PATH, "client.keystore");
config.put(SSLSocketBuilder.REMOTING_KEY_STORE_PASSWORD, "pssword");
config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_FILE_PATH, "client.truststore");
config.put(SSLSocketBuilder.REMOTING_TRUST_STORE_PASSWORD, "password");
SSLSocketBuilder ssb = new SSLSocketBuilder(config);
ssb.setUseSSLSocketFactory(false);
try {
sf = ssb.createSSLSocketFactory(null);
} catch (Exception e) {
e.printStackTrace();
}
}
private static SocketFactory sf;
public static SocketFactory getDefault() {
return sf;
}
}
Now the runtime reads truststore, keystore info from the configuration map. I will try to fill the map from the resource file of the deploy war/jar/ear... So I can have more different queue clients talking to different "ssl" queues.
If you have better solution, please suggest it.
Pavel Kadlec