Philipp Hörist pushed to branch openpgp at gajim / gajim
Commits:
5f0a5dc2 by Philipp Hörist at 2026-05-03T16:37:29+02:00
new: Decrypt even if we cannot verify the signature
- - - - -
1 changed file:
- gajim/common/modules/openpgp.py
Changes:
=====================================
gajim/common/modules/openpgp.py
=====================================
@@ -685,8 +685,19 @@ def _store(_key_id: list[str]) -> list[pys.Cert]:
store=_store,
)
except Exception as error:
- self._log.warning(error)
- return
+ self._log.warning(
+ "Failed to decrypt with signature verification: %s", error
+ )
+ try:
+ decrypted = pys.decrypt(
+ bytes=properties.openpgp,
+ decryptor=self._secret_cert.secrets.decryptor(),
+ )
+ except Exception as error:
+ self._log.warning(
+ "Failed to decrypt without signature verification: %s",
error
+ )
+ return
assert decrypted.bytes is not None
payload = decrypted.bytes.decode()
@@ -711,14 +722,19 @@ def _store(_key_id: list[str]) -> list[pys.Cert]:
prepare_stanza(stanza, payload)
- fingerprint = decrypted.valid_sigs[0].certificate.upper()
- remote_key = find_remote_key(remote_public_keys, fingerprint)
- if remote_key is None:
- self._log.warning("Unable to find remote key: %s", fingerprint)
- return
+ trust = Trust.UNTRUSTED
+ fingerprint = "Unknown"
+
+ if decrypted.valid_sigs:
+ fingerprint = decrypted.valid_sigs[0].certificate.upper()
+ remote_key = find_remote_key(remote_public_keys, fingerprint)
+ if remote_key is None:
+ self._log.warning("Unable to find remote key: %s", fingerprint)
+ else:
+ trust = remote_key.trust
properties.encrypted = EncryptionData(
- protocol="OpenPGP", key=fingerprint, trust=remote_key.trust
+ protocol="OpenPGP", key=fingerprint, trust=trust
)
raise StanzaDecrypted
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/5f0a5dc283d73c414474f3c3171a6daca354bd8e
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/5f0a5dc283d73c414474f3c3171a6daca354bd8e
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]