• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need coding help

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://coderanch.com/t/377730/java/java/Encryption-client-server-data
 
Rajesh kannan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Marc,


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

Any ideas..
 
Ranch Hand
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://javaalmanac.com/egs/javax.crypto/DesString.html
 
Rajesh kannan
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 221
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic