0% found this document useful (0 votes)
38 views

Client Server Chat Application

1) The document describes a client-server chat application where encryption is used to securely transmit messages from client to client. 2) When users log in, their passwords are hashed using MD5 encryption before being validated against a list of registered users. 3) Once logged in, clients can exchange encrypted messages via the server that are decrypted only by the intended recipients.

Uploaded by

Habib Ait Elkadi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Client Server Chat Application

1) The document describes a client-server chat application where encryption is used to securely transmit messages from client to client. 2) When users log in, their passwords are hashed using MD5 encryption before being validated against a list of registered users. 3) Once logged in, clients can exchange encrypted messages via the server that are decrypted only by the intended recipients.

Uploaded by

Habib Ait Elkadi
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Journal of Multidisciplinary Engineering Science and Technology (JMEST)

ISSN: 2458-9403
Vol. 3 Issue 7, July - 2016

Client Server Chat Application


M. A. Mioc

University Stefan cel Mare Suceava


Integrated Center for research, development and innovation in
Advanced Materials, Nanotechnologies, and Distributed Systems – MANSiD
Suceava, Romania
[email protected]

Abstract—Nowadays it is a continuous transmitting the secret communication key, which is


increasing of the networks interconnections then used in a secret key algorithm, like 3DES or
which generates a growing necessity to keep the AES.
information secure from the eavesdroppers
AES (Advanced Encryption Standard), known also
attacks and also from the hackers. Despite the
fact that the scientific fundamentals of Coding by the name of Rijndael, is a standard algorithm for
Theory are already known for years it is important blocks symmetric encrypting, used today on a large
to present some researches from this area. The domain of applications and adopted as standard by
development of Coding Theory produced the Governmental American Association NIST. The
successful applications in Cryptography, in Error new standard algorithm developed by the two Belgian
Detecting and Correcting Codes and in Wireless cryptographs, Joan Daemen and Vincent Rijmen
Communication Systems. This paper describes a
became the officially AES and newt to NIST for
research based on developing a client server chat
application. The originality of this work is given selection under the name of Rijndael [7].
by the encryption part of this implementation. So,
the encryption part through the encryption In the advanced proposal NIST, the two authors of
password logon, encryption and sending the algorithm Rijndael have defined a block
messages keeps them safe from client to client. encrypting algorithm having the independent lengths
for the block and for the key of 128 bits, 192 bits, or
Keywords—cryptography; security; ciphers;
plaintext; algorithm; encryption; decryption. 256 bits. AES specification standardizes all 3
dimensions possible for the length of the key, but
restricts the block length at 128 bits. Input and output
of encrypting and decrypting algorithm is a block of
I. INTRODUCTION 128 bits. In FIPS number 197, AES operations are
In cryptography, RSA is a cryptographic algorithm defined under the form of matrix operations, where
with public keys, first algorithm used for encrypting the key and the block are written in matrix format. At
and also for electrical signature. Algorithm was the beginning of cipher run, the block is copied in a
developed in 1977 and published in 1978 by Ron table named state having first 4 bites on the first
Rivest, Adi Shamir and Leonard Adleman at MIT column, then the next 4 on the second continuing in
having the name composed from all three authors the same way till all table is completed.
initials [2].
In 1978, in the Communications of Association for II. APPLICATION DESCRIPTION
Computing Machinery (ACM) some specific methods The application is composed of a server that
for obtaining Digital Signatures and Public-Key connects all users logged in the application. In order
Cryptosystems were presented by the same team [2]. to begin a chat the program must be ran and the
RSA is a block encrypting algorithm. This means that server should be started. In developing this research
the initial text (clear text), but also an encrypted text the main principles from the Handbook Applied
are numbers between 0 and -1, with a chosen n. A Cryptography were respected [3]. Some other
message longer than log. n is split in segments of the specific researches are done in many other domains
corresponding length, named blocks, which are as military [4], medicine [5] and commerce as well.
encrypted one by one. Also, as cryptographic Another problem is how to choose the most
algorithm with public keys, it functions based on a convenient algorithm for a specific application [6]. For
pair of keys mathematically connected to each other: this goal a comparison of the most frequently used
a public key, well known to all involved parts, and a Encryption Algorithms is important to be taken into
secret key, known only by its keeper. RSA is used account [9].
only at the beginning of communication, for

