From 8b778809bf2799319980063600fb175d9f0d541f Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sun, 26 Oct 2014 00:34:16 +0200 Subject: [PATCH] add test case for symantec secret keys (#974) --- .../provider/ProviderHelperSaveTest.java | 22 +++++++++ .../resources/test-keys/symantec_public.asc | 37 +++++++++++++++ .../resources/test-keys/symantec_secret.asc | 46 +++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 OpenKeychain-Test/src/test/resources/test-keys/symantec_public.asc create mode 100644 OpenKeychain-Test/src/test/resources/test-keys/symantec_secret.asc diff --git a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java index 364e559e6..8e72b3c35 100644 --- a/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java +++ b/OpenKeychain-Test/src/test/java/org/sufficientlysecure/keychain/provider/ProviderHelperSaveTest.java @@ -77,6 +77,28 @@ public class ProviderHelperSaveTest { } + @Test public void testImportSymantec() throws Exception { + + // insert two keys with same long key id, make sure the second one gets rejected either way! + UncachedKeyRing seckey = + readRingFromResource("/test-keys/symantec_secret.asc"); + UncachedKeyRing pubkey = + readRingFromResource("/test-keys/symantec_public.asc"); + + SaveKeyringResult result; + + // insert secret, this should fail because of missing self-cert + result = new ProviderHelper(Robolectric.application).saveSecretKeyRing(seckey, new ProgressScaler()); + Assert.assertFalse("secret keyring import before pubring import should fail", result.success()); + + // insert pubkey, then seckey - both should succeed + result = new ProviderHelper(Robolectric.application).savePublicKeyRing(pubkey); + Assert.assertTrue("public keyring import should succeed", result.success()); + result = new ProviderHelper(Robolectric.application).saveSecretKeyRing(seckey, new ProgressScaler()); + Assert.assertTrue("secret keyring import after pubring import should succeed", result.success()); + + } + @Test public void testImportNoFlagKey() throws Exception { UncachedKeyRing pub = readRingFromResource("/test-keys/mailvelope_07_no_key_flags.asc"); diff --git a/OpenKeychain-Test/src/test/resources/test-keys/symantec_public.asc b/OpenKeychain-Test/src/test/resources/test-keys/symantec_public.asc new file mode 100644 index 000000000..f4148935c --- /dev/null +++ b/OpenKeychain-Test/src/test/resources/test-keys/symantec_public.asc @@ -0,0 +1,37 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: Encryption Desktop 10.3.1 (Build 13100) + +mQENBFRHpJ8BCADIzN2EB8emV3l1wZ+GyKiC3roHEUnWcIj2ZksEJ1ZBfUC/En4/ +wjNSAsJCcECRUDRaoMH1NI2w6BOrODt+7EsBqndGtKi0LzcDvHj9WNe9XfwXWRAH +tnaTtzqLyPsqkKWJQzzyqpys8sy58qIb3gqpRSXL8UST3OtIGesYmeFSI8swL/0l +vabQ7JJjImFyuwiel5TE5A5sRr/Tqd26jW1Y1cInqtSQqeSwzUwi0uNMCZrNJNs6 +fk902U8xanLk4TkIJT6nPVzoGOcczPES4U8p27m82IuqKeua+Yzwmeitllhm98mw +k9u3jSM36FwHRomdBmWBPn6supMbrPR+wrYXABEBAAG0F1Rlc3QgPHRlc3RAYmxh +aGJsYWguZGU+iQFyBBABAgBcBQJUR6SfMBSAAAAAACAAB3ByZWZlcnJlZC1lbWFp +bC1lbmNvZGluZ0BwZ3AuY29tcGdwbWltZQgLCQgHAwIBCgIZAQUbAwAAAAUWAAMC +AQUeAQAAAAYVCAkKAwIACgkQuR01xc4cnZxtTwf/QJ0G4ME/XhdPxfHIHzG9H1uo +dtFPjf2Bpt1TKZNrf+Cf+7P+M1HvgRhhR4pp04lFCBYhaworaX0bqyGCqKmON11M +cCAUC63ygrKmuGTmU1vnLcct/j7+k3cpX0Q4JZjQNzQ5ebSQP3PQyTfcd1SuZL8f +XA1xBjPXMNhgqkLC1qzyVaJMmlBouXeW/fICWDz6Cwl2kw/9BgxaWZVAJvIxuspN +1i3mTQvZ5Ztyhc1++GES+BxcxSzjcd43OaPJVWJW68MqcjwQTUBT3s5tz+QqYN3s +zVT9piZ72E9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WxzEy/Kj +NxkZjNhL2olwk8HctIWzAEFNSOzJZ+Y6hNePN5ARmjaJeve7cNU1cxgeY4SSmZsm +uNTAvlX6Lqi4l3p/Uroz3T4UltFIDUbzhqQbNQ902Hz6ag== +=c8vd +-----END PGP PUBLIC KEY BLOCK----- diff --git a/OpenKeychain-Test/src/test/resources/test-keys/symantec_secret.asc b/OpenKeychain-Test/src/test/resources/test-keys/symantec_secret.asc new file mode 100644 index 000000000..94451c1bf --- /dev/null +++ b/OpenKeychain-Test/src/test/resources/test-keys/symantec_secret.asc @@ -0,0 +1,46 @@ +-----BEGIN PGP PRIVATE KEY BLOCK----- +Version: Encryption Desktop 10.3.1 (Build 13100) + +lQPGBFRHpJ8BCADIzN2EB8emV3l1wZ+GyKiC3roHEUnWcIj2ZksEJ1ZBfUC/En4/ +wjNSAsJCcECRUDRaoMH1NI2w6BOrODt+7EsBqndGtKi0LzcDvHj9WNe9XfwXWRAH +tnaTtzqLyPsqkKWJQzzyqpys8sy58qIb3gqpRSXL8UST3OtIGesYmeFSI8swL/0l +vabQ7JJjImFyuwiel5TE5A5sRr/Tqd26jW1Y1cInqtSQqeSwzUwi0uNMCZrNJNs6 +fk902U8xanLk4TkIJT6nPVzoGOcczPES4U8p27m82IuqKeua+Yzwmeitllhm98mw +k9u3jSM36FwHRomdBmWBPn6supMbrPR+wrYXABEBAAH+CQMCgd+uT2AR0iSohaM1 +J4VJkc9XImdR0sOx38MaTA/wQYUMEgU4SHlHcRGb7cUluYNysSTTRnYZxE1SU1t7 +0wN13ce3DELMEahBnEsRKE9a1COUnpkBsfw/1qWWyeX4iJPKiMBKABiLiZ8PxkI2 +Rhi2c0epWb2xsw4KZtB+c4UcCIkvRgrgJrEPIwL0DBCgtBd1jqKHa58pyPo28Y8Q +Wf9hxRGyRz6QErcfZE7JiAsBE9kHZufo/NzrYEps4gtuZkmwYojT0NuzWIS64P1D +AQe/ay3av406xQsoVmamYNklgDUVf+YrTw6Rv/0G2ocaqTbCKqoaDi1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9E+e79QwHfgSvszxIirGVXw8wlju2hCh544U +0qj1CHfeZ02Qww+gViQikn0PAONeqdKBztDKUgys/dyarC4ROhB16qfyYUJgSy5M +lENBSLrKf1AZoWTARw6wl0a20pDI1qk/SAh8Dyi+kNk7yX9wzYnaCKGE6pnydSJF +HvK3tUHbMmYroucbRSWW7AdeoznBt1801kvuPIKEP0CexSZeW72GgpF3ZDSXmyeS +gXpE7rgYD/yttPkzMRM/f2VwHov78jVPDnA1Z5hzi0I2vBbFLpdli1o4Wqazffvm +4dR7Bfd6sfbTNi3hB5rwEcCKvKQZ4HdUe7+8f7VzzqCEuRaVcpsAn5sejn0dcvdg +ON0sWUvGSS/hcl92aKhrYRqSfycZiT5snzYQ79II3Mv9e/juB5LdFOOEK1XMo0+L +WvV5TfgwnLTYNQBUkhRioJl5YM4xFTCgzP2e0kLDMuSfQa8BiRB7ip27YxonTWQW ++nwD+3WmO5DKChAp0reljQSsCfxr7QVmNNf2oCmlO9TQHEDjJx3CkC/lb07igbel +SABIRkfAm8ylMINalatd5TO8Pk1+spCKJav1wbYjyttyy97IFV/DhVUp5lxdUPxS +7QEi8BGPbAPQNrLwckktK4EcCwgjIS4KuFe7awQfM8VUSkpRx7g/6YpC7aN0AkBA +ao9YTXGsf9TOegzXOChwCrcnskWfkydIyYzG4enxeR7c3hiyyh4NiHzZ0hLCr/Pt +wImpcHWRyWoIU7R7oNnOaWfpH5P2mv83ZvffGfVZQdjoj6gUinHqtU+tlEwkhbua +lyhs+g99VJbxJchFM1JADgokcc31enYM41J239Y9ScoPjQh+Kz9UJzQjmg== +=jUby +-----END PGP PRIVATE KEY BLOCK-----