Skip to main content
IBM  
Shop Support Downloads
IBM Home Products Consulting Industries News About IBM
IBM developerWorks : Java : Education - Tutorials
Using JSSE for secure socket communication
ZIPPDF (letter)PDF (A4)e-mail
Main menuSection menuFeedbackPrevious
Next Section
5. Using JSSE sockets
  


Server-side setup page 11 of 11


Setting up the server side is more or less the same as setting up the client side, so we won't go over it in detail. Of course, the server reads its key information from client.public and server.private, rather than from server.public and client.private.

In addition, the code to carry out the final step (establishing a connection) is a little different for the server side, as shown here:


        SSLServerSocketFactory sf = sslContext.getServerSocketFactory();
        SSLServerSocket ss = (SSLServerSocket)sf.createServerSocket( port );
        ss.setNeedClientAuth( true );

Note that we called SSLServerSocket.setNeedClientAuth(). This is the server call indicating that the client should authenticate itself. Client applications do not authenticate themselves by default, so you must make this call if you want client authentication to be part of the handshaking process.


Next Section
Main menuSection menuFeedbackPrevious
Privacy Legal Contact