aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-05-07 22:41:09 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-05-07 22:43:14 +0200
commit346b5dbb2821254ffc7052871e5ded3207edc29f (patch)
tree4036356e8603d3851d8d951b4cb0083f596e7dca /OpenKeychain
parentb4a9d1a2db941a66bade5be2e12fe3ea7f1a3f26 (diff)
downloadopen-keychain-346b5dbb2821254ffc7052871e5ded3207edc29f.tar.gz
open-keychain-346b5dbb2821254ffc7052871e5ded3207edc29f.tar.bz2
open-keychain-346b5dbb2821254ffc7052871e5ded3207edc29f.zip
Don't allow certification using keys where primary subkey is stripped
Closes #596
Diffstat (limited to 'OpenKeychain')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyFragment.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyFragment.java
index 6de03198e..38a0c8478 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyFragment.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyFragment.java
@@ -56,7 +56,7 @@ public class SelectSecretKeyFragment extends ListFragment implements
Bundle args = new Bundle();
args.putBoolean(ARG_FILTER_CERTIFY, filterCertify);
- args.putBoolean(ARG_FILTER_CERTIFY, filterSign);
+ args.putBoolean(ARG_FILTER_SIGN, filterSign);
frag.setArguments(args);
return frag;
@@ -124,7 +124,8 @@ public class SelectSecretKeyFragment extends ListFragment implements
KeyRings.CAN_CERTIFY,
// has sign may be any subkey
KeyRings.HAS_SIGN,
- KeyRings.HAS_ANY_SECRET
+ KeyRings.HAS_ANY_SECRET,
+ KeyRings.HAS_SECRET
};
String where = KeyRings.HAS_ANY_SECRET + " = 1";
@@ -158,7 +159,7 @@ public class SelectSecretKeyFragment extends ListFragment implements
private class SelectSecretKeyCursorAdapter extends SelectKeyCursorAdapter {
- private int mIndexHasSign, mIndexCanCertify;
+ private int mIndexHasSign, mIndexCanCertify, mIndexHasSecret;
public SelectSecretKeyCursorAdapter(Context context, Cursor c, int flags, ListView listView) {
super(context, c, flags, listView);
@@ -170,6 +171,7 @@ public class SelectSecretKeyFragment extends ListFragment implements
if (cursor != null) {
mIndexCanCertify = cursor.getColumnIndexOrThrow(KeyRings.CAN_CERTIFY);
mIndexHasSign = cursor.getColumnIndexOrThrow(KeyRings.HAS_SIGN);
+ mIndexHasSecret = cursor.getColumnIndexOrThrow(KeyRings.HAS_SECRET);
}
}
@@ -187,7 +189,8 @@ public class SelectSecretKeyFragment extends ListFragment implements
// Check if key is viable for our purposes (certify or sign)
if(mFilterCertify) {
// Only enable if can certify
- if (cursor.getInt(mIndexCanCertify) == 0) {
+ if (cursor.getInt(mIndexCanCertify) == 0
+ || cursor.getInt(mIndexHasSecret) == 0) {
h.status.setText(R.string.can_certify_not);
} else {
h.status.setText(R.string.can_certify);