aspose file tools*
The moose likes Sockets and Internet Protocols and the fly likes Decrypt String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Decrypt String" Watch "Decrypt String" New topic
Author

Decrypt String

Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

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

Joined: Oct 27, 2005
Posts: 19784
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Mathew Mintalm
Ranch Hand

Joined: Feb 21, 2010
Posts: 103

Ok, thank you for information.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Decrypt String