The SSLClient Class Constructor

The SSLClient class constructor contains the details of obtaining the SSLSocketFactory reference. The SSLSocketFactory must be initialized using three arguments: the keystore to be used, the truststore to be used, and the SecureRandom class reference to use.

As was done in the SSLServer constructor, the password is created as a character array. The getInstance factory method for the KeyStore is then created using the JKS format. The KeyStore is then loaded, passing both the password and the InputStream for the keystore file to the load method. In this case, the truststore file is read from the directory in which the program is run.

A TrustManagerFactory is then created using the default encryption algorithm. The ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software 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.