aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'OpenKeychain/src/test')
-rw-r--r--OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java53
-rw-r--r--OpenKeychain/src/test/java/tests/ProviderHelperKeyringTest.java103
-rw-r--r--OpenKeychain/src/test/java/tests/UncachedKeyringTest.java91
m---------OpenKeychain/src/test/resources/extern/OpenPGP-Haskell0
-rw-r--r--OpenKeychain/src/test/resources/public-key-canonicalize.blobbin1224 -> 0 bytes
-rw-r--r--OpenKeychain/src/test/resources/public-key-for-sample.blobbin35198 -> 0 bytes
-rw-r--r--OpenKeychain/src/test/resources/sample-altered.txt26
-rw-r--r--OpenKeychain/src/test/resources/sample.txt26
8 files changed, 0 insertions, 299 deletions
diff --git a/OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java b/OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java
deleted file mode 100644
index 0353e03f5..000000000
--- a/OpenKeychain/src/test/java/tests/PgpDecryptVerifyTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) Art O Cathain
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package tests;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.*;
-import org.openintents.openpgp.OpenPgpSignatureResult;
-import org.sufficientlysecure.keychain.testsupport.PgpVerifyTestingHelper;
-
-@RunWith(RobolectricTestRunner.class)
-@org.robolectric.annotation.Config(emulateSdk = 18) // Robolectric doesn't yet support 19
-public class PgpDecryptVerifyTest {
-
- @Test
- public void testVerifySuccess() throws Exception {
-
- String testFileName = "/sample.txt";
- int expectedSignatureResult = OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED;
-
- int status = new PgpVerifyTestingHelper(Robolectric.application).doTestFile(testFileName);
-
- Assert.assertEquals(expectedSignatureResult, status);
- }
-
- @Test
- public void testVerifyFailure() throws Exception {
-
- String testFileName = "/sample-altered.txt";
- int expectedSignatureResult = OpenPgpSignatureResult.SIGNATURE_ERROR;
-
- int status = new PgpVerifyTestingHelper(Robolectric.application).doTestFile(testFileName);
-
- Assert.assertEquals(expectedSignatureResult, status);
- }
-
-}
diff --git a/OpenKeychain/src/test/java/tests/ProviderHelperKeyringTest.java b/OpenKeychain/src/test/java/tests/ProviderHelperKeyringTest.java
deleted file mode 100644
index 830ec1266..000000000
--- a/OpenKeychain/src/test/java/tests/ProviderHelperKeyringTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) Art O Cathain
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package tests;
-
-import java.util.Collections;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.ArrayList;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.*;
-import org.openintents.openpgp.OpenPgpSignatureResult;
-import org.sufficientlysecure.keychain.testsupport.KeyringTestingHelper;
-import org.sufficientlysecure.keychain.testsupport.PgpVerifyTestingHelper;
-
-@RunWith(RobolectricTestRunner.class)
-@org.robolectric.annotation.Config(emulateSdk = 18) // Robolectric doesn't yet support 19
-public class ProviderHelperKeyringTest {
-
- @Test
- public void testSavePublicKeyring() throws Exception {
- Assert.assertTrue(new KeyringTestingHelper(Robolectric.application).addKeyring(Collections.singleton(
- "/public-key-for-sample.blob"
- )));
- }
-
- @Test
- public void testSavePublicKeyringRsa() throws Exception {
- Assert.assertTrue(new KeyringTestingHelper(Robolectric.application).addKeyring(prependResourcePath(Arrays.asList(
- "000001-006.public_key",
- "000002-013.user_id",
- "000003-002.sig",
- "000004-012.ring_trust",
- "000005-002.sig",
- "000006-012.ring_trust",
- "000007-002.sig",
- "000008-012.ring_trust",
- "000009-002.sig",
- "000010-012.ring_trust",
- "000011-002.sig",
- "000012-012.ring_trust",
- "000013-014.public_subkey",
- "000014-002.sig",
- "000015-012.ring_trust"
- ))));
- }
-
- @Test
- public void testSavePublicKeyringDsa() throws Exception {
- Assert.assertTrue(new KeyringTestingHelper(Robolectric.application).addKeyring(prependResourcePath(Arrays.asList(
- "000016-006.public_key",
- "000017-002.sig",
- "000018-012.ring_trust",
- "000019-013.user_id",
- "000020-002.sig",
- "000021-012.ring_trust",
- "000022-002.sig",
- "000023-012.ring_trust",
- "000024-014.public_subkey",
- "000025-002.sig",
- "000026-012.ring_trust"
- ))));
- }
-
- @Test
- public void testSavePublicKeyringDsa2() throws Exception {
- Assert.assertTrue(new KeyringTestingHelper(Robolectric.application).addKeyring(prependResourcePath(Arrays.asList(
- "000027-006.public_key",
- "000028-002.sig",
- "000029-012.ring_trust",
- "000030-013.user_id",
- "000031-002.sig",
- "000032-012.ring_trust",
- "000033-002.sig",
- "000034-012.ring_trust"
- ))));
- }
-
- private static Collection<String> prependResourcePath(Collection<String> files) {
- Collection<String> prependedFiles = new ArrayList<String>();
- for (String file: files) {
- prependedFiles.add("/extern/OpenPGP-Haskell/tests/data/" + file);
- }
- return prependedFiles;
- }
-}
diff --git a/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java b/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java
deleted file mode 100644
index b3f78f22d..000000000
--- a/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) Art O Cathain, Vincent Breitmoser
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package tests;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.*;
-import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
-import org.sufficientlysecure.keychain.service.OperationResultParcel;
-import org.sufficientlysecure.keychain.testsupport.*;
-import org.sufficientlysecure.keychain.testsupport.KeyringBuilder;
-import org.sufficientlysecure.keychain.testsupport.KeyringTestingHelper;
-import org.sufficientlysecure.keychain.testsupport.TestDataUtil;
-
-import java.util.*;
-import java.io.*;
-
-@RunWith(RobolectricTestRunner.class)
-@org.robolectric.annotation.Config(emulateSdk = 18) // Robolectric doesn't yet support 19
-public class UncachedKeyringTest {
-
- @Test
- public void testCanonicalizeNoChanges() throws Exception {
- UncachedKeyRing expectedKeyRing = KeyringBuilder.correctRing();
- UncachedKeyRing inputKeyRing = KeyringBuilder.correctRing();
-// Uncomment to dump the encoded key for manual inspection
-// TestDataUtil.appendToOutput(new ByteArrayInputStream(inputKeyRing.getEncoded()), new FileOutputStream(new File("/tmp/key-encoded")));
- new UncachedKeyringTestingHelper().doTestCanonicalize(inputKeyRing, expectedKeyRing);
-
- OperationResultParcel.OperationLog log = new OperationResultParcel.OperationLog();
- UncachedKeyRing canonicalizedRing = inputKeyRing.canonicalize(log, 0);
-
- if (canonicalizedRing == null) {
- throw new AssertionError("Canonicalization failed; messages: [" + log.toString() + "]");
- }
-
- HashSet onlyA = new HashSet<KeyringTestingHelper.Packet>();
- HashSet onlyB = new HashSet<KeyringTestingHelper.Packet>();
- Assert.assertTrue(KeyringTestingHelper.diffKeyrings(
- canonicalizedRing.getEncoded(), expectedKeyRing.getEncoded(), onlyA, onlyB));
-
-
- }
-
-
- @Test
- public void testCanonicalizeExtraIncorrectSignature() throws Exception {
- UncachedKeyRing expectedKeyRing = KeyringBuilder.correctRing();
- UncachedKeyRing inputKeyRing = KeyringBuilder.ringWithExtraIncorrectSignature();
- new UncachedKeyringTestingHelper().doTestCanonicalize(inputKeyRing, expectedKeyRing);
- }
-
- /**
- * Check the original GnuPG-generated public key is OK
- */
- @Test
- public void testCanonicalizeOriginalGpg() throws Exception {
- byte[] data = TestDataUtil.readAllFully(Collections.singleton("/public-key-canonicalize.blob"));
- UncachedKeyRing inputKeyRing = UncachedKeyRing.decodeFromData(data);
- new UncachedKeyringTestingHelper().doTestCanonicalize(inputKeyRing, KeyringBuilder.correctRing());
- }
-
-
- /**
- * Just testing my own test code. Should really be using a library for this.
- */
- @Test
- public void testConcat() throws Exception {
- byte[] actual = TestDataUtil.concatAll(new byte[]{1}, new byte[]{2, -2}, new byte[]{5}, new byte[]{3});
- byte[] expected = new byte[]{1, 2, -2, 5, 3};
- Assert.assertEquals(java.util.Arrays.toString(expected), java.util.Arrays.toString(actual));
- }
-
-
-}
diff --git a/OpenKeychain/src/test/resources/extern/OpenPGP-Haskell b/OpenKeychain/src/test/resources/extern/OpenPGP-Haskell
deleted file mode 160000
-Subproject eba7e4fdce3de6622b4ec3862b405b0acd01637
diff --git a/OpenKeychain/src/test/resources/public-key-canonicalize.blob b/OpenKeychain/src/test/resources/public-key-canonicalize.blob
deleted file mode 100644
index 3450824c1..000000000
--- a/OpenKeychain/src/test/resources/public-key-canonicalize.blob
+++ /dev/null
Binary files differ
diff --git a/OpenKeychain/src/test/resources/public-key-for-sample.blob b/OpenKeychain/src/test/resources/public-key-for-sample.blob
deleted file mode 100644
index 4aa91510b..000000000
--- a/OpenKeychain/src/test/resources/public-key-for-sample.blob
+++ /dev/null
Binary files differ
diff --git a/OpenKeychain/src/test/resources/sample-altered.txt b/OpenKeychain/src/test/resources/sample-altered.txt
deleted file mode 100644
index 458821f81..000000000
--- a/OpenKeychain/src/test/resources/sample-altered.txt
+++ /dev/null
@@ -1,26 +0,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-This is a simple text document, which is used to illustrate
-the concept of signing simple text files. There are no
-control characters or special formatting commands in this
-text, just simple printable ASCII characters.
-MALICIOUS TEXT
-To make this a slightly less uninteresting document, there
-follows a short shopping list.
-
- eggs, 1 doz
- milk, 1 gal
- bacon, 1 lb
- olive oil
- bread, 1 loaf
-
-That's all there is to this document.
-
------BEGIN PGP SIGNATURE-----
-Version: PGPfreeware 5.5.5 for non-commercial use <http://www.nai.com>
-
-iQA/AwUBN78ib3S9RCOKzj55EQKqDACg1NV2/iyPKrDlOVJvJwz6ArcQ0UQAnjNC
-CDxKAFyaaGa835l1vpbFkAJk
-=3r/N
------END PGP SIGNATURE-----
diff --git a/OpenKeychain/src/test/resources/sample.txt b/OpenKeychain/src/test/resources/sample.txt
deleted file mode 100644
index c0065f78d..000000000
--- a/OpenKeychain/src/test/resources/sample.txt
+++ /dev/null
@@ -1,26 +0,0 @@
------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA1
-
-This is a simple text document, which is used to illustrate
-the concept of signing simple text files. There are no
-control characters or special formatting commands in this
-text, just simple printable ASCII characters.
-
-To make this a slightly less uninteresting document, there
-follows a short shopping list.
-
- eggs, 1 doz
- milk, 1 gal
- bacon, 1 lb
- olive oil
- bread, 1 loaf
-
-That's all there is to this document.
-
------BEGIN PGP SIGNATURE-----
-Version: PGPfreeware 5.5.5 for non-commercial use <http://www.nai.com>
-
-iQA/AwUBN78ib3S9RCOKzj55EQKqDACg1NV2/iyPKrDlOVJvJwz6ArcQ0UQAnjNC
-CDxKAFyaaGa835l1vpbFkAJk
-=3r/N
------END PGP SIGNATURE-----