• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Securing a JAVA chat client with RSA

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello:

I have a simple java chat client that I would like to secure using RSA.

I have knowledge of how RSA works, but I am having trouble implementing it from JAVA.

If I need to obtain the Public Key from the server that my client connects to, do I need to have the ChatServer.java script obtain the Public Key from the server and then have my chatClient.java script grab that Public Key?

Please help, I need some direction.

 
Sheriff
Posts: 22862
132
Eclipse IDE Spring TypeScript Quarkus Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps you can use javax.crypto.Cipher for this. With such a Cipher you can use CipherInputStream and CipherOutputStream around your sockets' streams, and the API will take care of the encryption for you.

java.security.Key, used with Cipher, has sub interfaces like RSAPublicKey and RSAPrivateKey so I'm quite sure Cipher could be used with RSA. A little browsing through the API may be able to help you further along the right path.
 
Joanna Spence
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your help.

Ok I am reading the API on the classes you suggested.

If I know that the server is storing the public key somewhere...how would I obtain that with the chatclient.java script?

Would you like me to the post the code that I have so far?
 
Sheriff
Posts: 7413
1423
IntelliJ IDE jQuery Eclipse IDE Postgres Database Tomcat Server Chrome Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Elmira Love", please check your private messages regarding an important administrative matter.
reply
    Bookmark Topic Watch Topic
  • New Topic