O'Reilly logo

J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software by Art Taylor

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required