Encryption:
Once the DES algorithm is done and the corresponding keys are generated and distributed among the users successfully, now the encryption can be done using this algorithm. The process of encryption is similar to the process of decryption as explained in the above section. Any file can be used as the input for this encryption process and in general the messages that pass among the client and server are encrypted and java IO package can be used read and write the corresponding required files.
File Input Stream and File Output Stream are used as the basic classes to read and write the required files and the file streams are opened as the instance of these classes and null values are assigned to these objects before reading or writing the required files. The required files are read from the console and once the files are read, they are divided using the random functions and the corresponding BufferReader classes.
Now the DES algorithm is used in this case to generate the keys are share the keys among the users involved in the communication process. Few math functions are used in this case, to generate the random keys and a separate class known as Encryption is created to handle all this process. The main input parameter to this class is the encryption keys generated using the DES algorithm and thus once the keys are passed, the required messages are encrypted and communicate as per the requirement.
Once the encryption process is done, all the objects are closed and the corresponding exceptions are caught using the try and catch blocks. The actual coding used to achieve this encryption process is given in the Appendix section.
This Paper is written & submitted by Vamshidhar A.