diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-09-09 22:41:24 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-09-09 22:43:14 +0200 |
commit | 7dbb7cf1e1fd4de1098d4a2207a90ddc680598ed (patch) | |
tree | e44cec83c4e97c586e8fd730d0458b5da92c3bc8 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java | |
parent | a925e8b83f2af77bd74752dbe56c18baedeb1f1f (diff) | |
download | open-keychain-7dbb7cf1e1fd4de1098d4a2207a90ddc680598ed.tar.gz open-keychain-7dbb7cf1e1fd4de1098d4a2207a90ddc680598ed.tar.bz2 open-keychain-7dbb7cf1e1fd4de1098d4a2207a90ddc680598ed.zip |
jury-rig broken sign mechanism
Should improve situation on #811
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java index 9bed6a5ae..290dc1ce6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java @@ -36,6 +36,9 @@ import org.sufficientlysecure.keychain.compatibility.ClipboardReflection; import org.sufficientlysecure.keychain.helper.Preferences; import org.sufficientlysecure.keychain.helper.ShareHelper; import org.sufficientlysecure.keychain.pgp.KeyRing; +import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; +import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing; +import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; import org.sufficientlysecure.keychain.service.PassphraseCacheService; @@ -235,7 +238,7 @@ public class EncryptTextActivity extends DrawerActivity implements EncryptActivi } data.putString(KeychainIntentService.ENCRYPT_SYMMETRIC_PASSPHRASE, passphrase); } else { - data.putLong(KeychainIntentService.ENCRYPT_SIGNATURE_KEY_ID, mSigningKeyId); + data.putLong(KeychainIntentService.ENCRYPT_SIGNATURE_MASTER_ID, mSigningKeyId); data.putLongArray(KeychainIntentService.ENCRYPT_ENCRYPTION_KEYS_IDS, mEncryptionKeyIds); } return data; @@ -310,21 +313,28 @@ public class EncryptTextActivity extends DrawerActivity implements EncryptActivi } try { - if (mSigningKeyId != 0 && PassphraseCacheService.getCachedPassphrase(this, mSigningKeyId) == null) { - PassphraseDialogFragment.show(this, mSigningKeyId, - new Handler() { - @Override - public void handleMessage(Message message) { - if (message.what == PassphraseDialogFragment.MESSAGE_OKAY) { - // restart - startEncrypt(); + if (mSigningKeyId != 0) { + CachedPublicKeyRing signingRing = + new ProviderHelper(this).getCachedPublicKeyRing(mSigningKeyId); + long sigSubKeyId = signingRing.getSignId(); + if (PassphraseCacheService.getCachedPassphrase(this, sigSubKeyId) == null) { + PassphraseDialogFragment.show(this, sigSubKeyId, + new Handler() { + @Override + public void handleMessage(Message message) { + if (message.what == PassphraseDialogFragment.MESSAGE_OKAY) { + // restart + startEncrypt(); + } } } - } - ); + ); - return false; + return false; + } } + } catch (PgpGeneralException e) { + Log.e(Constants.TAG, "Key not found!", e); } catch (PassphraseCacheService.KeyNotFoundException e) { Log.e(Constants.TAG, "Key not found!", e); } |