Hello, I made my multi threaded client <-> server application.
How does it work?
1. Client try connect to the server
2. Server accpet clients
3. Client send String to the server
4. Server compare this string with String from server
5. If string sent from client equals to server string server send "stringIsOk" String
6. If client receive "stringIsOk" string, will print something.
Ok, it works as it should, but my friend told me thats unsafe, and told me that I should read about how to encrypt/decrypt.
I found this way to encrypt String (MD5)
But till now I couldn't code or find any way to decrypt string received with this way.
MD5 cannot be decrypted. It's one-way only. Use javax.crypto.Cipher instead, with an algorithm like AES.
An alternative is to use SSLServerSocketFactory to create SSLServerSocket instances instead of regular ServerSocket instances, and SSLSocketFactory to create SSLSocket instances instead of regular Socket instances.