mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-25 07:51:48 -05:00
integrated key server look-up into decrypt Activity, allowing to touch an unkown signature to import the key
Update issue 39 added: <string name="unknownSignatureKeyTouchToLookUp">Unknown signature, touch to look up key.</string>
This commit is contained in:
parent
08305b4963
commit
996a1dbe1c
@ -144,7 +144,8 @@
|
|||||||
android:id="@+id/signature"
|
android:id="@+id/signature"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent">
|
android:layout_width="fill_parent"
|
||||||
|
android:clickable="true">
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -208,6 +208,7 @@
|
|||||||
<string name="keyCreationElGamalInfo">Note: only subkeys support ElGamal, and for ElGamal the nearest keysize of 1536, 2048, 3072, 4096, or 8192 will be used.</string>
|
<string name="keyCreationElGamalInfo">Note: only subkeys support ElGamal, and for ElGamal the nearest keysize of 1536, 2048, 3072, 4096, or 8192 will be used.</string>
|
||||||
<string name="keyNotFound">Couldn\'t find key %08X.</string>
|
<string name="keyNotFound">Couldn\'t find key %08X.</string>
|
||||||
<string name="keysFound">Found %s key(s).</string>
|
<string name="keysFound">Found %s key(s).</string>
|
||||||
|
<string name="unknownSignatureKeyTouchToLookUp">Unknown signature, touch to look up key.</string>
|
||||||
|
|
||||||
<!-- error_lowerCase: phrases, no punctuation, all lowercase,
|
<!-- error_lowerCase: phrases, no punctuation, all lowercase,
|
||||||
they will be put after "errorMessage", e.g. "Error: file not found" -->
|
they will be put after "errorMessage", e.g. "Error: file not found" -->
|
||||||
|
@ -116,6 +116,7 @@ public class Apg {
|
|||||||
public static final String SELECT_SECRET_KEY = "org.thialfihar.android.apg.intent.SELECT_SECRET_KEY";
|
public static final String SELECT_SECRET_KEY = "org.thialfihar.android.apg.intent.SELECT_SECRET_KEY";
|
||||||
public static final String IMPORT = "org.thialfihar.android.apg.intent.IMPORT";
|
public static final String IMPORT = "org.thialfihar.android.apg.intent.IMPORT";
|
||||||
public static final String LOOK_UP_KEY_ID = "org.thialfihar.android.apg.intent.LOOK_UP_KEY_ID";
|
public static final String LOOK_UP_KEY_ID = "org.thialfihar.android.apg.intent.LOOK_UP_KEY_ID";
|
||||||
|
public static final String LOOK_UP_KEY_ID_AND_RETURN = "org.thialfihar.android.apg.intent.LOOK_UP_KEY_ID_AND_RETURN";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String EXTRA_TEXT = "text";
|
public static final String EXTRA_TEXT = "text";
|
||||||
|
@ -28,6 +28,7 @@ import java.util.regex.Matcher;
|
|||||||
|
|
||||||
import org.bouncycastle2.jce.provider.BouncyCastleProvider;
|
import org.bouncycastle2.jce.provider.BouncyCastleProvider;
|
||||||
import org.bouncycastle2.openpgp.PGPException;
|
import org.bouncycastle2.openpgp.PGPException;
|
||||||
|
import org.bouncycastle2.openpgp.PGPPublicKeyRing;
|
||||||
import org.thialfihar.android.apg.provider.DataProvider;
|
import org.thialfihar.android.apg.provider.DataProvider;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
@ -276,6 +277,21 @@ public class DecryptActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mSignatureLayout.setVisibility(View.GONE);
|
mSignatureLayout.setVisibility(View.GONE);
|
||||||
|
mSignatureLayout.setOnClickListener(new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
if (mSignatureKeyId == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PGPPublicKeyRing key = Apg.getPublicKeyRing(mSignatureKeyId);
|
||||||
|
if (key != null) {
|
||||||
|
Intent intent = new Intent(DecryptActivity.this, KeyServerQueryActivity.class);
|
||||||
|
intent.setAction(Apg.Intent.LOOK_UP_KEY_ID);
|
||||||
|
intent.putExtra(Apg.EXTRA_KEY_ID, mSignatureKeyId);
|
||||||
|
startActivity(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mDecryptButton.setOnClickListener(new OnClickListener() {
|
mDecryptButton.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -599,6 +615,7 @@ public class DecryptActivity extends BaseActivity {
|
|||||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
|
mSignatureStatusImage.setImageResource(R.drawable.overlay_ok);
|
||||||
} else if (data.getBoolean(Apg.EXTRA_SIGNATURE_UNKNOWN)) {
|
} else if (data.getBoolean(Apg.EXTRA_SIGNATURE_UNKNOWN)) {
|
||||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||||
|
Toast.makeText(this, R.string.unknownSignatureKeyTouchToLookUp, Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
mSignatureStatusImage.setImageResource(R.drawable.overlay_error);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ public class HkpKeyServer extends KeyServer {
|
|||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
throw new QueryException(e.toString());
|
throw new QueryException(e.toString());
|
||||||
}
|
}
|
||||||
for (int i = 5; i < ips.length; ++i) {
|
for (int i = 0; i < ips.length; ++i) {
|
||||||
try {
|
try {
|
||||||
String url = "http://" + ips[i].getHostAddress() + ":" + mPort + request;
|
String url = "http://" + ips[i].getHostAddress() + ":" + mPort + request;
|
||||||
URL realUrl = new URL(url);
|
URL realUrl = new URL(url);
|
||||||
|
@ -86,7 +86,8 @@ public class KeyServerQueryActivity extends BaseActivity {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
if (Apg.Intent.LOOK_UP_KEY_ID.equals(intent.getAction())) {
|
if (Apg.Intent.LOOK_UP_KEY_ID.equals(intent.getAction()) ||
|
||||||
|
Apg.Intent.LOOK_UP_KEY_ID_AND_RETURN.equals(intent.getAction())) {
|
||||||
long keyId = intent.getLongExtra(Apg.EXTRA_KEY_ID, 0);
|
long keyId = intent.getLongExtra(Apg.EXTRA_KEY_ID, 0);
|
||||||
if (keyId != 0) {
|
if (keyId != 0) {
|
||||||
String query = "0x" + Apg.keyToHex(keyId);
|
String query = "0x" + Apg.keyToHex(keyId);
|
||||||
@ -168,15 +169,21 @@ public class KeyServerQueryActivity extends BaseActivity {
|
|||||||
mAdapter.setKeys(mSearchResult);
|
mAdapter.setKeys(mSearchResult);
|
||||||
}
|
}
|
||||||
} else if (mQueryType == Id.query.get) {
|
} else if (mQueryType == Id.query.get) {
|
||||||
if (mKeyData != null) {
|
Intent orgIntent = getIntent();
|
||||||
Intent intent = new Intent(this, PublicKeyListActivity.class);
|
if (Apg.Intent.LOOK_UP_KEY_ID_AND_RETURN.equals(orgIntent.getAction())) {
|
||||||
intent.setAction(Apg.Intent.IMPORT);
|
if (mKeyData != null) {
|
||||||
intent.putExtra(Apg.EXTRA_TEXT, mKeyData);
|
Intent intent = new Intent();
|
||||||
Intent orgIntent = getIntent();
|
intent.putExtra(Apg.EXTRA_TEXT, mKeyData);
|
||||||
if (Apg.Intent.LOOK_UP_KEY_ID.equals(orgIntent.getAction())) {
|
|
||||||
setResult(RESULT_OK, intent);
|
setResult(RESULT_OK, intent);
|
||||||
finish();
|
|
||||||
} else {
|
} else {
|
||||||
|
setResult(RESULT_CANCELED);
|
||||||
|
}
|
||||||
|
finish();
|
||||||
|
} else {
|
||||||
|
if (mKeyData != null) {
|
||||||
|
Intent intent = new Intent(this, PublicKeyListActivity.class);
|
||||||
|
intent.setAction(Apg.Intent.IMPORT);
|
||||||
|
intent.putExtra(Apg.EXTRA_TEXT, mKeyData);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -91,7 +91,7 @@ public class PublicKeyListActivity extends KeyListActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = new Intent(this, KeyServerQueryActivity.class);
|
Intent intent = new Intent(this, KeyServerQueryActivity.class);
|
||||||
intent.setAction(Apg.Intent.LOOK_UP_KEY_ID);
|
intent.setAction(Apg.Intent.LOOK_UP_KEY_ID_AND_RETURN);
|
||||||
intent.putExtra(Apg.EXTRA_KEY_ID, keyId);
|
intent.putExtra(Apg.EXTRA_KEY_ID, keyId);
|
||||||
startActivityForResult(intent, Id.request.look_up_key_id);
|
startActivityForResult(intent, Id.request.look_up_key_id);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user