diff options
Diffstat (limited to 'OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/remote')
2 files changed, 15 insertions, 14 deletions
diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java index e6e6ba31b..b38fea5a9 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -35,7 +35,8 @@ import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; import org.sufficientlysecure.keychain.pgp.PgpSignEncrypt; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; -import org.sufficientlysecure.keychain.provider.KeychainContract; +import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; +import org.sufficientlysecure.keychain.provider.KeychainContract.ApiAccounts; import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.remote.ui.RemoteServiceActivity; import org.sufficientlysecure.keychain.service.PassphraseCacheService; @@ -61,15 +62,15 @@ public class OpenPgpService extends RemoteService { ArrayList<Long> keyIds = new ArrayList<Long>(); boolean missingUserIdsCheck = false; - boolean dublicateUserIdsCheck = false; + boolean duplicateUserIdsCheck = false; ArrayList<String> missingUserIds = new ArrayList<String>(); - ArrayList<String> dublicateUserIds = new ArrayList<String>(); + ArrayList<String> duplicateUserIds = new ArrayList<String>(); for (String email : encryptionUserIds) { - Uri uri = KeychainContract.KeyRings.buildUnifiedKeyRingsByEmailUri(email); + Uri uri = KeyRings.buildUnifiedKeyRingsFindByEmailUri(email); Cursor cur = getContentResolver().query(uri, null, null, null, null); if (cur.moveToFirst()) { - long id = cur.getLong(cur.getColumnIndex(KeychainContract.KeyRings.MASTER_KEY_ID)); + long id = cur.getLong(cur.getColumnIndex(KeyRings.MASTER_KEY_ID)); keyIds.add(id); } else { missingUserIdsCheck = true; @@ -77,8 +78,8 @@ public class OpenPgpService extends RemoteService { Log.d(Constants.TAG, "user id missing"); } if (cur.moveToNext()) { - dublicateUserIdsCheck = true; - dublicateUserIds.add(email); + duplicateUserIdsCheck = true; + duplicateUserIds.add(email); Log.d(Constants.TAG, "more than one user id with the same email"); } } @@ -90,13 +91,13 @@ public class OpenPgpService extends RemoteService { } // allow the user to verify pub key selection - if (missingUserIdsCheck || dublicateUserIdsCheck) { + if (missingUserIdsCheck || duplicateUserIdsCheck) { // build PendingIntent Intent intent = new Intent(getBaseContext(), RemoteServiceActivity.class); intent.setAction(RemoteServiceActivity.ACTION_SELECT_PUB_KEYS); intent.putExtra(RemoteServiceActivity.EXTRA_SELECTED_MASTER_KEY_IDS, keyIdsArray); intent.putExtra(RemoteServiceActivity.EXTRA_MISSING_USER_IDS, missingUserIds); - intent.putExtra(RemoteServiceActivity.EXTRA_DUBLICATE_USER_IDS, dublicateUserIds); + intent.putExtra(RemoteServiceActivity.EXTRA_DUBLICATE_USER_IDS, duplicateUserIds); intent.putExtra(RemoteServiceActivity.EXTRA_DATA, data); PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, @@ -351,7 +352,7 @@ public class OpenPgpService extends RemoteService { try { long keyId = data.getLongExtra(OpenPgpApi.EXTRA_KEY_ID, 0); - if (ProviderHelper.getPGPPublicKeyByKeyId(this, keyId) == null) { + if (ProviderHelper.getPGPPublicKeyRing(this, keyId) == null) { Intent result = new Intent(); // If keys are not in db we return an additional PendingIntent @@ -462,7 +463,7 @@ public class OpenPgpService extends RemoteService { String currentPkg = getCurrentCallingPackage(); Set<Long> allowedKeyIds = ProviderHelper.getAllKeyIdsForApp(mContext, - KeychainContract.ApiAccounts.buildBaseUri(currentPkg)); + ApiAccounts.buildBaseUri(currentPkg)); return decryptAndVerifyImpl(data, input, output, allowedKeyIds); } else if (OpenPgpApi.ACTION_GET_KEY.equals(action)) { return getKeyImpl(data); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AccountSettingsFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AccountSettingsFragment.java index dee0dae95..992aa7c95 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AccountSettingsFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/AccountSettingsFragment.java @@ -34,6 +34,7 @@ import com.beardedhen.androidbootstrap.BootstrapButton; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.provider.KeychainContract; +import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.remote.AccountSettings; import org.sufficientlysecure.keychain.ui.EditKeyActivity; import org.sufficientlysecure.keychain.ui.SelectSecretKeyLayoutFragment; @@ -176,9 +177,8 @@ public class AccountSettingsFragment extends Fragment implements case REQUEST_CODE_CREATE_KEY: { if (resultCode == Activity.RESULT_OK) { // select newly created key - Uri newKeyUri = data.getData(); - // TODO helper method for this? - mSelectKeyFragment.selectKey(Long.parseLong(newKeyUri.getPathSegments().get(1))); + long masterKeyId = ProviderHelper.getMasterKeyId(getActivity(), data.getData()); + mSelectKeyFragment.selectKey(masterKeyId); } break; } |