1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-24 03:47:57 +01:00

Add utility methods to KeyRingInfo

This commit is contained in:
Paul Schaub 2023-06-24 10:11:36 +02:00
parent 6e1d7321db
commit cb594c3b2c
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -117,6 +117,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;