aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2015-04-01 00:38:01 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2015-04-01 00:39:32 +0200
commitad69622b6983d139e2cef1380f502edef19d2180 (patch)
tree17d06ee5ce8a683503b3ecc9e56f265c4f99324b /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
parentcc44ff1a8b3b51331023ef738ccd28bece32da40 (diff)
downloadopen-keychain-ad69622b6983d139e2cef1380f502edef19d2180.tar.gz
open-keychain-ad69622b6983d139e2cef1380f502edef19d2180.tar.bz2
open-keychain-ad69622b6983d139e2cef1380f502edef19d2180.zip
fix Decrypt*Fragment for RequiredInputParcel (except decryptOriginalFilename)
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java36
1 files changed, 14 insertions, 22 deletions
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 e6b3a2167..98ddaaf27 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java
@@ -473,31 +473,23 @@ public class OpenPgpService extends RemoteService {
// allow only private keys associated with accounts of this app
// no support for symmetric encryption
- builder.setPassphrase(cryptoInput.getPassphrase()) // TODO proper CryptoInputParcel support
- .setAllowSymmetricDecryption(false)
- .setAllowedKeyIds(allowedKeyIds)
- .setDecryptMetadataOnly(decryptMetadataOnly)
- .setNfcState(null) // TODO proper CryptoInputParcel support
- .setDetachedSignature(detachedSignature);
+ builder.setAllowSymmetricDecryption(false)
+ .setAllowedKeyIds(allowedKeyIds)
+ .setDecryptMetadataOnly(decryptMetadataOnly)
+ .setDetachedSignature(detachedSignature);
- DecryptVerifyResult pgpResult = builder.build().execute();
+ DecryptVerifyResult pgpResult = builder.build().execute(cryptoInput);
if (pgpResult.isPending()) {
- if ((pgpResult.getResult() & DecryptVerifyResult.RESULT_PENDING_ASYM_PASSPHRASE) ==
- DecryptVerifyResult.RESULT_PENDING_ASYM_PASSPHRASE) {
- throw new AssertionError("not implemented"); // TODO
- // return returnPassphraseIntent(data, pgpResult.getKeyIdPassphraseNeeded());
- } else if ((pgpResult.getResult() & DecryptVerifyResult.RESULT_PENDING_SYM_PASSPHRASE) ==
- DecryptVerifyResult.RESULT_PENDING_SYM_PASSPHRASE) {
- throw new PgpGeneralException(
- "Decryption of symmetric content not supported by API!");
- } else if ((pgpResult.getResult() & DecryptVerifyResult.RESULT_PENDING_NFC) ==
- DecryptVerifyResult.RESULT_PENDING_NFC) {
- throw new AssertionError("not implemented"); // TODO
- } else {
- throw new PgpGeneralException(
- "Encountered unhandled type of pending action not supported by API!");
- }
+ // prepare and return PendingIntent to be executed by client
+ RequiredInputParcel requiredInput = pgpResult.getRequiredInputParcel();
+ PendingIntent pIntent = getRequiredInputPendingIntent(getBaseContext(), data, requiredInput);
+
+ Intent result = new Intent();
+ result.putExtra(OpenPgpApi.RESULT_INTENT, pIntent);
+ result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED);
+ return result;
+
} else if (pgpResult.success()) {
Intent result = new Intent();