From 4e285d9254f98381bd59a9a683d406ad1b6020d6 Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Sat, 22 Mar 2014 15:31:18 +0100 Subject: [PATCH] The current implementation of saving new generated key doesn't save the key due to the public key of master key id can not be resolved by ProviderHelper.getPGPPublicKeyByKeyId (via URI/Cursor). Workaround uses local keys-arraylist for resoving the pubkey of master key id. --- .../keychain/service/KeychainIntentService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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 0751fa33c..5ef41cced 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 @@ -543,7 +543,14 @@ public class KeychainIntentService extends IntentService ProviderHelper.getPGPSecretKeyRingByKeyId(this, masterKeyId), oldPassPhrase, newPassPhrase); } else { - PGPPublicKey pubkey = ProviderHelper.getPGPPublicKeyByKeyId(this, masterKeyId); + PGPPublicKey pubkey = null; + for(PGPSecretKey key : keys) { + PGPPublicKey tempKey = key.getPublicKey(); + if (tempKey.getKeyID() == masterKeyId) { + pubkey = tempKey; + } + } + //PGPPublicKey pubkey = ProviderHelper.getPGPPublicKeyByKeyId(this, masterKeyId); keyOperations.buildSecretKey(userIds, keys, keysUsages, keysExpiryDates, pubkey, oldPassPhrase, newPassPhrase); }