title: Unable to connect to tor network using silvertunnel netlib in java
body: <p>I am trying to connect to tor network to send anonymous HTTP requests. But it throws <code>IllegalBlockSizeException</code>. I have used <code>silvertunnel.org_netlib.jar</code> </p>
  
  <pre><code>public static void main(String[] args) {
          try {
              // TODO code application logic here
               NetLayer lowerNetLayer = NetFactory.getInstance().getNetLayerById(NetLayerIDs.TOR); 
  
              lowerNetLayer.waitUntilReady();
              NetlibURLStreamHandlerFactory factory = new NetlibURLStreamHandlerFactory(false);
               factory.setNetLayerForHttpHttpsFtp(lowerNetLayer);
              String urlStr = "http://www.whatismyip.com/";
              URLStreamHandler handler = factory.createURLStreamHandler("http");
              URL context = null;
              URL url = new URL(context, urlStr, handler);
              HttpURLConnection connection = (HttpURLConnection) url.openConnection();
          connection.setDoOutput(true);
          connection.setRequestMethod("GET");
          //connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
          //connection.setRequestProperty("Content-Length",  String.valueOf(postData.length()));
  
          // Write data
           OutputStream os = connection.getOutputStream();
  
  
          // Read response
          StringBuilder responseSB = new StringBuilder();
           BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
  
          String line;
          while ( (line = br.readLine()) != null)
             responseSB.append(line);
  
          // Close streams
          br.close();
          os.close();
          Document doc=Jsoup.parse(responseSB.toString());
  
          } catch (IOException ex) {
              System.out.println(ex);
          }
  
      }
  </code></pre>
  
  <p>I got this error:</p>
  
  <pre><code>`WARNING: Directory.updateNetworkStatusNew Exception
  java.lang.RuntimeException: javax.crypto.IllegalBlockSizeException: Data must not be longer than 256 bytes
      at org.silvertunnel.netlib.layer.tor.util.Encryption.verifySignature(Encryption.java:272)
      at org.silvertunnel.netlib.layer.tor.directory.DirectoryConsensus.&lt;init&gt;(DirectoryConsensus.java:117)
      at org.silvertunnel.netlib.layer.tor.directory.Directory.updateNetworkStatusNew(Directory.java:377)
      at org.silvertunnel.netlib.layer.tor.directory.Directory.refreshListOfServers(Directory.java:287)
      at org.silvertunnel.netlib.layer.tor.directory.DirectoryManagerThread.updateDirectory(DirectoryManagerThread.java:60)
      at org.silvertunnel.netlib.layer.tor.directory.DirectoryManagerThread.run(DirectoryManagerThread.java:76)
  Caused by: javax.crypto.IllegalBlockSizeException: Data must not be longer than 256 bytes
      at com.sun.crypto.provider.RSACipher.doFinal(RSACipher.java:337)
      at com.sun.crypto.provider.RSACipher.engineDoFinal(RSACipher.java:382)
      at javax.crypto.Cipher.doFinal(Cipher.java:2087)
      at org.silvertunnel.netlib.layer.tor.util.Encryption.verifySignature(Encryption.java:251)
      ... 5 more
  `
  </code></pre>