diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-07-08 04:36:43 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-07-08 04:36:43 +0200 |
commit | 5633fcc92f20ecd81e4a4ea7f22416f58d051c49 (patch) | |
tree | 51f5effca32e6e6d5b962aea9b3039f61d982b7b /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations | |
parent | 6cbc0ceeaed90fdeba1d6cdd94db274e53a10235 (diff) | |
download | open-keychain-5633fcc92f20ecd81e4a4ea7f22416f58d051c49.tar.gz open-keychain-5633fcc92f20ecd81e4a4ea7f22416f58d051c49.tar.bz2 open-keychain-5633fcc92f20ecd81e4a4ea7f22416f58d051c49.zip |
fix symmetric passphrase caching (fixes #1401)
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations')
2 files changed, 7 insertions, 2 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BaseOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BaseOperation.java index a8d1f0313..e4026eaaf 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BaseOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/BaseOperation.java @@ -21,6 +21,7 @@ import android.content.Context; import android.os.Parcelable; import android.support.annotation.NonNull; +import org.sufficientlysecure.keychain.Constants.key; import org.sufficientlysecure.keychain.operations.results.OperationResult; import org.sufficientlysecure.keychain.pgp.PassphraseCacheInterface; import org.sufficientlysecure.keychain.pgp.Progressable; @@ -111,8 +112,11 @@ public abstract class BaseOperation <T extends Parcelable> implements Passphrase @Override public Passphrase getCachedPassphrase(long subKeyId) throws NoSecretKeyException { try { - long masterKeyId = mProviderHelper.getMasterKeyId(subKeyId); - return getCachedPassphrase(masterKeyId, subKeyId); + if (subKeyId != key.symmetric) { + long masterKeyId = mProviderHelper.getMasterKeyId(subKeyId); + return getCachedPassphrase(masterKeyId, subKeyId); + } + return getCachedPassphrase(key.symmetric, key.symmetric); } catch (NotFoundException e) { throw new PassphraseCacheInterface.NoSecretKeyException(); } 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 9da3b94af..88d04350c 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 @@ -605,6 +605,7 @@ public abstract class OperationResult implements Parcelable { MSG_DC_CLEAR_SIGNATURE_OK (LogLevel.OK, R.string.msg_dc_clear_signature_ok), MSG_DC_CLEAR_SIGNATURE (LogLevel.DEBUG, R.string.msg_dc_clear_signature), MSG_DC_ERROR_BAD_PASSPHRASE (LogLevel.ERROR, R.string.msg_dc_error_bad_passphrase), + MSG_DC_ERROR_SYM_PASSPHRASE (LogLevel.ERROR, R.string.msg_dc_error_sym_passphrase), MSG_DC_ERROR_CORRUPT_DATA (LogLevel.ERROR, R.string.msg_dc_error_corrupt_data), MSG_DC_ERROR_EXTRACT_KEY (LogLevel.ERROR, R.string.msg_dc_error_extract_key), MSG_DC_ERROR_INTEGRITY_CHECK (LogLevel.ERROR, R.string.msg_dc_error_integrity_check), |