diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java index 77a11165d..f90250f57 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyHelper.java @@ -392,15 +392,29 @@ public class PgpKeyHelper { return isCertificationKey(key.getPublicKey()); } - public static String getAlgorithmInfo(PGPPublicKey key) { - return getAlgorithmInfo(key.getAlgorithm(), key.getBitStrength()); + public static String getAlgorithmInfo(Context context, PGPPublicKey key) { + return getAlgorithmInfo(context, key.getAlgorithm(), key.getBitStrength()); } - public static String getAlgorithmInfo(PGPSecretKey key) { - return getAlgorithmInfo(key.getPublicKey()); + public static String getAlgorithmInfo(Context context, PGPSecretKey key) { + return getAlgorithmInfo(context, key.getPublicKey()); } - public static String getAlgorithmInfo(int algorithm, int keySize) { + /** + * TODO: Only used in HkpKeyServer. Get rid of this one! + */ + public static String getAlgorithmInfo(int algorithm) { + return getAlgorithmInfo(null, algorithm, 0); + } + + public static String getAlgorithmInfo(Context context, int algorithm) { + return getAlgorithmInfo(context, algorithm, 0); + } + + /** + * Based on OpenPGP Message Format + */ + public static String getAlgorithmInfo(Context context, int algorithm, int keySize) { String algorithmStr; switch (algorithm) { @@ -421,8 +435,19 @@ public class PgpKeyHelper { break; } + case PGPPublicKey.ECDSA: + case PGPPublicKey.ECDH: { + algorithmStr = "ECC"; + break; + } + default: { - algorithmStr = "Unknown"; + if (context != null) { + algorithmStr = context.getResources().getString(R.string.unknown_algorithm); + } else { + // TODO + algorithmStr = "unknown"; + } break; } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 046c3431e..6c71c641f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -71,7 +71,7 @@ public class EncryptActivity extends DrawerActivity implements private static final int PAGER_CONTENT_MESSAGE = 0; private static final int PAGER_CONTENT_FILE = 1; - // model useb by message and file fragment + // model used by message and file fragments private long mEncryptionKeyIds[] = null; private long mSigningKeyId = Constants.key.none; private String mPassphrase; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index 46da6257a..0fccd668f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -17,7 +17,7 @@ package org.sufficientlysecure.keychain.ui; -import android.annotation.SuppressLint; +import android.annotation.TargetApi; import android.app.Activity; import android.app.ProgressDialog; import android.content.Context; @@ -25,6 +25,7 @@ import android.content.Intent; import android.net.Uri; import android.nfc.NdefMessage; import android.nfc.NfcAdapter; +import android.os.Build; import android.os.Bundle; import android.os.Message; import android.os.Messenger; @@ -211,7 +212,8 @@ public class ImportKeysActivity extends ActionBarActivity implements ActionBar.O } else { Log.e(Constants.TAG, "IMPORT_KEY_FROM_KEYSERVER action needs to contain the 'query', 'key_id', or " + - "'fingerprint' extra!"); + "'fingerprint' extra!" + ); return; } } else if (ACTION_IMPORT_KEY_FROM_FILE.equals(action)) { @@ -458,9 +460,13 @@ public class ImportKeysActivity extends ActionBarActivity implements ActionBar.O @Override public void onResume() { super.onResume(); - // Check to see that the Activity started due to an Android Beam - if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) { + + // Check to see if the Activity started due to an Android Beam + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN + && NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent().getAction())) { handleActionNdefDiscovered(getIntent()); + } else { + Log.e(Constants.TAG, "Android Beam not supported by Android < 4.1"); } } @@ -476,7 +482,7 @@ public class ImportKeysActivity extends ActionBarActivity implements ActionBar.O /** * NFC: Parses the NDEF Message from the intent and prints to the TextView */ - @SuppressLint("NewApi") + @TargetApi(Build.VERSION_CODES.JELLY_BEAN) void handleActionNdefDiscovered(Intent intent) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); // only one message sent during the beam diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java index 899d9864e..f740cfc22 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewCertActivity.java @@ -176,7 +176,7 @@ public class ViewCertActivity extends ActionBarActivity mStatus.setTextColor(getResources().getColor(R.color.black)); } - String algorithmStr = PgpKeyHelper.getAlgorithmInfo(sig.getKeyAlgorithm(), 0); + String algorithmStr = PgpKeyHelper.getAlgorithmInfo(this, sig.getKeyAlgorithm(), 0); mAlgorithm.setText(algorithmStr); mRowReason.setVisibility(View.GONE); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyCertsFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyCertsFragment.java index 5418f4033..3c4135715 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyCertsFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyCertsFragment.java @@ -50,21 +50,23 @@ public class ViewKeyCertsFragment extends Fragment implements LoaderManager.LoaderCallbacks, AdapterView.OnItemClickListener { // These are the rows that we will retrieve. - static final String[] PROJECTION = new String[] { - Certs._ID, - Certs.MASTER_KEY_ID, - Certs.VERIFIED, - Certs.TYPE, - Certs.RANK, - Certs.KEY_ID_CERTIFIER, - Certs.USER_ID, - Certs.SIGNER_UID + static final String[] PROJECTION = new String[]{ + Certs._ID, + Certs.MASTER_KEY_ID, + Certs.VERIFIED, + Certs.TYPE, + Certs.RANK, + Certs.KEY_ID_CERTIFIER, + Certs.USER_ID, + Certs.SIGNER_UID }; // sort by our user id, static final String SORT_ORDER = - Tables.CERTS + "." + Certs.RANK + " ASC, " - + Certs.VERIFIED + " DESC, " + Certs.TYPE + " DESC, " + Certs.SIGNER_UID + " ASC"; + Tables.CERTS + "." + Certs.RANK + " ASC, " + + Certs.VERIFIED + " DESC, " + + Certs.TYPE + " DESC, " + + Certs.SIGNER_UID + " ASC"; public static final String ARG_DATA_URI = "data_uri"; @@ -106,10 +108,6 @@ public class ViewKeyCertsFragment extends Fragment mStickyList.setEmptyView(getActivity().findViewById(R.id.empty)); - // TODO this view is made visible if no data is available - // mStickyList.setEmptyView(getActivity().findViewById(R.id.empty)); - - // Create an empty adapter we will use to display the loaded data. mAdapter = new CertListAdapter(getActivity(), null); mStickyList.setAdapter(mAdapter); @@ -138,7 +136,7 @@ public class ViewKeyCertsFragment extends Fragment */ @Override public void onItemClick(AdapterView adapterView, View view, int position, long id) { - if(view.getTag(R.id.tag_mki) != null) { + if (view.getTag(R.id.tag_mki) != null) { long masterKeyId = (Long) view.getTag(R.id.tag_mki); long rank = (Long) view.getTag(R.id.tag_rank); long certifierId = (Long) view.getTag(R.id.tag_certifierId); @@ -215,17 +213,22 @@ public class ViewKeyCertsFragment extends Fragment String signerKeyId = PgpKeyHelper.convertKeyIdToHex(cursor.getLong(mIndexSignerKeyId)); String signerUserId = cursor.getString(mIndexSignerUserId); - switch(cursor.getInt(mIndexType)) { + switch (cursor.getInt(mIndexType)) { case PGPSignature.DEFAULT_CERTIFICATION: // 0x10 - wSignStatus.setText(R.string.cert_default); break; + wSignStatus.setText(R.string.cert_default); + break; case PGPSignature.NO_CERTIFICATION: // 0x11 - wSignStatus.setText(R.string.cert_none); break; + wSignStatus.setText(R.string.cert_none); + break; case PGPSignature.CASUAL_CERTIFICATION: // 0x12 - wSignStatus.setText(R.string.cert_casual); break; + wSignStatus.setText(R.string.cert_casual); + break; case PGPSignature.POSITIVE_CERTIFICATION: // 0x13 - wSignStatus.setText(R.string.cert_positive); break; + wSignStatus.setText(R.string.cert_positive); + break; case PGPSignature.CERTIFICATION_REVOCATION: // 0x30 - wSignStatus.setText(R.string.cert_revoke); break; + wSignStatus.setText(R.string.cert_revoke); + break; } wSignerUserId.setText(signerUserId); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java index 39eceda81..5b1ed5866 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java @@ -278,7 +278,10 @@ public class ViewKeyMainFragment extends Fragment implements } String algorithmStr = PgpKeyHelper.getAlgorithmInfo( - data.getInt(INDEX_UNIFIED_ALGORITHM), data.getInt(INDEX_UNIFIED_KEY_SIZE)); + getActivity(), + data.getInt(INDEX_UNIFIED_ALGORITHM), + data.getInt(INDEX_UNIFIED_KEY_SIZE) + ); mAlgorithm.setText(algorithmStr); byte[] fingerprintBlob = data.getBlob(INDEX_UNIFIED_FINGERPRINT); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java index c571831cd..f4fa7f3bf 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java @@ -17,7 +17,7 @@ package org.sufficientlysecure.keychain.ui.adapter; -import android.annotation.SuppressLint; +import android.annotation.TargetApi; import android.app.Activity; import android.content.Context; import android.graphics.Color; @@ -61,14 +61,14 @@ public class ImportKeysAdapter extends ArrayAdapter { mInflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } - @SuppressLint("NewApi") + @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void setData(List data) { clear(); if (data != null) { this.mData = data; // add data to extended ArrayAdapter - if (Build.VERSION.SDK_INT >= 11) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { addAll(data); } else { for (ImportKeysListEntry entry : data) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java index 201cda2e8..b06852af4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java @@ -17,6 +17,7 @@ package org.sufficientlysecure.keychain.ui.adapter; +import android.content.Context; import android.os.Parcel; import android.os.Parcelable; import android.util.SparseArray; @@ -213,7 +214,7 @@ public class ImportKeysListEntry implements Serializable, Parcelable { * Constructor based on key object, used for import from NFC, QR Codes, files */ @SuppressWarnings("unchecked") - public ImportKeysListEntry(PGPKeyRing pgpKeyRing) { + public ImportKeysListEntry(Context context, PGPKeyRing pgpKeyRing) { // save actual key object into entry, used to import it later try { this.mBytes = pgpKeyRing.getEncoded(); @@ -263,32 +264,6 @@ public class ImportKeysListEntry implements Serializable, Parcelable { this.fingerPrintHex = PgpKeyHelper.convertFingerprintToHex(key.getFingerprint()); this.bitStrength = key.getBitStrength(); final int algorithm = key.getAlgorithm(); - this.algorithm = getAlgorithmFromId(algorithm); - } - - /** - * Based on OpenPGP Message Format - */ - private static final SparseArray ALGORITHM_IDS = new SparseArray() {{ - put(-1, "unknown"); // TODO: with resources - put(0, "unencrypted"); - put(PGPPublicKey.RSA_GENERAL, "RSA"); - put(PGPPublicKey.RSA_ENCRYPT, "RSA"); - put(PGPPublicKey.RSA_SIGN, "RSA"); - put(PGPPublicKey.ELGAMAL_ENCRYPT, "ElGamal"); - put(PGPPublicKey.ELGAMAL_GENERAL, "ElGamal"); - put(PGPPublicKey.DSA, "DSA"); - put(PGPPublicKey.EC, "ECC"); - put(PGPPublicKey.ECDSA, "ECC"); - put(PGPPublicKey.ECDH, "ECC"); - }}; - - /** - * Based on OpenPGP Message Format - */ - public static String getAlgorithmFromId(int algorithmId) { - return (ALGORITHM_IDS.get(algorithmId) != null ? - ALGORITHM_IDS.get(algorithmId) : - ALGORITHM_IDS.get(-1)); + this.algorithm = PgpKeyHelper.getAlgorithmInfo(context, algorithm); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java index e7a045294..3fd5d5daf 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java @@ -165,7 +165,7 @@ public class ImportKeysListLoader } private void addToData(PGPKeyRing keyring) { - ImportKeysListEntry item = new ImportKeysListEntry(keyring); + ImportKeysListEntry item = new ImportKeysListEntry(getContext(), keyring); mData.add(item); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java index 259e14319..838aeefee 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListServerLoader.java @@ -101,7 +101,7 @@ public class ImportKeysListServerLoader String fingerprint = query.substring(2); Log.d(Constants.TAG, "fingerprint: " + fingerprint); // query must return only one result! - if (searchResult.size() > 0) { + if (searchResult.size() == 1) { ImportKeysListEntry uniqueEntry = searchResult.get(0); /* * set fingerprint explicitly after query diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyValueSpinnerAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyValueSpinnerAdapter.java index c3d6024c7..80d605fb9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyValueSpinnerAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyValueSpinnerAdapter.java @@ -39,7 +39,8 @@ public class KeyValueSpinnerAdapter extends ArrayAdapter { public int compare(Map.Entry e1, Map.Entry e2) { return e1.getValue().compareTo(e2.getValue()); } - }); + } + ); sortedEntries.addAll(map.entrySet()); return sortedEntries; } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java index 2210975fe..cde008175 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java @@ -65,8 +65,8 @@ abstract public class SelectKeyCursorAdapter extends HighlightQueryCursorAdapter if (cursor != null) { mIndexUserId = cursor.getColumnIndexOrThrow(KeyRings.USER_ID); mIndexMasterKeyId = cursor.getColumnIndexOrThrow(KeyRings.MASTER_KEY_ID); - mIndexExpiry= cursor.getColumnIndexOrThrow(KeyRings.EXPIRY); - mIndexRevoked= cursor.getColumnIndexOrThrow(KeyRings.IS_REVOKED); + mIndexExpiry = cursor.getColumnIndexOrThrow(KeyRings.EXPIRY); + mIndexRevoked = cursor.getColumnIndexOrThrow(KeyRings.IS_REVOKED); } } @@ -122,7 +122,7 @@ abstract public class SelectKeyCursorAdapter extends HighlightQueryCursorAdapter h.keyId.setText(PgpKeyHelper.convertKeyIdToHex(masterKeyId)); boolean enabled = true; - if(cursor.getInt(mIndexRevoked) != 0) { + if (cursor.getInt(mIndexRevoked) != 0) { h.status.setText(R.string.revoked); enabled = false; } else if (!cursor.isNull(mIndexExpiry) @@ -134,7 +134,6 @@ abstract public class SelectKeyCursorAdapter extends HighlightQueryCursorAdapter } h.status.setTag(enabled); - } @Override diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java index 27ba19233..9e26e559f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyKeysAdapter.java @@ -73,7 +73,7 @@ public class ViewKeyKeysAdapter extends CursorAdapter { hasAnySecret = true; break; } - } while(newCursor.moveToNext()); + } while (newCursor.moveToNext()); } return super.swapCursor(newCursor); @@ -112,8 +112,11 @@ public class ViewKeyKeysAdapter extends CursorAdapter { ImageView revokedKeyIcon = (ImageView) view.findViewById(R.id.ic_revokedKey); String keyIdStr = PgpKeyHelper.convertKeyIdToHex(cursor.getLong(mIndexKeyId)); - String algorithmStr = PgpKeyHelper.getAlgorithmInfo(cursor.getInt(mIndexAlgorithm), - cursor.getInt(mIndexKeySize)); + String algorithmStr = PgpKeyHelper.getAlgorithmInfo( + context, + cursor.getInt(mIndexAlgorithm), + cursor.getInt(mIndexKeySize) + ); keyId.setText(keyIdStr); // may be set with additional "stripped" later on @@ -173,6 +176,7 @@ public class ViewKeyKeysAdapter extends CursorAdapter { } else { keyExpiry.setVisibility(View.GONE); } + // if key is expired or revoked, strike through text if (!valid) { keyId.setText(OtherHelper.strikeOutText(keyId.getText())); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java index 29883d750..52e6dec92 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ViewKeyUserIdsAdapter.java @@ -46,8 +46,12 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView. private final ArrayList mCheckStates; public static final String[] USER_IDS_PROJECTION = new String[]{ - UserIds._ID, UserIds.USER_ID, UserIds.RANK, - UserIds.VERIFIED, UserIds.IS_PRIMARY, UserIds.IS_REVOKED + UserIds._ID, + UserIds.USER_ID, + UserIds.RANK, + UserIds.VERIFIED, + UserIds.IS_PRIMARY, + UserIds.IS_REVOKED }; public ViewKeyUserIdsAdapter(Context context, Cursor c, int flags, boolean showCheckBoxes) { @@ -102,7 +106,6 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView. @Override public void bindView(View view, Context context, Cursor cursor) { - TextView vRank = (TextView) view.findViewById(R.id.rank); TextView vUserId = (TextView) view.findViewById(R.id.userId); TextView vAddress = (TextView) view.findViewById(R.id.address); @@ -137,12 +140,16 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter implements AdapterView. int verified = cursor.getInt(mVerifiedId); // TODO introduce own resources for this :) - if (verified == Certs.VERIFIED_SECRET) { - vVerified.setImageResource(R.drawable.key_certify_ok_depth0); - } else if (verified == Certs.VERIFIED_SELF) { - vVerified.setImageResource(R.drawable.key_certify_ok_self); - } else { - vVerified.setImageResource(R.drawable.key_certify_error); + switch (verified) { + case Certs.VERIFIED_SECRET: + vVerified.setImageResource(R.drawable.key_certify_ok_depth0); + break; + case Certs.VERIFIED_SELF: + vVerified.setImageResource(R.drawable.key_certify_ok_self); + break; + default: + vVerified.setImageResource(R.drawable.key_certify_error); + break; } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java index 7913df6c8..93cdef5e3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteKeyDialogFragment.java @@ -68,7 +68,6 @@ public class DeleteKeyDialogFragment extends DialogFragment { @Override public Dialog onCreateDialog(Bundle savedInstanceState) { - final FragmentActivity activity = getActivity(); mMessenger = getArguments().getParcelable(ARG_MESSENGER); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareNfcDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareNfcDialogFragment.java index 01079b44e..15df53dcc 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareNfcDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareNfcDialogFragment.java @@ -88,13 +88,11 @@ public class ShareNfcDialogFragment extends DialogFragment { Settings.ACTION_NFCSHARING_SETTINGS); startActivity(intentSettings); } - }); + } + ); } } - - // no flickering when clicking textview for Android < 4 - // aboutTextView.setTextColor(getResources().getColor(android.R.color.black)); - + return alert.create(); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareQrCodeDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareQrCodeDialogFragment.java index 37b219b02..fe50c759b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareQrCodeDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareQrCodeDialogFragment.java @@ -92,7 +92,7 @@ public class ShareQrCodeDialogFragment extends DialogFragment { mText = (TextView) view.findViewById(R.id.share_qr_code_dialog_text); ProviderHelper providerHelper = new ProviderHelper(getActivity()); - String content = null; + String content; try { if (mFingerprintOnly) { alert.setPositiveButton(R.string.btn_okay, null); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index c401ca62e..1628c9e95 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -216,7 +216,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { mDeleteButton.setVisibility(View.INVISIBLE); } - mAlgorithm.setText(PgpKeyHelper.getAlgorithmInfo(key)); + mAlgorithm.setText(PgpKeyHelper.getAlgorithmInfo(getContext(), key)); String keyIdStr = PgpKeyHelper.convertKeyIdToHex(key.getKeyID()); mKeyId.setText(keyIdStr); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java index b7f021646..cf658b0b6 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java @@ -31,6 +31,7 @@ import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.pgp.PgpHelper; +import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry; import java.io.ByteArrayOutputStream; @@ -256,7 +257,7 @@ public class HkpKeyServer extends KeyServer { entry.setBitStrength(Integer.parseInt(matcher.group(3))); final int algorithmId = Integer.decode(matcher.group(2)); - entry.setAlgorithm(ImportKeysListEntry.getAlgorithmFromId(algorithmId)); + entry.setAlgorithm(PgpKeyHelper.getAlgorithmInfo(algorithmId)); // group 1 contains the full fingerprint (v4) or the long key id if available // see http://bit.ly/1d4bxbk and http://bit.ly/1gD1wwr diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index a815a9cc3..71342eaec 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -140,6 +140,8 @@ <no key> can encrypt can sign + can certify + cannot certify expired revoked @@ -368,6 +370,7 @@ Start FAQ + Web of Trust NFC Beam Changelog About @@ -468,6 +471,17 @@ Write message here to encrypt and/or sign… Enter ciphertext here to decrypt and/or verify… + + default + none + casual + positive + revoke + ok + failed! + error! + key unavailable + Signer Certificate Details @@ -475,26 +489,15 @@ <unknown> No certificates for this key User IDs to sign - default - none - casual - positive - revoke - Web of Trust - ok - failed! - error! - key unavailable Revocation Reason Verification Status Type - can certify - cannot certify Key not found! Error processing key! subkey unavailable stripped Secret keys can only be deleted individually! View Certificate Details + unknown