mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 11:35:07 -05:00
remove userIds before adding them again
This commit is contained in:
parent
46e9b507f1
commit
6fb9b8055d
@ -309,6 +309,8 @@ public class PGPMain {
|
|||||||
throws ApgGeneralException, NoSuchProviderException, PGPException,
|
throws ApgGeneralException, NoSuchProviderException, PGPException,
|
||||||
NoSuchAlgorithmException, SignatureException, IOException {
|
NoSuchAlgorithmException, SignatureException, IOException {
|
||||||
|
|
||||||
|
Log.d(Constants.TAG, "userIds: " + userIds.toString());
|
||||||
|
|
||||||
updateProgress(progress, R.string.progress_buildingKey, 0, 100);
|
updateProgress(progress, R.string.progress_buildingKey, 0, 100);
|
||||||
|
|
||||||
if (oldPassPhrase == null) {
|
if (oldPassPhrase == null) {
|
||||||
@ -327,15 +329,23 @@ public class PGPMain {
|
|||||||
String mainUserId = userIds.get(0);
|
String mainUserId = userIds.get(0);
|
||||||
|
|
||||||
PGPSecretKey masterKey = keys.get(0);
|
PGPSecretKey masterKey = keys.get(0);
|
||||||
PGPPublicKey masterPublicKey = masterKey.getPublicKey();
|
|
||||||
|
|
||||||
// Somehow, the PGPPublicKey already has an empty certification attached to it when the
|
// this removes all userIds and certifications previously attached to the masterPublicKey
|
||||||
// keyRing is generated the first time, we remove that when it exists, before adding the new
|
PGPPublicKey tmpKey = masterKey.getPublicKey();
|
||||||
// ones
|
PGPPublicKey masterPublicKey = new PGPPublicKey(tmpKey.getAlgorithm(),
|
||||||
PGPPublicKey masterPublicKeyRmCert = PGPPublicKey.removeCertification(masterPublicKey, "");
|
tmpKey.getKey(new BouncyCastleProvider()), tmpKey.getCreationTime());
|
||||||
if (masterPublicKeyRmCert != null) {
|
|
||||||
masterPublicKey = masterPublicKeyRmCert;
|
// already done by code above:
|
||||||
}
|
// PGPPublicKey masterPublicKey = masterKey.getPublicKey();
|
||||||
|
// // Somehow, the PGPPublicKey already has an empty certification attached to it when the
|
||||||
|
// // keyRing is generated the first time, we remove that when it exists, before adding the
|
||||||
|
// new
|
||||||
|
// // ones
|
||||||
|
// PGPPublicKey masterPublicKeyRmCert = PGPPublicKey.removeCertification(masterPublicKey,
|
||||||
|
// "");
|
||||||
|
// if (masterPublicKeyRmCert != null) {
|
||||||
|
// masterPublicKey = masterPublicKeyRmCert;
|
||||||
|
// }
|
||||||
|
|
||||||
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider(
|
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder().setProvider(
|
||||||
BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassPhrase.toCharArray());
|
BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassPhrase.toCharArray());
|
||||||
|
Loading…
Reference in New Issue
Block a user