1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-01-09 19:57:57 +01:00

Prevent third-party assigned user-ids from being accidentally returned as primary user-id

Fixes #293
This commit is contained in:
Paul Schaub 2022-07-10 23:02:00 +02:00
parent 520fcd7cbf
commit 52c8439da5
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -289,16 +289,16 @@ public class KeyRingInfo {
return null; return null;
} }
String firstUserId = userIds.get(0); String firstUserId = null;
if (userIds.size() == 1) {
return firstUserId;
}
for (String userId : userIds) { for (String userId : userIds) {
PGPSignature certification = signatures.userIdCertifications.get(userId); PGPSignature certification = signatures.userIdCertifications.get(userId);
if (certification == null) { if (certification == null) {
continue; continue;
} }
if (firstUserId == null) {
firstUserId = userId;
}
Date creationTime = certification.getCreationTime(); Date creationTime = certification.getCreationTime();
if (certification.getHashedSubPackets().isPrimaryUserID()) { if (certification.getHashedSubPackets().isPrimaryUserID()) {