some decrypt/verify bug fixes

This commit is contained in:
Vincent Breitmoser 2015-05-30 13:52:56 +02:00
parent 99fe806ea3
commit ef209450c6
3 changed files with 12 additions and 5 deletions

View File

@ -528,6 +528,7 @@ public class OpenPgpService extends RemoteService {
PgpDecryptVerify op = new PgpDecryptVerify(this, mProviderHelper, null); PgpDecryptVerify op = new PgpDecryptVerify(this, mProviderHelper, null);
long inputLength = inputStream.available(); long inputLength = inputStream.available();
InputData inputData = new InputData(inputStream, inputLength);
// allow only private keys associated with accounts of this app // allow only private keys associated with accounts of this app
// no support for symmetric encryption // no support for symmetric encryption
@ -537,7 +538,7 @@ public class OpenPgpService extends RemoteService {
.setDecryptMetadataOnly(decryptMetadataOnly) .setDecryptMetadataOnly(decryptMetadataOnly)
.setDetachedSignature(detachedSignature); .setDetachedSignature(detachedSignature);
DecryptVerifyResult pgpResult = op.execute(input, cryptoInput, inputStream, outputStream); DecryptVerifyResult pgpResult = op.execute(input, cryptoInput, inputData, outputStream);
if (pgpResult.isPending()) { if (pgpResult.isPending()) {
// prepare and return PendingIntent to be executed by client // prepare and return PendingIntent to be executed by client

View File

@ -250,11 +250,14 @@ public class KeychainIntentService extends IntentService implements Progressable
CryptoInputParcel cryptoInput = data.getParcelable(EXTRA_CRYPTO_INPUT); CryptoInputParcel cryptoInput = data.getParcelable(EXTRA_CRYPTO_INPUT);
PgpDecryptVerifyInputParcel input = data.getParcelable(DECRYPT_VERIFY_PARCEL); PgpDecryptVerifyInputParcel input = data.getParcelable(DECRYPT_VERIFY_PARCEL);
// verifyText and decrypt returning additional resultData values for the // this action is here for compatibility only
// verification of signatures input.setDecryptMetadataOnly(true);
/* Operation */
PgpDecryptVerify op = new PgpDecryptVerify(this, new ProviderHelper(this), this); PgpDecryptVerify op = new PgpDecryptVerify(this, new ProviderHelper(this), this);
DecryptVerifyResult decryptVerifyResult = op.execute(input, cryptoInput); DecryptVerifyResult decryptVerifyResult = op.execute(input, cryptoInput);
/* Result */
sendMessageToHandler(MessageStatus.OKAY, decryptVerifyResult); sendMessageToHandler(MessageStatus.OKAY, decryptVerifyResult);
break; break;
@ -355,6 +358,10 @@ public class KeychainIntentService extends IntentService implements Progressable
CryptoInputParcel cryptoInput = data.getParcelable(EXTRA_CRYPTO_INPUT); CryptoInputParcel cryptoInput = data.getParcelable(EXTRA_CRYPTO_INPUT);
PgpDecryptVerifyInputParcel input = data.getParcelable(DECRYPT_VERIFY_PARCEL); PgpDecryptVerifyInputParcel input = data.getParcelable(DECRYPT_VERIFY_PARCEL);
// for compatibility
// TODO merge with ACTION_DECRYPT_METADATA
input.setDecryptMetadataOnly(false);
/* Operation */ /* Operation */
PgpDecryptVerify op = new PgpDecryptVerify(this, new ProviderHelper(this), this); PgpDecryptVerify op = new PgpDecryptVerify(this, new ProviderHelper(this), this);
DecryptVerifyResult decryptVerifyResult = op.execute(input, cryptoInput); DecryptVerifyResult decryptVerifyResult = op.execute(input, cryptoInput);

View File

@ -206,8 +206,7 @@ public class DecryptFilesFragment extends DecryptFragment {
Log.d(Constants.TAG, "mInputUri=" + mInputUri + ", mOutputUri=" + mOutputUri); Log.d(Constants.TAG, "mInputUri=" + mInputUri + ", mOutputUri=" + mOutputUri);
PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(mInputUri, mOutputUri) PgpDecryptVerifyInputParcel input = new PgpDecryptVerifyInputParcel(mInputUri, mOutputUri)
.setAllowSymmetricDecryption(true) .setAllowSymmetricDecryption(true);
.setDecryptMetadataOnly(true);
data.putParcelable(KeychainIntentService.DECRYPT_VERIFY_PARCEL, input); data.putParcelable(KeychainIntentService.DECRYPT_VERIFY_PARCEL, input);
data.putParcelable(KeychainIntentService.EXTRA_CRYPTO_INPUT, cryptoInput); data.putParcelable(KeychainIntentService.EXTRA_CRYPTO_INPUT, cryptoInput);