From ef209450c67f6d47756ffd900fcb8ab4083482f4 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Sat, 30 May 2015 13:52:56 +0200 Subject: some decrypt/verify bug fixes --- .../sufficientlysecure/keychain/remote/OpenPgpService.java | 3 ++- .../keychain/service/KeychainIntentService.java | 11 +++++++++-- .../sufficientlysecure/keychain/ui/DecryptFilesFragment.java | 3 +-- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'OpenKeychain/src') diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java index bef0519a3..0d2d3256d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -528,6 +528,7 @@ public class OpenPgpService extends RemoteService { PgpDecryptVerify op = new PgpDecryptVerify(this, mProviderHelper, null); long inputLength = inputStream.available(); + InputData inputData = new InputData(inputStream, inputLength); // allow only private keys associated with accounts of this app // no support for symmetric encryption @@ -537,7 +538,7 @@ public class OpenPgpService extends RemoteService { .setDecryptMetadataOnly(decryptMetadataOnly) .setDetachedSignature(detachedSignature); - DecryptVerifyResult pgpResult = op.execute(input, cryptoInput, inputStream, outputStream); + DecryptVerifyResult pgpResult = op.execute(input, cryptoInput, inputData, outputStream); if (pgpResult.isPending()) { // prepare and return PendingIntent to be executed by client diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 05336cc31..5f9c98ac5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -250,11 +250,14 @@ public class KeychainIntentService extends IntentService implements Progressable CryptoInputParcel cryptoInput = data.getParcelable(EXTRA_CRYPTO_INPUT); PgpDecryptVerifyInputParcel input = data.getParcelable(DECRYPT_VERIFY_PARCEL); - // verifyText and decrypt returning additional resultData values for the - // verification of signatures + // this action is here for compatibility only + input.setDecryptMetadataOnly(true); + + /* Operation */ PgpDecryptVerify op = new PgpDecryptVerify(this, new ProviderHelper(this), this); DecryptVerifyResult decryptVerifyResult = op.execute(input, cryptoInput); + /* Result */ sendMessageToHandler(MessageStatus.OKAY, decryptVerifyResult); break; @@ -355,6 +358,10 @@ public class KeychainIntentService extends IntentService implements Progressable CryptoInputParcel cryptoInput = data.getParcelable(EXTRA_CRYPTO_INPUT); PgpDecryptVerifyInputParcel input = data.getParcelable(DECRYPT_VERIFY_PARCEL); + // for compatibility + // TODO merge with ACTION_DECRYPT_METADATA + input.setDecryptMetadataOnly(false); + /* Operation */ PgpDecryptVerify op = new PgpDecryptVerify(this, new ProviderHelper(this), this); DecryptVerifyResult decryptVerifyResult = op.execute(input, cryptoInput); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java index c0b293b99..254b926d4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesFragment.java @@ -206,8 +206,7 @@ public class DecryptFilesFragment extends DecryptFragment { Log.d(Constants.TAG, "mInputUri=" + mInputUri + ", mOutputUri=" + mOutputUri); PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(mInputUri, mOutputUri) - .setAllowSymmetricDecryption(true) - .setDecryptMetadataOnly(true); + .setAllowSymmetricDecryption(true); data.putParcelable(KeychainIntentService.DECRYPT_VERIFY_PARCEL, input); data.putParcelable(KeychainIntentService.EXTRA_CRYPTO_INPUT, cryptoInput); -- cgit v1.2.3