Cryptography Reference
In-Depth Information
input.close();
connection.close();
//We are no longer connected
connection=null;
//Change components
serverField.setEditable(true);
connectButton.setLabel(“Connect to server above”);
enterField.setEnabled(false);
}
Here is the main() method of CipherChatClient, which simply sets up the GUI.
public static void main( String args[] ) throws IOException {
final CipherChatClient ccc = new CipherChatClient();
ccc.addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
);
}
}
Note that this chat program makes no attempt to authenticate its users. That is, you don't
know if the person on the other end of the socket is actually whom he or she claims to be
(without, perhaps, asking a few personal questions). To provide authentication, the keys
would not be generated for each connection, but would already be on file with a Trusted Third
Party, or TTP (see the chapter on cryptographic applications for discussion of a TTP). Each
communicant can check the received public keys against this database. It would be virtu-
ally impossible for a chatter to pretend to be someone else without knowledge of his or her
decryption keys. (They certainly would have a hell of a time trying to carry on an intelli-
gent conversation with you without being able to decrypt your messages!)
EXERCISE Realistically, a chat program should function both as a multithreaded server, and a multi-
threaded client. This would allow you to start your chat program and initiate connections
with multiple chatters, while at the same time listening for connections from other chatters
wishing to connect with you. Write an enciphered chat program with this capability, and use
a cipher other than RSA.
Search WWH ::




Custom Search