Under the Hood

Architecture

The nucleus of CipherMail is the Message class, which encapsulates an email message. The other four classes of the CipherMail application use the Message class as follows:

  • POP3 manages a connection to a POP3 mail server. It receives email messages from the server and converts them to Message instances.

  • SMTP manages a connection to an SMTP mail server. It can take a Message instance and convert it into an outgoing email message.

  • Composer is a window that is used to create new Messages.

  • CipherMail, the main application window, keeps a list of Messages (the in-box) and can display the contents of messages.

Of these classes, CipherMail is the only one that knows anything about cryptography. Message only encapsulates message data, not caring whether its contents are encrypted. POP3 and SMTP understand how to exchange Messages with mail servers. And Composer creates a new, unencrypted Message . It is CipherMail that encrypts the contents of messages before they are sent out and decrypts their contents before they are displayed.

Like SafeTalk, CipherMail uses a KeyManager to keep track of cryptographic keys. The KeyManager class is presented in Chapter 5.

Figure 11.4 shows how Message objects are passed among the CipherMail classes. The POP3 class, for example, retrieves Messages from the Internet and passes them to CipherMail. The Composer window creates a new Message, which it gives to CipherMail; CipherMail uses an SMTP object to send the Message

Get Java Cryptography 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.