This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Decrypt String

 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

If someone can help me, would be great, thanks.
 
Rob Spoor
Sheriff
Pie
Posts: 20533
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Mathew Mintalm
Ranch Hand
Posts: 103
Eclipse IDE Firefox Browser Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thank you for information.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic