Design

The MIDlet allows the user to encrypt and decrypt messages using a 128-bit Advanced Encryption Standard (AES) key. The MIDlet first encrypts each message using AES. To ensure that the original message has not been tampered with, the MIDlet uses the SHA-1 digest algorithm to include a message digest in the message. (A stronger version of this scheme would use digital signatures to ensure the origin of the message. However, the SATSA-CRYPTO API does not support the creation of such signatures.)

The following figure shows the process of encoding and decoding messages used in the MIDlet.

Figure: Simplified cryptographic model used in the MIDlet

The MIDlet stores each message with the length of the message in two bytes, the encrypted message, and an SHA-1 digest. The length of the message is necessary, since the encryption process can enlarge the original message with some padding due to the cipher's block size. The following figure shows the message format.

Figure: Message format

The MIDlet UI has five views for operation, and one view for displaying error messages, as shown in the following figure. One view is used for scrolling through and selecting previously saved messages, one is for entering a new message to be stored in the record store of the device, and three are used for displaying the message in both encrypted and decrypted form.

Figure: MIDlet UI views

The MIDlet consists of the following classes:

  • SATSAMIDlet—MIDlet main class, which controls the state changes between views.

  • Codec—Handles the cryptographic operations.

  • MessageStore—Handles the record store.

  • ListScreen—Creates the main UI view of the MIDlet.

  • NewScreen—Creates a new message entry to the record store.

  • EncryptScreen—Displays the encrypted message in hexadecimal presentation.

  • PasswordScreen—Displays a prompt asking the user for a password, and forwards the password to the SATSAMIDlet class for message decryption.

  • DecryptScreen—Displays the decrypted plain text message.

  • InfoScreen—Simple utility class for displaying exceptions and alerts.

For information about implementing the MIDlet, see section Implementation.