mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-16 22:05:05 -05:00
pass through which keys are new
This commit is contained in:
parent
fab74590eb
commit
fa533dda32
@ -345,7 +345,7 @@ public class PgpKeyOperation {
|
|||||||
updateProgress(R.string.progress_done, 100, 100);
|
updateProgress(R.string.progress_done, 100, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildSecretKey(ArrayList<String> userIds, ArrayList<String> OriginalIDs, ArrayList<String> deletedIDs, boolean primaryIDChanged, boolean[] modded_keys, ArrayList<PGPSecretKey> deleted_keys, ArrayList<GregorianCalendar> keysExpiryDates, ArrayList<Integer> keysUsages, String newPassPhrase, String oldPassPhrase, ArrayList<PGPSecretKey> keys) throws PgpGeneralException,
|
public void buildSecretKey(ArrayList<String> userIds, ArrayList<String> OriginalIDs, ArrayList<String> deletedIDs, boolean primaryIDChanged, boolean[] modded_keys, ArrayList<PGPSecretKey> deleted_keys, ArrayList<GregorianCalendar> keysExpiryDates, ArrayList<Integer> keysUsages, String newPassPhrase, String oldPassPhrase, boolean[] new_keys, ArrayList<PGPSecretKey> keys) throws PgpGeneralException,
|
||||||
PGPException, SignatureException, IOException {
|
PGPException, SignatureException, IOException {
|
||||||
|
|
||||||
updateProgress(R.string.progress_building_key, 0, 100);
|
updateProgress(R.string.progress_building_key, 0, 100);
|
||||||
@ -490,6 +490,11 @@ public class PgpKeyOperation {
|
|||||||
masterKeyPair, mainUserId, sha1Calc, hashedPacketsGen.generate(),
|
masterKeyPair, mainUserId, sha1Calc, hashedPacketsGen.generate(),
|
||||||
unhashedPacketsGen.generate(), certificationSignerBuilder, keyEncryptor);
|
unhashedPacketsGen.generate(), certificationSignerBuilder, keyEncryptor);
|
||||||
|
|
||||||
|
//updating master is slightly different to updating the others
|
||||||
|
if (modded_keys[0]) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
updateProgress(R.string.progress_adding_sub_keys, 40, 100);
|
updateProgress(R.string.progress_adding_sub_keys, 40, 100);
|
||||||
|
|
||||||
for (int i = 1; i < keys.size(); ++i) {
|
for (int i = 1; i < keys.size(); ++i) {
|
||||||
@ -549,7 +554,7 @@ public class PgpKeyOperation {
|
|||||||
|
|
||||||
PGPSecretKeyRing secretKeyRing = keyGen.generateSecretKeyRing();
|
PGPSecretKeyRing secretKeyRing = keyGen.generateSecretKeyRing();
|
||||||
PGPPublicKeyRing publicKeyRing = keyGen.generatePublicKeyRing();
|
PGPPublicKeyRing publicKeyRing = keyGen.generatePublicKeyRing();
|
||||||
|
//must copy with new passphrase... new keys will have an empty passphrase... pass in boolean array to mark new key?
|
||||||
updateProgress(R.string.progress_saving_key_ring, 90, 100);
|
updateProgress(R.string.progress_saving_key_ring, 90, 100);
|
||||||
|
|
||||||
ProviderHelper.saveKeyRing(mContext, secretKeyRing);
|
ProviderHelper.saveKeyRing(mContext, secretKeyRing);
|
||||||
|
@ -138,6 +138,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
|||||||
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";
|
public static final String SAVE_KEYRING_DELETED_KEYS = "deleted_keys";
|
||||||
|
public static final String SAVE_KEYRING_NEW_KEYS = "new_keys";
|
||||||
|
|
||||||
// generate key
|
// generate key
|
||||||
public static final String GENERATE_KEY_ALGORITHM = "algorithm";
|
public static final String GENERATE_KEY_ALGORITHM = "algorithm";
|
||||||
@ -548,6 +549,7 @@ 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);
|
||||||
|
boolean[] new_keys = data.getBooleanArray(SAVE_KEYRING_NEW_KEYS);
|
||||||
ArrayList<PGPSecretKey> deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(data
|
ArrayList<PGPSecretKey> deletedKeys = PgpConversionHelper.BytesToPGPSecretKeyList(data
|
||||||
.getByteArray(SAVE_KEYRING_DELETED_KEYS));
|
.getByteArray(SAVE_KEYRING_DELETED_KEYS));
|
||||||
boolean primaryChanged = data.getBoolean(SAVE_KEYRING_PRIMARY_ID_CHANGED);
|
boolean primaryChanged = data.getBoolean(SAVE_KEYRING_PRIMARY_ID_CHANGED);
|
||||||
@ -563,7 +565,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
|||||||
} else {
|
} else {
|
||||||
keyOperations.buildSecretKey(userIds, original_ids, deleted_ids, primaryChanged,
|
keyOperations.buildSecretKey(userIds, original_ids, deleted_ids, primaryChanged,
|
||||||
modded_keys, deletedKeys, keysExpiryDates, keysUsages, newPassPhrase,
|
modded_keys, deletedKeys, keysExpiryDates, keysUsages, newPassPhrase,
|
||||||
oldPassPhrase, keys);
|
oldPassPhrase, new_keys, keys);
|
||||||
}
|
}
|
||||||
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);
|
PassphraseCacheService.addCachedPassphrase(this, masterKeyId, newPassPhrase);
|
||||||
|
|
||||||
|
@ -597,6 +597,8 @@ public class EditKeyActivity extends ActionBarActivity implements EditorListener
|
|||||||
toPrimitiveArray(mKeysView.getNeedsSavingArray()));
|
toPrimitiveArray(mKeysView.getNeedsSavingArray()));
|
||||||
data.putBoolean(KeychainIntentService.SAVE_KEYRING_PRIMARY_ID_CHANGED,
|
data.putBoolean(KeychainIntentService.SAVE_KEYRING_PRIMARY_ID_CHANGED,
|
||||||
mUserIdsView.primaryChanged());
|
mUserIdsView.primaryChanged());
|
||||||
|
data.putBooleanArray(KeychainIntentService.SAVE_KEYRING_NEW_KEYS,
|
||||||
|
toPrimitiveArray(mKeysView.getNewKeysArray()));
|
||||||
|
|
||||||
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
intent.putExtra(KeychainIntentService.EXTRA_DATA, data);
|
||||||
|
|
||||||
|
@ -314,4 +314,9 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getIsNewKey()
|
||||||
|
{
|
||||||
|
return mIsNewKey;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -223,6 +223,18 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor
|
|||||||
return mList;
|
return mList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Boolean> getNewKeysArray()
|
||||||
|
{
|
||||||
|
ArrayList<Boolean> mList = new ArrayList<Boolean>();
|
||||||
|
if (mType == Id.type.key) {
|
||||||
|
for (int i = 0; i < mEditors.getChildCount(); ++i) {
|
||||||
|
KeyEditor editor = (KeyEditor) mEditors.getChildAt(i);
|
||||||
|
mList.add(editor.getIsNewKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return mList;
|
||||||
|
}
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
|
Loading…
Reference in New Issue
Block a user