A Secure Chat Program Message Decryption in Java

Decryption:

Once the database connection and the corresponding coding is done, the very next step in the coding is to decrypt the message that need to be communicated across this project. A typical client server module is used in this project and thus whenever a message is communicated between the client and server, the corresponding message is decrypted always and java coding is used in this case. DES algorithm is used to do the decryption process and the corresponding code used to develop the DES algorithm is coded in a separate java class named DESalgorithm, and the corresponding instance of the class is created as object and used in this process, whenever the message decryption is required between the client and the server.

The common communication attribute considered in this case, is a file and any file can be used an input for the communication process. Java has a separate package known as Java.io.*, where the required input and output streaming methods and classes are available with this package. The most commonly used classes among this package to read and write the file content are FileInputStream and FileOutputStream. Instance of these classes are created across the coding and they are initialized to null values, before reading or writing any file to the server or client.

The file input is given from the console and the Buffered Reader class can be used to read the file and make the necessary buffering bit wise. The file can be split accordingly and a separate set of mathematical calculations are done to calculate the decryption key and this can be achieved using the Math class of Java.lang package. A random key is generated using these math functions of java and then distributed among the users as per their requirement.

This key is converted in to the binary format and then split using the string functions among the users and again string concatenation should be used to remake the key and used. Once the file decryption process is completed, the corresponding input and output streams are closed and if in case they throw any exception, all of them are caught using the try and catch blocks. The actual coding followed for the decryption process is as shown in the appendix section. 

This Paper is written & submitted by Vamshidhar A.

Leave a Reply

Your email address will not be published. Required fields are marked *