Jan 22

To listener for SSL connections you need to use a ServerSocket using the SSLServerSocketFactory cla as shown in the following example.


// Create the listening server socket

ServerSocketFactory serverSocketFactory =
   SSLServerSocketFactory.getDefault();
int port = 443;
ServerSocket ssocket =
   serverSocketFactory.createServerSocket(port);

// Listen for SSL connections

Socket socket = ssocket.accept();

// Treat the connection as you would any socket

In addition you will also need to add the certificate (that is sent to the connecting client) to the keystore used by the application.

written by objects \\ tags: , , , ,

Oct 15

You need to add the public key of the server you are connecting to to the keystore being by your application.

You can use the application InstallCert found in the question “How do I programatically extract a certificate from a site and add it to my keystore?” to extract the public key from the server and store it in your keystore.

written by objects \\ tags: , , ,

Oct 15

You can specify the keystore location wusing the javax.net.ssl.keyStore system property

java -Djavax.net.ssl.keyStore=<path to keystore file> -Djavax.net.ssl.keyStorePassword=<keystore password> au.com.objects.MyServer

written by objects \\ tags: , ,