Merge remote-tracking branch 'origin/master'
Conflicts: OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java OpenKeychain/src/main/res/values-de/strings.xml
This commit is contained in:
@@ -40,6 +40,7 @@ import org.sufficientlysecure.keychain.service.results.OperationResult.LogType;
|
||||
import org.sufficientlysecure.keychain.service.results.OperationResult.OperationLog;
|
||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Utf8Util;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -363,7 +364,7 @@ public class UncachedKeyRing {
|
||||
|
||||
ArrayList<byte[]> processedUserIds = new ArrayList<byte[]>();
|
||||
for (byte[] rawUserId : new IterableIterator<byte[]>(masterKey.getRawUserIDs())) {
|
||||
String userId = Strings.fromUTF8ByteArray(rawUserId);
|
||||
String userId = Utf8Util.fromUTF8ByteArrayReplaceBadEncoding(rawUserId);
|
||||
|
||||
// check for duplicate user ids
|
||||
if (processedUserIds.contains(rawUserId)) {
|
||||
@@ -437,7 +438,7 @@ public class UncachedKeyRing {
|
||||
continue;
|
||||
}
|
||||
// warn user if the signature was made with bad encoding
|
||||
if (!cert.verifySignature(masterKey, userId)) {
|
||||
if (!Utf8Util.isValidUTF8(rawUserId)) {
|
||||
log.add(LogType.MSG_KC_UID_WARN_ENCODING, indent);
|
||||
}
|
||||
} catch (PgpGeneralException e) {
|
||||
|
||||
@@ -32,6 +32,7 @@ import org.spongycastle.util.Strings;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.util.IterableIterator;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
import org.sufficientlysecure.keychain.util.Utf8Util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -185,7 +186,7 @@ public class UncachedPublicKey {
|
||||
}
|
||||
}
|
||||
if (found != null) {
|
||||
return Strings.fromUTF8ByteArray(found);
|
||||
return Utf8Util.fromUTF8ByteArrayReplaceBadEncoding(found);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
@@ -204,8 +205,9 @@ public class UncachedPublicKey {
|
||||
|
||||
public ArrayList<String> getUnorderedUserIds() {
|
||||
ArrayList<String> userIds = new ArrayList<String>();
|
||||
for (String userId : new IterableIterator<String>(mPublicKey.getUserIDs())) {
|
||||
userIds.add(userId);
|
||||
for (byte[] rawUserId : new IterableIterator<byte[]>(mPublicKey.getRawUserIDs())) {
|
||||
// use our decoding method
|
||||
userIds.add(Utf8Util.fromUTF8ByteArrayReplaceBadEncoding(rawUserId));
|
||||
}
|
||||
return userIds;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user