File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes SSL sockets - adapter class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "SSL sockets - adapter class" Watch "SSL sockets - adapter class" New topic
Author

SSL sockets - adapter class

Vladimir Ergovic
Ranch Hand

Joined: Apr 22, 2001
Posts: 63
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?


Vladimir Ergovic
chris snyder
Greenhorn

Joined: Apr 24, 2001
Posts: 7
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

Joined: Apr 20, 2000
Posts: 3252
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

Joined: Apr 22, 2001
Posts: 63
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

Joined: Apr 22, 2001
Posts: 63
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!
 
IntelliJ Java IDE
 
subject: SSL sockets - adapter class
 
Threads others viewed
configuring RMI with SSL
Switching between SSL and non SSL mode using custom RMI socket factory
HTTPS POST using java.net
sending objects thorough socket connection
use ssl scokets to communicate to the server
IntelliJ Java IDE