File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Need coding help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Need coding help" Watch "Need coding help" New topic
Author

Need coding help

Rajesh kannan
Greenhorn

Joined: Jun 06, 2005
Posts: 22
I need to code encryption/decryption in a java based client server application. [I am new to client/server programming]

I have a swing client which takes user id and password. On the client side, I have another class, client.java which can take userid/password and do encryption.
Now, I have to do decryption. How do I call the server side class ?
Also, we have to have this done by des.

Can anyone give me code samples for des encryption/decryption using Java ?

Thanks
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

http://www.coderanch.com/t/377730/java/java/Encryption-client-server-data


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Rajesh kannan
Greenhorn

Joined: Jun 06, 2005
Posts: 22
Thanks Marc,


I would prefer to have a DES implementation for my encryption/decryption..

Any ideas..
Horatio Westock
Ranch Hand

Joined: Feb 23, 2005
Posts: 221
http://javaalmanac.com/egs/javax.crypto/DesString.html
Rajesh kannan
Greenhorn

Joined: Jun 06, 2005
Posts: 22
Thanks,

I already saw this example. But this example still uses Base64 type of encoding,

See this line:
return new sun.misc.BASE64Encoder().encode(enc);

I want to avoid using base64 encoding/decoding.

Any thoughts ?
Horatio Westock
Ranch Hand

Joined: Feb 23, 2005
Posts: 221
Well, as long as you don't mind passing around a byte array, you can skip the base64 encoding/decoding. You just need to alter those methods slightly to accept as a parameter/return a byte[].

Just depends upon how you want to use the data you are working with. For example, writing to an XML file you might want it base64 encoded, passing to another method or somesuch then a byte[] would be fine.
Rajesh kannan
Greenhorn

Joined: Jun 06, 2005
Posts: 22
Thanks.

Basically I want to pass in id/password, encrypt them, send to the server.

In server, id/password will be decrypted and I would like to convert byte[] to String...
Rajesh kannan
Greenhorn

Joined: Jun 06, 2005
Posts: 22
Horatio,

AS I mentioned before, I would like to return a String.
How can I return a string without using base64 encoder/decoder ? Our company stays away from base 64 encodier/decoder.

Any help...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Need coding help