aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
diff options
context:
space:
mode:
authorAshley Hughes <spirit.returned@gmail.com>2014-03-06 23:47:11 +0000
committerAshley Hughes <spirit.returned@gmail.com>2014-03-06 23:47:11 +0000
commit04fa0e9cc7fbfc117948d60a3ad8bfab0b0060ba (patch)
tree8b248117c6c7d4f9907a46846b0ac11a45f94dec /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
parent01951810ae1b3a0e4fefab7d55c090fc8f776ce5 (diff)
downloadopen-keychain-04fa0e9cc7fbfc117948d60a3ad8bfab0b0060ba.tar.gz
open-keychain-04fa0e9cc7fbfc117948d60a3ad8bfab0b0060ba.tar.bz2
open-keychain-04fa0e9cc7fbfc117948d60a3ad8bfab0b0060ba.zip
use parcel to save keys, but saving existing keys is disabled, pending a rewrite...
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java45
1 files changed, 8 insertions, 37 deletions
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 9d6e24d30..24bce8eeb 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
@@ -125,20 +125,9 @@ public class KeychainIntentService extends IntentService implements ProgressDial
public static final String DECRYPT_ASSUME_SYMMETRIC = "assume_symmetric";
// save keyring
- public static final String SAVE_KEYRING_NEW_PASSPHRASE = "new_passphrase";
- public static final String SAVE_KEYRING_CURRENT_PASSPHRASE = "current_passphrase";
- public static final String SAVE_KEYRING_USER_IDS = "user_ids";
- public static final String SAVE_KEYRING_PRIMARY_ID_CHANGED = "primary_id_changed";
- public static final String SAVE_KEYRING_KEYS = "keys";
- public static final String SAVE_KEYRING_KEYS_USAGES = "keys_usages";
- public static final String SAVE_KEYRING_KEYS_EXPIRY_DATES = "keys_expiry_dates";
- public static final String SAVE_KEYRING_MASTER_KEY_ID = "master_key_id";
+ public static final String SAVE_KEYRING_PARCEL = "save_parcel";
public static final String SAVE_KEYRING_CAN_SIGN = "can_sign";
- 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";
- public static final String SAVE_KEYRING_NEW_KEYS = "new_keys";
+
// generate key
public static final String GENERATE_KEY_ALGORITHM = "algorithm";
@@ -530,8 +519,9 @@ public class KeychainIntentService extends IntentService implements ProgressDial
} else if (ACTION_SAVE_KEYRING.equals(action)) {
try {
/* Input */
- String oldPassPhrase = data.getString(SAVE_KEYRING_CURRENT_PASSPHRASE);
- String newPassPhrase = data.getString(SAVE_KEYRING_NEW_PASSPHRASE);
+ SaveKeyringParcel saveParams = data.getParcelable(SAVE_KEYRING_PARCEL);
+ String oldPassPhrase = saveParams.oldPassPhrase;
+ String newPassPhrase = saveParams.newPassPhrase;
boolean canSign = true;
if (data.containsKey(SAVE_KEYRING_CAN_SIGN)) {
@@ -541,25 +531,8 @@ public class KeychainIntentService extends IntentService implements ProgressDial
if (newPassPhrase == null) {
newPassPhrase = oldPassPhrase;
}
- ArrayList<String> userIds = data.getStringArrayList(SAVE_KEYRING_USER_IDS);
- ArrayList<PGPSecretKey> keys = PgpConversionHelper.BytesToPGPSecretKeyList(data
- .getByteArray(SAVE_KEYRING_KEYS));
- ArrayList<Integer> keysUsages = data.getIntegerArrayList(SAVE_KEYRING_KEYS_USAGES);
- ArrayList<GregorianCalendar> keysExpiryDates = (ArrayList<GregorianCalendar>) data.getSerializable(SAVE_KEYRING_KEYS_EXPIRY_DATES);
- 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);
- boolean[] new_keys = data.getBooleanArray(SAVE_KEYRING_NEW_KEYS);
- byte[] tmp = data.getByteArray(SAVE_KEYRING_DELETED_KEYS);
- ArrayList<PGPSecretKey> deletedKeys;
- if (tmp != null)
- deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(data
- .getByteArray(SAVE_KEYRING_DELETED_KEYS));
- else
- deletedKeys = new ArrayList<PGPSecretKey>();
- boolean primaryChanged = data.getBoolean(SAVE_KEYRING_PRIMARY_ID_CHANGED);
-
- long masterKeyId = data.getLong(SAVE_KEYRING_MASTER_KEY_ID);
+
+ long masterKeyId = saveParams.keys.get(0).getKeyID();
PgpKeyOperation keyOperations = new PgpKeyOperation(this, this);
/* Operation */
@@ -568,9 +541,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
ProviderHelper.getPGPSecretKeyRingByKeyId(this, masterKeyId),
oldPassPhrase, newPassPhrase);
} else {
- keyOperations.buildSecretKey(userIds, original_ids, deleted_ids, primaryChanged,
- modded_keys, deletedKeys, keysExpiryDates, keysUsages, newPassPhrase,
- oldPassPhrase, new_keys, keys);
+ keyOperations.buildSecretKey(saveParams);
}
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);