mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-25 00:18:51 -05:00
change how empty private cheks happen, speeds things up
This commit is contained in:
parent
2ccd3796c4
commit
12d6cfefd7
@ -164,9 +164,7 @@ public class PgpHelper {
|
|||||||
for (int i = 0; i < signingKeys.size(); ++i) {
|
for (int i = 0; i < signingKeys.size(); ++i) {
|
||||||
PGPSecretKey key = signingKeys.get(i);
|
PGPSecretKey key = signingKeys.get(i);
|
||||||
if (key.isMasterKey()) {
|
if (key.isMasterKey()) {
|
||||||
if (!isSecretKeyPrivateEmpty(key)) {
|
masterKey = key;
|
||||||
masterKey = key;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
usableKeys.add(key);
|
usableKeys.add(key);
|
||||||
}
|
}
|
||||||
|
@ -370,11 +370,19 @@ public class ProviderHelper {
|
|||||||
private static ContentProviderOperation buildSecretKeyOperations(Context context,
|
private static ContentProviderOperation buildSecretKeyOperations(Context context,
|
||||||
long keyRingRowId, PGPSecretKey key, int rank) throws IOException {
|
long keyRingRowId, PGPSecretKey key, int rank) throws IOException {
|
||||||
ContentValues values = new ContentValues();
|
ContentValues values = new ContentValues();
|
||||||
|
|
||||||
|
boolean has_private = true;
|
||||||
|
if (key.isMasterKey()) {
|
||||||
|
if (PgpHelper.isSecretKeyPrivateEmpty(key)) {
|
||||||
|
has_private = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
values.put(Keys.KEY_ID, key.getKeyID());
|
values.put(Keys.KEY_ID, key.getKeyID());
|
||||||
values.put(Keys.IS_MASTER_KEY, key.isMasterKey());
|
values.put(Keys.IS_MASTER_KEY, key.isMasterKey());
|
||||||
values.put(Keys.ALGORITHM, key.getPublicKey().getAlgorithm());
|
values.put(Keys.ALGORITHM, key.getPublicKey().getAlgorithm());
|
||||||
values.put(Keys.KEY_SIZE, key.getPublicKey().getBitStrength());
|
values.put(Keys.KEY_SIZE, key.getPublicKey().getBitStrength());
|
||||||
values.put(Keys.CAN_SIGN, PgpHelper.isSigningKey(key));
|
values.put(Keys.CAN_SIGN, (PgpHelper.isSigningKey(key) && has_private));
|
||||||
values.put(Keys.CAN_ENCRYPT, PgpHelper.isEncryptionKey(key));
|
values.put(Keys.CAN_ENCRYPT, PgpHelper.isEncryptionKey(key));
|
||||||
values.put(Keys.IS_REVOKED, key.getPublicKey().isRevoked());
|
values.put(Keys.IS_REVOKED, key.getPublicKey().isRevoked());
|
||||||
values.put(Keys.CREATION, PgpHelper.getCreationDate(key).getTime() / 1000);
|
values.put(Keys.CREATION, PgpHelper.getCreationDate(key).getTime() / 1000);
|
||||||
|
@ -159,13 +159,8 @@ public class KeyListAdapter extends CursorTreeAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ImageView signIcon = (ImageView) view.findViewById(R.id.ic_signKey);
|
ImageView signIcon = (ImageView) view.findViewById(R.id.ic_signKey);
|
||||||
boolean privateEmpty = false; //Don't show signing icon for master keys without private keys
|
|
||||||
//TODO: does this need to be done for encrypting icon? Does anyone use master key for encrypt?
|
if (cursor.getInt(cursor.getColumnIndex(Keys.CAN_SIGN)) != 1) {
|
||||||
if (cursor.getInt(cursor.getColumnIndex(Keys.IS_MASTER_KEY)) == 1) {
|
|
||||||
privateEmpty = PgpHelper.isSecretKeyPrivateEmpty(context,
|
|
||||||
cursor.getLong(cursor.getColumnIndex(Keys.KEY_ID)));
|
|
||||||
}
|
|
||||||
if (privateEmpty || cursor.getInt(cursor.getColumnIndex(Keys.CAN_SIGN)) != 1) {
|
|
||||||
signIcon.setVisibility(View.GONE);
|
signIcon.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
signIcon.setVisibility(View.VISIBLE);
|
signIcon.setVisibility(View.VISIBLE);
|
||||||
|
Loading…
Reference in New Issue
Block a user