From ea5ffe92ea6c0a62afd822d3d8e96bc6b16537c0 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sat, 28 Oct 2023 17:44:27 +0200 Subject: [PATCH] improve logging when PGP decryption fails --- .../eu/siacs/conversations/crypto/PgpDecryptionService.java | 4 +++- .../siacs/conversations/services/XmppConnectionService.java | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java b/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java index db84e0cf4..68447e552 100644 --- a/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java +++ b/src/main/java/eu/siacs/conversations/crypto/PgpDecryptionService.java @@ -156,7 +156,8 @@ public class PgpDecryptionService { && manager.getAutoAcceptFileSize() > 0) { manager.createNewDownloadConnection(message); } - } catch (IOException e) { + } catch (final IOException e) { + Log.d(Config.LOGTAG,"decryption failed", e); message.setEncryption(Message.ENCRYPTION_DECRYPTION_FAILED); } mXmppConnectionService.updateMessage(message); @@ -170,6 +171,7 @@ public class PgpDecryptionService { } break; case OpenPgpApi.RESULT_CODE_ERROR: + Log.d(Config.LOGTAG,"decryption failed (api error)"); message.setEncryption(Message.ENCRYPTION_DECRYPTION_FAILED); mXmppConnectionService.updateMessage(message); break; diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index a202a480c..09ceaeffc 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -1259,7 +1259,7 @@ public class XmppConnectionService extends Service { if (Config.supportOpenPgp()) { this.pgpServiceConnection = new OpenPgpServiceConnection(this, "org.sufficientlysecure.keychain", new OpenPgpServiceConnection.OnBound() { @Override - public void onBound(IOpenPgpService2 service) { + public void onBound(final IOpenPgpService2 service) { for (Account account : accounts) { final PgpDecryptionService pgp = account.getPgpDecryptionService(); if (pgp != null) { @@ -1269,7 +1269,8 @@ public class XmppConnectionService extends Service { } @Override - public void onError(Exception e) { + public void onError(final Exception exception) { + Log.e(Config.LOGTAG,"could not bind to OpenKeyChain", exception); } }); this.pgpServiceConnection.bindToService();