aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-04-04 01:07:09 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-04-04 01:56:02 +0200
commitd921cca91312e5888f98b178252efa2f5db103cf (patch)
tree2df5180644b302bd5360f8963a73237d6ae12a14 /OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service
parent59f4b4e3e7cc27981e66f140030bef9a3fce3d25 (diff)
downloadopen-keychain-d921cca91312e5888f98b178252efa2f5db103cf.tar.gz
open-keychain-d921cca91312e5888f98b178252efa2f5db103cf.tar.bz2
open-keychain-d921cca91312e5888f98b178252efa2f5db103cf.zip
db-overhaul: reintroduce by-mail and by-subkey queries
the only thing left to fix after the db upgrade (that I can think of right now) are key exports
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service')
-rw-r--r--OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java13
1 files changed, 5 insertions, 8 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java
index 0ec4c1239..962b304c7 100644
--- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java
+++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java
@@ -46,6 +46,7 @@ import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.Id;
import org.sufficientlysecure.keychain.helper.Preferences;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
+import org.sufficientlysecure.keychain.provider.KeychainContract;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import java.util.Date;
@@ -170,15 +171,11 @@ public class PassphraseCacheService extends Service {
// try to get master key id which is used as an identifier for cached passphrases
long masterKeyId = keyId;
if (masterKeyId != Id.key.symmetric) {
- PGPSecretKeyRing keyRing = ProviderHelper.getPGPSecretKeyRingWithKeyId(this, keyId);
- if (keyRing == null) {
+ masterKeyId = ProviderHelper.getMasterKeyId(this,
+ KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(Long.toString(keyId)));
+ // Failure
+ if(masterKeyId == 0)
return null;
- }
- PGPSecretKey masterKey = keyRing.getSecretKey();
- if (masterKey == null) {
- return null;
- }
- masterKeyId = masterKey.getKeyID();
}
Log.d(TAG, "getCachedPassphraseImpl() for masterKeyId " + masterKeyId);