aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-09-17 21:26:08 +0200
committerDominik Schürmann <dominik@dominikschuermann.de>2014-09-17 21:26:08 +0200
commit7d917fa39c4a02de78bffabf8436dac418aa36a9 (patch)
tree5cc08db4afc75d46d14d39a14765b4c50d6a89fc /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java
parent1abf167f80e1eccfef551c2e1385999b06f9cfbf (diff)
downloadopen-keychain-7d917fa39c4a02de78bffabf8436dac418aa36a9.tar.gz
open-keychain-7d917fa39c4a02de78bffabf8436dac418aa36a9.tar.bz2
open-keychain-7d917fa39c4a02de78bffabf8436dac418aa36a9.zip
Fix cleartext verify
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java12
1 files changed, 10 insertions, 2 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 73e17f95e..e0e199684 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java
@@ -191,7 +191,7 @@ public class PgpDecryptVerify {
if (aIn.isClearText()) {
// a cleartext signature, verify it with the other method
- return verifyCleartextSignature(aIn);
+ return verifyCleartextSignature(aIn, 0);
}
// else: ascii armored encryption! go on...
}
@@ -672,7 +672,7 @@ public class PgpDecryptVerify {
* The method is heavily based on
* pg/src/main/java/org/spongycastle/openpgp/examples/ClearSignedFileProcessor.java
*/
- private DecryptVerifyResult verifyCleartextSignature(ArmoredInputStream aIn)
+ private DecryptVerifyResult verifyCleartextSignature(ArmoredInputStream aIn, int indent)
throws IOException, PGPException {
OperationLog log = new OperationLog();
@@ -756,6 +756,7 @@ public class PgpDecryptVerify {
if (signature != null) try {
updateProgress(R.string.progress_verifying_signature, 90, 100);
+ log.add(LogType.MSG_DC_CLEAR_SIGNATURE_CHECK, indent);
InputStream sigIn = new BufferedInputStream(new ByteArrayInputStream(clearText));
@@ -776,6 +777,11 @@ public class PgpDecryptVerify {
// Verify signature and check binding signatures
boolean validSignature = signature.verify();
+ if (validSignature) {
+ log.add(LogType.MSG_DC_CLEAR_SIGNATURE_OK, indent +1);
+ } else {
+ log.add(LogType.MSG_DC_CLEAR_SIGNATURE_BAD, indent +1);
+ }
signatureResultBuilder.setValidSignature(validSignature);
} catch (SignatureException e) {
@@ -784,6 +790,8 @@ public class PgpDecryptVerify {
updateProgress(R.string.progress_done, 100, 100);
+ log.add(LogType.MSG_DC_OK, indent);
+
DecryptVerifyResult result = new DecryptVerifyResult(DecryptVerifyResult.RESULT_OK, log);
result.setSignatureResult(signatureResultBuilder.build());
return result;