Shifted duplicate method implementations from KeyRing to openpgp-api submodule
This commit is contained in:
@@ -34,6 +34,7 @@ import android.widget.CheckBox;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.bouncycastle.bcpg.sig.KeyFlags;
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.EditKeyResult;
|
||||
@@ -305,7 +306,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
}
|
||||
}
|
||||
String userId = KeyRing.createUserId(
|
||||
new KeyRing.UserId(createKeyActivity.mName, createKeyActivity.mEmail, null)
|
||||
new OpenPgpUtils.UserId(createKeyActivity.mName, createKeyActivity.mEmail, null)
|
||||
);
|
||||
saveKeyringParcel.mAddUserIds.add(userId);
|
||||
saveKeyringParcel.mChangePrimaryUserId = userId;
|
||||
@@ -313,7 +314,7 @@ public class CreateKeyFinalFragment extends Fragment {
|
||||
&& createKeyActivity.mAdditionalEmails.size() > 0) {
|
||||
for (String email : createKeyActivity.mAdditionalEmails) {
|
||||
String thisUserId = KeyRing.createUserId(
|
||||
new KeyRing.UserId(createKeyActivity.mName, email, null)
|
||||
new OpenPgpUtils.UserId(createKeyActivity.mName, email, null)
|
||||
);
|
||||
saveKeyringParcel.mAddUserIds.add(thisUserId);
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ import android.widget.ViewAnimator;
|
||||
|
||||
import org.openintents.openpgp.OpenPgpDecryptionResult;
|
||||
import org.openintents.openpgp.OpenPgpSignatureResult;
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
|
||||
@@ -308,7 +309,7 @@ public abstract class DecryptFragment extends Fragment implements LoaderManager.
|
||||
long signatureKeyId = mSignatureResult.getKeyId();
|
||||
|
||||
String userId = data.getString(INDEX_USER_ID);
|
||||
KeyRing.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
OpenPgpUtils.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
if (userIdSplit.name != null) {
|
||||
mSignatureName.setText(userIdSplit.name);
|
||||
} else {
|
||||
@@ -418,7 +419,7 @@ public abstract class DecryptFragment extends Fragment implements LoaderManager.
|
||||
}
|
||||
|
||||
String userId = mSignatureResult.getPrimaryUserId();
|
||||
KeyRing.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
OpenPgpUtils.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
if (userIdSplit.name != null) {
|
||||
mSignatureName.setText(userIdSplit.name);
|
||||
} else {
|
||||
|
||||
@@ -35,6 +35,7 @@ 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.operations.results.DeleteResult;
|
||||
@@ -100,7 +101,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||
);
|
||||
|
||||
String name;
|
||||
KeyRing.UserId mainUserId = KeyRing.splitUserId(
|
||||
OpenPgpUtils.UserId mainUserId = KeyRing.splitUserId(
|
||||
(String) data.get(KeychainContract.KeyRings.USER_ID));
|
||||
if (mainUserId.name != null) {
|
||||
name = mainUserId.name;
|
||||
@@ -280,7 +281,7 @@ public class DeleteKeyDialogActivity extends FragmentActivity {
|
||||
}
|
||||
);
|
||||
String name;
|
||||
KeyRing.UserId mainUserId = KeyRing.splitUserId((String) data.get(KeychainContract.KeyRings.USER_ID));
|
||||
OpenPgpUtils.UserId mainUserId = KeyRing.splitUserId((String) data.get(KeychainContract.KeyRings.USER_ID));
|
||||
if (mainUserId.name != null) {
|
||||
name = mainUserId.name;
|
||||
} else {
|
||||
|
||||
@@ -58,6 +58,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.SignEncryptResult;
|
||||
@@ -704,7 +705,7 @@ public class EncryptFilesFragment
|
||||
|
||||
Set<String> users = new HashSet<>();
|
||||
for (String user : encryptionUserIds) {
|
||||
KeyRing.UserId userId = KeyRing.splitUserId(user);
|
||||
OpenPgpUtils.UserId userId = KeyRing.splitUserId(user);
|
||||
if (userId.email != null) {
|
||||
users.add(userId.email);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.SignEncryptResult;
|
||||
@@ -326,7 +327,7 @@ public class EncryptTextFragment
|
||||
|
||||
Set<String> users = new HashSet<>();
|
||||
for (String user : encryptionUserIds) {
|
||||
KeyRing.UserId userId = KeyRing.splitUserId(user);
|
||||
OpenPgpUtils.UserId userId = KeyRing.splitUserId(user);
|
||||
if (userId.email != null) {
|
||||
users.add(userId.email);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ListView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
@@ -151,7 +152,7 @@ public class MultiUserIdsFragment extends Fragment implements LoaderManager.Load
|
||||
while (!data.isAfterLast()) {
|
||||
long masterKeyId = data.getLong(INDEX_MASTER_KEY_ID);
|
||||
String userId = data.getString(INDEX_USER_ID);
|
||||
KeyRing.UserId pieces = KeyRing.splitUserId(userId);
|
||||
OpenPgpUtils.UserId pieces = KeyRing.splitUserId(userId);
|
||||
|
||||
// Two cases:
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
import android.widget.ViewAnimator;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey;
|
||||
@@ -236,7 +237,7 @@ public class PassphraseDialogActivity extends FragmentActivity {
|
||||
// above can't be statically verified to have been set in all cases because
|
||||
// the catch clause doesn't return.
|
||||
String mainUserId = cachedPublicKeyRing.getPrimaryUserIdWithFallback();
|
||||
KeyRing.UserId mainUserIdSplit = KeyRing.splitUserId(mainUserId);
|
||||
OpenPgpUtils.UserId mainUserIdSplit = KeyRing.splitUserId(mainUserId);
|
||||
if (mainUserIdSplit.name != null) {
|
||||
userId = mainUserIdSplit.name;
|
||||
} else {
|
||||
|
||||
@@ -67,6 +67,7 @@ import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing;
|
||||
@@ -877,7 +878,7 @@ public class ViewKeyActivity extends BaseSecurityTokenActivity implements
|
||||
|
||||
if (data.moveToFirst()) {
|
||||
// get name, email, and comment from USER_ID
|
||||
KeyRing.UserId mainUserId = KeyRing.splitUserId(data.getString(INDEX_USER_ID));
|
||||
OpenPgpUtils.UserId mainUserId = KeyRing.splitUserId(data.getString(INDEX_USER_ID));
|
||||
if (mainUserId.name != null) {
|
||||
mCollapsingToolbarLayout.setTitle(mainUserId.name);
|
||||
} else {
|
||||
|
||||
@@ -41,6 +41,7 @@ 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;
|
||||
@@ -213,7 +214,7 @@ public class ViewKeyAdvActivity extends BaseActivity implements
|
||||
case LOADER_ID_UNIFIED: {
|
||||
if (data.moveToFirst()) {
|
||||
// get name, email, and comment from USER_ID
|
||||
KeyRing.UserId mainUserId = KeyRing.splitUserId(data.getString(INDEX_USER_ID));
|
||||
OpenPgpUtils.UserId mainUserId = KeyRing.splitUserId(data.getString(INDEX_USER_ID));
|
||||
if (mainUserId.name != null) {
|
||||
setTitle(mainUserId.name);
|
||||
} else {
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
@@ -237,7 +238,7 @@ public class ViewKeyAdvCertsFragment extends LoaderFragment implements
|
||||
TextView wSignStatus = (TextView) view.findViewById(R.id.signStatus);
|
||||
|
||||
String signerKeyId = KeyFormattingUtils.beautifyKeyIdWithPrefix(getActivity(), cursor.getLong(mIndexSignerKeyId));
|
||||
KeyRing.UserId userId = KeyRing.splitUserId(cursor.getString(mIndexSignerUserId));
|
||||
OpenPgpUtils.UserId userId = KeyRing.splitUserId(cursor.getString(mIndexSignerUserId));
|
||||
if (userId.name != null) {
|
||||
wSignerName.setText(userId.name);
|
||||
} else {
|
||||
|
||||
@@ -51,6 +51,7 @@ import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
@@ -247,7 +248,7 @@ public class ViewKeyAdvShareFragment extends LoaderFragment implements
|
||||
TemporaryFileProvider shareFileProv = new TemporaryFileProvider();
|
||||
|
||||
String filename = KeyFormattingUtils.convertFingerprintToHex(mFingerprint);
|
||||
KeyRing.UserId mainUserId = KeyRing.splitUserId(mUserId);
|
||||
OpenPgpUtils.UserId mainUserId = KeyRing.splitUserId(mUserId);
|
||||
if (mainUserId.name != null) {
|
||||
filename = mainUserId.name;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry;
|
||||
import org.sufficientlysecure.keychain.operations.ImportOperation;
|
||||
@@ -141,7 +142,7 @@ public class ImportKeysAdapter extends ArrayAdapter<ImportKeysListEntry> {
|
||||
|
||||
// main user id
|
||||
String userId = entry.getUserIds().get(0);
|
||||
KeyRing.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
OpenPgpUtils.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
|
||||
// name
|
||||
if (userIdSplit.name != null) {
|
||||
|
||||
@@ -38,6 +38,7 @@ import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKey;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing;
|
||||
@@ -125,7 +126,7 @@ public class KeyAdapter extends CursorAdapter {
|
||||
mDisplayedItem = item;
|
||||
|
||||
{ // set name and stuff, common to both key types
|
||||
KeyRing.UserId userIdSplit = item.mUserId;
|
||||
OpenPgpUtils.UserId userIdSplit = item.mUserId;
|
||||
if (userIdSplit.name != null) {
|
||||
mMainUserId.setText(highlighter.highlight(userIdSplit.name));
|
||||
} else {
|
||||
@@ -288,7 +289,7 @@ public class KeyAdapter extends CursorAdapter {
|
||||
public static class KeyItem implements Serializable {
|
||||
|
||||
public final String mUserIdFull;
|
||||
public final KeyRing.UserId mUserId;
|
||||
public final OpenPgpUtils.UserId mUserId;
|
||||
public final long mKeyId;
|
||||
public final boolean mHasDuplicate;
|
||||
public final boolean mHasEncrypt;
|
||||
|
||||
@@ -30,6 +30,7 @@ import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.service.CertifyActionsParcel.CertifyAction;
|
||||
@@ -87,7 +88,7 @@ public class MultiUserIdsAdapter extends CursorAdapter {
|
||||
|
||||
{ // first one
|
||||
String userId = uids.get(0);
|
||||
KeyRing.UserId splitUserId = KeyRing.splitUserId(userId);
|
||||
OpenPgpUtils.UserId splitUserId = KeyRing.splitUserId(userId);
|
||||
if (splitUserId.name != null) {
|
||||
vName.setText(splitUserId.name);
|
||||
} else {
|
||||
@@ -112,7 +113,7 @@ public class MultiUserIdsAdapter extends CursorAdapter {
|
||||
|
||||
StringBuilder lines = new StringBuilder();
|
||||
for (String uid : uids) {
|
||||
KeyRing.UserId splitUserId = KeyRing.splitUserId(uid);
|
||||
OpenPgpUtils.UserId splitUserId = KeyRing.splitUserId(uid);
|
||||
if (splitUserId.email == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings;
|
||||
@@ -118,7 +119,7 @@ abstract public class SelectKeyCursorAdapter extends CursorAdapter {
|
||||
ViewHolderItem h = (ViewHolderItem) view.getTag();
|
||||
|
||||
String userId = cursor.getString(mIndexUserId);
|
||||
KeyRing.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
OpenPgpUtils.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
|
||||
if (userIdSplit.name != null) {
|
||||
h.mainUserId.setText(highlighter.highlight(userIdSplit.name));
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.ViewAnimator;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract.Certs;
|
||||
@@ -70,7 +71,7 @@ public class UserIdsAdapter extends UserAttributesAdapter {
|
||||
vDeleteButton.setVisibility(View.GONE); // not used
|
||||
|
||||
String userId = cursor.getString(INDEX_USER_ID);
|
||||
KeyRing.UserId splitUserId = KeyRing.splitUserId(userId);
|
||||
OpenPgpUtils.UserId splitUserId = KeyRing.splitUserId(userId);
|
||||
if (splitUserId.name != null) {
|
||||
vName.setText(splitUserId.name);
|
||||
} else {
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
|
||||
@@ -92,7 +93,7 @@ public class UserIdsAddedAdapter extends ArrayAdapter<String> {
|
||||
// save reference to model item
|
||||
holder.mModel = getItem(position);
|
||||
|
||||
KeyRing.UserId splitUserId = KeyRing.splitUserId(holder.mModel);
|
||||
OpenPgpUtils.UserId splitUserId = KeyRing.splitUserId(holder.mModel);
|
||||
if (splitUserId.name != null) {
|
||||
holder.vName.setText(splitUserId.name);
|
||||
} else {
|
||||
|
||||
@@ -38,6 +38,7 @@ import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.OnEditorActionListener;
|
||||
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.pgp.KeyRing;
|
||||
@@ -110,7 +111,7 @@ public class AddUserIdDialogFragment extends DialogFragment implements OnEditorA
|
||||
|
||||
// return new user id back to activity
|
||||
Bundle data = new Bundle();
|
||||
String userId = KeyRing.createUserId(new KeyRing.UserId(mName.getText().toString(),
|
||||
String userId = KeyRing.createUserId(new OpenPgpUtils.UserId(mName.getText().toString(),
|
||||
mEmail.getText().toString(), mComment.getText().toString()));
|
||||
data.putString(MESSAGE_DATA_USER_ID, userId);
|
||||
sendMessageToHandler(MESSAGE_OKAY, data);
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.bouncycastle.asn1.nist.NISTNamedCurves;
|
||||
import org.bouncycastle.asn1.teletrust.TeleTrusTNamedCurves;
|
||||
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
|
||||
import org.bouncycastle.util.encoders.Hex;
|
||||
import org.openintents.openpgp.util.OpenPgpUtils;
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.R;
|
||||
import org.sufficientlysecure.keychain.operations.results.DecryptVerifyResult;
|
||||
@@ -593,7 +594,7 @@ public class KeyFormattingUtils {
|
||||
holder.getSignatureAction().setDisplayedChild(sigActionDisplayedChild);
|
||||
|
||||
String userId = result.getSignatureResult().getPrimaryUserId();
|
||||
KeyRing.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
OpenPgpUtils.UserId userIdSplit = KeyRing.splitUserId(userId);
|
||||
if (userIdSplit.name != null) {
|
||||
holder.getSignatureUserName().setText(userIdSplit.name);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user