mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-30 12:32:17 -05:00
pass through deleted keys
This commit is contained in:
parent
ba62d30563
commit
c9d9c800b6
@ -198,7 +198,7 @@ public class PgpKeyOperation {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildSecretKey(ArrayList<String> userIds, ArrayList<String> OriginalIDs, ArrayList<String> deletedIDs, ArrayList<PGPSecretKey> keys, boolean[] modded_keys, String newPassPhrase, ArrayList<GregorianCalendar> keysExpiryDates, String oldPassPhrase, ArrayList<Integer> keysUsages) throws PgpGeneralException,
|
public void buildSecretKey(ArrayList<String> userIds, ArrayList<String> OriginalIDs, ArrayList<String> deletedIDs, ArrayList<PGPSecretKey> keys, boolean[] modded_keys, ArrayList<PGPSecretKey> deleted_keys, ArrayList<GregorianCalendar> keysExpiryDates, ArrayList<Integer> keysUsages, String newPassPhrase, String oldPassPhrase) throws PgpGeneralException,
|
||||||
PGPException, SignatureException, IOException {
|
PGPException, SignatureException, IOException {
|
||||||
|
|
||||||
Log.d(Constants.TAG, "userIds: " + userIds.toString());
|
Log.d(Constants.TAG, "userIds: " + userIds.toString());
|
||||||
|
@ -137,6 +137,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
|||||||
public static final String SAVE_KEYRING_ORIGINAL_IDS = "original_ids";
|
public static final String SAVE_KEYRING_ORIGINAL_IDS = "original_ids";
|
||||||
public static final String SAVE_KEYRING_DELETED_IDS = "deleted_ids";
|
public static final String SAVE_KEYRING_DELETED_IDS = "deleted_ids";
|
||||||
public static final String SAVE_KEYRING_MODDED_KEYS = "modified_keys";
|
public static final String SAVE_KEYRING_MODDED_KEYS = "modified_keys";
|
||||||
|
public static final String SAVE_KEYRING_DELETED_KEYS = "deleted_keys";
|
||||||
|
|
||||||
// generate key
|
// generate key
|
||||||
public static final String GENERATE_KEY_ALGORITHM = "algorithm";
|
public static final String GENERATE_KEY_ALGORITHM = "algorithm";
|
||||||
@ -537,6 +538,8 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
|||||||
ArrayList<String> original_ids = data.getStringArrayList(SAVE_KEYRING_ORIGINAL_IDS);
|
ArrayList<String> original_ids = data.getStringArrayList(SAVE_KEYRING_ORIGINAL_IDS);
|
||||||
ArrayList<String> deleted_ids = data.getStringArrayList(SAVE_KEYRING_DELETED_IDS);
|
ArrayList<String> deleted_ids = data.getStringArrayList(SAVE_KEYRING_DELETED_IDS);
|
||||||
boolean[] modded_keys = data.getBooleanArray(SAVE_KEYRING_MODDED_KEYS);
|
boolean[] modded_keys = data.getBooleanArray(SAVE_KEYRING_MODDED_KEYS);
|
||||||
|
ArrayList<PGPSecretKey> deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(data
|
||||||
|
.getByteArray(SAVE_KEYRING_DELETED_KEYS));
|
||||||
|
|
||||||
long masterKeyId = data.getLong(SAVE_KEYRING_MASTER_KEY_ID);
|
long masterKeyId = data.getLong(SAVE_KEYRING_MASTER_KEY_ID);
|
||||||
|
|
||||||
@ -548,7 +551,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
|||||||
oldPassPhrase, newPassPhrase);
|
oldPassPhrase, newPassPhrase);
|
||||||
} else {
|
} else {
|
||||||
keyOperations.buildSecretKey(userIds, original_ids, deleted_ids, keys, modded_keys,
|
keyOperations.buildSecretKey(userIds, original_ids, deleted_ids, keys, modded_keys,
|
||||||
newPassPhrase, keysExpiryDates, oldPassPhrase, keysUsages);
|
deletedKeys, keysExpiryDates, keysUsages, newPassPhrase, oldPassPhrase);
|
||||||
}
|
}
|
||||||
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);
|
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);
|
||||||
|
|
||||||
|
@ -580,6 +580,9 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
ArrayList<PGPSecretKey> keys = getKeys(mKeysView);
|
ArrayList<PGPSecretKey> keys = getKeys(mKeysView);
|
||||||
data.putByteArray(KeychainIntentService.SAVE_KEYRING_KEYS,
|
data.putByteArray(KeychainIntentService.SAVE_KEYRING_KEYS,
|
||||||
PgpConversionHelper.PGPSecretKeyArrayListToBytes(keys));
|
PgpConversionHelper.PGPSecretKeyArrayListToBytes(keys));
|
||||||
|
ArrayList<PGPSecretKey> dKeys = mKeysView.getDeletedKeys();
|
||||||
|
data.putByteArray(KeychainIntentService.SAVE_KEYRING_DELETED_KEYS,
|
||||||
|
PgpConversionHelper.PGPSecretKeyArrayListToBytes(dKeys));
|
||||||
data.putIntegerArrayList(KeychainIntentService.SAVE_KEYRING_KEYS_USAGES,
|
data.putIntegerArrayList(KeychainIntentService.SAVE_KEYRING_KEYS_USAGES,
|
||||||
getKeysUsages(mKeysView));
|
getKeysUsages(mKeysView));
|
||||||
data.putSerializable(KeychainIntentService.SAVE_KEYRING_KEYS_EXPIRY_DATES,
|
data.putSerializable(KeychainIntentService.SAVE_KEYRING_KEYS_EXPIRY_DATES,
|
||||||
|
@ -66,6 +66,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
private boolean canEdit = true;
|
private boolean canEdit = true;
|
||||||
private boolean oldItemDeleted = false;
|
private boolean oldItemDeleted = false;
|
||||||
private ArrayList<String> mDeletedIDs = new ArrayList<String>();
|
private ArrayList<String> mDeletedIDs = new ArrayList<String>();
|
||||||
|
private ArrayList<PGPSecretKey> mDeletedKeys = new ArrayList<PGPSecretKey>();
|
||||||
|
|
||||||
private ActionBarActivity mActivity;
|
private ActionBarActivity mActivity;
|
||||||
|
|
||||||
@ -136,8 +137,13 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void onDeleted(Editor editor, boolean wasNewItem) {
|
public void onDeleted(Editor editor, boolean wasNewItem) {
|
||||||
oldItemDeleted |= !wasNewItem;
|
oldItemDeleted |= !wasNewItem;
|
||||||
if (oldItemDeleted && mType == Id.type.user_id)
|
if (oldItemDeleted) {
|
||||||
|
if (mType == Id.type.user_id)
|
||||||
mDeletedIDs.add(((UserIdEditor)editor).getOriginalID());
|
mDeletedIDs.add(((UserIdEditor)editor).getOriginalID());
|
||||||
|
else if (mType == Id.type.key)
|
||||||
|
mDeletedKeys.add(((KeyEditor)editor).getValue());
|
||||||
|
|
||||||
|
}
|
||||||
this.updateEditorsVisible();
|
this.updateEditorsVisible();
|
||||||
if (mEditorListener != null) {
|
if (mEditorListener != null) {
|
||||||
mEditorListener.onEdited();
|
mEditorListener.onEdited();
|
||||||
@ -186,6 +192,11 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
return mDeletedIDs;
|
return mDeletedIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ArrayList<PGPSecretKey> getDeletedKeys()
|
||||||
|
{
|
||||||
|
return mDeletedKeys;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Boolean> getNeedsSavingArray()
|
public List<Boolean> getNeedsSavingArray()
|
||||||
{
|
{
|
||||||
ArrayList<Boolean> mList = new ArrayList<Boolean>();
|
ArrayList<Boolean> mList = new ArrayList<Boolean>();
|
||||||
|
Loading…
Reference in New Issue
Block a user