Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

SSL sockets - adapter class  RSS feed

 
Vladimir Ergovic
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to write class that implements SSL Sockets instead of regular Sockets when using RMI. I have class that is adapter and now I have a problem:
How can I convert (easy way) SSL socket to regular one. Can I just cast it (I don't think so) or do I have implement all methods from Socket class?
 
chris snyder
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you familiar with the Java Secure Socket Extension (JSSE). It provides all the classes necessary to create SSL connections. The samples provided in the download demonstrate several ways of creating secure sockets for a number of purposes including RMI.
I found these links helpful: http://java.sun.com/products/jsse/ http://java.sun.com/products/jsse/doc/apidoc/index.html http://www.javaworld.com/javaworld/jw-05-2001/jw-0511-howto.html?
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In fact, JSSE comes with a complete example demonstrating how to use RMI over SSL. It's pretty easy... once you know how Have a look in jsse*\samples\rmi (it's in JDK 1.4 too but buried somewhere deep inside the documentation directories, have a look).
- Peter
 
Vladimir Ergovic
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, maybe I was not too clear. I am familiar with all those links and I red 3 books about it but there is no example how it should be done. For example in Remote Method Invocation Guide, author left the problem for reader to do as exercise
The problem is that interface defined in RMI say for example:
Socket accept().
Now if I do following:
Socket accept(){
return (Socket)sslSocketInstance;
}
Not good.
That is the problem!
 
Vladimir Ergovic
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, maybe I was not too clear. I am familiar with all those links and I red 3 books about it but there is no example how it should be done. For example in Remote Method Invocation Guide, author left the problem for reader to do as exercise
The problem is that interface defined in RMI say for example:
Socket accept().
Now if I do following:
Socket accept(){
return (Socket)sslSocketInstance;
}
Not good.
That is the problem!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!