Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Example of SSLSocket

 
John Landon
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Where I can find an example of usage of SSLSocket with keystore....
Like here but Socket (because I am on client side).
http://stackoverflow.com/questions/867751/ssl-and-socketchannel

Thanks!
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The example with SSLContext and SSLServerSocketFactory can be easily adapted to use a SSLSocketFactory instead of a SSLServerSocketFactory. Using that SSLSocketFactory you can then create (SSL) sockets.
 
John Landon
Ranch Hand
Posts: 228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:The example with SSLContext and SSLServerSocketFactory can be easily adapted to use a SSLSocketFactory instead of a SSLServerSocketFactory. Using that SSLSocketFactory you can then create (SSL) sockets.


I figured.. But the problem is that the code does not even compile.
For example: KeyStore keyStore = new KeyStore();
You cannot do because the constructor is protected. You need to do getInstance and I don't know what "type" to provide....

I am looking for some code that has been ran at least.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic