2 Replies Latest reply on Sep 27, 2007 7:10 AM by Pavel Kadlec

    Secure Socket Connection Example question

    Pavel Kadlec Novice

      Hello,

      I was looking at Secure Socket Connection Example. Is it possible to configure client in a different way, not using system properties? For example is it possible to configure the client (truststore password, truststore path) from some decriptor or using some method parameters?

        • 1. Re: Secure Socket Connection Example question
          Andy Taylor Master

          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
            Pavel Kadlec Novice

            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