diff --git a/pgpainless-core/src/main/java/org/pgpainless/key/info/KeyRingInfo.java b/pgpainless-core/src/main/java/org/pgpainless/key/info/KeyRingInfo.java index a6c8e1a7..f58fb5fc 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/key/info/KeyRingInfo.java +++ b/pgpainless-core/src/main/java/org/pgpainless/key/info/KeyRingInfo.java @@ -149,10 +149,8 @@ public class KeyRingInfo { } if (publicKey == getPublicKey()) { - if (signatures.primaryKeyRevocation != null) { - if (SignatureUtils.isHardRevocation(signatures.primaryKeyRevocation)) { - return false; - } + if (signatures.primaryKeyRevocation != null && SignatureUtils.isHardRevocation(signatures.primaryKeyRevocation)) { + return false; } return signatures.primaryKeyRevocation == null; } @@ -825,10 +823,8 @@ public class KeyRingInfo { * @return encryption subkeys */ public @Nonnull List getEncryptionSubkeys(String userId, EncryptionPurpose purpose) { - if (userId != null) { - if (!isUserIdValid(userId)) { - throw new KeyValidationException(userId, getLatestUserIdCertification(userId), getUserIdRevocation(userId)); - } + if (userId != null && !isUserIdValid(userId)) { + throw new KeyValidationError(userId, getLatestUserIdCertification(userId), getUserIdRevocation(userId)); } return getEncryptionSubkeys(purpose); diff --git a/pgpainless-core/src/main/java/org/pgpainless/signature/SignatureUtils.java b/pgpainless-core/src/main/java/org/pgpainless/signature/SignatureUtils.java index 6ac18175..a59cefdc 100644 --- a/pgpainless-core/src/main/java/org/pgpainless/signature/SignatureUtils.java +++ b/pgpainless-core/src/main/java/org/pgpainless/signature/SignatureUtils.java @@ -308,10 +308,8 @@ public final class SignatureUtils { if (issuerKeyId != null && issuerKeyId.getKeyID() != 0) { return issuerKeyId.getKeyID(); } - if (issuerKeyId == null) { - if (fingerprint != null) { - return fingerprint.getKeyId(); - } + if (issuerKeyId == null && fingerprint != null) { + return fingerprint.getKeyId(); } return 0; }