diff options
Diffstat (limited to 'OpenKeychain/src/main/java')
4 files changed, 15 insertions, 5 deletions
| diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java index 25abab25b..4646aef8a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java @@ -530,7 +530,6 @@ public abstract class OperationResult implements Parcelable {          MSG_MF_ERROR_REVOKED_PRIMARY (LogLevel.ERROR, R.string.msg_mf_error_revoked_primary),          MSG_MF_ERROR_SIG (LogLevel.ERROR, R.string.msg_mf_error_sig),          MSG_MF_ERROR_SUBKEY_MISSING(LogLevel.ERROR, R.string.msg_mf_error_subkey_missing), -        MSG_MF_INPUT_REQUIRED (LogLevel.OK, R.string.msg_mf_input_required),          MSG_MF_MASTER (LogLevel.DEBUG, R.string.msg_mf_master),          MSG_MF_NOTATION_PIN (LogLevel.DEBUG, R.string.msg_mf_notation_pin),          MSG_MF_NOTATION_EMPTY (LogLevel.DEBUG, R.string.msg_mf_notation_empty), @@ -540,6 +539,9 @@ public abstract class OperationResult implements Parcelable {          MSG_MF_PASSPHRASE_FAIL (LogLevel.WARN, R.string.msg_mf_passphrase_fail),          MSG_MF_PRIMARY_REPLACE_OLD (LogLevel.DEBUG, R.string.msg_mf_primary_replace_old),          MSG_MF_PRIMARY_NEW (LogLevel.DEBUG, R.string.msg_mf_primary_new), +        MSG_MF_RESTRICTED_MODE (LogLevel.INFO, R.string.msg_mf_restricted_mode), +        MSG_MF_REQUIRE_DIVERT (LogLevel.OK, R.string.msg_mf_require_divert), +        MSG_MF_REQUIRE_PASSPHRASE (LogLevel.OK, R.string.msg_mf_require_passphrase),          MSG_MF_SUBKEY_CHANGE (LogLevel.INFO, R.string.msg_mf_subkey_change),          MSG_MF_SUBKEY_NEW_ID (LogLevel.DEBUG, R.string.msg_mf_subkey_new_id),          MSG_MF_SUBKEY_NEW (LogLevel.INFO, R.string.msg_mf_subkey_new), diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index f739cfb69..454a35cd6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -395,12 +395,14 @@ public class PgpKeyOperation {              return new PgpEditKeyResult(PgpEditKeyResult.RESULT_ERROR, log, null);          } -        if (saveParcel.isRestrictedOnly()) { +        if (isDummy(masterSecretKey) || saveParcel.isRestrictedOnly()) { +            log.add(LogType.MSG_MF_RESTRICTED_MODE, indent);              return internalRestricted(sKR, saveParcel, log);          }          // Do we require a passphrase? If so, pass it along          if (!isDivertToCard(masterSecretKey) && !cryptoInput.hasPassphrase()) { +            log.add(LogType.MSG_MF_REQUIRE_PASSPHRASE, indent);              return new PgpEditKeyResult(log, RequiredInputParcel.createRequiredPassphrase(                      masterSecretKey.getKeyID(), cryptoInput.getSignatureTime()));          } @@ -971,7 +973,7 @@ public class PgpKeyOperation {          progress(R.string.progress_done, 100);          if (!nfcSignOps.isEmpty()) { -            log.add(LogType.MSG_MF_INPUT_REQUIRED, indent); +            log.add(LogType.MSG_MF_REQUIRE_DIVERT, indent);              return new PgpEditKeyResult(log, nfcSignOps.build());          } @@ -1459,6 +1461,12 @@ public class PgpKeyOperation {          return flags;      } +    private static boolean isDummy(PGPSecretKey secretKey) { +        S2K s2k = secretKey.getS2K(); +        return s2k.getType() == S2K.GNU_DUMMY_S2K +                && s2k.getProtectionMode() == S2K.GNU_PROTECTION_MODE_NO_PRIVATE_KEY; +    } +      private static boolean isDivertToCard(PGPSecretKey secretKey) {          S2K s2k = secretKey.getS2K();          return s2k.getType() == S2K.GNU_DUMMY_S2K diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java index 9fd278c13..88f258c58 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/SaveKeyringParcel.java @@ -85,7 +85,7 @@ public class SaveKeyringParcel implements Parcelable {      /** Returns true iff this parcel does not contain any operations which require a passphrase. */      public boolean isRestrictedOnly() {          if (mNewUnlock != null || !mAddUserIds.isEmpty() || !mAddUserAttribute.isEmpty() -                || !mAddSubKeys.isEmpty() || mChangePrimaryUserId != null || !mRevokeSubKeys .isEmpty() +                || !mAddSubKeys.isEmpty() || mChangePrimaryUserId != null || !mRevokeUserIds.isEmpty()                  || !mRevokeSubKeys.isEmpty()) {              return false;          } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java index 6edc48b09..21aacd1f0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/input/CryptoInputParcel.java @@ -36,7 +36,7 @@ public class CryptoInputParcel implements Parcelable {      public CryptoInputParcel(Passphrase passphrase) {          mSignatureTime = new Date(); -        mPassphrase = null; +        mPassphrase = passphrase;      }      public CryptoInputParcel(Date signatureTime) { | 
