The SSLServer Class Constructor

The SSLServer class constructor does the work necessary to create the SSL connection. Within this constructor, the KeyManagerFactory must be created to provide the keys necessary to allow encryption and to provide clients to the server some assurance that we are who we say we are.

In this example, the keys are stored in a keystore in the form of X.509 certificates. We therefore require a password to our keystore, which we've chosen to embed in our code in plain text. (More sophisticated and secure implementations would store this password in encrypted form in a hidden file or database.)

An SSLContext is used to obtain our SSLServerSocketFactory instance, so the static getInstance method is called to obtain a new ...

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.