diff options
author | Dominik <dominik@dominikschuermann.de> | 2012-10-31 18:22:24 +0100 |
---|---|---|
committer | Dominik <dominik@dominikschuermann.de> | 2012-10-31 18:22:24 +0100 |
commit | 6fb9b8055d139d1036e3b3c5bacb2b2f305d6f34 (patch) | |
tree | 986eb311f3e6a49f513e2e048e39f12a81ebd636 /org_apg/src | |
parent | 46e9b507f199bbc03da76bc9a810bfbdb2bae671 (diff) | |
download | open-keychain-6fb9b8055d139d1036e3b3c5bacb2b2f305d6f34.tar.gz open-keychain-6fb9b8055d139d1036e3b3c5bacb2b2f305d6f34.tar.bz2 open-keychain-6fb9b8055d139d1036e3b3c5bacb2b2f305d6f34.zip |
remove userIds before adding them again
Diffstat (limited to 'org_apg/src')
-rw-r--r-- | org_apg/src/org/thialfihar/android/apg/helper/PGPMain.java | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/org_apg/src/org/thialfihar/android/apg/helper/PGPMain.java b/org_apg/src/org/thialfihar/android/apg/helper/PGPMain.java index 2af1e2453..598efd40b 100644 --- a/org_apg/src/org/thialfihar/android/apg/helper/PGPMain.java +++ b/org_apg/src/org/thialfihar/android/apg/helper/PGPMain.java @@ -309,6 +309,8 @@ public class PGPMain { throws ApgGeneralException, NoSuchProviderException, PGPException, NoSuchAlgorithmException, SignatureException, IOException { + Log.d(Constants.TAG, "userIds: " + userIds.toString()); + updateProgress(progress, R.string.progress_buildingKey, 0, 100); if (oldPassPhrase == null) { @@ -327,15 +329,23 @@ public class PGPMain { String mainUserId = userIds.get(0); PGPSecretKey masterKey = keys.get(0); - 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; - } + // this removes all userIds and certifications previously attached to the masterPublicKey + PGPPublicKey tmpKey = masterKey.getPublicKey(); + PGPPublicKey masterPublicKey = new PGPPublicKey(tmpKey.getAlgorithm(), + tmpKey.getKey(new BouncyCastleProvider()), tmpKey.getCreationTime()); + + // 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( BOUNCY_CASTLE_PROVIDER_NAME).build(oldPassPhrase.toCharArray()); |