diff --git a/pgpainless-wot/src/main/java/org/pgpainless/wot/WebOfTrust.java b/pgpainless-wot/src/main/java/org/pgpainless/wot/WebOfTrust.java index 6ff7b7d0..b90ae6ad 100644 --- a/pgpainless-wot/src/main/java/org/pgpainless/wot/WebOfTrust.java +++ b/pgpainless-wot/src/main/java/org/pgpainless/wot/WebOfTrust.java @@ -8,7 +8,6 @@ import java.io.IOException; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; -import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -198,6 +197,12 @@ public class WebOfTrust implements CertificateAuthority { } certsWithKey.add(cert); + Map userIds = new HashMap<>(); + for (String userId : cert.getUserIds()) { + RevocationState state = revocationStateFromSignature(cert.getUserIdRevocation(userId)); + userIds.put(userId, state); + } + // index synopses Date expirationDate; try { @@ -210,7 +215,7 @@ public class WebOfTrust implements CertificateAuthority { new CertSynopsis(cert.getFingerprint(), expirationDate, revocationStateFromSignature(cert.getRevocationSelfSignature()), - new HashSet<>(cert.getValidUserIds()))); + userIds)); } diff --git a/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/CertSynopsis.java b/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/CertSynopsis.java index 37efda07..7be04c1a 100644 --- a/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/CertSynopsis.java +++ b/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/CertSynopsis.java @@ -4,19 +4,20 @@ package org.pgpainless.wot.dijkstra.sq; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + import org.pgpainless.algorithm.RevocationState; import org.pgpainless.key.OpenPgpFingerprint; -import java.util.Date; -import java.util.HashSet; -import java.util.Set; - public class CertSynopsis { private final OpenPgpFingerprint fingerprint; private final Date expirationTime; private final RevocationState revocationState; - private final Set userIds; + private final Map userIds; /** * Create a new {@link CertSynopsis}. @@ -29,7 +30,7 @@ public class CertSynopsis { public CertSynopsis(OpenPgpFingerprint fingerprint, Date expirationTime, RevocationState revocationState, - Set userIds) { + Map userIds) { this.fingerprint = fingerprint; this.expirationTime = expirationTime; this.revocationState = revocationState; @@ -68,12 +69,12 @@ public class CertSynopsis { * * @return user-ids */ - public Set userIds() { - return new HashSet<>(userIds); + public Map userIds() { + return new HashMap<>(userIds); } @Override public String toString() { - return fingerprint + (userIds.isEmpty() ? "" : "(" + userIds.iterator().next() + ")"); + return fingerprint + (userIds.isEmpty() ? "" : "(" + userIds.keySet().iterator().next() + ")"); } } diff --git a/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/Certification.java b/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/Certification.java index baaed2d8..6a9b93d1 100644 --- a/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/Certification.java +++ b/wot-dijkstra/src/main/java/org/pgpainless/wot/dijkstra/sq/Certification.java @@ -140,9 +140,9 @@ public class Certification { @Override public String toString() { StringBuilder sb = new StringBuilder(); - sb.append(issuer.getFingerprint()).append((issuer.userIds().isEmpty() ? " " : " (" + issuer.userIds().iterator().next() + ") ")); + sb.append(issuer.getFingerprint()).append((issuer.userIds().isEmpty() ? " " : " (" + issuer.userIds().keySet().iterator().next() + ") ")); sb.append(userId.isPresent() ? "certifies" : "delegates to").append(userId.isPresent() ? " [" + userId.get() + "] " : " ").append(target.getFingerprint()) - .append(userId.isEmpty() && !target.userIds().isEmpty() ? " (" + target.userIds().iterator().next() + ")" : ""); + .append(userId.isEmpty() && !target.userIds().isEmpty() ? " (" + target.userIds().keySet().iterator().next() + ")" : ""); return sb.toString(); } }