[jdev] ByteStream Out-Band SOCKS5 problem... SHA1 Host not found

Anthony AnthonyPaulO at gmail.com
Fri Feb 25 06:44:14 CST 2005


Good morning everyone,

Last week I decided to sit down and write a Jabber client in a Java applet, 
and I've implemented the basics so far (am able to digest/plain-text log in, 
check roster, send/process presence, and chat.) Now I would like to add File 
Transfer capabilities, specifically SOCKS5 Bytestreams 
(http://www.jabber.org/jeps/jep-0065.html). I think I am doing everything 
right, but for some reason it keeps telling me that it is unable to find the 
(SHA1 hashed) host.

I am doing all my testing on my local machine, which is running the JabberD 
server as well as acting as a web server.
I am using a PSI client to send the file and my java applet is receiving. * 
note : props to the PSI people... good job on the client. *
I am also aware that an applet can only open a socket connection to the 
webserver hosting the applets' webpage, which is why I plan on implementing 
the proxy "middleman" protocol later on but for now I just want to do a 
direct transfer, so I've temporarily enabled all socket access in my 
.java.policy file.

This is basically what I have going on in pseudo java :

* XML STREAM INFO SENT FROM PSI INITIATOR *
<iq xmlns='jabber:client' type='set' to='aortiz at 68.101.84.233/JClient' 
id='ab33a' from='venkata at 68.101.84.233/Psi'>
   <query xmlns='http://jabber.org/protocol/bytestreams' mode='tcp' 
sid='s5b_8e463861b5e6bc04'>
      <streamhost xmlns='http://jabber.org/protocol/bytestreams' port='8010' 
host='192.168.1.100' jid='venkata at 68.101.84.233/Psi'/>
      <fast xmlns='http://affinix.com/jabber/stream'/>
   </query>
</iq>
* END OF STREAM INFO *

* CODE START*
sid = s5b_8e463861b5e6bc04
from = venkata at 68.101.84.233/Psi
to = aortiz at 68.101.84.233/JClient

// using libidn/java/gnu/inet/encoding/Stringprep.java -- too boring to 
implement, thk god I found this!
String SocksHost = SHA1(sid + Stringprep.nameprep(from + to)); // HASH 
OUTPUT=9134A1B74EB358B866C604B1E1B0DDEE0D664967

host = 192.168.1.100
port = 8010
// using http://lightning.prohosting.com/~kirillka/SOCKS/SOCKSLib.html 
SOCKS5 library. thk god for this too!
Proxy.setDefaultProxy(host, port);
Socket ss = new SocksSocket(SocksHost, 0);  // <-- Unknown Host Exception

* CODE END *

I'm sure my SHA1 algorithm works since I use it for digest authentication 
and I log in fine. Can anyone spot the problem here? Can someone confirm 
that my hash of the provided [sid + from + to] is correct? Can anyone 
provide some insight or some example code?

Also, the jep--0065 is sort of vague on what should be going on here, 
especially where they say that the target MAY have to authenticate with the 
proxy. I don't understand what they mean by MAY... either you do or you 
don't is what I figure. Are there any documents out there that can explain 
this whole process in absolute detail?

Thanks everyone!!

Anthony 






More information about the JDev mailing list