www.jmest.org
JMESTN42351694 5218
Journal of Multidisciplinary Engineering Science and Technology (JMEST)
ISSN: 2458-9403
Vol. 3 Issue 7, July - 2016

Fig. 4 UserName and Password part 2 – Client console

Fig. 1 Server start

Once the server is started, we can introduce the


users in the application, by opening 1, 2 or multiple
users. For this we search in project folder and we
chose the path “…\ChatServer\Client\bin\Debug” and
there we start the executable Client.
Fig. 5 UserName and Password part 3 – Error message

Password is encrypted with the hashing method,


more specifically MD5CryptoServiceProvider() has
been used. In the moment when user enters a name
and password, and clicks LogIn, a method call is
performed in which all registered users of the
application are returned and cached in a Dictionary
(name, password), then the hashing of the input
password is performed and a check is done on the
name, password existing pairs. If the password if
found, then the program is continued, otherwise text
Fig. 2 Executable Client
field for name and password are reseted and an error
message is shown.
The user must log in to the application with a
UserName and an existing Password from the
application. If the Password does not exist in the
application, an error message will be shown and all
messaging fields will become inactive. For logging
in, a text file is created, where the names of all
registered users are defined (name:daniela ; pswd:
daniela; Name: ion; Pswd: ionel ). UserName and
password of existing users are saved in a text
document from ChatServer “name_passwd.txt”
separated by comma, password being under hashed Fig. 6 UserName and Password part 4 – Login code
format.

Fig. 3 UserName and Password part 1 – name_passwd.txt

www.jmest.org
JMESTN42351694 5219
Journal of Multidisciplinary Engineering Science and Technology (JMEST)
ISSN: 2458-9403
Vol. 3 Issue 7, July - 2016

The same is for the server interface where all


connected users will be visible.

Fig. 10 Server Interface – Available users

For messages encrypting there have been used


Fig. 7 Encryption and error message code two tipes of encrypting: asymethrical encrypting with
a public key and RSA private key and symethrical
AES encrypting. Both modalities have been used
Hashing method (returns encrypted password as given RSA is the most secure encrypting method, but
string): has the inconvenience that it can not be used on long
messages. AES does the encrypting of the messages
while RSA is used to encrypt the key and the VI of
AES in order to send them both to the receiver of the
message. Below methods defined for this behaviour
have been described:
We create the publical key and the private key and
we save them in xml files. For Server we have the
folder ServerKeys, and each connected client will
have a folder ClientKeys.
Fig. 8 Hashing password code

If multiple users are connected, each of them will


see the others in the graphical interface he was
provided with, and can choose between all of them
the one he wants to start a chat with.

Fig. 11 ServerKeys Folder

Generation of RSA key and caching in XML files


is done by the code below.

Fig. 9 Client Interface – Available users


Fig. 12 Generation of RSA key and caching in XML files

www.jmest.org
JMESTN42351694 5220
Journal of Multidisciplinary Engineering Science and Technology (JMEST)
ISSN: 2458-9403
Vol. 3 Issue 7, July - 2016

Encrypting and decrypting with RSA is done by


the code below.

Fig. 15 Decrypting with AES

Fig. 13 Generation of RSA key and caching in XML files. Message transmission occurs in the following
manner. User logs in, user creates its own public key
and private RSA key and caches them locally, while
Encrypting and decrypting with AES is done by
the code below. the public key is forwarded to the server. Server
writes the public key in an xml format file, caches it
inside a directory and forwards all public keys to the
other users connected at that time. Server will store
all public keys of all users.
For being able to communicate each user will
select from the list another user, will write the
message. In the moment user will choose send
option from the chat panel, the message will be
encrypted using AES encrypting method, then by
using the destinations public key RSA algorithm is
applied to the AES message, the key and the VI.
These data are now transmitted to the Server. Server
receives the data, does not perform any action other
than transferring them to the destination (name of the
destination is also transmitted in order for the Server
to be able to forward the message). The destination
decrypts the data with the private key, then using the
key and the VI it decrypts the whole AES encrypted
message.
Fig. 14 Encrypting with AES

