1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-18 02:12:06 +01:00

Add utility methods to KeyRingInfo

This commit is contained in:
Paul Schaub 2023-06-24 10:11:36 +02:00
parent 30481cd510
commit 172972fe29
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -118,6 +118,26 @@ public class KeyRingInfo {
this.revocationState = findRevocationState();
}
/**
* Return the underlying {@link PGPKeyRing}.
* @return keys
*/
public PGPKeyRing getKeys() {
return keys;
}
public List<PGPPublicKey> getValidSubkeys() {
List<PGPPublicKey> subkeys = new ArrayList<>();
Iterator<PGPPublicKey> iterator = getKeys().getPublicKeys();
while (iterator.hasNext()) {
PGPPublicKey key = iterator.next();
if (isKeyValidlyBound(key.getKeyID())) {
subkeys.add(key);
}
}
return subkeys;
}
@Nonnull
private RevocationState findRevocationState() {
PGPSignature revocation = signatures.primaryKeyRevocation;