HKPClient (JAVA) not working properly or something I'm doing wrong

27 views
Skip to first unread message

Daniel Salinas

unread,
Mar 12, 2015, 1:50:19 PM3/12/15
to didisof...@googlegroups.com
Hi
 
I want to retrieve a public key from HKP Server (4 different) but not working properly
I´m using the Trial Java Library + JRE 1.6
 
But always return the same errors: Connection reset (MIT & sks-keyservers) or Connection Time Out (rediris.es & zdv.uni-mainz.de)
 
This is my code (also try without HKPClient parameters... only server without Port and/or https connection.. with same results):
 
try
{
   boolean useHttps = false;
   HKPClient hkp = new HKPClient("pgp.mit.edu", 80, useHttps);
   //HKPClient hkp = new HKPClient("hkps.pool.sks-keyservers.net", 80, useHttps);
   //HKPClient hkp = new HKPClient("pgp.rediris.es", 11371, useHttps);
   //HKPClient hkp = new HKPClient("pgp.zdv.uni-mainz.de", 11371, useHttps);
   
   hkp.setPartialMatchUserIds(true);
   byte[] keyBytes = hkp.getKeyByUserId("Julio Cesar Arellano");
   if (keyBytes != null && keyBytes.length > 0)
      {
         String keyInAscii = new String(keyBytes, "ASCII");
         System.out.println("key found");
         System.out.println(keyInAscii);
      }
      else
      {
         System.out.println("no key found");
      }
   }
   catch (IOException e)
   {
      System.out.println("ERROR: " + e.getMessage());
   }
}
 
 
But ... if I do the same test with the C# library (Visual Studio 2013 + NET 3.5) works perfect in all cases.
 
Please help =D
Daniel

didisoft

unread,
Mar 13, 2015, 1:59:24 AM3/13/15
to didisof...@googlegroups.com
Hi Daniel,

I have tested your code and it works fine - the key is retrieved immediately.

Can you please check don't you have any firewall restrictions for the Java runtime on your test system.
This could be the reason for the timeout.

Best,
Peter Kalef ' DidiSoft
Reply all
Reply to author
Forward
0 new messages