Several SSL Connections in one Application
Hi, Im triing to wirte an application that connects to several SSL- servers. When Im writing an application with one connection I set the systemproperties javax.net.ssl.keyStore and password and use the SSLSocketFactory.getDefault().
But now, this doesnt work, heres my testcode:
System.setProperty("javax.net.ssl.keyStore","c:/keystore1");
System.setProperty("javax.net.ssl.keyStorePassword","123456");
System.setProperty("javax.net.ssl.trustStore","c:/keystore1");
System.setProperty("javax.net.ssl.trustStorePassword","123456");
SSLSocket s = (SSLSocket) SSLSocketFactory.getDefault().createSocket("server1", 1099);
s.startHandshake();
System.out.println("Handshake1 works");
System.setProperty("javax.net.ssl.keyStore","c:/keystore2");
System.setProperty("javax.net.ssl.keyStorePassword","tetappl");
System.setProperty("javax.net.ssl.trustStore","c:/keystore2");
System.setProperty("javax.net.ssl.trustStorePassword","tetappl");
s = (SSLSocket) SSLSocketFactory.getDefault().createSocket("server2", 636);
s.startHandshake();
System.out.println("Handshake2 works");
Of cause, if this worked, I didnt write here. I think I have to create one SocketFactory for each connection, but I dont know how. Please help.
Bye Michael

