Creating an SSL Server Program

The key management aspect of SSL is by far the toughest part. If you've made it this far, it's all downhill from here. Using the javax.net.ssl.SSLServerSocket class is just like using the ServerSocket class except that you must create the socket a different way. Also, you must tell Java your key store password one way or another.

To create an SSLServerSocket object, you must create an SSLServerSocketFactory and then ask the factory to create the SSLServerSocket, as shown in Listing 35.2.

Code Listing 35.2. SSLServerSocket Creation
 // Create a socket for receiving incoming connections SSLServerSocketFactory sslServerFactory = (SSLServerSocketFactory) SSLServerSocketFactory.getDefault(); SSLServerSocket serverSock ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.