From a19784ed7e930055a6a1d0a537f2f4f1d3ea1f21 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Thu, 14 Aug 2014 16:27:50 +0200 Subject: [PATCH] merge: check fingerprints on merge operation! (this needs a testcase!) --- .../org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java | 4 +++- OpenKeychain/src/main/res/values/strings.xml | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java index 5c8a85de9..20e78d7fa 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java @@ -45,6 +45,7 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.util.Arrays; import java.util.Comparator; import java.util.Date; import java.util.Iterator; @@ -692,7 +693,8 @@ public class UncachedKeyRing { long masterKeyId = other.getMasterKeyId(); - if (getMasterKeyId() != masterKeyId) { + if (getMasterKeyId() != masterKeyId + || Arrays.equals(getFingerprint(), other.getFingerprint())) { log.add(LogLevel.ERROR, LogType.MSG_MG_HETEROGENEOUS, indent); return null; } diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 20a149956..0da651b03 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -616,7 +616,7 @@ Merging into public keyring %s Merging into secret keyring %s Fatal error encoding signature - Tried to consolidate heterogeneous keyrings + Tried to merge keyrings with differing fingerprints! Adding new subkey %s Found %s new certificates in keyring No new certificates