diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/AbstractOpenPgpIntegrationTest.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/AbstractOpenPgpIntegrationTest.java
new file mode 100644
index 000000000..c0b16b997
--- /dev/null
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/AbstractOpenPgpIntegrationTest.java
@@ -0,0 +1,76 @@
+/**
+ *
+ * Copyright 2018 Paul Schaub.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jivesoftware.smackx.openpgp;
+
+import java.security.Security;
+
+import org.jivesoftware.smack.SmackException;
+import org.jivesoftware.smack.XMPPConnection;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smackx.ox.util.PubSubDelegate;
+import org.jivesoftware.smackx.pep.PEPManager;
+
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
+import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
+import org.igniterealtime.smack.inttest.TestNotPossibleException;
+import org.jxmpp.jid.BareJid;
+
+public class AbstractOpenPgpIntegrationTest extends AbstractSmackIntegrationTest {
+
+ protected final XMPPConnection aliceConnection;
+ protected final XMPPConnection bobConnection;
+ protected final XMPPConnection chloeConnection;
+
+ protected final BareJid alice;
+ protected final BareJid bob;
+ protected final BareJid chloe;
+
+ public AbstractOpenPgpIntegrationTest(SmackIntegrationTestEnvironment environment)
+ throws XMPPException.XMPPErrorException, TestNotPossibleException, SmackException.NotConnectedException,
+ InterruptedException, SmackException.NoResponseException {
+ super(environment);
+
+ throwIfPubSubNotSupported(conOne);
+ throwIfPubSubNotSupported(conTwo);
+ throwIfPubSubNotSupported(conThree);
+
+ Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME);
+ Security.addProvider(new BouncyCastleProvider());
+
+ this.aliceConnection = conOne;
+ this.bobConnection = conTwo;
+ this.chloeConnection = conThree;
+
+ this.alice = aliceConnection.getUser().asBareJid();
+ this.bob = bobConnection.getUser().asBareJid();
+ this.chloe = chloeConnection.getUser().asBareJid();
+
+ PubSubDelegate.deletePubkeysListNode(aliceConnection);
+ PubSubDelegate.deletePubkeysListNode(bobConnection);
+ PubSubDelegate.deletePubkeysListNode(chloeConnection);
+ }
+
+ private static void throwIfPubSubNotSupported(XMPPConnection connection)
+ throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
+ SmackException.NoResponseException, TestNotPossibleException {
+ if (!PEPManager.getInstanceFor(connection).isSupported()) {
+ throw new TestNotPossibleException("Server " + connection.getXMPPServiceDomain().toString() +
+ " does not support PEP.");
+ }
+ }
+}
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
new file mode 100644
index 000000000..ec18be3ef
--- /dev/null
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/BasicOpenPgpInstantMessagingIntegrationTest.java
@@ -0,0 +1,131 @@
+/**
+ *
+ * Copyright 2018 Paul Schaub.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jivesoftware.smackx.openpgp;
+
+import java.io.File;
+
+import org.jivesoftware.smack.SmackException;
+import org.jivesoftware.smack.XMPPException;
+import org.jivesoftware.smack.packet.Message;
+import org.jivesoftware.smack.util.FileUtils;
+import org.jivesoftware.smackx.ox.OXInstantMessagingManager;
+import org.jivesoftware.smackx.ox.OpenPgpManager;
+import org.jivesoftware.smackx.ox.OpenPgpV4Fingerprint;
+import org.jivesoftware.smackx.ox.bouncycastle.FileBasedPainlessOpenPgpStore;
+import org.jivesoftware.smackx.ox.bouncycastle.PainlessOpenPgpProvider;
+import org.jivesoftware.smackx.ox.chat.OpenPgpContact;
+import org.jivesoftware.smackx.ox.element.SigncryptElement;
+import org.jivesoftware.smackx.ox.listener.OxMessageListener;
+import org.jivesoftware.smackx.ox.util.PubSubDelegate;
+
+import de.vanitasvitae.crypto.pgpainless.key.UnprotectedKeysProtector;
+import org.igniterealtime.smack.inttest.SmackIntegrationTest;
+import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
+import org.igniterealtime.smack.inttest.TestNotPossibleException;
+import org.igniterealtime.smack.inttest.util.SimpleResultSyncPoint;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public class BasicOpenPgpInstantMessagingIntegrationTest extends AbstractOpenPgpIntegrationTest {
+
+ private static final File aliceStorePath = FileUtils.getTempDir("basic_ox_messaging_test_alice");
+ private static final File bobStorePath = FileUtils.getTempDir("basic_ox_messaging_test_bob");
+
+ private OpenPgpV4Fingerprint aliceFingerprint = null;
+ private OpenPgpV4Fingerprint bobFingerprint = null;
+
+ public BasicOpenPgpInstantMessagingIntegrationTest(SmackIntegrationTestEnvironment environment)
+ throws XMPPException.XMPPErrorException, InterruptedException, SmackException.NotConnectedException,
+ TestNotPossibleException, SmackException.NoResponseException {
+ super(environment);
+ }
+
+ @BeforeClass
+ @AfterClass
+ public static void deleteStore() {
+ FileUtils.deleteDirectory(aliceStorePath);
+ FileUtils.deleteDirectory(bobStorePath);
+ }
+
+ @SmackIntegrationTest
+ public void basicInstantMessagingTest()
+ throws Exception {
+
+ final SimpleResultSyncPoint bobReceivedMessage = new SimpleResultSyncPoint();
+ final String body = "Writing integration tests is an annoying task, but it has to be done, so lets do it!!!";
+
+ FileBasedPainlessOpenPgpStore aliceStore = new FileBasedPainlessOpenPgpStore(aliceStorePath, new UnprotectedKeysProtector());
+ FileBasedPainlessOpenPgpStore bobStore = new FileBasedPainlessOpenPgpStore(bobStorePath, new UnprotectedKeysProtector());
+
+ PainlessOpenPgpProvider aliceProvider = new PainlessOpenPgpProvider(alice, aliceStore);
+ PainlessOpenPgpProvider bobProvider = new PainlessOpenPgpProvider(bob, bobStore);
+
+ OpenPgpManager aliceOpenPgp = OpenPgpManager.getInstanceFor(aliceConnection);
+ OpenPgpManager bobOpenPgp = OpenPgpManager.getInstanceFor(bobConnection);
+
+ OXInstantMessagingManager aliceInstantMessaging = OXInstantMessagingManager.getInstanceFor(aliceConnection);
+ OXInstantMessagingManager bobInstantMessaging = OXInstantMessagingManager.getInstanceFor(bobConnection);
+
+ bobInstantMessaging.addOxMessageListener(new OxMessageListener() {
+ @Override
+ public void newIncomingOxMessage(OpenPgpContact contact, Message originalMessage, SigncryptElement decryptedPayload) {
+ if (((Message.Body) decryptedPayload.getExtension(Message.Body.NAMESPACE)).getMessage().equals(body)) {
+ bobReceivedMessage.signal();
+ } else {
+ bobReceivedMessage.signalFailure();
+ }
+ }
+ });
+
+ aliceOpenPgp.setOpenPgpProvider(aliceProvider);
+ bobOpenPgp.setOpenPgpProvider(bobProvider);
+
+ aliceOpenPgp.generateAndImportKeyPair(alice);
+ bobOpenPgp.generateAndImportKeyPair(bob);
+
+ aliceFingerprint = aliceOpenPgp.getOurFingerprint();
+ bobFingerprint = bobOpenPgp.getOurFingerprint();
+
+ aliceOpenPgp.announceSupportAndPublish();
+ bobOpenPgp.announceSupportAndPublish();
+
+ aliceOpenPgp.requestMetadataUpdate(bob);
+ bobOpenPgp.requestMetadataUpdate(alice);
+
+ OpenPgpContact bobForAlice = aliceOpenPgp.getOpenPgpContact(bob.asEntityBareJidIfPossible());
+
+ aliceInstantMessaging.sendOxMessage(bobForAlice, body);
+
+ bobReceivedMessage.waitForResult(timeout);
+ }
+
+ @After
+ public void deleteKeyMetadata()
+ throws XMPPException.XMPPErrorException, SmackException.NotConnectedException, InterruptedException,
+ SmackException.NoResponseException {
+ PubSubDelegate.deletePubkeysListNode(aliceConnection);
+ PubSubDelegate.deletePubkeysListNode(bobConnection);
+
+ if (aliceFingerprint != null) {
+ PubSubDelegate.deletePublicKeyNode(aliceConnection, aliceFingerprint);
+ }
+ if (bobFingerprint != null) {
+ PubSubDelegate.deletePublicKeyNode(bobConnection, bobFingerprint);
+ }
+ }
+}
diff --git a/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/package-info.java b/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/package-info.java
new file mode 100644
index 000000000..290bf1181
--- /dev/null
+++ b/smack-integration-test/src/main/java/org/jivesoftware/smackx/openpgp/package-info.java
@@ -0,0 +1,24 @@
+/**
+ *
+ * Copyright 2018 Paul Schaub
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Integration Tests for Smacks support for XEP-0373 and XEP-0374: OpenPGP for XMPP: Instant Messaging.
+ * @see
+ * XEP-0373: OpenPGP for XMPP
+ * @see
+ * XEP-0374: OpenPGP for XMPP: Instant Messaging
+ */
+package org.jivesoftware.smackx.openpgp;