rename ProviderHelper -> DatabaseInteractor
This commit is contained in:
@@ -35,7 +35,7 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.experimental.SentenceConfirm;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.ui.base.LoaderFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
@@ -213,7 +213,7 @@ public class CertifyFingerprintFragment extends LoaderFragment implements
|
||||
private void certify(Uri dataUri) {
|
||||
long keyId = 0;
|
||||
try {
|
||||
keyId = new ProviderHelper(getActivity())
|
||||
keyId = new DatabaseInteractor(getActivity())
|
||||
.getCachedPublicKeyRing(dataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
|
||||
@@ -20,37 +20,25 @@ package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.support.v4.app.LoaderManager;
|
||||
import android.support.v4.content.CursorLoader;
|
||||
import android.support.v4.content.Loader;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.CertifyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase.Tables;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.service.CertifyActionsParcel;
|
||||
import org.sufficientlysecure.keychain.service.CertifyActionsParcel.CertifyAction;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.MultiUserIdsAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.base.CachingCryptoOperationFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
|
||||
@@ -80,7 +68,7 @@ public class CertifyKeyFragment
|
||||
.getLongExtra(CertifyKeyActivity.EXTRA_CERTIFY_KEY_ID, Constants.key.none);
|
||||
if (certifyKeyId != Constants.key.none) {
|
||||
try {
|
||||
CachedPublicKeyRing key = (new ProviderHelper(getActivity()))
|
||||
CachedPublicKeyRing key = (new DatabaseInteractor(getActivity()))
|
||||
.getCachedPublicKeyRing(certifyKeyId);
|
||||
if (key.canCertify()) {
|
||||
mCertifyKeySpinner.setPreSelectedKeyId(certifyKeyId);
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.securitytoken.KeyFormat;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseSecurityTokenActivity;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
@@ -180,7 +180,7 @@ public class CreateKeyActivity extends BaseSecurityTokenActivity {
|
||||
if (containsKeys(mScannedFingerprints)) {
|
||||
try {
|
||||
long masterKeyId = KeyFormattingUtils.getKeyIdFromFingerprint(mScannedFingerprints);
|
||||
CachedPublicKeyRing ring = new ProviderHelper(this).getCachedPublicKeyRing(masterKeyId);
|
||||
CachedPublicKeyRing ring = new DatabaseInteractor(this).getCachedPublicKeyRing(masterKeyId);
|
||||
ring.getMasterKeyId();
|
||||
|
||||
Intent intent = new Intent(this, ViewKeyActivity.class);
|
||||
|
||||
@@ -41,14 +41,12 @@ import org.sufficientlysecure.keychain.operations.results.EditKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.UploadResult;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.PgpSecurityConstants;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.service.ChangeUnlockParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.Algorithm;
|
||||
import org.sufficientlysecure.keychain.service.UploadKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction;
|
||||
@@ -413,7 +411,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
CreateKeyActivity activity = (CreateKeyActivity) getActivity();
|
||||
|
||||
final SaveKeyringParcel changeKeyringParcel;
|
||||
CachedPublicKeyRing key = (new ProviderHelper(activity))
|
||||
CachedPublicKeyRing key = (new DatabaseInteractor(activity))
|
||||
.getCachedPublicKeyRing(saveKeyResult.mMasterKeyId);
|
||||
try {
|
||||
changeKeyringParcel = new SaveKeyringParcel(key.getMasterKeyId(), key.getFingerprint());
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
@@ -192,7 +192,7 @@ public abstract class DecryptFragment extends Fragment implements LoaderManager.
|
||||
try {
|
||||
|
||||
Intent viewKeyIntent = new Intent(getActivity(), ViewKeyActivity.class);
|
||||
long masterKeyId = new ProviderHelper(getActivity()).getCachedPublicKeyRing(
|
||||
long masterKeyId = new DatabaseInteractor(getActivity()).getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(keyId)
|
||||
).getMasterKeyId();
|
||||
viewKeyIntent.setData(KeyRings.buildGenericKeyRingUri(masterKeyId));
|
||||
|
||||
@@ -35,16 +35,14 @@ import android.widget.AdapterView;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.keyimport.ParcelableHkpKeyserver;
|
||||
import org.sufficientlysecure.keychain.operations.results.DeleteResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.RevokeResult;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.service.DeleteKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.RevokeKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
@@ -91,13 +89,13 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||
if (mMasterKeyIds.length == 1 && mHasSecret) {
|
||||
// if mMasterKeyIds.length == 0 we let the DeleteOperation respond
|
||||
try {
|
||||
HashMap<String, Object> data = new ProviderHelper(this).getUnifiedData(
|
||||
HashMap<String, Object> data = new DatabaseInteractor(this).getUnifiedData(
|
||||
mMasterKeyIds[0], new String[]{
|
||||
KeychainContract.KeyRings.NAME,
|
||||
KeychainContract.KeyRings.IS_REVOKED
|
||||
}, new int[]{
|
||||
ProviderHelper.FIELD_TYPE_STRING,
|
||||
ProviderHelper.FIELD_TYPE_INTEGER
|
||||
DatabaseInteractor.FIELD_TYPE_STRING,
|
||||
DatabaseInteractor.FIELD_TYPE_INTEGER
|
||||
}
|
||||
);
|
||||
|
||||
@@ -114,7 +112,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||
} else {
|
||||
showRevokeDeleteDialog(name);
|
||||
}
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
Log.e(Constants.TAG,
|
||||
"Secret key to delete not found at DeleteKeyDialogActivity for "
|
||||
+ mMasterKeyIds[0], e);
|
||||
@@ -271,13 +269,13 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||
long masterKeyId = masterKeyIds[0];
|
||||
|
||||
try {
|
||||
HashMap<String, Object> data = new ProviderHelper(activity).getUnifiedData(
|
||||
HashMap<String, Object> data = new DatabaseInteractor(activity).getUnifiedData(
|
||||
masterKeyId, new String[]{
|
||||
KeychainContract.KeyRings.NAME,
|
||||
KeychainContract.KeyRings.HAS_ANY_SECRET
|
||||
}, new int[]{
|
||||
ProviderHelper.FIELD_TYPE_STRING,
|
||||
ProviderHelper.FIELD_TYPE_INTEGER
|
||||
DatabaseInteractor.FIELD_TYPE_STRING,
|
||||
DatabaseInteractor.FIELD_TYPE_INTEGER
|
||||
}
|
||||
);
|
||||
String name;
|
||||
@@ -295,7 +293,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||
} else {
|
||||
mMainMessage.setText(getString(R.string.public_key_deletetion_confirmation, name));
|
||||
}
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
dismiss();
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.UploadKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter;
|
||||
@@ -170,7 +170,7 @@ public class EditIdentitiesFragment extends Fragment
|
||||
try {
|
||||
Uri secretUri = KeychainContract.KeyRings.buildUnifiedKeyRingUri(mDataUri);
|
||||
CachedPublicKeyRing keyRing =
|
||||
new ProviderHelper(getActivity()).getCachedPublicKeyRing(secretUri);
|
||||
new DatabaseInteractor(getActivity()).getCachedPublicKeyRing(secretUri);
|
||||
long masterKeyId = keyRing.getMasterKeyId();
|
||||
|
||||
// check if this is a master secret key we can work with
|
||||
|
||||
@@ -50,8 +50,8 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.UserPackets;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.service.ChangeUnlockParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.SaveKeyringParcel.SubkeyChange;
|
||||
@@ -203,7 +203,7 @@ public class EditKeyFragment extends QueueingCryptoOperationFragment<SaveKeyring
|
||||
try {
|
||||
Uri secretUri = KeychainContract.KeyRings.buildUnifiedKeyRingUri(mDataUri);
|
||||
CachedPublicKeyRing keyRing =
|
||||
new ProviderHelper(getActivity()).getCachedPublicKeyRing(secretUri);
|
||||
new DatabaseInteractor(getActivity()).getCachedPublicKeyRing(secretUri);
|
||||
long masterKeyId = keyRing.getMasterKeyId();
|
||||
|
||||
// check if this is a master secret key we can work with
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ViewAnimator;
|
||||
|
||||
import com.tokenautocomplete.TokenCompleteTextView;
|
||||
import com.tokenautocomplete.TokenCompleteTextView.TokenListener;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
@@ -31,8 +30,8 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.KeyAdapter.KeyItem;
|
||||
import org.sufficientlysecure.keychain.ui.widget.EncryptKeyCompletionView;
|
||||
import org.sufficientlysecure.keychain.ui.widget.KeySpinner;
|
||||
@@ -46,7 +45,7 @@ import java.util.List;
|
||||
|
||||
public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
|
||||
|
||||
ProviderHelper mProviderHelper;
|
||||
DatabaseInteractor mDatabaseInteractor;
|
||||
|
||||
private KeySpinner mSignKeySpinner;
|
||||
private EncryptKeyCompletionView mEncryptKeyView;
|
||||
@@ -115,7 +114,7 @@ public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
|
||||
@Override
|
||||
public void onActivityCreated(Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mProviderHelper = new ProviderHelper(getActivity());
|
||||
mDatabaseInteractor = new DatabaseInteractor(getActivity());
|
||||
|
||||
// preselect keys given, from state or arguments
|
||||
if (savedInstanceState == null) {
|
||||
@@ -135,7 +134,7 @@ public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
|
||||
private void preselectKeys(Long signatureKeyId, long[] encryptionKeyIds) {
|
||||
if (signatureKeyId != null) {
|
||||
try {
|
||||
CachedPublicKeyRing keyring = mProviderHelper.getCachedPublicKeyRing(
|
||||
CachedPublicKeyRing keyring = mDatabaseInteractor.getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingUri(signatureKeyId));
|
||||
if (keyring.hasAnySecret()) {
|
||||
mSignKeySpinner.setPreSelectedKeyId(signatureKeyId);
|
||||
@@ -149,7 +148,7 @@ public class EncryptModeAsymmetricFragment extends EncryptModeFragment {
|
||||
for (long preselectedId : encryptionKeyIds) {
|
||||
try {
|
||||
CanonicalizedPublicKeyRing ring =
|
||||
mProviderHelper.getCanonicalizedPublicKeyRing(preselectedId);
|
||||
mDatabaseInteractor.getCanonicalizedPublicKeyRing(preselectedId);
|
||||
mEncryptKeyView.addObject(new KeyItem(ring));
|
||||
} catch (NotFoundException e) {
|
||||
Log.e(Constants.TAG, "key not found!", e);
|
||||
|
||||
@@ -59,7 +59,7 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainDatabase;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.service.BenchmarkInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.ConsolidateInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
||||
@@ -486,8 +486,8 @@ public class KeyListFragment extends RecyclerFragment<KeySectionedListAdapter>
|
||||
return;
|
||||
}
|
||||
|
||||
ProviderHelper providerHelper = new ProviderHelper(activity);
|
||||
Cursor cursor = providerHelper.getContentResolver().query(
|
||||
DatabaseInteractor databaseInteractor = new DatabaseInteractor(activity);
|
||||
Cursor cursor = databaseInteractor.getContentResolver().query(
|
||||
KeyRings.buildUnifiedKeyRingsUri(), new String[]{
|
||||
KeyRings.FINGERPRINT
|
||||
}, null, null, null
|
||||
|
||||
@@ -31,7 +31,6 @@ import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.Editable;
|
||||
import android.text.InputType;
|
||||
import android.text.Layout;
|
||||
import android.text.TextWatcher;
|
||||
import android.text.method.PasswordTransformationMethod;
|
||||
import android.view.ContextThemeWrapper;
|
||||
@@ -59,8 +58,8 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
@@ -113,7 +112,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
// handle empty passphrases by directly returning an empty crypto input parcel
|
||||
try {
|
||||
CachedPublicKeyRing pubRing =
|
||||
new ProviderHelper(this).getCachedPublicKeyRing(requiredInput.getMasterKeyId());
|
||||
new DatabaseInteractor(this).getCachedPublicKeyRing(requiredInput.getMasterKeyId());
|
||||
// use empty passphrase for empty passphrase
|
||||
if (pubRing.getSecretKeyType(requiredInput.getSubKeyId()) == SecretKeyType.PASSPHRASE_EMPTY) {
|
||||
// also return passphrase back to activity
|
||||
@@ -232,7 +231,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
try {
|
||||
long subKeyId = mRequiredInput.getSubKeyId();
|
||||
|
||||
ProviderHelper helper = new ProviderHelper(activity);
|
||||
DatabaseInteractor helper = new DatabaseInteractor(activity);
|
||||
CachedPublicKeyRing cachedPublicKeyRing = helper.getCachedPublicKeyRing(
|
||||
KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(subKeyId));
|
||||
// yes the inner try/catch block is necessary, otherwise the final variable
|
||||
@@ -267,7 +266,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
throw new AssertionError("Unhandled SecretKeyType (should not happen)");
|
||||
}
|
||||
|
||||
} catch (PgpKeyNotFoundException | ProviderHelper.NotFoundException e) {
|
||||
} catch (PgpKeyNotFoundException | DatabaseInteractor.NotFoundException e) {
|
||||
alert.setTitle(R.string.title_key_not_found);
|
||||
alert.setMessage(getString(R.string.key_not_found, mRequiredInput.getSubKeyId()));
|
||||
alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {
|
||||
@@ -458,7 +457,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
|
||||
Long subKeyId = mRequiredInput.getSubKeyId();
|
||||
CanonicalizedSecretKeyRing secretKeyRing =
|
||||
new ProviderHelper(getActivity()).getCanonicalizedSecretKeyRing(
|
||||
new DatabaseInteractor(getActivity()).getCanonicalizedSecretKeyRing(
|
||||
KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(subKeyId));
|
||||
CanonicalizedSecretKey secretKeyToUnlock =
|
||||
secretKeyRing.getSecretKey(subKeyId);
|
||||
|
||||
@@ -29,7 +29,7 @@ import android.widget.ImageView;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.ui.util.Notify;
|
||||
@@ -74,11 +74,11 @@ public class QrCodeViewActivity extends BaseActivity {
|
||||
}
|
||||
});
|
||||
|
||||
ProviderHelper providerHelper = new ProviderHelper(this);
|
||||
DatabaseInteractor databaseInteractor = new DatabaseInteractor(this);
|
||||
try {
|
||||
byte[] blob = (byte[]) providerHelper.getGenericData(
|
||||
byte[] blob = (byte[]) databaseInteractor.getGenericData(
|
||||
KeychainContract.KeyRings.buildUnifiedKeyRingUri(dataUri),
|
||||
KeychainContract.KeyRings.FINGERPRINT, ProviderHelper.FIELD_TYPE_BLOB);
|
||||
KeychainContract.KeyRings.FINGERPRINT, DatabaseInteractor.FIELD_TYPE_BLOB);
|
||||
if (blob == null) {
|
||||
Log.e(Constants.TAG, "key not found!");
|
||||
Notify.create(this, R.string.error_key_not_found, Style.ERROR).show();
|
||||
@@ -102,7 +102,7 @@ public class QrCodeViewActivity extends BaseActivity {
|
||||
mQrCode.setImageBitmap(scaled);
|
||||
}
|
||||
});
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
Log.e(Constants.TAG, "key not found!", e);
|
||||
Notify.create(this, R.string.error_key_not_found, Style.ERROR).show();
|
||||
ActivityCompat.finishAfterTransition(QrCodeViewActivity.this);
|
||||
|
||||
@@ -34,7 +34,7 @@ import org.sufficientlysecure.keychain.operations.ImportOperation;
|
||||
import org.sufficientlysecure.keychain.operations.results.ImportKeyResult;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||
@@ -105,8 +105,8 @@ public class SafeSlingerActivity extends BaseActivity
|
||||
// retrieve public key blob and start SafeSlinger
|
||||
Uri uri = KeychainContract.KeyRingData.buildPublicKeyRingUri(masterKeyId);
|
||||
try {
|
||||
byte[] keyBlob = (byte[]) new ProviderHelper(this).getGenericData(
|
||||
uri, KeychainContract.KeyRingData.KEY_RING_DATA, ProviderHelper.FIELD_TYPE_BLOB);
|
||||
byte[] keyBlob = (byte[]) new DatabaseInteractor(this).getGenericData(
|
||||
uri, KeychainContract.KeyRingData.KEY_RING_DATA, DatabaseInteractor.FIELD_TYPE_BLOB);
|
||||
|
||||
Intent slingerIntent = new Intent(this, ExchangeActivity.class);
|
||||
|
||||
@@ -114,7 +114,7 @@ public class SafeSlingerActivity extends BaseActivity
|
||||
slingerIntent.putExtra(ExchangeConfig.extra.USER_DATA, keyBlob);
|
||||
slingerIntent.putExtra(ExchangeConfig.extra.HOST_NAME, Constants.SAFESLINGER_SERVER);
|
||||
startActivityForResult(slingerIntent, REQUEST_CODE_SAFE_SLINGER);
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
Log.e(Constants.TAG, "personal key not found", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.securitytoken.KeyType;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
@@ -193,12 +193,12 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity {
|
||||
throw new IOException(getString(R.string.error_wrong_security_token));
|
||||
}
|
||||
|
||||
ProviderHelper providerHelper = new ProviderHelper(this);
|
||||
DatabaseInteractor databaseInteractor = new DatabaseInteractor(this);
|
||||
CanonicalizedPublicKeyRing publicKeyRing;
|
||||
try {
|
||||
publicKeyRing = providerHelper.getCanonicalizedPublicKeyRing(
|
||||
publicKeyRing = databaseInteractor.getCanonicalizedPublicKeyRing(
|
||||
KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(mRequiredInput.getMasterKeyId()));
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
throw new IOException("Couldn't find subkey for key to token operation.");
|
||||
}
|
||||
|
||||
@@ -232,13 +232,13 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity {
|
||||
mSecurityTokenHelper.setPin(new Passphrase("123456"));
|
||||
mSecurityTokenHelper.setAdminPin(new Passphrase("12345678"));
|
||||
|
||||
ProviderHelper providerHelper = new ProviderHelper(this);
|
||||
DatabaseInteractor databaseInteractor = new DatabaseInteractor(this);
|
||||
CanonicalizedSecretKeyRing secretKeyRing;
|
||||
try {
|
||||
secretKeyRing = providerHelper.getCanonicalizedSecretKeyRing(
|
||||
secretKeyRing = databaseInteractor.getCanonicalizedSecretKeyRing(
|
||||
KeychainContract.KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(mRequiredInput.getMasterKeyId())
|
||||
);
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
throw new IOException("Couldn't find subkey for key to token operation.");
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.Certs;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
@@ -184,8 +184,8 @@ public class ViewCertActivity extends BaseActivity
|
||||
Intent viewIntent = new Intent(ViewCertActivity.this, ViewKeyActivity.class);
|
||||
|
||||
try {
|
||||
ProviderHelper providerHelper = new ProviderHelper(ViewCertActivity.this);
|
||||
long signerMasterKeyId = providerHelper.getCachedPublicKeyRing(
|
||||
DatabaseInteractor databaseInteractor = new DatabaseInteractor(ViewCertActivity.this);
|
||||
long signerMasterKeyId = databaseInteractor.getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(mCertifierKeyId)).getMasterKeyId();
|
||||
viewIntent.setData(KeyRings.buildGenericKeyRingUri(signerMasterKeyId));
|
||||
startActivity(viewIntent);
|
||||
|
||||
@@ -74,8 +74,8 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor.NotFoundException;
|
||||
import org.sufficientlysecure.keychain.service.ChangeUnlockParcel;
|
||||
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
@@ -125,7 +125,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
public static final String EXTRA_DISPLAY_RESULT = "display_result";
|
||||
public static final String EXTRA_LINKED_TRANSITION = "linked_transition";
|
||||
|
||||
ProviderHelper mProviderHelper;
|
||||
DatabaseInteractor mDatabaseInteractor;
|
||||
|
||||
protected Uri mDataUri;
|
||||
|
||||
@@ -185,7 +185,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mProviderHelper = new ProviderHelper(this);
|
||||
mDatabaseInteractor = new DatabaseInteractor(this);
|
||||
mImportOpHelper = new CryptoOperationHelper<>(1, this, this, null);
|
||||
|
||||
setTitle(null);
|
||||
@@ -318,7 +318,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
// or start new ones.
|
||||
getSupportLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this);
|
||||
|
||||
mNfcHelper = new NfcHelper(this, mProviderHelper);
|
||||
mNfcHelper = new NfcHelper(this, mDatabaseInteractor);
|
||||
mNfcHelper.initNfc(mDataUri);
|
||||
|
||||
if (savedInstanceState == null && getIntent().hasExtra(EXTRA_DISPLAY_RESULT)) {
|
||||
@@ -399,8 +399,8 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
}
|
||||
case R.id.menu_key_view_refresh: {
|
||||
try {
|
||||
updateFromKeyserver(mDataUri, mProviderHelper);
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
updateFromKeyserver(mDataUri, mDatabaseInteractor);
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
Notify.create(this, R.string.error_key_not_found, Notify.Style.ERROR).show();
|
||||
}
|
||||
return true;
|
||||
@@ -550,7 +550,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
private boolean keyHasPassphrase() {
|
||||
try {
|
||||
SecretKeyType secretKeyType =
|
||||
mProviderHelper.getCachedPublicKeyRing(mMasterKeyId).getSecretKeyType(mMasterKeyId);
|
||||
mDatabaseInteractor.getCachedPublicKeyRing(mMasterKeyId).getSecretKeyType(mMasterKeyId);
|
||||
switch (secretKeyType) {
|
||||
// all of these make no sense to ask
|
||||
case PASSPHRASE_EMPTY:
|
||||
@@ -666,7 +666,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
try {
|
||||
|
||||
// if the security token matches a subkey in any key
|
||||
CachedPublicKeyRing ring = mProviderHelper.getCachedPublicKeyRing(
|
||||
CachedPublicKeyRing ring = mDatabaseInteractor.getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(tokenId));
|
||||
byte[] candidateFp = ring.getFingerprint();
|
||||
|
||||
@@ -741,7 +741,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
return;
|
||||
}
|
||||
try {
|
||||
long keyId = new ProviderHelper(this)
|
||||
long keyId = new DatabaseInteractor(this)
|
||||
.getCachedPublicKeyRing(dataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
long[] encryptionKeyIds = new long[]{keyId};
|
||||
@@ -765,7 +765,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
private void startSafeSlinger(Uri dataUri) {
|
||||
long keyId = 0;
|
||||
try {
|
||||
keyId = new ProviderHelper(this)
|
||||
keyId = new DatabaseInteractor(this)
|
||||
.getCachedPublicKeyRing(dataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
@@ -1118,17 +1118,17 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
// CryptoOperationHelper.Callback functions
|
||||
|
||||
|
||||
private void updateFromKeyserver(Uri dataUri, ProviderHelper providerHelper)
|
||||
throws ProviderHelper.NotFoundException {
|
||||
private void updateFromKeyserver(Uri dataUri, DatabaseInteractor databaseInteractor)
|
||||
throws DatabaseInteractor.NotFoundException {
|
||||
|
||||
mIsRefreshing = true;
|
||||
mRefreshItem.setEnabled(false);
|
||||
mRefreshItem.setActionView(mRefresh);
|
||||
mRefresh.startAnimation(mRotate);
|
||||
|
||||
byte[] blob = (byte[]) providerHelper.getGenericData(
|
||||
byte[] blob = (byte[]) databaseInteractor.getGenericData(
|
||||
KeychainContract.KeyRings.buildUnifiedKeyRingUri(dataUri),
|
||||
KeychainContract.Keys.FINGERPRINT, ProviderHelper.FIELD_TYPE_BLOB);
|
||||
KeychainContract.Keys.FINGERPRINT, DatabaseInteractor.FIELD_TYPE_BLOB);
|
||||
String fingerprint = KeyFormattingUtils.convertFingerprintToHex(blob);
|
||||
|
||||
ParcelableKeyRing keyEntry = new ParcelableKeyRing(fingerprint, null, null, null);
|
||||
|
||||
@@ -41,13 +41,11 @@ import android.widget.Toast;
|
||||
|
||||
import com.astuetz.PagerSlidingTabStrip;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.OperationResult;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.ui.adapter.PagerTabStripAdapter;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.ui.util.KeyFormattingUtils;
|
||||
@@ -57,7 +55,7 @@ import org.sufficientlysecure.keychain.util.Log;
|
||||
public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
LoaderCallbacks<Cursor>, OnPageChangeListener {
|
||||
|
||||
ProviderHelper mProviderHelper;
|
||||
DatabaseInteractor mDatabaseInteractor;
|
||||
|
||||
protected Uri mDataUri;
|
||||
|
||||
@@ -90,7 +88,7 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
}
|
||||
});
|
||||
|
||||
mProviderHelper = new ProviderHelper(this);
|
||||
mDatabaseInteractor = new DatabaseInteractor(this);
|
||||
|
||||
mViewPager = (ViewPager) findViewById(R.id.pager);
|
||||
mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tab_layout);
|
||||
|
||||
@@ -58,7 +58,7 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.provider.TemporaryFileProvider;
|
||||
import org.sufficientlysecure.keychain.ui.base.LoaderFragment;
|
||||
import org.sufficientlysecure.keychain.ui.util.FormattingUtils;
|
||||
@@ -93,8 +93,8 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
||||
View root = super.onCreateView(inflater, superContainer, savedInstanceState);
|
||||
View view = inflater.inflate(R.layout.view_key_adv_share_fragment, getContainer());
|
||||
|
||||
ProviderHelper providerHelper = new ProviderHelper(ViewKeyAdvShareFragment.this.getActivity());
|
||||
mNfcHelper = new NfcHelper(getActivity(), providerHelper);
|
||||
DatabaseInteractor databaseInteractor = new DatabaseInteractor(ViewKeyAdvShareFragment.this.getActivity());
|
||||
mNfcHelper = new NfcHelper(getActivity(), databaseInteractor);
|
||||
|
||||
mFingerprintView = (TextView) view.findViewById(R.id.view_key_fingerprint);
|
||||
mQrCode = (ImageView) view.findViewById(R.id.view_key_qr_code);
|
||||
@@ -200,7 +200,7 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
||||
private void startSafeSlinger(Uri dataUri) {
|
||||
long keyId = 0;
|
||||
try {
|
||||
keyId = new ProviderHelper(getActivity())
|
||||
keyId = new DatabaseInteractor(getActivity())
|
||||
.getCachedPublicKeyRing(dataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
@@ -216,10 +216,10 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
||||
if (activity == null || mFingerprint == null) {
|
||||
return;
|
||||
}
|
||||
ProviderHelper providerHelper = new ProviderHelper(activity);
|
||||
DatabaseInteractor databaseInteractor = new DatabaseInteractor(activity);
|
||||
|
||||
try {
|
||||
String content = providerHelper.getKeyRingAsArmoredString(
|
||||
String content = databaseInteractor.getKeyRingAsArmoredString(
|
||||
KeychainContract.KeyRingData.buildPublicKeyRingUri(mDataUri));
|
||||
|
||||
if (toClipboard) {
|
||||
@@ -273,7 +273,7 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
||||
} catch (PgpGeneralException | IOException e) {
|
||||
Log.e(Constants.TAG, "error processing key!", e);
|
||||
Notify.create(activity, R.string.error_key_processing, Notify.Style.ERROR).show();
|
||||
} catch (ProviderHelper.NotFoundException e) {
|
||||
} catch (DatabaseInteractor.NotFoundException e) {
|
||||
Log.e(Constants.TAG, "key not found!", e);
|
||||
Notify.create(activity, R.string.error_key_not_found, Notify.Style.ERROR).show();
|
||||
}
|
||||
@@ -457,7 +457,7 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
||||
private void uploadToKeyserver() {
|
||||
long keyId;
|
||||
try {
|
||||
keyId = new ProviderHelper(getActivity())
|
||||
keyId = new DatabaseInteractor(getActivity())
|
||||
.getCachedPublicKeyRing(mDataUri)
|
||||
.extractOrGetMasterKeyId();
|
||||
} catch (PgpKeyNotFoundException e) {
|
||||
|
||||
@@ -41,7 +41,7 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedKeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.service.ImportKeyringParcel;
|
||||
import org.sufficientlysecure.keychain.ui.ViewKeyActivity;
|
||||
import org.sufficientlysecure.keychain.ui.base.CryptoOperationHelper;
|
||||
@@ -65,7 +65,7 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
private List<ImportKeysListEntry> mData;
|
||||
private KeyState[] mKeyStates;
|
||||
|
||||
private ProviderHelper mProviderHelper;
|
||||
private DatabaseInteractor mDatabaseInteractor;
|
||||
|
||||
public ImportKeysAdapter(FragmentActivity activity, ImportKeysListener listener,
|
||||
boolean nonInteractive) {
|
||||
@@ -74,7 +74,7 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
mListener = listener;
|
||||
mNonInteractive = nonInteractive;
|
||||
|
||||
mProviderHelper = new ProviderHelper(activity);
|
||||
mDatabaseInteractor = new DatabaseInteractor(activity);
|
||||
}
|
||||
|
||||
public void setData(List<ImportKeysListEntry> data) {
|
||||
@@ -89,13 +89,13 @@ public class ImportKeysAdapter extends RecyclerView.Adapter<ImportKeysAdapter.Vi
|
||||
try {
|
||||
KeyRing keyRing;
|
||||
if (entry.isSecretKey()) {
|
||||
keyRing = mProviderHelper.getCanonicalizedSecretKeyRing(keyId);
|
||||
keyRing = mDatabaseInteractor.getCanonicalizedSecretKeyRing(keyId);
|
||||
} else {
|
||||
keyRing = mProviderHelper.getCachedPublicKeyRing(keyId);
|
||||
keyRing = mDatabaseInteractor.getCachedPublicKeyRing(keyId);
|
||||
}
|
||||
keyState.mAlreadyPresent = true;
|
||||
keyState.mVerified = keyRing.getVerified() > 0;
|
||||
} catch (ProviderHelper.NotFoundException | PgpKeyNotFoundException ignored) {
|
||||
} catch (DatabaseInteractor.NotFoundException | PgpKeyNotFoundException ignored) {
|
||||
}
|
||||
|
||||
mKeyStates[i] = keyState;
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.service.PassphraseCacheService;
|
||||
import org.sufficientlysecure.keychain.service.input.CryptoInputParcel;
|
||||
import org.sufficientlysecure.keychain.service.input.RequiredInputParcel;
|
||||
@@ -105,7 +105,7 @@ public abstract class BaseSecurityTokenActivity extends BaseActivity
|
||||
final long subKeyId = KeyFormattingUtils.getKeyIdFromFingerprint(mSecurityTokenFingerprints);
|
||||
|
||||
try {
|
||||
CachedPublicKeyRing ring = new ProviderHelper(this).getCachedPublicKeyRing(
|
||||
CachedPublicKeyRing ring = new DatabaseInteractor(this).getCachedPublicKeyRing(
|
||||
KeyRings.buildUnifiedKeyRingsFindBySubkeyUri(subKeyId));
|
||||
long masterKeyId = ring.getMasterKeyId();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.sufficientlysecure.keychain.pgp.exception.PgpKeyNotFoundException;
|
||||
import org.sufficientlysecure.keychain.provider.CachedPublicKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
import org.sufficientlysecure.keychain.provider.ProviderHelper;
|
||||
import org.sufficientlysecure.keychain.provider.DatabaseInteractor;
|
||||
import org.sufficientlysecure.keychain.ui.base.BaseActivity;
|
||||
import org.sufficientlysecure.keychain.util.Log;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class LinkedIdWizard extends BaseActivity {
|
||||
try {
|
||||
Uri uri = getIntent().getData();
|
||||
uri = KeychainContract.KeyRings.buildUnifiedKeyRingUri(uri);
|
||||
CachedPublicKeyRing ring = new ProviderHelper(this).getCachedPublicKeyRing(uri);
|
||||
CachedPublicKeyRing ring = new DatabaseInteractor(this).getCachedPublicKeyRing(uri);
|
||||
if (!ring.hasAnySecret()) {
|
||||
Log.e(Constants.TAG, "Linked Identities can only be added to secret keys!");
|
||||
finish();
|
||||
|
||||
Reference in New Issue
Block a user