tags:

views:

250

answers:

3

Hi All ,

How to implement java RMI over SSH v2 protocol.Is this possible?.If its not possible then can i achieve this using raw socket communication?.Simply i want to transmit my data via RMI but it should be encrypted as SSH v2 packets .

+1  A: 

Did you check Using RMI with SSL? The The New RMI article on java.net might be worth the read too.

(EDIT: The OP has updated his question and is actually looking for RMI over SSH so I'm updating my answer.

I never tried it but I guess you should be able to tunnel RMI through SSH. I don't see why it shouldn't be possible. Create a SSH tunnel and there you go.

There is a two parts article on javaranch about this, SSH Tunneling for Java RMI Part-I and Part II, that provides more details.

To be honest, I'm not sure why you should prefer SSH over SSL (which has strong authentication too)).

Pascal Thivent
sorry wrongly asked its about java RMI over SSHv2
Sidharth
A: 

Just open up some ssh tunnels via port forwarding and you can do this completely transparently.

disown
+1  A: 

Use an API like this http://www.jcraft.com/jsch/ to open an ssh tunnel (port forwarding from local machine to remote, on the port where the RMI service is listening), then configure your RMI client to connect to the local (forwarded) port.

Alex R
Alex can u give me some code snippet to do this?
Sidharth
There are two PortForwarding examples at http://www.jcraft.com/jsch/examples/ ... one of them should be almost exactly what you need.
Alex R