From 3262582de920ca8bd4b10698df73019a5bed93a1 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Wed, 4 Jul 2018 16:03:04 +0200 Subject: [PATCH] Do not update the keys in constructor --- .../BasicOpenPgpInstantMessagingIntegrationTest.java | 3 +++ .../java/org/jivesoftware/smackx/ox/OpenPgpContact.java | 8 +------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/BasicOpenPgpInstantMessagingIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/BasicOpenPgpInstantMessagingIntegrationTest.java index 5e918aeb8..2c58c0198 100644 --- a/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/BasicOpenPgpInstantMessagingIntegrationTest.java +++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/BasicOpenPgpInstantMessagingIntegrationTest.java @@ -113,6 +113,9 @@ public class BasicOpenPgpInstantMessagingIntegrationTest extends AbstractOpenPgp OpenPgpContact bobForAlice = aliceOpenPgp.getOpenPgpContact(bob.asEntityBareJidIfPossible()); OpenPgpContact aliceForBob = bobOpenPgp.getOpenPgpContact(alice.asEntityBareJidIfPossible()); + bobForAlice.updateKeys(); + aliceForBob.updateKeys(); + assertTrue(bobForAlice.getActiveKeys().contains(bobFingerprint)); assertTrue(aliceForBob.getActiveKeys().contains(aliceFingerprint)); diff --git a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpContact.java b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpContact.java index 42c906c30..d9fe328e4 100644 --- a/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpContact.java +++ b/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/OpenPgpContact.java @@ -75,12 +75,6 @@ public class OpenPgpContact { this.jid = jid; this.cryptoProvider = cryptoProvider; this.connection = connection; - - try { - this.updateKeys(); - } catch (SmackOpenPgpException | InterruptedException | XMPPException.XMPPErrorException | SmackException e) { - LOGGER.log(Level.WARNING, "Initial key update for contact " + getJid() + " failed.", e); - } } /** @@ -356,7 +350,7 @@ public class OpenPgpContact { /** * Process an incoming {@link OpenPgpElement} and return the decrypted and verified {@link OpenPgpContentElement}. - * + * * @param element possibly encrypted, possibly signed {@link OpenPgpElement}. * @return decrypted {@link OpenPgpContentElement} * @throws XmlPullParserException if the decrypted message does not represent valid XML.