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 ...
Get Learning Network Programming with Java 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.