psi-im / psi

XMPP client
https://psi-im.org/
Other
404 stars 122 forks source link

OpenPGP encryption disabled on incoming encrypted message #349

Open yeezy69 opened 6 years ago

yeezy69 commented 6 years ago

With actual 1.3-dev i have a problem with gpg encrypted messages. While receiving a gpg encryped message, my psi decrypt the message correctly, but set "Encryption Disabled".

Reproduce:

I spend some time in searching the problem. I think, it could something to do with commit 047910ee95647df7d6529401668e9924f9b930d7 (Plugin API adjustments required for OMEMO plugin).

In file src/psiaccount.cpp the function PsiAccount::processIncomingMessage(const Message &_m) has following new code:

#ifdef PSI_PLUGINS m.setWasEncrypted(PluginManager::instance()->stanzaWasEncrypted(m.id())); #endif

This will set the m.wasEncrypted() const to false while receiving a gpg message, because in function PsiAccount::pgp_decryptFinished() the function processIncomingMessage(m) will be called AFTER m.setWasEncrypted(true).

Thank you!

Ri0n commented 6 years ago

Thanks for the report. We are on the way of stabilizing of our encryption API, especially wrt to all possible encryption mechanisms, but unfortunately we are lack of human resources. Any help is very appreciated.

yeezy69 commented 6 years ago

Hey! I tried to understand the code. But it is not easy to examine the foreign code. And I'm not a C++ pro. Sorry, at the moment I will not be able to help.

Neustradamus commented 5 years ago

@stigger for information about the problem with OMEMO.

Neustradamus commented 5 years ago

@yeezy69 Have you tested a Psi or Psi+ 1.4.x? What do you see?

mithodin commented 5 years ago

I have the same problem in 1.4.659

anideth commented 5 years ago

I have this problem too on Ubuntu 18.04.2 after last update from ppa repository. I downgraded to 1.4.650

tehnick commented 5 years ago

I downgraded to 1.4.650

Ok, something have been changed since that version:

$ git diff 1.4.650 1.4.669 | grep -i encrypt
 QString Message::xencrypted() const
-    return d->xencrypted;
+    return d? d->xencrypted: QString();
 void Message::setXEncrypted(const QString &s)
-    d->xencrypted = s;
+    MessageD()->xencrypted = s;
 bool Message::wasEncrypted() const
-    return d->wasEncrypted;
+    return d && d->wasEncrypted;
 void Message::setWasEncrypted(bool b)
-    d->wasEncrypted = b;
+    MessageD()->wasEncrypted = b;

Lets see if this help to find an issue.

tehnick commented 5 years ago

Preliminary, problem appeared somewhere here: https://github.com/psi-plus/psi-plus-snapshots/commit/acb93d35e6e7ddfe7828838c9f484d8868e58219#diff-7050b0125c3b63aec1d88c1913e240dd I'll try to look deeper when I find more free time.

tehnick commented 5 years ago

Preliminary, problem appeared somewhere here: https://github.com/psi-plus/psi-plus-snapshots/commit/acb93d35

More other, these changes also broke Message Carbons and indicator of OMEMO encrypted messages.

arrowd commented 5 years ago

Got the same problem with Psi 1.3 release on FreeBSD.

Neustradamus commented 4 years ago

@yeezy69, @mithodin, @anideth, @arrowd: Have you always the problem with last Psi/Psi+ builds?

Have you tested OMEMO and OpenPGP/GnuPG in same time?

mithodin commented 4 years ago

I have not uses OMEMO and PGP at the same time. I will test on v1.4.980 and report since I haven't used Psi in a while.