backward compatible extras, restructuring

This commit is contained in:
Dominik 2012-06-20 20:06:17 +03:00
parent 4130123e77
commit 1e78dd165a
21 changed files with 152 additions and 176 deletions

View File

@ -16,7 +16,7 @@
package org.thialfihar.android.apg;
import org.thialfihar.android.apg.passphrase.PassphraseCacheService;
import org.thialfihar.android.apg.service.PassphraseCacheService;
import android.app.Application;

View File

@ -34,10 +34,10 @@ import org.thialfihar.android.apg.R.string;
import org.thialfihar.android.apg.helper.PGPHelper;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.helper.Preferences;
import org.thialfihar.android.apg.passphrase.PassphraseCacheService;
import org.thialfihar.android.apg.provider.KeyRings;
import org.thialfihar.android.apg.provider.Keys;
import org.thialfihar.android.apg.provider.UserIds;
import org.thialfihar.android.apg.service.PassphraseCacheService;
import org.thialfihar.android.apg.util.InputData;
import android.content.ContentResolver;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.passphrase;
package org.thialfihar.android.apg.deprecated;
import org.spongycastle.jce.provider.BouncyCastleProvider;
import org.spongycastle.openpgp.PGPException;
@ -38,6 +38,13 @@ import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
/**
* TODO:
*
* - Use new PassphraseDialogFragment!
*
*
*/
public class AskForPassphrase {
public static interface PassPhraseCallbackInterface {
void passPhraseCallback(long keyId, String passPhrase);

View File

@ -71,13 +71,13 @@ import org.spongycastle.openpgp.operator.jcajce.JcePBESecretKeyEncryptorBuilder;
import org.spongycastle.openpgp.operator.jcajce.JcePGPDataEncryptorBuilder;
import org.spongycastle.openpgp.operator.jcajce.JcePublicKeyDataDecryptorFactoryBuilder;
import org.spongycastle.openpgp.operator.jcajce.JcePublicKeyKeyEncryptionMethodGenerator;
import org.thialfihar.android.apg.passphrase.CachedPassPhrase;
import org.thialfihar.android.apg.provider.DataProvider;
import org.thialfihar.android.apg.provider.Database;
import org.thialfihar.android.apg.provider.KeyRings;
import org.thialfihar.android.apg.provider.Keys;
import org.thialfihar.android.apg.provider.UserIds;
import org.thialfihar.android.apg.service.ApgService;
import org.thialfihar.android.apg.service.CachedPassphrase;
import org.thialfihar.android.apg.util.HkpKeyServer;
import org.thialfihar.android.apg.util.InputData;
import org.thialfihar.android.apg.util.PositionAwareInputStream;
@ -185,7 +185,7 @@ public class PGPMain {
".*?(-----BEGIN PGP PUBLIC KEY BLOCK-----.*?-----END PGP PUBLIC KEY BLOCK-----).*",
Pattern.DOTALL);
private static HashMap<Long, CachedPassPhrase> mPassPhraseCache = new HashMap<Long, CachedPassPhrase>();
private static HashMap<Long, CachedPassphrase> mPassPhraseCache = new HashMap<Long, CachedPassphrase>();
private static String mEditPassPhrase = null;
private static Database mDatabase = null;
@ -225,7 +225,7 @@ public class PGPMain {
}
public static void setCachedPassPhrase(long keyId, String passPhrase) {
mPassPhraseCache.put(keyId, new CachedPassPhrase(new Date().getTime(), passPhrase));
mPassPhraseCache.put(keyId, new CachedPassphrase(new Date().getTime(), passPhrase));
}
public static String getCachedPassPhrase(long keyId) {
@ -241,7 +241,7 @@ public class PGPMain {
}
realId = masterKey.getKeyID();
}
CachedPassPhrase cpp = mPassPhraseCache.get(realId);
CachedPassphrase cpp = mPassPhraseCache.get(realId);
if (cpp == null) {
return null;
}
@ -255,7 +255,7 @@ public class PGPMain {
long realTtl = ttl * 1000;
long now = new Date().getTime();
Vector<Long> oldKeys = new Vector<Long>();
for (Map.Entry<Long, CachedPassPhrase> pair : mPassPhraseCache.entrySet()) {
for (Map.Entry<Long, CachedPassphrase> pair : mPassPhraseCache.entrySet()) {
long lived = now - pair.getValue().timestamp;
if (lived >= realTtl) {
oldKeys.add(pair.getKey());
@ -1516,7 +1516,7 @@ public class PGPMain {
if (dataChunk instanceof PGPOnePassSignatureList) {
if (progress != null)
progress.setProgress(R.string.progress_processingSignature, currentProgress, 100);
returnData.putBoolean(ApgService.EXTRA_SIGNATURE, true);
returnData.putBoolean(ApgService.RESULT_SIGNATURE, true);
PGPOnePassSignatureList sigList = (PGPOnePassSignatureList) dataChunk;
for (int i = 0; i < sigList.size(); ++i) {
signature = sigList.get(i);
@ -1534,12 +1534,12 @@ public class PGPMain {
if (sigKeyRing != null) {
userId = PGPHelper.getMainUserId(PGPHelper.getMasterKey(sigKeyRing));
}
returnData.putString(ApgService.EXTRA_SIGNATURE_USER_ID, userId);
returnData.putString(ApgService.RESULT_SIGNATURE_USER_ID, userId);
break;
}
}
returnData.putLong(ApgService.EXTRA_SIGNATURE_KEY_ID, signatureKeyId);
returnData.putLong(ApgService.RESULT_SIGNATURE_KEY_ID, signatureKeyId);
if (signature != null) {
JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider()
@ -1550,7 +1550,7 @@ public class PGPMain {
// deprecated method:
// signature.initVerify(signatureKey, new BouncyCastleProvider());
} else {
returnData.putBoolean(ApgService.EXTRA_SIGNATURE_UNKNOWN, true);
returnData.putBoolean(ApgService.RESULT_SIGNATURE_UNKNOWN, true);
}
dataChunk = plainFact.nextObject();
@ -1587,7 +1587,7 @@ public class PGPMain {
try {
signature.update(buffer, 0, n);
} catch (SignatureException e) {
returnData.putBoolean(ApgService.EXTRA_SIGNATURE_SUCCESS, false);
returnData.putBoolean(ApgService.RESULT_SIGNATURE_SUCCESS, false);
signature = null;
}
}
@ -1610,9 +1610,9 @@ public class PGPMain {
PGPSignatureList signatureList = (PGPSignatureList) plainFact.nextObject();
PGPSignature messageSignature = signatureList.get(signatureIndex);
if (signature.verify(messageSignature)) {
returnData.putBoolean(ApgService.EXTRA_SIGNATURE_SUCCESS, true);
returnData.putBoolean(ApgService.RESULT_SIGNATURE_SUCCESS, true);
} else {
returnData.putBoolean(ApgService.EXTRA_SIGNATURE_SUCCESS, false);
returnData.putBoolean(ApgService.RESULT_SIGNATURE_SUCCESS, false);
}
}
}
@ -1667,7 +1667,7 @@ public class PGPMain {
byte[] clearText = out.toByteArray();
outStream.write(clearText);
returnData.putBoolean(ApgService.EXTRA_SIGNATURE, true);
returnData.putBoolean(ApgService.RESULT_SIGNATURE, true);
if (progress != null)
progress.setProgress(R.string.progress_processingSignature, 60, 100);
@ -1709,15 +1709,15 @@ public class PGPMain {
if (sigKeyRing != null) {
userId = PGPHelper.getMainUserId(PGPHelper.getMasterKey(sigKeyRing));
}
returnData.putString(ApgService.EXTRA_SIGNATURE_USER_ID, userId);
returnData.putString(ApgService.RESULT_SIGNATURE_USER_ID, userId);
break;
}
}
returnData.putLong(ApgService.EXTRA_SIGNATURE_KEY_ID, signatureKeyId);
returnData.putLong(ApgService.RESULT_SIGNATURE_KEY_ID, signatureKeyId);
if (signature == null) {
returnData.putBoolean(ApgService.EXTRA_SIGNATURE_UNKNOWN, true);
returnData.putBoolean(ApgService.RESULT_SIGNATURE_UNKNOWN, true);
if (progress != null)
progress.setProgress(R.string.progress_done, 100, 100);
return returnData;
@ -1748,7 +1748,7 @@ public class PGPMain {
} while (lookAhead != -1);
}
returnData.putBoolean(ApgService.EXTRA_SIGNATURE_SUCCESS, signature.verify());
returnData.putBoolean(ApgService.RESULT_SIGNATURE_SUCCESS, signature.verify());
if (progress != null)
progress.setProgress(R.string.progress_done, 100, 100);

View File

@ -21,10 +21,6 @@ import org.spongycastle.bcpg.HashAlgorithmTags;
import org.spongycastle.openpgp.PGPEncryptedData;
import org.thialfihar.android.apg.Constants;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.Constants.defaults;
import org.thialfihar.android.apg.Constants.pref;
import org.thialfihar.android.apg.Id.choice;
import org.thialfihar.android.apg.Id.choice.compression;
import android.content.Context;
import android.content.SharedPreferences;

View File

@ -75,40 +75,40 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
// keys for data bundle
// encrypt
public static final String SECRET_KEY_ID = "secret_key_id";
public static final String USE_ASCII_AMOR = "use_ascii_amor";
public static final String ENCRYPTION_KEYS_IDS = "encryption_keys_ids";
public static final String SIGNATURE_KEY_ID = "signature_key_id";
public static final String COMPRESSION_ID = "compression_id";
public static final String GENERATE_SIGNATURE = "generate_signature";
public static final String SIGN_ONLY = "sign_only";
public static final String MESSAGE_BYTES = "message_bytes";
public static final String INPUT_FILE = "input_file";
public static final String OUTPUT_FILE = "output_file";
public static final String PROVIDER_URI = "provider_uri";
public static final String SECRET_KEY_ID = "secretKeyId";
public static final String USE_ASCII_AMOR = "useAsciiAmor";
public static final String ENCRYPTION_KEYS_IDS = "encryptionKeysIds";
public static final String SIGNATURE_KEY_ID = "signatureKeyId";
public static final String COMPRESSION_ID = "compressionId";
public static final String GENERATE_SIGNATURE = "generateSignature";
public static final String SIGN_ONLY = "signOnly";
public static final String MESSAGE_BYTES = "messageBytes";
public static final String INPUT_FILE = "inputFile";
public static final String OUTPUT_FILE = "outputFile";
public static final String PROVIDER_URI = "providerUri";
// decrypt
public static final String SIGNED_ONLY = "signed_only";
public static final String RETURN_BYTES = "return_binary";
public static final String CIPHERTEXT_BYTES = "ciphertext_bytes";
public static final String ASSUME_SYMMETRIC = "assume_symmetric";
public static final String SIGNED_ONLY = "signedOnly";
public static final String RETURN_BYTES = "returnBinary";
public static final String CIPHERTEXT_BYTES = "ciphertextBytes";
public static final String ASSUME_SYMMETRIC = "assumeSymmetric";
// edit keys
public static final String NEW_PASSPHRASE = "new_passphrase";
public static final String CURRENT_PASSPHRASE = "current_passphrase";
public static final String USER_IDS = "user_ids";
public static final String NEW_PASSPHRASE = "newPassphrase";
public static final String CURRENT_PASSPHRASE = "currentPassphrase";
public static final String USER_IDS = "userIds";
public static final String KEYS = "keys";
public static final String KEYS_USAGES = "keys_usages";
public static final String MASTER_KEY_ID = "master_key_id";
public static final String KEYS_USAGES = "keysUsages";
public static final String MASTER_KEY_ID = "masterKeyId";
// generate key
public static final String ALGORITHM = "algorithm";
public static final String KEY_SIZE = "key_size";
public static final String SYMMETRIC_PASSPHRASE = "passphrase";
public static final String MASTER_KEY = "master_key";
public static final String MASTER_KEY = "masterKey";
// delete file securely
public static final String DELETE_FILE = "delete_file";
public static final String DELETE_FILE = "deleteFile";
// possible EXTRA_ACTIONs
public static final int ACTION_ENCRYPT_SIGN_BYTES = 10;
@ -127,24 +127,24 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
// possible data keys as result
// keys
public static final String RESULT_NEW_KEY = "new_key";
public static final String RESULT_NEW_KEY2 = "new_key2";
public static final String RESULT_NEW_KEY = "newKey";
public static final String RESULT_NEW_KEY2 = "newKey2";
// encrypt
public static final String RESULT_SIGNATURE_DATA = "signature_data";
public static final String RESULT_SIGNATURE_TEXT = "signature_text";
public static final String RESULT_ENCRYPTED_MESSAGE = "encrypted_message";
public static final String RESULT_ENCRYPTED_DATA = "encrypted_data";
public static final String RESULT_URI = "result_uri";
public static final String RESULT_SIGNATURE_DATA = "signatureData";
public static final String RESULT_SIGNATURE_TEXT = "signatureText";
public static final String RESULT_ENCRYPTED_MESSAGE = "encryptedMessage";
public static final String RESULT_ENCRYPTED_DATA = "encryptedData";
public static final String RESULT_URI = "resultUri";
// decrypt
public static final String RESULT_DECRYPTED_MESSAGE = "decrypted_message";
public static final String RESULT_DECRYPTED_DATA = "decrypted_data";
public static final String EXTRA_SIGNATURE = "signature";
public static final String EXTRA_SIGNATURE_KEY_ID = "signature_key_id";
public static final String EXTRA_SIGNATURE_USER_ID = "signature_user_id";
public static final String EXTRA_SIGNATURE_SUCCESS = "signature_success";
public static final String EXTRA_SIGNATURE_UNKNOWN = "signature_unknown";
public static final String RESULT_DECRYPTED_MESSAGE = "decryptedMessage";
public static final String RESULT_DECRYPTED_DATA = "decryptedData";
public static final String RESULT_SIGNATURE = "signature";
public static final String RESULT_SIGNATURE_KEY_ID = "signatureKeyId";
public static final String RESULT_SIGNATURE_USER_ID = "signatureUserId";
public static final String RESULT_SIGNATURE_SUCCESS = "signatureSuccess";
public static final String RESULT_SIGNATURE_UNKNOWN = "signatureUnknown";
Messenger mMessenger;
@ -197,8 +197,8 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
long masterKeyId = data.getLong(MASTER_KEY_ID);
/* Operation */
PGPMain.buildSecretKey(this, userIds, keys, keysUsages, masterKeyId,
oldPassPhrase, newPassPhrase, this);
PGPMain.buildSecretKey(this, userIds, keys, keysUsages, masterKeyId, oldPassPhrase,
newPassPhrase, this);
PGPMain.setCachedPassPhrase(masterKeyId, newPassPhrase);
/* Output */
@ -429,8 +429,7 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
while (true) {
streamFilename = PGPMain.generateRandomString(32);
if (streamFilename == null) {
throw new PGPMain.GeneralException(
"couldn't generate random file name");
throw new PGPMain.GeneralException("couldn't generate random file name");
}
openFileInput(streamFilename).close();
}
@ -613,8 +612,7 @@ public class ApgService extends IntentService implements ProgressDialogUpdater {
while (true) {
streamFilename = PGPMain.generateRandomString(32);
if (streamFilename == null) {
throw new PGPMain.GeneralException(
"couldn't generate random file name");
throw new PGPMain.GeneralException("couldn't generate random file name");
}
openFileInput(streamFilename).close();
}

View File

@ -12,13 +12,13 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.passphrase;
package org.thialfihar.android.apg.service;
public class CachedPassPhrase {
public class CachedPassphrase {
public final long timestamp;
public final String passPhrase;
public CachedPassPhrase(long timestamp, String passPhrase) {
public CachedPassphrase(long timestamp, String passPhrase) {
super();
this.timestamp = timestamp;
this.passPhrase = passPhrase;
@ -33,11 +33,11 @@ public class CachedPassPhrase {
@Override
public boolean equals(Object other) {
if (!(other instanceof CachedPassPhrase)) {
if (!(other instanceof CachedPassphrase)) {
return false;
}
CachedPassPhrase o = (CachedPassPhrase) other;
CachedPassphrase o = (CachedPassphrase) other;
if (timestamp != o.timestamp) {
return false;
}

View File

@ -12,7 +12,7 @@
* limitations under the License.
*/
package org.thialfihar.android.apg.passphrase;
package org.thialfihar.android.apg.service;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.helper.Preferences;

View File

@ -17,25 +17,20 @@
package org.thialfihar.android.apg.ui;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import org.thialfihar.android.apg.R;
import org.thialfihar.android.apg.Constants;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.ProgressDialogUpdater;
import org.thialfihar.android.apg.deprecated.AskForPassphrase;
import org.thialfihar.android.apg.deprecated.PausableThread;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.helper.Preferences;
import org.thialfihar.android.apg.passphrase.AskForPassphrase;
import org.thialfihar.android.apg.passphrase.PassphraseCacheService;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;
import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
@ -45,9 +40,6 @@ import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.widget.Toast;
public class BaseActivity extends SherlockFragmentActivity implements Runnable,
ProgressDialogUpdater, AskForPassphrase.PassPhraseCallbackInterface {
@ -89,14 +81,14 @@ public class BaseActivity extends SherlockFragmentActivity implements Runnable,
}
}
// startCacheService(this, mPreferences);
// startCacheService(this, mPreferences);
}
// public static void startCacheService(Activity activity, Preferences preferences) {
// Intent intent = new Intent(activity, PassphraseCacheService.class);
// intent.putExtra(PassphraseCacheService.EXTRA_TTL, preferences.getPassPhraseCacheTtl());
// activity.startService(intent);
// }
// public static void startCacheService(Activity activity, Preferences preferences) {
// Intent intent = new Intent(activity, PassphraseCacheService.class);
// intent.putExtra(PassphraseCacheService.EXTRA_TTL, preferences.getPassPhraseCacheTtl());
// activity.startService(intent);
// }
@Override
public boolean onOptionsItemSelected(MenuItem item) {
@ -218,48 +210,48 @@ public class BaseActivity extends SherlockFragmentActivity implements Runnable,
return alert.create();
}
// case Id.dialog.delete_file: {
// AlertDialog.Builder alert = new AlertDialog.Builder(this);
//
// alert.setIcon(android.R.drawable.ic_dialog_alert);
// alert.setTitle(R.string.warning);
// alert.setMessage(this.getString(R.string.fileDeleteConfirmation, getDeleteFile()));
//
// alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
// public void onClick(DialogInterface dialog, int id) {
// removeDialog(Id.dialog.delete_file);
// final File file = new File(getDeleteFile());
// showDialog(Id.dialog.deleting);
// mDeletingThread = new Thread(new Runnable() {
// public void run() {
// Bundle data = new Bundle();
// data.putInt(Constants.extras.STATUS, Id.message.delete_done);
// try {
// Apg.deleteFileSecurely(BaseActivity.this, file, BaseActivity.this);
// } catch (FileNotFoundException e) {
// data.putString(Apg.EXTRA_ERROR, BaseActivity.this.getString(
// R.string.error_fileNotFound, file));
// } catch (IOException e) {
// data.putString(Apg.EXTRA_ERROR, BaseActivity.this.getString(
// R.string.error_fileDeleteFailed, file));
// }
// Message msg = new Message();
// msg.setData(data);
// sendMessage(msg);
// }
// });
// mDeletingThread.start();
// }
// });
// alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
// public void onClick(DialogInterface dialog, int id) {
// removeDialog(Id.dialog.delete_file);
// }
// });
// alert.setCancelable(true);
//
// return alert.create();
// }
// case Id.dialog.delete_file: {
// AlertDialog.Builder alert = new AlertDialog.Builder(this);
//
// alert.setIcon(android.R.drawable.ic_dialog_alert);
// alert.setTitle(R.string.warning);
// alert.setMessage(this.getString(R.string.fileDeleteConfirmation, getDeleteFile()));
//
// alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
// public void onClick(DialogInterface dialog, int id) {
// removeDialog(Id.dialog.delete_file);
// final File file = new File(getDeleteFile());
// showDialog(Id.dialog.deleting);
// mDeletingThread = new Thread(new Runnable() {
// public void run() {
// Bundle data = new Bundle();
// data.putInt(Constants.extras.STATUS, Id.message.delete_done);
// try {
// Apg.deleteFileSecurely(BaseActivity.this, file, BaseActivity.this);
// } catch (FileNotFoundException e) {
// data.putString(Apg.EXTRA_ERROR, BaseActivity.this.getString(
// R.string.error_fileNotFound, file));
// } catch (IOException e) {
// data.putString(Apg.EXTRA_ERROR, BaseActivity.this.getString(
// R.string.error_fileDeleteFailed, file));
// }
// Message msg = new Message();
// msg.setData(data);
// sendMessage(msg);
// }
// });
// mDeletingThread.start();
// }
// });
// alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
// public void onClick(DialogInterface dialog, int id) {
// removeDialog(Id.dialog.delete_file);
// }
// });
// alert.setCancelable(true);
//
// return alert.create();
// }
default: {
break;
@ -335,11 +327,11 @@ public class BaseActivity extends SherlockFragmentActivity implements Runnable,
break;
}
// case Id.message.delete_done: {
// mProgressDialog = null;
// deleteDoneCallback(msg);
// break;
// }
// case Id.message.delete_done: {
// mProgressDialog = null;
// deleteDoneCallback(msg);
// break;
// }
case Id.message.import_done: // intentionally no break
case Id.message.export_done: // intentionally no break
@ -360,21 +352,21 @@ public class BaseActivity extends SherlockFragmentActivity implements Runnable,
}
// public void deleteDoneCallback(Message msg) {
// removeDialog(Id.dialog.deleting);
// mDeletingThread = null;
//
// Bundle data = msg.getData();
// String error = data.getString(Apg.EXTRA_ERROR);
// String message;
// if (error != null) {
// message = getString(R.string.errorMessage, error);
// } else {
// message = getString(R.string.fileDeleteSuccessful);
// }
//
// Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
// }
// public void deleteDoneCallback(Message msg) {
// removeDialog(Id.dialog.deleting);
// mDeletingThread = null;
//
// Bundle data = msg.getData();
// String error = data.getString(Apg.EXTRA_ERROR);
// String message;
// if (error != null) {
// message = getString(R.string.errorMessage, error);
// } else {
// message = getString(R.string.fileDeleteSuccessful);
// }
//
// Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
// }
public void passPhraseCallback(long keyId, String passPhrase) {
// TODO: Not needed anymore, now implemented in AskForSecretKeyPass

View File

@ -770,9 +770,9 @@ public class DecryptActivity extends SherlockFragmentActivity {
}
}
if (data.getBoolean(ApgService.EXTRA_SIGNATURE)) {
String userId = data.getString(ApgService.EXTRA_SIGNATURE_USER_ID);
mSignatureKeyId = data.getLong(ApgService.EXTRA_SIGNATURE_KEY_ID);
if (data.getBoolean(ApgService.RESULT_SIGNATURE)) {
String userId = data.getString(ApgService.RESULT_SIGNATURE_USER_ID);
mSignatureKeyId = data.getLong(ApgService.RESULT_SIGNATURE_KEY_ID);
mUserIdRest
.setText("id: " + PGPHelper.getSmallFingerPrint(mSignatureKeyId));
if (userId == null) {
@ -785,9 +785,9 @@ public class DecryptActivity extends SherlockFragmentActivity {
}
mUserId.setText(userId);
if (data.getBoolean(ApgService.EXTRA_SIGNATURE_SUCCESS)) {
if (data.getBoolean(ApgService.RESULT_SIGNATURE_SUCCESS)) {
mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
} else if (data.getBoolean(ApgService.EXTRA_SIGNATURE_UNKNOWN)) {
} else if (data.getBoolean(ApgService.RESULT_SIGNATURE_UNKNOWN)) {
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
Toast.makeText(DecryptActivity.this,
R.string.unknownSignatureKeyTouchToLookUp, Toast.LENGTH_LONG)

View File

@ -23,7 +23,6 @@ import org.thialfihar.android.apg.Constants;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.helper.PGPHelper;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.helper.OtherHelper;
import org.thialfihar.android.apg.helper.PGPConversionHelper;
import org.thialfihar.android.apg.service.ApgHandler;
import org.thialfihar.android.apg.service.ApgService;

View File

@ -21,7 +21,6 @@ import org.thialfihar.android.apg.R;
import org.thialfihar.android.apg.Constants;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.helper.PGPHelper;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.util.HkpKeyServer;
import org.thialfihar.android.apg.util.KeyServer.InsufficientQuery;
import org.thialfihar.android.apg.util.KeyServer.KeyInfo;

View File

@ -22,7 +22,6 @@ import java.security.Security;
import org.spongycastle.jce.provider.BouncyCastleProvider;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.R;
import org.thialfihar.android.apg.helper.PGPMain;
import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockActivity;

View File

@ -20,9 +20,8 @@ import org.spongycastle.bcpg.HashAlgorithmTags;
import org.spongycastle.openpgp.PGPEncryptedData;
import org.thialfihar.android.apg.Constants;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.helper.Preferences;
import org.thialfihar.android.apg.passphrase.PassphraseCacheService;
import org.thialfihar.android.apg.service.PassphraseCacheService;
import org.thialfihar.android.apg.ui.widget.IntegerListPreference;
import org.thialfihar.android.apg.R;

View File

@ -20,7 +20,6 @@ import java.util.Vector;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.R;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.ui.widget.Editor;
import org.thialfihar.android.apg.ui.widget.KeyServerEditor;
import org.thialfihar.android.apg.ui.widget.Editor.EditorListener;

View File

@ -26,7 +26,6 @@ import org.thialfihar.android.apg.helper.PGPMain;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.ContextMenu;

View File

@ -19,9 +19,9 @@ package org.thialfihar.android.apg.ui;
import org.thialfihar.android.apg.R;
import org.thialfihar.android.apg.Constants;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.deprecated.AskForPassphrase;
import org.thialfihar.android.apg.helper.PGPHelper;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.passphrase.AskForPassphrase;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuItem;

View File

@ -21,7 +21,6 @@ import java.util.Vector;
import org.thialfihar.android.apg.Constants;
import org.thialfihar.android.apg.R;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.ui.widget.SelectPublicKeyListAdapter;
import com.actionbarsherlock.app.ActionBar;

View File

@ -19,7 +19,6 @@ package org.thialfihar.android.apg.ui;
import org.thialfihar.android.apg.Constants;
import org.thialfihar.android.apg.R;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.ui.widget.SelectSecretKeyListAdapter;
import com.actionbarsherlock.app.ActionBar;

View File

@ -20,7 +20,6 @@ import org.spongycastle.openpgp.PGPPublicKey;
import org.spongycastle.openpgp.PGPSecretKey;
import org.thialfihar.android.apg.Id;
import org.thialfihar.android.apg.helper.PGPHelper;
import org.thialfihar.android.apg.helper.PGPMain;
import org.thialfihar.android.apg.util.Choice;
import org.thialfihar.android.apg.R;

View File

@ -193,13 +193,6 @@ public class ApgIntentHelper {
break;
}
apgData.setEncryptedData(data.getStringExtra(Constants.EXTRA_ENCRYPTED_MESSAGE));
// this was a stupid bug in an earlier version, just gonna leave this in for an APG
// version or two
if (apgData.getEncryptedData() == null) {
apgData.setEncryptedData(data.getStringExtra(Constants.EXTRA_DECRYPTED_MESSAGE));
}
if (apgData.getEncryptedData() != null) {
}
break;
case Constants.DECRYPT_MESSAGE:
@ -215,7 +208,6 @@ public class ApgIntentHelper {
false));
apgData.setDecryptedData(data.getStringExtra(Constants.EXTRA_DECRYPTED_MESSAGE));
break;
default: