From 91d500b20dba3d83085e4cca8836a4eaff24f113 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 6 May 2015 11:25:29 +0200 Subject: check for fingerprint of any subkey (arguable?) --- .../keychain/operations/ImportExportOperation.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java index ff0b545cd..b48a1da91 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java @@ -275,7 +275,7 @@ public class ImportExportOperation extends BaseOperation { // If we have an expected fingerprint, make sure it matches if (entry.mExpectedFingerprint != null) { - if(!KeyFormattingUtils.convertFingerprintToHex(key.getFingerprint()).equals(entry.mExpectedFingerprint)) { + if (!key.containsSubkey(entry.mExpectedFingerprint)) { log.add(LogType.MSG_IMPORT_FINGERPRINT_ERROR, 2); badKeys += 1; continue; @@ -314,10 +314,7 @@ public class ImportExportOperation extends BaseOperation { log.add(result, 2); - } catch (IOException e) { - Log.e(Constants.TAG, "Encountered bad key on import!", e); - ++badKeys; - } catch (PgpGeneralException e) { + } catch (IOException | PgpGeneralException e) { Log.e(Constants.TAG, "Encountered bad key on import!", e); ++badKeys; } @@ -460,6 +457,7 @@ public class ImportExportOperation extends BaseOperation { int okSecret = 0, okPublic = 0, progress = 0; + Cursor cursor = null; try { String selection = null, ids[] = null; @@ -480,7 +478,7 @@ public class ImportExportOperation extends BaseOperation { + " IN (" + placeholders + ")"; } - Cursor cursor = mProviderHelper.getContentResolver().query( + cursor = mProviderHelper.getContentResolver().query( KeyRings.buildUnifiedKeyRingsUri(), new String[]{ KeyRings.MASTER_KEY_ID, KeyRings.PUBKEY_DATA, KeyRings.PRIVKEY_DATA, KeyRings.HAS_ANY_SECRET @@ -569,6 +567,9 @@ public class ImportExportOperation extends BaseOperation { } catch (Exception e) { Log.e(Constants.TAG, "error closing stream", e); } + if (cursor != null) { + cursor.close(); + } } -- cgit v1.2.3 From 797cd289978055d48cfb0f7a39d94d123c0a30a9 Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Fri, 8 May 2015 19:05:21 +0530 Subject: fixed sync on key import, 'me' linked contact crash --- .../sufficientlysecure/keychain/operations/ImportExportOperation.java | 2 ++ 1 file changed, 2 insertions(+) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java index b48a1da91..86cfc21a3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java @@ -376,6 +376,8 @@ public class ImportExportOperation extends BaseOperation { log.add(LogType.MSG_IMPORT_ERROR, 1); } + ContactSyncAdapterService.requestSync(); + return new ImportKeyResult(resultType, log, newKeys, updatedKeys, badKeys, secret, importedMasterKeyIdsArray); } -- cgit v1.2.3