work on lookup key, fix some illegal state exceptions with hack
This commit is contained in:
@@ -123,7 +123,6 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
||||
public static final String DECRYPT_RETURN_BYTES = "return_binary";
|
||||
public static final String DECRYPT_CIPHERTEXT_BYTES = "ciphertext_bytes";
|
||||
public static final String DECRYPT_ASSUME_SYMMETRIC = "assume_symmetric";
|
||||
public static final String DECRYPT_LOOKUP_UNKNOWN_KEY = "lookup_unknownKey";
|
||||
|
||||
// save keyring
|
||||
public static final String SAVE_KEYRING_NEW_PASSPHRASE = "new_passphrase";
|
||||
@@ -188,7 +187,6 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
||||
|
||||
public static final String RESULT_SIGNATURE_SUCCESS = "signature_success";
|
||||
public static final String RESULT_SIGNATURE_UNKNOWN = "signature_unknown";
|
||||
public static final String RESULT_SIGNATURE_LOOKUP_KEY = "lookup_key";
|
||||
|
||||
// import
|
||||
public static final String RESULT_IMPORT_ADDED = "added";
|
||||
@@ -395,8 +393,6 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
||||
boolean returnBytes = data.getBoolean(DECRYPT_RETURN_BYTES);
|
||||
boolean assumeSymmetricEncryption = data.getBoolean(DECRYPT_ASSUME_SYMMETRIC);
|
||||
|
||||
boolean lookupUnknownKey = data.getBoolean(DECRYPT_LOOKUP_UNKNOWN_KEY);
|
||||
|
||||
InputStream inStream = null;
|
||||
long inLength = -1;
|
||||
InputData inputData = null;
|
||||
@@ -472,7 +468,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial
|
||||
// verification of signatures
|
||||
PgpOperation operation = new PgpOperation(this, this, inputData, outStream);
|
||||
if (signedOnly) {
|
||||
resultData = operation.verifyText(lookupUnknownKey);
|
||||
resultData = operation.verifyText();
|
||||
} else {
|
||||
resultData = operation.decryptAndVerify(
|
||||
PassphraseCacheService.getCachedPassphrase(this, secretKeyId),
|
||||
|
||||
@@ -25,6 +25,7 @@ import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class KeychainIntentServiceHandler extends Handler {
|
||||
@@ -60,7 +61,14 @@ public class KeychainIntentServiceHandler extends Handler {
|
||||
}
|
||||
|
||||
public void showProgressDialog(FragmentActivity activity) {
|
||||
mProgressDialogFragment.show(activity.getSupportFragmentManager(), "progressDialog");
|
||||
// TODO: THis is a hack!, see http://stackoverflow.com/questions/10114324/show-dialogfragment-from-onactivityresult
|
||||
final FragmentManager manager = activity.getSupportFragmentManager();
|
||||
Handler handler = new Handler();
|
||||
handler.post(new Runnable() {
|
||||
public void run() {
|
||||
mProgressDialogFragment.show(manager, "progressDialog");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -420,8 +420,7 @@ public class OpenPgpService extends RemoteService {
|
||||
Bundle outputBundle;
|
||||
PgpOperation operation = new PgpOperation(getContext(), null, inputData, outputStream);
|
||||
if (signedOnly) {
|
||||
// TODO: download missing keys from keyserver?
|
||||
outputBundle = operation.verifyText(false);
|
||||
outputBundle = operation.verifyText();
|
||||
} else {
|
||||
outputBundle = operation.decryptAndVerify(passphrase, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user