diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-11-13 16:56:56 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-11-13 16:58:26 +0100 |
commit | 2d7dada8880cff572a995009bc69a0b487b47265 (patch) | |
tree | 01ba265a5dde1799b510aec64e4b217b3526b4b1 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp | |
parent | d6a1be825c0ee2acad1c1115876f7f6d72354353 (diff) | |
download | open-keychain-2d7dada8880cff572a995009bc69a0b487b47265.tar.gz open-keychain-2d7dada8880cff572a995009bc69a0b487b47265.tar.bz2 open-keychain-2d7dada8880cff572a995009bc69a0b487b47265.zip |
decrypt: skip unavailable and unsuitable keys
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp')
-rw-r--r-- | OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java index 56e4e7aff..1511fd5b1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyOperation.java @@ -591,6 +591,18 @@ public class PgpDecryptVerifyOperation extends BaseOperation<PgpDecryptVerifyInp // get subkey which has been used for this encryption packet secretEncryptionKey = secretKeyRing.getSecretKey(subKeyId); + if (!secretEncryptionKey.canEncrypt()) { + secretEncryptionKey = null; + log.add(LogType.MSG_DC_ASKIP_BAD_FLAGS, indent + 1); + continue; + } + + if (!secretEncryptionKey.getSecretKeyType().isUsable()) { + secretEncryptionKey = null; + log.add(LogType.MSG_DC_ASKIP_UNAVAILABLE, indent + 1); + continue; + } + /* secret key exists in database and is allowed! */ asymmetricPacketFound = true; |