I used to have a bot that interacted with the btce api through java/netbeans, and then after the MtGox fiasco I shut it down for a while. Now I am trying to start it back up, but while bitstamp and cbx are working fine, my btce exchange interface is broken. I am getting a "PKIK path building failed, unable to find valid certification path". Given that btce changed their certificate recently, it seems that this certificate change must be related to the problem.

I have done some research and evidently this means that I need to add the new btce certificate to my trust store in java. After some further research, I understand that this involves adding a cetificate file to my cacerts keystore in myc:/program files/java/jre8/lib/security directory. I have tried doing it manually through firefox to a cer file, and putting it inside program files (x86)/java/jre8/bin and installing it through the command line using the following commands inside the same /java/jre8/bin directory:

$set KEYTOOL_PASS = 'changeit'
$keytool -import trustcacerts -keystore ../lib/security/cacerts -storepass %KEYTOOL_PASS% -noprompt -alias 'BTCE' -file btce.cer

But this did not work either. I talked to a friend who told me that perhaps I not only need to add the btce certificate, but also the godaddy G2 certificates on which it depends. So I exported those from firefox and added them to my keystore as well. But still I am getting the same "PKIK path building failed" error when I try to run my program in netbeans.

I cannot figure out what to do from here. My friend who is a server-side programmer is out of ideas, and I have tried every linux command I can find by googling this issue. And BTC-E.com says that they do not offer programming support, and said, I quote, "there is nothing we can do to help". so I am now turning to bc stack exchange. I would appreciate your help!



  • Have you tried to delete obsolete certificate? stackoverflow.com/questions/3008885/…
    – Sly
    Aug 13 '14 at 19:12
  • Hi Sly, yes, I deleted all of the godaddy certificates that were previously associated with btc-e.com.
    – Paul
    Aug 20 '14 at 19:57
  • I have posted a $100 bounty on odesk.com to whoever can walk me through the solution to this problem.
    – Paul
    Aug 21 '14 at 2:50

I have got two JREs in my windows 7 machine. I have executed both below listed commands and I am able to connect it btce.

keytool -import -keystore "C:/Program Files/Java/jdk1.8.0_05/jre/lib/security/cacerts" -storepass "changeit" -noprompt -alias "BTCE" -file C:/Users/Dell/Downloads/btceSERVER.cert

keytool -import -keystore "C:/Program Files/Java/jre8/lib/security/cacerts" -storepass "changeit" -noprompt -alias "BTCE" -file C:/Users/Dell/Downloads/btceSERVER.cert

Points to note:

  1. I have mentioned full path for the keystore
  2. I have not used trustcacerts

Awaiting response

Two ways I can think of to download certificate. First(using linux): echo -n | openssl s_client -connect btc-e.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/btceSERVERNAME.cert

Second(using firefox): 1. Visit h t t p s:/ / btc-e.com/ 2. Click on the small Lock icon present in front of https in the url section. This will bring up a small popup 3. Click "More information" button, this will bring up a popup window titled as "Page info", 4. Click "View certificate", this will bring up certificate viewer 5. In certificate viewer, select "Details" tab 6. Click export button, which will bring up file save dialogue to save the cert.

  • Hi Senthil, thank you for your comment. This looks promising. One part that you left out (maybe because yout hought it was obvious) is how to get the correct btceSERVER.cert file in the correct format.
    – Paul
    Aug 22 '14 at 14:50
  • Hello Paul, (1) click on the lock icon apears in front of "btc-e.com" in firefox, this will bring up Small window. (2) Click "More information". (3) Click "View certificate" (4) select "Details" Tab (5)click "Export" , will bring up file save dialogue. you can save it with your preferred name. Aug 22 '14 at 18:04
  • Ok, that is what I did before but the only options are for me to export it as PEM, DER, and PKCS. Should I should just save it as "all files" and then add a .cert extension to the name?
    – Paul
    Aug 22 '14 at 19:04
  • ".cert" is something I added on my own, you don't need to add. I think you just save it as all files. Aug 22 '14 at 19:10
  • hmm... when I save it as "all files", windows automatically puts a ".com" extension on it and recognizes it as an ms-dos application...
    – Paul
    Aug 22 '14 at 22:58

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.