aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org
diff options
context:
space:
mode:
authorAshley Hughes <spirit.returned@gmail.com>2014-02-15 14:45:57 +0000
committerAshley Hughes <spirit.returned@gmail.com>2014-02-15 14:45:57 +0000
commitc9d9c800b609d4bc9ed4b9f20a4085d4ad3f13bc (patch)
tree136c6367c05859a8a19a901fb244af2069189730 /OpenPGP-Keychain/src/main/java/org
parentba62d30563ee5dd316528decd272f1bbdcbee5bd (diff)
downloadopen-keychain-c9d9c800b609d4bc9ed4b9f20a4085d4ad3f13bc.tar.gz
open-keychain-c9d9c800b609d4bc9ed4b9f20a4085d4ad3f13bc.tar.bz2
open-keychain-c9d9c800b609d4bc9ed4b9f20a4085d4ad3f13bc.zip
pass through deleted keys
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java2
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java5
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java3
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java15
4 files changed, 21 insertions, 4 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
index 505d3ba55..c57718540 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java
@@ -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 {
Log.d(Constants.TAG, "userIds: " + userIds.toString());
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
index 4cace2658..5e5735c88 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
@@ -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_DELETED_IDS = "deleted_ids";
public static final String SAVE_KEYRING_MODDED_KEYS = "modified_keys";
+ public static final String SAVE_KEYRING_DELETED_KEYS = "deleted_keys";
// generate key
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> deleted_ids = data.getStringArrayList(SAVE_KEYRING_DELETED_IDS);
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);
@@ -548,7 +551,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
oldPassPhrase, newPassPhrase);
} else {
keyOperations.buildSecretKey(userIds, original_ids, deleted_ids, keys, modded_keys,
- newPassPhrase, keysExpiryDates, oldPassPhrase, keysUsages);
+ deletedKeys, keysExpiryDates, keysUsages, newPassPhrase, oldPassPhrase);
}
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
index 9ebe73197..ec7dd1330 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java
@@ -580,6 +580,9 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
ArrayList<PGPSecretKey> keys = getKeys(mKeysView);
data.putByteArray(KeychainIntentService.SAVE_KEYRING_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,
getKeysUsages(mKeysView));
data.putSerializable(KeychainIntentService.SAVE_KEYRING_KEYS_EXPIRY_DATES,
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
index 788a80a60..369288d2c 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java
@@ -66,6 +66,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
private boolean canEdit = true;
private boolean oldItemDeleted = false;
private ArrayList<String> mDeletedIDs = new ArrayList<String>();
+ private ArrayList<PGPSecretKey> mDeletedKeys = new ArrayList<PGPSecretKey>();
private ActionBarActivity mActivity;
@@ -136,8 +137,13 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
/** {@inheritDoc} */
public void onDeleted(Editor editor, boolean wasNewItem) {
oldItemDeleted |= !wasNewItem;
- if (oldItemDeleted && mType == Id.type.user_id)
- mDeletedIDs.add(((UserIdEditor)editor).getOriginalID());
+ if (oldItemDeleted) {
+ if (mType == Id.type.user_id)
+ mDeletedIDs.add(((UserIdEditor)editor).getOriginalID());
+ else if (mType == Id.type.key)
+ mDeletedKeys.add(((KeyEditor)editor).getValue());
+
+ }
this.updateEditorsVisible();
if (mEditorListener != null) {
mEditorListener.onEdited();
@@ -186,6 +192,11 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
return mDeletedIDs;
}
+ public ArrayList<PGPSecretKey> getDeletedKeys()
+ {
+ return mDeletedKeys;
+ }
+
public List<Boolean> getNeedsSavingArray()
{
ArrayList<Boolean> mList = new ArrayList<Boolean>();