2/2 use forked spongycastle to speed up secret key imports

This commit is contained in:
Ash Hughes
2013-05-13 15:10:52 +01:00
parent 3b798fd7e6
commit 5db08b9bdc
6 changed files with 11 additions and 18 deletions

Binary file not shown.

View File

@@ -480,18 +480,7 @@ public class PgpHelper {
}
public static boolean isSecretKeyPrivateEmpty(PGPSecretKey secretKey) {
try {
PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder()
.setProvider(PgpMain.BOUNCY_CASTLE_PROVIDER_NAME).build(new char[] {});
PGPPrivateKey testKey = secretKey.extractPrivateKey(
keyDecryptor);
if (testKey != null) {
return false;
}
} 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;
return secretKey.isPrivateKeyEmpty();
}
public static boolean isSecretKeyPrivateEmpty(Context context, long keyId) {