What libraries exist for programming Tor Hidden Services in Java?

I am looking for a Java implementation of the Tor Rendezvous Specification that allow you to implement a service using an existing implementation of the protocol. This library would let you implement a call back and handle the Tor protocol for you the same way you can extends the class Servlet and have the servlet container handling the HTTP protocol for you.

If possible, please provide links for the libraries home page, sample code and tutorials.


Hidden Services are simply servers. Tor doesn't care, or know, about what exactly is serving the service - it could be a website, or an email server, or almost anything else.

If you can write a Server in Java (or use an existing one such as Jetty for a HTTP Server), then you can use it to serve a Hidden Service. You would configure it so that it will accept TCP connections only from localhost/ on a port of your choosing. Further help with either configuring an existing Java Server, or writing your own is probably beyond the scope of this site.

You would then edit your Tor configuration file to tell it to publish a Hidden Service, where your Tor Client would forward the requests to the port you specified in your Server. For further details see the Tor Documentation, or other questions such as this one. If you encounter an issue with this part of the setup, that problem may be on topic here, so further questions could be asked.

  • Or any other kind of TCP server for that matter. No need to serve HTTP. – Sam Whited Oct 31 '13 at 1:31
  • Good point. edited. – Megan Walker Oct 31 '13 at 8:28
  • When you run a program like torchat do not need to edit the configuration of tor, neither to have tor install. There are program that publish a hidden service directly. This is doable in Java. Is there a library that does it. – Guillaume Coté Oct 31 '13 at 22:00
  • I added the word programming in the question to make it obvious that the question is about programming. – Guillaume Coté Oct 31 '13 at 22:43
  • Can you please edit your answer so it fit the question or remove it? – Guillaume Coté Nov 1 '13 at 12:03

silvertunnel-ng should do what you want. It's a Java library for easily accessing the Tor network.

Checkout the Unittests for how to access/provide a hidden service.


T0rlib4j is the best choice by far because it is fullly funtional and is up to dated . With it you can use a java app Tor's control protocol to communicate against the Tor process an connect to a hidden service via SOCKS4a/5 proxy. The documentation is fully detailed and worths to take a look. In addition, it has a working Samples Client - Server model in order to start connecting to Tor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.