canonicalize: compare user ids as string rather than bytes

This commit is contained in:
Vincent Breitmoser
2014-10-04 11:14:02 +02:00
parent 2b5341f0d4
commit ff144c7c11

View File

@@ -362,18 +362,18 @@ public class UncachedKeyRing {
} }
} }
ArrayList<byte[]> processedUserIds = new ArrayList<byte[]>(); ArrayList<String> processedUserIds = new ArrayList<String>();
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);
// check for duplicate user ids // check for duplicate user ids
if (processedUserIds.contains(rawUserId)) { if (processedUserIds.contains(userId)) {
log.add(LogType.MSG_KC_UID_DUP, log.add(LogType.MSG_KC_UID_DUP,
indent, userId); indent, userId);
// strip out the first found user id with this name // strip out the first found user id with this name
modified = PGPPublicKey.removeCertification(modified, rawUserId); modified = PGPPublicKey.removeCertification(modified, rawUserId);
} }
processedUserIds.add(rawUserId); processedUserIds.add(userId);
PGPSignature selfCert = null; PGPSignature selfCert = null;
revocation = null; revocation = null;