tidy up code

This commit is contained in:
Ash Hughes
2013-03-14 22:04:24 +00:00
parent 935274960d
commit dd27d132be
2 changed files with 6 additions and 20 deletions

View File

@@ -493,18 +493,12 @@ public class PgpMain {
boolean save = true;
for (PGPSecretKey testSecretKey : new IterableIterator<PGPSecretKey>(secretKeyRing.getSecretKeys())) {
try {
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder()
.setProvider(BOUNCY_CASTLE_PROVIDER_NAME).build(new char[] {});
PGPPrivateKey testKey = testSecretKey.extractPrivateKey(
keyDecryptor);
if (testKey == null && !testSecretKey.isMasterKey()) {
if (!testSecretKey.isMasterKey()) {
if (PgpHelper.isSecretKeyPrivateEmpty(testSecretKey)) {
// this is bad, something is very wrong...
save = false;
status = Id.return_value.bad;
}
} catch (PGPException e) {
// all good if this fails, we likely didn't use the right password
}
}