mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-25 16:01:52 -05:00
only sign keys if private key has capability
This commit is contained in:
parent
2d856c5f0e
commit
650b22d5e9
@ -34,8 +34,11 @@ public class SelectSecretKeyActivity extends SherlockFragmentActivity {
|
|||||||
public static final String ACTION_SELECT_SECRET_KEY = Constants.INTENT_PREFIX
|
public static final String ACTION_SELECT_SECRET_KEY = Constants.INTENT_PREFIX
|
||||||
+ "SELECT_SECRET_KEYRING";
|
+ "SELECT_SECRET_KEYRING";
|
||||||
|
|
||||||
|
public static final String EXTRA_FILTER_CERTIFY = "filter_certify";
|
||||||
|
|
||||||
public static final String RESULT_EXTRA_MASTER_KEY_ID = "masterKeyId";
|
public static final String RESULT_EXTRA_MASTER_KEY_ID = "masterKeyId";
|
||||||
public static final String RESULT_EXTRA_USER_ID = "userId";
|
public static final String RESULT_EXTRA_USER_ID = "userId";
|
||||||
|
public static boolean filterCertify = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@ -61,6 +64,8 @@ public class SelectSecretKeyActivity extends SherlockFragmentActivity {
|
|||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
filterCertify = getIntent().getBooleanExtra(EXTRA_FILTER_CERTIFY, false);
|
||||||
|
|
||||||
handleIntent(getIntent());
|
handleIntent(getIntent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,12 +91,22 @@ public class SelectSecretKeyFragment extends SherlockListFragment implements
|
|||||||
// sample only has one Loader, so we don't care about the ID.
|
// sample only has one Loader, so we don't care about the ID.
|
||||||
Uri baseUri = KeyRings.buildSecretKeyRingsUri();
|
Uri baseUri = KeyRings.buildSecretKeyRingsUri();
|
||||||
|
|
||||||
|
String CapFilter = null;
|
||||||
|
if (((SelectSecretKeyActivity)getActivity()).filterCertify == true) {
|
||||||
|
CapFilter = "(cert>0)";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// These are the rows that we will retrieve.
|
// These are the rows that we will retrieve.
|
||||||
long now = new Date().getTime() / 1000;
|
long now = new Date().getTime() / 1000;
|
||||||
String[] projection = new String[] {
|
String[] projection = new String[] {
|
||||||
KeyRings._ID,
|
KeyRings._ID,
|
||||||
KeyRings.MASTER_KEY_ID,
|
KeyRings.MASTER_KEY_ID,
|
||||||
UserIds.USER_ID,
|
UserIds.USER_ID,
|
||||||
|
"(SELECT COUNT(cert_keys." + Keys._ID + ") FROM " + Tables.KEYS
|
||||||
|
+ " AS cert_keys WHERE cert_keys." + Keys.KEY_RING_ROW_ID + " = "
|
||||||
|
+ KeychainDatabase.Tables.KEY_RINGS + "." + KeyRings._ID + " AND cert_keys."
|
||||||
|
+ Keys.CAN_CERTIFY + " = '1') AS cert",
|
||||||
"(SELECT COUNT(available_keys." + Keys._ID + ") FROM " + Tables.KEYS
|
"(SELECT COUNT(available_keys." + Keys._ID + ") FROM " + Tables.KEYS
|
||||||
+ " AS available_keys WHERE available_keys." + Keys.KEY_RING_ROW_ID + " = "
|
+ " AS available_keys WHERE available_keys." + Keys.KEY_RING_ROW_ID + " = "
|
||||||
+ KeychainDatabase.Tables.KEY_RINGS + "." + KeyRings._ID
|
+ KeychainDatabase.Tables.KEY_RINGS + "." + KeyRings._ID
|
||||||
@ -127,7 +137,7 @@ public class SelectSecretKeyFragment extends SherlockListFragment implements
|
|||||||
|
|
||||||
// Now create and return a CursorLoader that will take care of
|
// Now create and return a CursorLoader that will take care of
|
||||||
// creating a Cursor for the data being displayed.
|
// creating a Cursor for the data being displayed.
|
||||||
return new CursorLoader(getActivity(), baseUri, projection, null, null, orderBy);
|
return new CursorLoader(getActivity(), baseUri, projection, CapFilter, null, orderBy);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -121,6 +121,7 @@ public class SignKeyActivity extends SherlockFragmentActivity {
|
|||||||
// kick off the SecretKey selection activity so the user chooses which key to sign with
|
// kick off the SecretKey selection activity so the user chooses which key to sign with
|
||||||
// first
|
// first
|
||||||
Intent intent = new Intent(this, SelectSecretKeyActivity.class);
|
Intent intent = new Intent(this, SelectSecretKeyActivity.class);
|
||||||
|
intent.putExtra(SelectSecretKeyActivity.EXTRA_FILTER_CERTIFY, true);
|
||||||
startActivityForResult(intent, Id.request.secret_keys);
|
startActivityForResult(intent, Id.request.secret_keys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user