Move utf8 check for user id upwards

This commit is contained in:
Dominik Schürmann 2014-10-07 18:11:12 +02:00
parent 27d062496f
commit 678265483a

View File

@ -366,6 +366,11 @@ public class UncachedKeyRing {
for (byte[] rawUserId : new IterableIterator<byte[]>(masterKey.getRawUserIDs())) { for (byte[] rawUserId : new IterableIterator<byte[]>(masterKey.getRawUserIDs())) {
String userId = Utf8Util.fromUTF8ByteArrayReplaceBadEncoding(rawUserId); 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 // check for duplicate user ids
if (processedUserIds.contains(userId)) { if (processedUserIds.contains(userId)) {
log.add(LogType.MSG_KC_UID_DUP, log.add(LogType.MSG_KC_UID_DUP,
@ -437,10 +442,6 @@ public class UncachedKeyRing {
badCerts += 1; badCerts += 1;
continue; 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) { } catch (PgpGeneralException e) {
log.add(LogType.MSG_KC_UID_BAD_ERR, log.add(LogType.MSG_KC_UID_BAD_ERR,
indent, userId); indent, userId);