O'Reilly logo

Java Cryptography by Jonathan Knudsen

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

Under the Hood

Now that you know how to use SafeTalk, I’ll explain how it works, starting with an overview of SafeTalk’s architecture. After that, I’ll walk you through the code for each class.

Architecture

The SafeTalk application has five major components. The Session class is the center of this universe; it manages the connection with a remote SafeTalk application. The other four classes orbit around Session, each with a specific job:

  • SessionServer listens for incoming socket connections and notifies Session if a connection is received. It exists primarily to isolate the action of listening for connections into a thread that’s separate from the main application thread.

  • Receiver is used while a conversation is in progress. It lives in its own thread, listening for incoming data and notifying the Session . Session, in turn, notifies SafeTalk , and the incoming data is shown in the lower text area of the SafeTalk window.

  • The SafeTalk class itself is the GUI. It’s a subclass of Frame.

  • KeyManager manages the user’s key pair as well as the public keys of recipients. Session uses KeyManager when it exchanges a session key at the beginning of a conversation. SafeTalk uses KeyManager to import and export keys. This class is presented in Chapter 5.

Figure 10.2 shows the relationships of the SafeTalk classes.

SafeTalk architecture
Figure 10-2. SafeTalk architecture

Session

The Session class manages the niggly ...

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