From 678265483a9ec7457dd75bfdaba02bf8e981b6a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 7 Oct 2014 18:11:12 +0200 Subject: Move utf8 check for user id upwards --- .../org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java') 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 7c640efb8..17d35dc1f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java @@ -366,6 +366,11 @@ public class UncachedKeyRing { for (byte[] rawUserId : new IterableIterator(masterKey.getRawUserIDs())) { String userId = Utf8Util.fromUTF8ByteArrayReplaceBadEncoding(rawUserId); + // warn if user id was made with bad encoding + if (!Utf8Util.isValidUTF8(rawUserId)) { + log.add(LogType.MSG_KC_UID_WARN_ENCODING, indent); + } + // check for duplicate user ids if (processedUserIds.contains(userId)) { log.add(LogType.MSG_KC_UID_DUP, @@ -437,10 +442,6 @@ public class UncachedKeyRing { badCerts += 1; continue; } - // warn user if the signature was made with bad encoding - if (!Utf8Util.isValidUTF8(rawUserId)) { - log.add(LogType.MSG_KC_UID_WARN_ENCODING, indent); - } } catch (PgpGeneralException e) { log.add(LogType.MSG_KC_UID_BAD_ERR, indent, userId); -- cgit v1.2.3