Merge branch 'development' of github.com:open-keychain/open-keychain into development

This commit is contained in:
Dominik Schürmann 2014-10-26 00:38:31 +02:00
commit 825baeee1b
6 changed files with 123 additions and 4 deletions

View File

@ -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");

View File

@ -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
aGJs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MoGYT/Zyccld+C9VN3
qgJ+DSQvv/zV2R5h94cZefaGh5PoXw5usz9hHMz2+VUR7iy1rY53Fv0qwSYib6cQ
SqrhoIoFEYUhFJZ4zc9LQzPVlwND0hpN5e7clr5A3HNbUb1GC1J9X1P+mQaLdysx
Iv2MZnRtcgyn8ci5I9xm2mB09qaMLU05iZK/hkWlAH5LMrn/e4xtcGMsYm26SAK4
g6wACgkQuR01xc4cnZzC2Qf/dtJRT0S1PGIl8uGTF2tBukCZBOXqtCxfWR/EHlK4
AwOpwAJ8dgIV9qDkw36lC6bdxeu/qm4EXcczxxYc2TVGHaj3QH2sjU0MUmsXj2Ri
ybdS62pXl/0cI2dBNGnWmcydm6NHNidymJ9LeL5+NQv5lPh1k12UDpj8PCz7TNqw
0XwWww11fizmW6I5bIkkdaPzXg14jBQkY5YIt63sDyMCFJectYHNyobgWxzEy/Kj
NxkZjNhL2olwk8HctIWzAEFNSOzJZ+Y6hNePN5ARmjaJeve7cNU1cxgeY4SSmZsm
uNTAvlX6Lqi4l3p/Uroz3T4UltFIDUbzhqQbNQ902Hz6ag==
=c8vd
-----END PGP PUBLIC KEY BLOCK-----

View File

@ -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+uT2AR0iS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pH5P2mv83ZvffGfVZQdjoj6gUinHqtU+tlEwkhbua
lyhs+g99VJbxJchFM1JADgokcc31enYM41J239Y9ScoPjQh+Kz9UJzQjmg==
=jUby
-----END PGP PRIVATE KEY BLOCK-----

View File

@ -351,6 +351,7 @@ public abstract class OperationResult implements Parcelable {
MSG_IS_ERROR_IO_EXC(LogLevel.DEBUG, R.string.msg_is_error_io_exc),
MSG_IS_MERGE_PUBLIC (LogLevel.DEBUG, R.string.msg_is_merge_public),
MSG_IS_MERGE_SECRET (LogLevel.DEBUG, R.string.msg_is_merge_secret),
MSG_IS_MERGE_SPECIAL (LogLevel.DEBUG, R.string.msg_is_merge_special),
MSG_IS_IMPORTING_SUBKEYS (LogLevel.DEBUG, R.string.msg_is_importing_subkeys),
MSG_IS_PUBRING_GENERATE (LogLevel.DEBUG, R.string.msg_is_pubring_generate),
MSG_IS_SUBKEY_NONEXISTENT (LogLevel.DEBUG, R.string.msg_is_subkey_nonexistent),

View File

@ -135,9 +135,7 @@ public class ProviderHelper {
}
public void clearLog() {
if (mLog != null) {
mLog.clear();
}
mLog = new OperationLog();
}
// If we ever switch to api level 11, we can ditch this whole mess!
@ -866,9 +864,23 @@ public class ProviderHelper {
// Canonicalize this keyring, to assert a number of assumptions made about it.
// This is a safe cast, because we made sure this is a secret ring above
canSecretRing = (CanonicalizedSecretKeyRing) secretRing.canonicalize(mLog, mIndent);
if (canSecretRing == null) {
// Special case: If keyring canonicalization failed, try again after adding
// all self-certificates from the public key.
try {
log(LogType.MSG_IS_MERGE_SPECIAL);
UncachedKeyRing oldPublicRing = getCanonicalizedPublicKeyRing(masterKeyId).getUncachedKeyRing();
secretRing = secretRing.merge(oldPublicRing, mLog, mIndent);
canSecretRing = (CanonicalizedSecretKeyRing) secretRing.canonicalize(mLog, mIndent);
} catch (NotFoundException e2) {
// nothing, this is handled right in the next line
}
if (canSecretRing == null) {
return new SaveKeyringResult(SaveKeyringResult.RESULT_ERROR, mLog, null);
}
}
}

View File

@ -688,6 +688,7 @@
<string name="msg_is_error_io_exc">"Error encoding keyring"</string>
<string name="msg_is_merge_public">"Merging imported data into existing public keyring"</string>
<string name="msg_is_merge_secret">"Merging imported data into existing public keyring"</string>
<string name="msg_is_merge_special">"Merging in self-certificates data from public keyring"</string>
<string name="msg_is_pubring_generate">"Generating public keyring from secret keyring"</string>
<string name="msg_is_subkey_nonexistent">"Subkey %s unavailable in secret key"</string>
<string name="msg_is_subkey_ok">"Marked secret subkey %s as available"</string>