GeeCON Prague 2014*
The moose likes Java in General and the fly likes A simple SSL Client Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "A simple SSL Client Server" Watch "A simple SSL Client Server" New topic
Author

A simple SSL Client Server

chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

I was reading about SSL and thought of implementing a simple client-server application in which client establishes ssl connection with the server. I tried to google online but couldnt find any examples/resources. Can anyone point me to any resources?


Enjoy, Chander
SCJP 5, Oracle Certified PL/SQL Developer
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

Use SSLSocket and SSLServerSocket, which can be retrieved through SSLSocketFactory and SSLServerSocketFactory. The createSocket and createServerSocket methods return a Socket and ServerSocket respectively, but if you really need any methods from SSLSocket / SSLServerSocket you can just cast the return values.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
chander shivdasani
Ranch Hand

Joined: Oct 09, 2007
Posts: 206

Do these classes abstract the entire handshaking mechanism and other steps needed for SSL connection? If yes, then from where do they get certifcates and keys?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19697
    
  20

If I recall correctly, from the default keystore. You can modify that either using the keytool command or from code (but I can't remember which classes / methods to use).
 
GeeCON Prague 2014
 
subject: A simple SSL Client Server