aboutsummaryrefslogtreecommitdiffstats
path: root/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2014-10-13 15:02:42 +0200
committerVincent Breitmoser <valodim@mugenguild.com>2014-10-13 15:02:42 +0200
commitee4d911baf39fe242a90e12163d9853728479a35 (patch)
tree33595519e6e96b1f48d204cf38affe0477283a75 /OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
parente5c7d8dcd1f441511f8f43cac9e764a8bd3a0668 (diff)
downloadopen-keychain-ee4d911baf39fe242a90e12163d9853728479a35.tar.gz
open-keychain-ee4d911baf39fe242a90e12163d9853728479a35.tar.bz2
open-keychain-ee4d911baf39fe242a90e12163d9853728479a35.zip
make PgpEncryptSign and PgpDecryptVerify subclasses of BaseOperation
Diffstat (limited to 'OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java')
-rw-r--r--OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java42
1 files changed, 7 insertions, 35 deletions
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 f69a0c5a4..eb5ab93f7 100644
--- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
+++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java
@@ -20,7 +20,6 @@ package org.sufficientlysecure.keychain.service;
import android.app.IntentService;
import android.content.Intent;
-import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
@@ -58,8 +57,6 @@ import org.sufficientlysecure.keychain.pgp.UncachedKeyRing;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralMsgIdException;
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
-import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
-import org.sufficientlysecure.keychain.provider.KeychainDatabase;
import org.sufficientlysecure.keychain.provider.ProviderHelper;
import org.sufficientlysecure.keychain.operations.results.OperationResult;
import org.sufficientlysecure.keychain.operations.results.OperationResult.LogType;
@@ -78,7 +75,6 @@ import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
@@ -91,7 +87,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
* data from the activities or other apps, queues these intents, executes them, and stops itself
* after doing them.
*/
-public class KeychainIntentService extends IntentService implements Progressable, PassphraseCacheInterface {
+public class KeychainIntentService extends IntentService implements Progressable {
/* extras that can be given by intent */
public static final String EXTRA_MESSENGER = "messenger";
@@ -297,11 +293,9 @@ public class KeychainIntentService extends IntentService implements Progressable
// verifyText and decrypt returning additional resultData values for the
// verification of signatures
PgpDecryptVerify.Builder builder = new PgpDecryptVerify.Builder(
- new ProviderHelper(this),
- this, inputData, null
+ this, new ProviderHelper(this), this, inputData, null
);
- builder.setProgressable(this)
- .setAllowSymmetricDecryption(true)
+ builder.setAllowSymmetricDecryption(true)
.setPassphrase(passphrase)
.setDecryptMetadataOnly(true)
.setNfcState(nfcDecryptedSessionKey);
@@ -330,11 +324,10 @@ public class KeychainIntentService extends IntentService implements Progressable
// verifyText and decrypt returning additional resultData values for the
// verification of signatures
PgpDecryptVerify.Builder builder = new PgpDecryptVerify.Builder(
- new ProviderHelper(this), this,
+ this, new ProviderHelper(this), this,
inputData, outStream
);
- builder.setProgressable(this)
- .setAllowSymmetricDecryption(true)
+ builder.setAllowSymmetricDecryption(true)
.setPassphrase(passphrase)
.setNfcState(nfcDecryptedSessionKey);
@@ -591,10 +584,9 @@ public class KeychainIntentService extends IntentService implements Progressable
/* Operation */
PgpSignEncrypt.Builder builder = new PgpSignEncrypt.Builder(
- new ProviderHelper(this), this, inputData, outStream
+ this, new ProviderHelper(this), this, inputData, outStream
);
- builder.setProgressable(this)
- .setEnableAsciiArmorOutput(useAsciiArmor)
+ builder.setEnableAsciiArmorOutput(useAsciiArmor)
.setVersionHeader(PgpHelper.getVersionForHeader(this))
.setCompressionId(compressionId)
.setSymmetricEncryptionAlgorithm(
@@ -788,26 +780,6 @@ public class KeychainIntentService extends IntentService implements Progressable
}
@Override
- public String getCachedPassphrase(long subKeyId) throws NoSecretKeyException {
- try {
- long masterKeyId = new ProviderHelper(this).getMasterKeyId(subKeyId);
- return getCachedPassphrase(masterKeyId, subKeyId);
- } catch (NotFoundException e) {
- throw new PassphraseCacheInterface.NoSecretKeyException();
- }
- }
-
- @Override
- public String getCachedPassphrase(long masterKeyId, long subKeyId) throws NoSecretKeyException {
- try {
- return PassphraseCacheService.getCachedPassphrase(
- KeychainIntentService.this, masterKeyId, subKeyId);
- } catch (PassphraseCacheService.KeyNotFoundException e) {
- throw new PassphraseCacheInterface.NoSecretKeyException();
- }
- }
-
- @Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (ACTION_CANCEL.equals(intent.getAction())) {
mActionCanceled.set(true);