From e906fe53870660bd7231e45acce2a7c525edeb91 Mon Sep 17 00:00:00 2001 From: Art O Cathain Date: Sun, 6 Jul 2014 17:35:07 +0100 Subject: [PATCH] add the GPG version --- .../src/test/java/tests/UncachedKeyringTest.java | 11 ++++++++++- .../test/resources/public-key-canonicalize.blob | Bin 0 -> 1224 bytes 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 OpenKeychain/src/test/resources/public-key-canonicalize.blob diff --git a/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java b/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java index cb44d5d8f..b14bc2301 100644 --- a/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java +++ b/OpenKeychain/src/test/java/tests/UncachedKeyringTest.java @@ -10,6 +10,7 @@ import org.sufficientlysecure.keychain.testsupport.KeyringBuilder; import org.sufficientlysecure.keychain.testsupport.TestDataUtil; import java.io.*; +import java.util.Collections; @RunWith(RobolectricTestRunner.class) @org.robolectric.annotation.Config(emulateSdk = 18) // Robolectric doesn't yet support 19 @@ -19,11 +20,19 @@ public class UncachedKeyringTest { public void testVerifySuccess() throws Exception { UncachedKeyRing expectedKeyRing = KeyringBuilder.ring2(); UncachedKeyRing inputKeyRing = KeyringBuilder.ring1(); - // Uncomment to dump the encoded key for manual inspection +// Uncomment to dump the encoded key for manual inspection // inputKeyRing.getPublicKey().getPublicKey().encode(new FileOutputStream(new File("/tmp/key-encoded"))); new UncachedKeyringTestingHelper().doTestCanonicalize(inputKeyRing, expectedKeyRing); } + @Test + public void testVerifyFromGpg() throws Exception { + byte[] data = TestDataUtil.readAllFully(Collections.singleton( "/public-key-canonicalize.blob")); + UncachedKeyRing inputKeyRing = UncachedKeyRing.decodeFromData(data); + new UncachedKeyringTestingHelper().doTestCanonicalize(inputKeyRing, KeyringBuilder.ring2()); + } + + /** * Just testing my own test code. Should really be using a library for this. */ diff --git a/OpenKeychain/src/test/resources/public-key-canonicalize.blob b/OpenKeychain/src/test/resources/public-key-canonicalize.blob new file mode 100644 index 0000000000000000000000000000000000000000..3450824c1f0197bd526dafc2b9d5118bf3090ccc GIT binary patch literal 1224 zcmV;(1ULJc0SyFGxBTM)2ms5gc-akKEWpK0)5Dc81)=7(A@TpEMp_UiNWXiL>~i_R zfOV4rSa^8K>vJ<9Rv@2&%3C{>FrAhW4{37G#cDVGVtMu*aq*jvWU`3kI4PaZ6Ez_9 zxwIudZ%d;bqiX$!!U!7`@UnyHH4Zlp7#btf6L}CH7os}p86r^IWk4>Rt12g3#fEib zB6}HpixX^vDwHx?Xbu!k*kt^TSMkFg$%}k zv3HHuv9%ah^K3OB@>uZ%+b@>08dKeL_Xy1V@65hJ3XmK(@$`45q_JOK%fHz(5vE7H z!}a(aS>NX+ELwWx#RML!DL- z>muc}-=0G4c(}<=NOOtg{FvycS_D57zgN|ffgX;1veOx70xd4)Lvn(VgX~ez;tWF9 zq2(Fr`XbGpxepK52~W_Iw~OMy+hPJClTma8*GUyDaqY(aNUt;&1C5A6V2;h+yRjTt zBcw7NASt++Jg^t~j#}4>nqh`=&>?(FGypFeN_His6t<{jb>(x*hsI5CX=RRLe-**vGQTG0)?@d8ohLa(^_v24G4>)T)F=w~uoMCF{V36aYqn;eChg5vA2 zLAVZF+&e(+C7OyS);MW(ObCI@+_et{Wd6;@mTTmsxOz1QsoB1{0SyFGxBTM)2mt8f z;-fJFWS<%Mpmc`&2Wk`s%7~3}t_9MM4)b!gK#oNdENS-T%W8SMitU7BL6&n9lc+6I z;N8?ODETbGSWt}Px5^rrFiS6ABGxoRGnjvFAp}5>XGGU