1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2025-12-10 06:11:08 +01:00

KeyRingInfo.isUsableFor*(): Check if primary key is revoked

This commit is contained in:
Paul Schaub 2022-08-03 13:37:18 +02:00
parent c1de66e1d7
commit ca09ac62ca
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
2 changed files with 49 additions and 1 deletions

View file

@ -1048,10 +1048,14 @@ public class KeyRingInfo {
* @return true if usable for encryption
*/
public boolean isUsableForEncryption(@Nonnull EncryptionPurpose purpose) {
return !getEncryptionSubkeys(purpose).isEmpty();
return isKeyValidlyBound(getKeyId()) && !getEncryptionSubkeys(purpose).isEmpty();
}
public boolean isUsableForSigning() {
if (!isKeyValidlyBound(getKeyId())) {
return false;
}
List<PGPPublicKey> signingKeys = getSigningSubkeys();
for (PGPPublicKey pk : signingKeys) {
PGPSecretKey sk = getSecretKey(pk.getKeyID());