aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpHelper.java')
-rw-r--r--OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpHelper.java16
1 files changed, 4 insertions, 12 deletions
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpHelper.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpHelper.java
index 697eb1aaa..9b8e4cb23 100644
--- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpHelper.java
+++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/helper/PgpHelper.java
@@ -164,16 +164,8 @@ public class PgpHelper {
for (int i = 0; i < signingKeys.size(); ++i) {
PGPSecretKey key = signingKeys.get(i);
if (key.isMasterKey()) {
- try {
- PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder()
- .setProvider(PgpMain.BOUNCY_CASTLE_PROVIDER_NAME).build(new char[] {});
- PGPPrivateKey testKey = key.extractPrivateKey(
- keyDecryptor);
- if (testKey != null) {
- masterKey = key;
- }
- } catch (PGPException e) {
- // all good if this fails, we likely didn't use the right password
+ if (!isSecretKeyPrivateEmpty(key)) {
+ masterKey = key;
}
} else {
usableKeys.add(key);
@@ -424,8 +416,8 @@ public class PgpHelper {
if (testKey != null) {
return false;
}
- } catch (PGPException e) {
- // all good if this fails, we likely didn't use the right password
+ } catch (PGPException e) { //exception if wrong key => not empty
+ return false; //all good if this fails, we likely didn't use the right password
}
return true;
}