From 9395fa80a25569f6af677b208b476366d2920403 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 28 Jun 2021 21:06:12 +0200 Subject: [PATCH] Revert if-conditions to reduce indentation level --- .../org/pgpainless/key/info/KeyRingInfo.java | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) 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 ab822393..4914f7fc 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 @@ -697,11 +697,12 @@ public class KeyRingInfo { * @return true if all secret keys are unencrypted. */ public boolean isFullyDecrypted() { - if (isSecretKey()) { - for (PGPSecretKey secretKey : getSecretKeys()) { - if (!KeyInfo.hasDummyS2K(secretKey) && KeyInfo.isEncrypted(secretKey)) { - return false; - } + if (!isSecretKey()) { + return true; + } + for (PGPSecretKey secretKey : getSecretKeys()) { + if (!KeyInfo.hasDummyS2K(secretKey) && KeyInfo.isEncrypted(secretKey)) { + return false; } } return true; @@ -716,15 +717,15 @@ public class KeyRingInfo { * @return true if all secret keys are encrypted. */ public boolean isFullyEncrypted() { - if (isSecretKey()) { - for (PGPSecretKey secretKey : getSecretKeys()) { - if (!KeyInfo.hasDummyS2K(secretKey) && KeyInfo.isDecrypted(secretKey)) { - return false; - } - } - return true; + if (!isSecretKey()) { + return false; } - return false; + for (PGPSecretKey secretKey : getSecretKeys()) { + if (!KeyInfo.hasDummyS2K(secretKey) && KeyInfo.isDecrypted(secretKey)) { + return false; + } + } + return true; } /**