diff --git a/src/common/connection.py b/src/common/connection.py index ff14a8257..28aaf1e3f 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -321,7 +321,7 @@ class CommonConnection: always_trust) def _on_encrypted(output): msgenc, error = output - if error == 'NOT_TRUSTED': + if error.startswith( 'NOT_TRUSTED'): def _on_always_trust(answer): if answer: gajim.thread_interface(encrypt_thread, [msg, keyID, @@ -334,7 +334,8 @@ class CommonConnection: form_node, user_nick, keyID, attention, correction_msg, callback) gajim.nec.push_incoming_event(GPGTrustKeyEvent(None, - conn=self, keyID=keyID, callback=_on_always_trust)) + conn=self, keyID=error.split(' ')[-1], + callback=_on_always_trust)) else: self._message_encrypted_cb(output, type_, msg, msgtxt, original_message, fjid, resource, jid, xhtml, diff --git a/src/common/gpg.py b/src/common/gpg.py index 65de5d0e2..d986fefee 100644 --- a/src/common/gpg.py +++ b/src/common/gpg.py @@ -50,6 +50,7 @@ if HAVE_GPG: def encrypt(self, str_, recipients, always_trust=False): trust = always_trust if not trust: + # check if we trust all keys trust = True for key in recipients: if key not in self.always_trust: @@ -59,7 +60,10 @@ if HAVE_GPG: result = super(GnuPG, self).list_keys(keys=recipients) for key in result: if key['trust'] not in ('f', 'u'): - return '', 'NOT_TRUSTED' + if key['keyid'][-8:] not in self.always_trust: + return '', 'NOT_TRUSTED ' + key['keyid'][-8:] + else: + trust = True result = super(GnuPG, self).encrypt(str_, recipients, always_trust=trust, passphrase=self.passphrase)