arlolra / ctypes-otr

js-ctypes wrapper for libotr
Mozilla Public License 2.0
29 stars 7 forks source link

Generating private key process does not finish #65

Closed psanders1 closed 8 years ago

psanders1 commented 8 years ago

Hi,

I have installed Tor Messenger and I created an XMPP account (jabber.calyxinstitute.org), but I am unable to create the private key by OTR preferences screen. the system is waiting a long time and does not finish the process. My operating system is Windows 10.

Please help me.

Regards

arlolra commented 8 years ago

Thanks for reporting the issue.

After attempting to generate the key, can you check Tools > Error Console for any errors? Are you using a VM? Are you able to generate a key with Pidgin on that machine? Did you try moving around the mouse / mashing the keyboard to provide some entropy to the system? Are you doing this immediately after system boot?

Sorry for all the questions. Trying to gather information.

psanders1 commented 8 years ago

Thank you for your feedback! Here are the information warning and errors.

After attempting to generate the key, can you check Tools > Error Console for any errors?

Tor WARN: Failed to find node for hop 0 of our path. Discarding this circuit. 

Timestamp: 30/01/2016 17:31:12
Warning: Unhandled presence stanza.
Source File: resource:///modules/xmpp.jsm
Line: 1276

Timestamp: 30/01/2016 15:11:13
Error: TypeError: this._idleService is undefined
Source File: jar:file:///C:/Users/S%C3%A9rgio/Documents/Tor%20Messenger/Messenger/omni.ja!/components/imCore.js
Line: 128

Are you using a VM?

No. I am not using a Virtual Machine.

Are you able to generate a key with Pidgin on that machine?

Yes I am able to generate a key with Pidgin in the same machine.

Did you try moving around the mouse / mashing the keyboard to provide some entropy to the system?

Yes, the system is ok. The other applications are running normally, but the nothing happens with the "Generating screen".

Are you doing this immediately after system boot?

No.

psanders1 commented 8 years ago

Hi,

I have a new Error Console Message (Now after clearing the error console log):

Timestamp: 30/01/2016 21:47:36
Error: A promise chain failed to handle a rejection. Did you forget to '.catch', or did you forget to 'return'?
See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise

Date: Sat Jan 30 2016 21:47:34 GMT-0200 (Hora oficial do Brasil)
Full Message: Error: Generating key failed!
Full Stack: otrPriv.onload/<@chrome://otr/content/priv.js:19:1
Handler.prototype.process@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:934:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:813:7
this.PromiseWalker.scheduleWalkerLoop/<@resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js:747:1
otrPref.generate@chrome://otr/content/prefs.js:89:5
oncommand@chrome://otr/content/prefs.xul:1:1

Source File: chrome://otr/content/priv.js
Line: 19
Source Code:
19
arlolra commented 8 years ago

@psanders1 Nice! Thank you. Is your system 32 or 64 bit?

psanders1 commented 8 years ago

32 bit

arlolra commented 8 years ago

I see ... well, that helps. I'll need to find a 32 bit Windows machine to test on. Thanks!

arlolra commented 8 years ago

Hmm, I had no issues on a 32 bit Windows 8 VM.

@psanders1 How adept are you at debugging? Could you add this statement Cu.reportError(err); on L217 (inside handleErr) of otr.js? And then try generating a key again?

arlolra commented 8 years ago

@azadi Tested in a 32 bit Windows 10 VM, also no issue.

psanders1 commented 8 years ago

Here is the Error Console, the code change I did is below. Is it correct?

Timestamp: 01/02/2016 18:27:09
Error: 16810065
Source File: chrome://otr/content/otr.js
Line: 218

Code change I did:

    let handleErr = function(err) {
      Cu.reportError(err)
      if (!newkey.isNull())
        libOTR.otrl_privkey_generate_cancelled(otr.userstate, newkey);
      return false;
    };
arlolra commented 8 years ago

the code change I did is below. Is it correct?

Yup, looks great, thanks.

So, 16810065 is a gcry_error_t and, unfortunately, we need to call gcry_err_code() on it to determine the gcry_err_code_t. The only thing Google points to for that particular value isn't very helpful.

https://lists.cypherpunks.ca/pipermail/otr-dev/2015-March/002323.html

I'll try and think about "next steps" here. Thanks for helping out so far.

arlolra commented 8 years ago

Yes I am able to generate a key with Pidgin in the same machine.

Btw, when did you last try that? Can you confirm that's still working for you now.

Can you think of anything specific to your environment that might be causing this issue?

Finally, can you download the latest version of Tor Messenger and install it in a different directory (we should keep the broken one around to try and get to the heart of the problem).

https://trac.torproject.org/projects/tor/wiki/doc/TorMessenger#Downloads

Then try generating a key again.

Sorry this isn't working out so well for you. I really appreciate your help in debugging.

psanders1 commented 8 years ago

I have just tried to generate a key with Pidgin with a new account in the same machine and it worked as before, that is, generated the private key without any problems.

I really do not know anything specific in my environment that might be causing this issue.

I also downloaded the latest version of Tor Messenger in a different directory and tried to generate the private key again, but the error persists.

arlolra commented 8 years ago

Hmm, just thought of something. Can you try putting the statement on L224 as well. Like this,

]).then(function(err) {
Cu.reportError(err);
if (!err)

That'll help us distinguish whether the error is happening while generating the key in otrl_privkey_generate_calculate or when saving it to disk with otrl_privkey_generate_finish. I'm thinking it's actually the latter, and this is some sort of file permission issue.

psanders1 commented 8 years ago

Hi,

Here is the error console after changing the code:

Timestamp: 02/02/2016 12:17:57
Error: 0
Source File: chrome://otr/content/otr.js
Line: 226

Timestamp: 02/02/2016 12:17:57
Error: 16810065
Source File: chrome://otr/content/otr.js
Line: 218

Regards

arlolra commented 8 years ago

Ok, so the problem isn't generating the key, it's saving it to disk.

Where are you installing the application? What's the path? If you haven't already, try installing it on your desktop where the application would have privilege to create files.

psanders1 commented 8 years ago

I have just installed in my desktop and the problem persisted. But you gave me a clue. My user folder is Sérgio with acute accent ( ´ ) used in portuguese language, this acute accent may be causing the issue in the path name. So, I installed in the root directory (C:\Tor Messenger) and now everything goes right and we got the private key.

Thank you a lot for your attention and help!

arlolra commented 8 years ago

Aha! Glad we got to the bottom of it.

I'm going to reopen the task because we can definitely improve the error messages here and we should be able to handle UTF8 paths.

arlolra commented 8 years ago

@psanders1 I pushed a fix for this issue. Look for it in the next Tor Messenger release. Thanks again for reporting.