diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2014-09-03 02:42:05 +0200 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2014-09-03 02:43:06 +0200 |
commit | 7bc424a8cb1c3d4d4c77778f27bd18fe61da0736 (patch) | |
tree | 0350e5ec8fab966159963572224d2151f0b0451f /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp | |
parent | e9b14585f5eecddf8c22b2e68aa1a0500682ba3a (diff) | |
download | open-keychain-7bc424a8cb1c3d4d4c77778f27bd18fe61da0736.tar.gz open-keychain-7bc424a8cb1c3d4d4c77778f27bd18fe61da0736.tar.bz2 open-keychain-7bc424a8cb1c3d4d4c77778f27bd18fe61da0736.zip |
work on passphrase caching, make use of cached SecretKeyType data (WIP!)
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index 11e986562..d7eb30f16 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -261,6 +261,8 @@ public class PgpDecryptVerify { PGPPublicKeyEncryptedData encData = (PGPPublicKeyEncryptedData) obj; + long subKeyId = encData.getKeyID(); + CanonicalizedSecretKeyRing secretKeyRing; try { // get actual keyring object based on master key id @@ -276,22 +278,20 @@ public class PgpDecryptVerify { continue; } // get subkey which has been used for this encryption packet - secretEncryptionKey = secretKeyRing.getSecretKey(encData.getKeyID()); + secretEncryptionKey = secretKeyRing.getSecretKey(subKeyId); if (secretEncryptionKey == null) { // continue with the next packet in the while loop continue; } - /* secret key exists in database! */ - long masterKeyId = secretEncryptionKey.getRing().getMasterKeyId(); - // allow only specific keys for decryption? if (mAllowedKeyIds != null) { - Log.d(Constants.TAG, "encData.getKeyID(): " + encData.getKeyID()); + Log.d(Constants.TAG, "encData.getKeyID(): " + subKeyId); Log.d(Constants.TAG, "mAllowedKeyIds: " + mAllowedKeyIds); - Log.d(Constants.TAG, "masterKeyId: " + masterKeyId); + Log.d(Constants.TAG, "masterKeyId: " + + secretEncryptionKey.getRing().getMasterKeyId()); - if (!mAllowedKeyIds.contains(masterKeyId)) { + if (!mAllowedKeyIds.contains(subKeyId)) { // this key is in our db, but NOT allowed! // continue with the next packet in the while loop continue; @@ -306,12 +306,12 @@ public class PgpDecryptVerify { // if no passphrase was explicitly set try to get it from the cache service if (mPassphrase == null) { // returns "" if key has no passphrase - mPassphrase = mPassphraseCache.getCachedPassphrase(masterKeyId); + mPassphrase = mPassphraseCache.getCachedPassphrase(subKeyId); // if passphrase was not cached, return here // indicating that a passphrase is missing! if (mPassphrase == null) { - result.setKeyIdPassphraseNeeded(masterKeyId); + result.setKeyIdPassphraseNeeded(subKeyId); result.setStatus(PgpDecryptVerifyResult.KEY_PASSHRASE_NEEDED); return result; } |