www.jmest.org
JMESTN42351694 5221
Journal of Multidisciplinary Engineering Science and Technology (JMEST)
ISSN: 2458-9403
Vol. 3 Issue 7, July - 2016

Fig. 19 Exit code for server shutdown

III. CONCLUSIONS

In this paper there has been presented a


research containg the development of an
application client server on the chat.
Fig. 16 Conversations as shown to the users In our own day it has a particular
importance to study different types of
implementations which can increase the
security in communication.
A special interest can be observed in
creating some possibilities to protect ourself
during the transmition of messages. The
whole project consists on two speciffic parts:
a first one which developed the client server
commumication and the second one
containing the encryption. While the first part
consists much more in putting together
some wellknown methods, the second part
is the original part of this research. We
Fig. 17 Send message code
combined modality through AES encryption
messages and sent encrypted and the key
The set of RSA keys are valid only during the message through a secure channel using
program execution, once closed, the keys will no RSA public key and private key. I also saved
longer be valid. On a different connection new sets locally keys to all customers and we
of keys will be created for the connected Client which distributed among them by using the Server
will overwrite the existing ones inside the xml files. and save them in a local encrypted file. (File
The server will be closed by selection of STOP that contains only the password hash sites).
button from the available interface having the
following implementation:
IV. ACKNOWLEDGEMENT
The infrastructure used for this work was
partially supported by the project Integrated
Center for research, development and innovation
in Advanced Materials, Nanotechnologies, and
Distributed Systems for fabrication and control,
Contract No. 671/09.04.2015, Sectoral
Operational Program for Increase of the
Economic Competitiveness co-funded from the
European Regional Development Fund.

Fig. 18 Stop Server code REFERENCES


which will stop the Server functioning, will delete the
[1] Rivest R., A. Shamir, L .Adleman, A method
list of names from the graphical interface, and if user
for Obtaining Digital Signatures and Public-Key
now will chose EXIT, Server will completely shut Cryptosystems, Communications of the ACM 21,
down. pp.120-126, 1978.

www.jmest.org
JMESTN42351694 5222
Journal of Multidisciplinary Engineering Science and Technology (JMEST)
ISSN: 2458-9403
Vol. 3 Issue 7, July - 2016

Public Key Based Scheme, ICACT 2008,


[2] The Original RSA Patent as filed with the February 17-20, 2008, pp. 1108-1111.
U.S. Patent Office by Rivest; Ronald L. (Belmont,
MA), Shamir Adi (Cambridge, MA), Adleman; [6] Vimalathithan R., M. L. Valarmathi,
Leonard M. (Arlington, MA), December 14, 1977. Cryptanalysis of Simplified-DES using
Computational Intelligence, TRANSACTIONS on
[3] Menezes A.J., van Oorschot P.C,Vanstone COMPUTERS, Issue 6, Volume 10, July 2011, pp
S.A.:Handbook of Applied Cryptography.The CRC 210-219
Press series on discrete mathematics and its
applications. CRC Press, 2000 N. W. Corporate [7] Daemen J., Rijmen V., "The Design of
Blvd., Boca Raton, FL 33431/9868, USA,1997. Rijndael: AES - The Advanced Encryption
Standard", Springer-Verlag, 2002.
[4] Gibson T., An architecture for Flexible Multi- [8] M. A. Mioc, S. G. Pentiuc – Comparison
Security Domain Networks, USA. between AES, Camellia and SEED, JMEST
(Journal of Multidisciplinary Engineering Science
[5] Haque M. M., Pathan A.-S. K., Hong C. S., and Technology) Vol.2 – Issue 12 (December –
Securing U-Healthcare Sensor Networks using 2015).

www.jmest.org
JMESTN42351694 5223

You might also like