mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-12-26 00:48:51 -05:00
make sure ID info is saved
This commit is contained in:
parent
974514e470
commit
300b90bcac
@ -368,7 +368,7 @@ public class PgpKeyOperation {
|
||||
}
|
||||
|
||||
/*
|
||||
IDs -
|
||||
IDs - NB This might not need to happen later, if we change the way the primary ID is chosen
|
||||
remove deleted ids
|
||||
if the primary ID changed we need to:
|
||||
remove all of the IDs from the keyring, saving their certifications
|
||||
@ -382,8 +382,6 @@ public class PgpKeyOperation {
|
||||
do we need to remove and add in?
|
||||
*/
|
||||
|
||||
//todo: flag changes of master key if IDs changed maybe?
|
||||
|
||||
for (PGPSecretKey dKey : saveParcel.deletedKeys) {
|
||||
mKR = PGPSecretKeyRing.removeSecretKey(mKR, dKey);
|
||||
}
|
||||
@ -406,7 +404,9 @@ public class PgpKeyOperation {
|
||||
}
|
||||
|
||||
int user_id_index = 0;
|
||||
boolean anyIDChanged = false;
|
||||
if (saveParcel.primaryIDChanged) {
|
||||
anyIDChanged = true;
|
||||
ArrayList<Pair<String, PGPSignature>> sigList = new ArrayList<Pair<String, PGPSignature>>();
|
||||
for (String userId : saveParcel.userIDs) {
|
||||
String orig_id = saveParcel.originalIDs.get(user_id_index);
|
||||
@ -437,6 +437,7 @@ public class PgpKeyOperation {
|
||||
for (String userId : saveParcel.userIDs) {
|
||||
String orig_id = saveParcel.originalIDs.get(user_id_index);
|
||||
if (!orig_id.equals(userId)) {
|
||||
anyIDChanged = true;
|
||||
PGPContentSignerBuilder signerBuilder = new JcaPGPContentSignerBuilder(
|
||||
masterPublicKey.getAlgorithm(), HashAlgorithmTags.SHA1)
|
||||
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME);
|
||||
@ -452,6 +453,12 @@ public class PgpKeyOperation {
|
||||
}
|
||||
}
|
||||
|
||||
//update the keyring with the new ID information
|
||||
if (anyIDChanged) {
|
||||
pKR = PGPPublicKeyRing.insertPublicKey(pKR, masterPublicKey);
|
||||
mKR = PGPSecretKeyRing.replacePublicKeys(mKR, pKR);
|
||||
}
|
||||
|
||||
PGPKeyPair masterKeyPair = new PGPKeyPair(masterPublicKey, masterPrivateKey);
|
||||
|
||||
PGPSignatureSubpacketGenerator hashedPacketsGen = new PGPSignatureSubpacketGenerator();
|
||||
|
Loading…
Reference in New Issue
Block a user