O'Reilly logo

Learning Network Programming with Java by Richard M Reese

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

Asymmetric encryption client/server

The AsymmetricKeyUtility class developed in asymmetric encryption techniques is used to support the client and server applications. We will use it's encrypt and decrypt methods. The structure of the client and server applications is similar to what was used in previous sections. The client will send the server an encrypted message, which the server will decrypt and then respond to with plain text.

Asymmetric server application

The AsymmetricEchoServer class, as declared next, is used for the server. The main method is its only method. A server socket is created, which blocks at the accept method waiting for client request:

public class AsymmetricEchoServer { public static void main(String[] args) { System.out.println("Simple ...

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